diff options
-rw-r--r-- | src/core/core.cpp | 4 | ||||
-rw-r--r-- | src/core/core.h | 9 | ||||
-rw-r--r-- | src/core/frontend/emu_window.cpp | 4 | ||||
-rw-r--r-- | src/core/frontend/emu_window.h | 4 | ||||
-rw-r--r-- | src/video_core/engines/maxwell_3d.h | 26 | ||||
-rw-r--r-- | src/video_core/gpu.cpp | 1 | ||||
-rw-r--r-- | src/video_core/gpu.h | 1 | ||||
-rw-r--r-- | src/video_core/renderer_base.cpp | 2 | ||||
-rw-r--r-- | src/video_core/renderer_base.h | 6 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 11 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 9 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 43 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 84 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/maxwell_to_gl.h | 19 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 8 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.h | 8 | ||||
-rw-r--r-- | src/video_core/video_core.cpp | 2 | ||||
-rw-r--r-- | src/video_core/video_core.h | 4 | ||||
-rw-r--r-- | src/yuzu/bootmanager.h | 2 | ||||
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2.h | 2 |
20 files changed, 170 insertions, 79 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 6b8004eb2..83d4d742b 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -88,7 +88,7 @@ System::ResultStatus System::SingleStep() { return RunLoop(false); } -System::ResultStatus System::Load(EmuWindow& emu_window, const std::string& filepath) { +System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath) { app_loader = Loader::GetLoader(virtual_filesystem->OpenFile(filepath, FileSys::Mode::Read)); if (!app_loader) { @@ -151,7 +151,7 @@ Cpu& System::CpuCore(size_t core_index) { return *cpu_cores[core_index]; } -System::ResultStatus System::Init(EmuWindow& emu_window) { +System::ResultStatus System::Init(Frontend::EmuWindow& emu_window) { LOG_DEBUG(HW_Memory, "initialized OK"); CoreTiming::Init(); diff --git a/src/core/core.h b/src/core/core.h index 2944b09cd..d98b15a71 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -22,9 +22,12 @@ #include "video_core/debug_utils/debug_utils.h" #include "video_core/gpu.h" -class EmuWindow; class ARM_Interface; +namespace Core::Frontend { +class EmuWindow; +} + namespace Service::SM { class ServiceManager; } @@ -99,7 +102,7 @@ public: * @param filepath String path to the executable application to load on the host file system. * @returns ResultStatus code, indicating if the operation succeeded. */ - ResultStatus Load(EmuWindow& emu_window, const std::string& filepath); + ResultStatus Load(Frontend::EmuWindow& emu_window, const std::string& filepath); /** * Indicates if the emulated system is powered on (all subsystems initialized and able to run an @@ -227,7 +230,7 @@ private: * input. * @return ResultStatus code, indicating if the operation succeeded. */ - ResultStatus Init(EmuWindow& emu_window); + ResultStatus Init(Frontend::EmuWindow& emu_window); /// RealVfsFilesystem instance FileSys::VirtualFilesystem virtual_filesystem; diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index 2d776c693..9dd493efb 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp @@ -8,6 +8,8 @@ #include "core/frontend/input.h" #include "core/settings.h" +namespace Core::Frontend { + class EmuWindow::TouchState : public Input::Factory<Input::TouchDevice>, public std::enable_shared_from_this<TouchState> { public: @@ -108,3 +110,5 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) { void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) { NotifyFramebufferLayoutChanged(Layout::DefaultFrameLayout(width, height)); } + +} // namespace Core::Frontend diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h index e8c29adfb..384dc7822 100644 --- a/src/core/frontend/emu_window.h +++ b/src/core/frontend/emu_window.h @@ -10,6 +10,8 @@ #include "common/common_types.h" #include "core/frontend/framebuffer_layout.h" +namespace Core::Frontend { + /** * Abstraction class used to provide an interface between emulation code and the frontend * (e.g. SDL, QGLWidget, GLFW, etc...). @@ -166,3 +168,5 @@ private: */ std::tuple<unsigned, unsigned> ClipToTouchScreen(unsigned new_x, unsigned new_y); }; + +} // namespace Core::Frontend diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 0506ac8fe..1b30ce018 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -93,6 +93,7 @@ public: struct VertexAttribute { enum class Size : u32 { + Invalid = 0x0, Size_32_32_32_32 = 0x01, Size_32_32_32 = 0x02, Size_16_16_16_16 = 0x03, @@ -257,6 +258,10 @@ public: bool IsNormalized() const { return (type == Type::SignedNorm) || (type == Type::UnsignedNorm); } + + bool IsValid() const { + return size != Size::Invalid; + } }; enum class PrimitiveTopology : u32 { @@ -352,6 +357,27 @@ public: OneMinusConstantColor = 0x62, ConstantAlpha = 0x63, OneMinusConstantAlpha = 0x64, + + // These values are used by Nouveau and some games. + ZeroGL = 0x4000, + OneGL = 0x4001, + SourceColorGL = 0x4300, + OneMinusSourceColorGL = 0x4301, + SourceAlphaGL = 0x4302, + OneMinusSourceAlphaGL = 0x4303, + DestAlphaGL = 0x4304, + OneMinusDestAlphaGL = 0x4305, + DestColorGL = 0x4306, + OneMinusDestColorGL = 0x4307, + SourceAlphaSaturateGL = 0x4308, + ConstantColorGL = 0xc001, + OneMinusConstantColorGL = 0xc002, + ConstantAlphaGL = 0xc003, + OneMinusConstantAlphaGL = 0xc004, + Source1ColorGL = 0xc900, + OneMinusSource1ColorGL = 0xc901, + Source1AlphaGL = 0xc902, + OneMinusSource1AlphaGL = 0xc903, }; u32 separate_alpha; diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 834940b83..19e7f1161 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -70,6 +70,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { case RenderTargetFormat::RG8_SNORM: return 2; case RenderTargetFormat::R8_UNORM: + case RenderTargetFormat::R8_UINT: return 1; default: UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index de5b037be..e008d8f26 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -42,6 +42,7 @@ enum class RenderTargetFormat : u32 { R16_UINT = 0xF1, R16_FLOAT = 0xF2, R8_UNORM = 0xF3, + R8_UINT = 0xF6, }; enum class DepthFormat : u32 { diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp index e87016429..afd86a83a 100644 --- a/src/video_core/renderer_base.cpp +++ b/src/video_core/renderer_base.cpp @@ -10,7 +10,7 @@ namespace VideoCore { -RendererBase::RendererBase(EmuWindow& window) : render_window{window} { +RendererBase::RendererBase(Core::Frontend::EmuWindow& window) : render_window{window} { RefreshBaseSettings(); } diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h index fd8c47592..d9f16b8e6 100644 --- a/src/video_core/renderer_base.h +++ b/src/video_core/renderer_base.h @@ -11,7 +11,9 @@ #include "video_core/gpu.h" #include "video_core/rasterizer_interface.h" +namespace Core::Frontend { class EmuWindow; +} namespace VideoCore { @@ -21,7 +23,7 @@ struct RendererSettings { class RendererBase : NonCopyable { public: - explicit RendererBase(EmuWindow& window); + explicit RendererBase(Core::Frontend::EmuWindow& window); virtual ~RendererBase(); /// Swap buffers (render frame) @@ -59,7 +61,7 @@ protected: /// Refreshes settings specific to the rasterizer. void RefreshRasterizerSetting(); - EmuWindow& render_window; ///< Reference to the render window handle. + Core::Frontend::EmuWindow& render_window; ///< Reference to the render window handle. std::unique_ptr<RasterizerInterface> rasterizer; f32 m_current_fps = 0.0f; ///< Current framerate, should be set by the renderer int m_current_frame = 0; ///< Current frame, should be set by the renderer diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 8360feb5d..38a7b1413 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -36,7 +36,7 @@ MICROPROFILE_DEFINE(OpenGL_Drawing, "OpenGL", "Drawing", MP_RGB(128, 128, 192)); MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255)); MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100)); -RasterizerOpenGL::RasterizerOpenGL(EmuWindow& window) : emu_window{window} { +RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& window) : emu_window{window} { // Create sampler objects for (size_t i = 0; i < texture_samplers.size(); ++i) { texture_samplers[i].Create(); @@ -161,11 +161,16 @@ std::pair<u8*, GLintptr> RasterizerOpenGL::SetupVertexArrays(u8* array_ptr, // assume every shader uses them all. for (unsigned index = 0; index < 16; ++index) { auto& attrib = regs.vertex_attrib_format[index]; + + // Ignore invalid attributes. + if (!attrib.IsValid()) + continue; + + auto& buffer = regs.vertex_array[attrib.buffer]; LOG_TRACE(HW_GPU, "vertex attrib {}, count={}, size={}, type={}, offset={}, normalize={}", index, attrib.ComponentCount(), attrib.SizeString(), attrib.TypeString(), attrib.offset.Value(), attrib.IsNormalized()); - auto& buffer = regs.vertex_array[attrib.buffer]; ASSERT(buffer.IsEnabled()); glEnableVertexAttribArray(index); @@ -211,7 +216,7 @@ void RasterizerOpenGL::SetupShaders(u8* buffer_ptr, GLintptr buffer_offset) { // Next available bindpoints to use when uploading the const buffers and textures to the GLSL // shaders. The constbuffer bindpoint starts after the shader stage configuration bind points. - u32 current_constbuffer_bindpoint = uniform_buffers.size(); + u32 current_constbuffer_bindpoint = static_cast<u32>(uniform_buffers.size()); u32 current_texture_bindpoint = 0; for (size_t index = 0; index < Maxwell::MaxShaderProgram; ++index) { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 6d6d85cc1..bd01dc0ae 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -21,12 +21,15 @@ #include "video_core/renderer_opengl/gl_state.h" #include "video_core/renderer_opengl/gl_stream_buffer.h" -class EmuWindow; struct ScreenInfo; +namespace Core::Frontend { +class EmuWindow; +} + class RasterizerOpenGL : public VideoCore::RasterizerInterface { public: - explicit RasterizerOpenGL(EmuWindow& renderer); + explicit RasterizerOpenGL(Core::Frontend::EmuWindow& renderer); ~RasterizerOpenGL() override; void DrawArrays() override; @@ -145,7 +148,7 @@ private: RasterizerCacheOpenGL res_cache; - EmuWindow& emu_window; + Core::Frontend::EmuWindow& emu_window; std::unique_ptr<GLShader::ProgramManager> shader_program_manager; OGLVertexArray sw_vao; diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index d055b1dfa..84c250c63 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -99,6 +99,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form false}, // A2B10G10R10 {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, ComponentType::UNorm, false}, // A1B5G5R5 {GL_R8, GL_RED, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // R8 + {GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, ComponentType::UInt, false}, // R8UI {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, ComponentType::Float, false}, // RGBA16F {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, ComponentType::Float, false}, // R11FG11FB10F @@ -233,26 +234,27 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, std::vector<u8>& gl_bu static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), SurfaceParams::MaxPixelFormat> morton_to_gl_fns = { - MortonCopy<true, PixelFormat::ABGR8U>, MortonCopy<true, PixelFormat::ABGR8S>, - MortonCopy<true, PixelFormat::B5G6R5>, MortonCopy<true, PixelFormat::A2B10G10R10>, - MortonCopy<true, PixelFormat::A1B5G5R5>, MortonCopy<true, PixelFormat::R8>, - MortonCopy<true, PixelFormat::RGBA16F>, MortonCopy<true, PixelFormat::R11FG11FB10F>, - MortonCopy<true, PixelFormat::RGBA32UI>, MortonCopy<true, PixelFormat::DXT1>, - MortonCopy<true, PixelFormat::DXT23>, MortonCopy<true, PixelFormat::DXT45>, - MortonCopy<true, PixelFormat::DXN1>, MortonCopy<true, PixelFormat::DXN2UNORM>, - MortonCopy<true, PixelFormat::DXN2SNORM>, MortonCopy<true, PixelFormat::BC7U>, - MortonCopy<true, PixelFormat::ASTC_2D_4X4>, MortonCopy<true, PixelFormat::G8R8>, - MortonCopy<true, PixelFormat::BGRA8>, MortonCopy<true, PixelFormat::RGBA32F>, - MortonCopy<true, PixelFormat::RG32F>, MortonCopy<true, PixelFormat::R32F>, - MortonCopy<true, PixelFormat::R16F>, MortonCopy<true, PixelFormat::R16UNORM>, - MortonCopy<true, PixelFormat::R16S>, MortonCopy<true, PixelFormat::R16UI>, - MortonCopy<true, PixelFormat::R16I>, MortonCopy<true, PixelFormat::RG16>, - MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, - MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, - MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>, - MortonCopy<true, PixelFormat::RG8S>, MortonCopy<true, PixelFormat::Z24S8>, - MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, - MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>, + MortonCopy<true, PixelFormat::ABGR8U>, MortonCopy<true, PixelFormat::ABGR8S>, + MortonCopy<true, PixelFormat::B5G6R5>, MortonCopy<true, PixelFormat::A2B10G10R10>, + MortonCopy<true, PixelFormat::A1B5G5R5>, MortonCopy<true, PixelFormat::R8>, + MortonCopy<true, PixelFormat::R8UI>, MortonCopy<true, PixelFormat::RGBA16F>, + MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::RGBA32UI>, + MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, + MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, + MortonCopy<true, PixelFormat::DXN2UNORM>, MortonCopy<true, PixelFormat::DXN2SNORM>, + MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, + MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, + MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, + MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, + MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::R16S>, + MortonCopy<true, PixelFormat::R16UI>, MortonCopy<true, PixelFormat::R16I>, + MortonCopy<true, PixelFormat::RG16>, MortonCopy<true, PixelFormat::RG16F>, + MortonCopy<true, PixelFormat::RG16UI>, MortonCopy<true, PixelFormat::RG16I>, + MortonCopy<true, PixelFormat::RG16S>, MortonCopy<true, PixelFormat::RGB32F>, + MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::RG8S>, + MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, + MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, + MortonCopy<true, PixelFormat::Z32FS8>, }; static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), @@ -264,6 +266,7 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU MortonCopy<false, PixelFormat::A2B10G10R10>, MortonCopy<false, PixelFormat::A1B5G5R5>, MortonCopy<false, PixelFormat::R8>, + MortonCopy<false, PixelFormat::R8UI>, MortonCopy<false, PixelFormat::RGBA16F>, MortonCopy<false, PixelFormat::R11FG11FB10F>, MortonCopy<false, PixelFormat::RGBA32UI>, diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index d7a43652e..202257b58 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -29,44 +29,45 @@ struct SurfaceParams { A2B10G10R10 = 3, A1B5G5R5 = 4, R8 = 5, - RGBA16F = 6, - R11FG11FB10F = 7, - RGBA32UI = 8, - DXT1 = 9, - DXT23 = 10, - DXT45 = 11, - DXN1 = 12, // This is also known as BC4 - DXN2UNORM = 13, - DXN2SNORM = 14, - BC7U = 15, - ASTC_2D_4X4 = 16, - G8R8 = 17, - BGRA8 = 18, - RGBA32F = 19, - RG32F = 20, - R32F = 21, - R16F = 22, - R16UNORM = 23, - R16S = 24, - R16UI = 25, - R16I = 26, - RG16 = 27, - RG16F = 28, - RG16UI = 29, - RG16I = 30, - RG16S = 31, - RGB32F = 32, - SRGBA8 = 33, - RG8S = 34, + R8UI = 6, + RGBA16F = 7, + R11FG11FB10F = 8, + RGBA32UI = 9, + DXT1 = 10, + DXT23 = 11, + DXT45 = 12, + DXN1 = 13, // This is also known as BC4 + DXN2UNORM = 14, + DXN2SNORM = 15, + BC7U = 16, + ASTC_2D_4X4 = 17, + G8R8 = 18, + BGRA8 = 19, + RGBA32F = 20, + RG32F = 21, + R32F = 22, + R16F = 23, + R16UNORM = 24, + R16S = 25, + R16UI = 26, + R16I = 27, + RG16 = 28, + RG16F = 29, + RG16UI = 30, + RG16I = 31, + RG16S = 32, + RGB32F = 33, + SRGBA8 = 34, + RG8S = 35, MaxColorFormat, // DepthStencil formats - Z24S8 = 35, - S8Z24 = 36, - Z32F = 37, - Z16 = 38, - Z32FS8 = 39, + Z24S8 = 36, + S8Z24 = 37, + Z32F = 38, + Z16 = 39, + Z32FS8 = 40, MaxDepthStencilFormat, @@ -110,6 +111,7 @@ struct SurfaceParams { 1, // A2B10G10R10 1, // A1B5G5R5 1, // R8 + 1, // R8UI 1, // RGBA16F 1, // R11FG11FB10F 1, // RGBA32UI @@ -161,6 +163,7 @@ struct SurfaceParams { 32, // A2B10G10R10 16, // A1B5G5R5 8, // R8 + 8, // R8UI 64, // RGBA16F 32, // R11FG11FB10F 128, // RGBA32UI @@ -250,6 +253,8 @@ struct SurfaceParams { return PixelFormat::RGBA32UI; case Tegra::RenderTargetFormat::R8_UNORM: return PixelFormat::R8; + case Tegra::RenderTargetFormat::R8_UINT: + return PixelFormat::R8UI; case Tegra::RenderTargetFormat::RG16_FLOAT: return PixelFormat::RG16F; case Tegra::RenderTargetFormat::RG16_UINT: @@ -301,7 +306,15 @@ struct SurfaceParams { case Tegra::Texture::TextureFormat::A1B5G5R5: return PixelFormat::A1B5G5R5; case Tegra::Texture::TextureFormat::R8: - return PixelFormat::R8; + switch (component_type) { + case Tegra::Texture::ComponentType::UNORM: + return PixelFormat::R8; + case Tegra::Texture::ComponentType::UINT: + return PixelFormat::R8UI; + } + LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", + static_cast<u32>(component_type)); + UNREACHABLE(); case Tegra::Texture::TextureFormat::G8R8: return PixelFormat::G8R8; case Tegra::Texture::TextureFormat::R16_G16_B16_A16: @@ -435,6 +448,7 @@ struct SurfaceParams { return ComponentType::Float; case Tegra::RenderTargetFormat::RGBA32_UINT: case Tegra::RenderTargetFormat::RG16_UINT: + case Tegra::RenderTargetFormat::R8_UINT: case Tegra::RenderTargetFormat::R16_UINT: return ComponentType::UInt; case Tegra::RenderTargetFormat::RG16_SINT: diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index c439446b1..5afd20dbe 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -156,42 +156,61 @@ inline GLenum BlendEquation(Maxwell::Blend::Equation equation) { inline GLenum BlendFunc(Maxwell::Blend::Factor factor) { switch (factor) { case Maxwell::Blend::Factor::Zero: + case Maxwell::Blend::Factor::ZeroGL: return GL_ZERO; case Maxwell::Blend::Factor::One: + case Maxwell::Blend::Factor::OneGL: return GL_ONE; case Maxwell::Blend::Factor::SourceColor: + case Maxwell::Blend::Factor::SourceColorGL: return GL_SRC_COLOR; case Maxwell::Blend::Factor::OneMinusSourceColor: + case Maxwell::Blend::Factor::OneMinusSourceColorGL: return GL_ONE_MINUS_SRC_COLOR; case Maxwell::Blend::Factor::SourceAlpha: + case Maxwell::Blend::Factor::SourceAlphaGL: return GL_SRC_ALPHA; case Maxwell::Blend::Factor::OneMinusSourceAlpha: + case Maxwell::Blend::Factor::OneMinusSourceAlphaGL: return GL_ONE_MINUS_SRC_ALPHA; case Maxwell::Blend::Factor::DestAlpha: + case Maxwell::Blend::Factor::DestAlphaGL: return GL_DST_ALPHA; case Maxwell::Blend::Factor::OneMinusDestAlpha: + case Maxwell::Blend::Factor::OneMinusDestAlphaGL: return GL_ONE_MINUS_DST_ALPHA; case Maxwell::Blend::Factor::DestColor: + case Maxwell::Blend::Factor::DestColorGL: return GL_DST_COLOR; case Maxwell::Blend::Factor::OneMinusDestColor: + case Maxwell::Blend::Factor::OneMinusDestColorGL: return GL_ONE_MINUS_DST_COLOR; case Maxwell::Blend::Factor::SourceAlphaSaturate: + case Maxwell::Blend::Factor::SourceAlphaSaturateGL: return GL_SRC_ALPHA_SATURATE; case Maxwell::Blend::Factor::Source1Color: + case Maxwell::Blend::Factor::Source1ColorGL: return GL_SRC1_COLOR; case Maxwell::Blend::Factor::OneMinusSource1Color: + case Maxwell::Blend::Factor::OneMinusSource1ColorGL: return GL_ONE_MINUS_SRC1_COLOR; case Maxwell::Blend::Factor::Source1Alpha: + case Maxwell::Blend::Factor::Source1AlphaGL: return GL_SRC1_ALPHA; case Maxwell::Blend::Factor::OneMinusSource1Alpha: + case Maxwell::Blend::Factor::OneMinusSource1AlphaGL: return GL_ONE_MINUS_SRC1_ALPHA; case Maxwell::Blend::Factor::ConstantColor: + case Maxwell::Blend::Factor::ConstantColorGL: return GL_CONSTANT_COLOR; case Maxwell::Blend::Factor::OneMinusConstantColor: + case Maxwell::Blend::Factor::OneMinusConstantColorGL: return GL_ONE_MINUS_CONSTANT_COLOR; case Maxwell::Blend::Factor::ConstantAlpha: + case Maxwell::Blend::Factor::ConstantAlphaGL: return GL_CONSTANT_ALPHA; case Maxwell::Blend::Factor::OneMinusConstantAlpha: + case Maxwell::Blend::Factor::OneMinusConstantAlphaGL: return GL_ONE_MINUS_CONSTANT_ALPHA; } LOG_CRITICAL(Render_OpenGL, "Unimplemented blend factor={}", static_cast<u32>(factor)); diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 899865e3b..95f1aa0fe 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -18,7 +18,6 @@ #include "core/tracer/recorder.h" #include "video_core/renderer_opengl/renderer_opengl.h" #include "video_core/utils.h" -#include "video_core/video_core.h" static const char vertex_shader[] = R"( #version 150 core @@ -92,7 +91,8 @@ static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, cons return matrix; } -ScopeAcquireGLContext::ScopeAcquireGLContext(EmuWindow& emu_window_) : emu_window{emu_window_} { +ScopeAcquireGLContext::ScopeAcquireGLContext(Core::Frontend::EmuWindow& emu_window_) + : emu_window{emu_window_} { if (Settings::values.use_multi_core) { emu_window.MakeCurrent(); } @@ -103,7 +103,9 @@ ScopeAcquireGLContext::~ScopeAcquireGLContext() { } } -RendererOpenGL::RendererOpenGL(EmuWindow& window) : VideoCore::RendererBase{window} {} +RendererOpenGL::RendererOpenGL(Core::Frontend::EmuWindow& window) + : VideoCore::RendererBase{window} {} + RendererOpenGL::~RendererOpenGL() = default; /// Swap buffers (render frame) diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index 428afa3b7..a5eab6997 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h @@ -12,7 +12,9 @@ #include "video_core/renderer_opengl/gl_resource_manager.h" #include "video_core/renderer_opengl/gl_state.h" +namespace Core::Frontend { class EmuWindow; +} /// Structure used for storing information about the textures for the Switch screen struct TextureInfo { @@ -34,16 +36,16 @@ struct ScreenInfo { /// Helper class to acquire/release OpenGL context within a given scope class ScopeAcquireGLContext : NonCopyable { public: - explicit ScopeAcquireGLContext(EmuWindow& window); + explicit ScopeAcquireGLContext(Core::Frontend::EmuWindow& window); ~ScopeAcquireGLContext(); private: - EmuWindow& emu_window; + Core::Frontend::EmuWindow& emu_window; }; class RendererOpenGL : public VideoCore::RendererBase { public: - explicit RendererOpenGL(EmuWindow& window); + explicit RendererOpenGL(Core::Frontend::EmuWindow& window); ~RendererOpenGL() override; /// Swap buffers (render frame) diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 1e686b89e..6780d1c16 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -9,7 +9,7 @@ namespace VideoCore { -std::unique_ptr<RendererBase> CreateRenderer(EmuWindow& emu_window) { +std::unique_ptr<RendererBase> CreateRenderer(Core::Frontend::EmuWindow& emu_window) { return std::make_unique<RendererOpenGL>(emu_window); } diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h index 2dc07540f..f79f85dfe 100644 --- a/src/video_core/video_core.h +++ b/src/video_core/video_core.h @@ -6,7 +6,9 @@ #include <memory> +namespace Core::Frontend { class EmuWindow; +} namespace VideoCore { @@ -18,6 +20,6 @@ class RendererBase; * @note The returned renderer instance is simply allocated. Its Init() * function still needs to be called to fully complete its setup. */ -std::unique_ptr<RendererBase> CreateRenderer(EmuWindow& emu_window); +std::unique_ptr<RendererBase> CreateRenderer(Core::Frontend::EmuWindow& emu_window); } // namespace VideoCore diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index d0f990c64..f133bfadf 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h @@ -101,7 +101,7 @@ signals: void ErrorThrown(Core::System::ResultStatus, std::string); }; -class GRenderWindow : public QWidget, public EmuWindow { +class GRenderWindow : public QWidget, public Core::Frontend::EmuWindow { Q_OBJECT public: diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.h b/src/yuzu_cmd/emu_window/emu_window_sdl2.h index 1d835c3c6..d34902109 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.h +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.h @@ -10,7 +10,7 @@ struct SDL_Window; -class EmuWindow_SDL2 : public EmuWindow { +class EmuWindow_SDL2 : public Core::Frontend::EmuWindow { public: explicit EmuWindow_SDL2(bool fullscreen); ~EmuWindow_SDL2(); |