diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 9e6c20e314..fc417962a0 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -327,7 +327,7 @@ void Renderer::WaitForGPUIdle() D3D::context->Flush(); } -void Renderer::RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc) +void Renderer::RenderXFBToScreen(const AbstractTexture* texture, const MathUtil::Rectangle& rc) { if (g_ActiveConfig.stereo_mode != StereoMode::Nvidia3DVision) return ::Renderer::RenderXFBToScreen(texture, rc); diff --git a/Source/Core/VideoBackends/D3D/Render.h b/Source/Core/VideoBackends/D3D/Render.h index e6b658ae9e..277cd4f19f 100644 --- a/Source/Core/VideoBackends/D3D/Render.h +++ b/Source/Core/VideoBackends/D3D/Render.h @@ -67,7 +67,8 @@ public: void Flush() override; void WaitForGPUIdle() override; - void RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc) override; + void RenderXFBToScreen(const AbstractTexture* texture, + const MathUtil::Rectangle& rc) override; void OnConfigChanged(u32 bits) override; private: diff --git a/Source/Core/VideoBackends/D3D12/Renderer.cpp b/Source/Core/VideoBackends/D3D12/Renderer.cpp index b834ba33e1..a61a3f40a6 100644 --- a/Source/Core/VideoBackends/D3D12/Renderer.cpp +++ b/Source/Core/VideoBackends/D3D12/Renderer.cpp @@ -132,7 +132,7 @@ void Renderer::WaitForGPUIdle() ExecuteCommandList(true); } -void Renderer::ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable, +void Renderer::ClearScreen(const MathUtil::Rectangle& rc, bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z) { // Use a fast path without the shader if both color/alpha are enabled. diff --git a/Source/Core/VideoBackends/D3D12/Renderer.h b/Source/Core/VideoBackends/D3D12/Renderer.h index 992e12aa8a..f660f5f817 100644 --- a/Source/Core/VideoBackends/D3D12/Renderer.h +++ b/Source/Core/VideoBackends/D3D12/Renderer.h @@ -52,8 +52,8 @@ public: void Flush() override; void WaitForGPUIdle() override; - void ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable, bool z_enable, - u32 color, u32 z) override; + void ClearScreen(const MathUtil::Rectangle& rc, bool color_enable, bool alpha_enable, + bool z_enable, u32 color, u32 z) override; void SetPipeline(const AbstractPipeline* pipeline) override; void SetFramebuffer(AbstractFramebuffer* framebuffer) override; diff --git a/Source/Core/VideoBackends/Null/Render.h b/Source/Core/VideoBackends/Null/Render.h index 339e21d637..4070db20fe 100644 --- a/Source/Core/VideoBackends/Null/Render.h +++ b/Source/Core/VideoBackends/Null/Render.h @@ -37,8 +37,8 @@ public: u16 BBoxRead(int index) override { return 0; } void BBoxWrite(int index, u16 value) override {} - void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, - u32 color, u32 z) override + void ClearScreen(const MathUtil::Rectangle& rc, bool colorEnable, bool alphaEnable, + bool zEnable, u32 color, u32 z) override { } diff --git a/Source/Core/VideoBackends/Null/TextureCache.h b/Source/Core/VideoBackends/Null/TextureCache.h index 91375430c9..35c802ce4b 100644 --- a/Source/Core/VideoBackends/Null/TextureCache.h +++ b/Source/Core/VideoBackends/Null/TextureCache.h @@ -21,15 +21,17 @@ public: protected: void CopyEFB(AbstractStagingTexture* dst, const EFBCopyParams& params, u32 native_width, - u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, - bool scale_by_half, bool linear_filter, float y_scale, float gamma, bool clamp_top, - bool clamp_bottom, const EFBCopyFilterCoefficients& filter_coefficients) override + u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, + const MathUtil::Rectangle& src_rect, bool scale_by_half, bool linear_filter, + float y_scale, float gamma, bool clamp_top, bool clamp_bottom, + const EFBCopyFilterCoefficients& filter_coefficients) override { } - void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy, const EFBRectangle& src_rect, - bool scale_by_half, bool linear_filter, EFBCopyFormat dst_format, - bool is_intensity, float gamma, bool clamp_top, bool clamp_bottom, + void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy, + const MathUtil::Rectangle& src_rect, bool scale_by_half, + bool linear_filter, EFBCopyFormat dst_format, bool is_intensity, + float gamma, bool clamp_top, bool clamp_bottom, const EFBCopyFilterCoefficients& filter_coefficients) override { } diff --git a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp index 50a6276c72..c95e1f8472 100644 --- a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp +++ b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp @@ -80,6 +80,7 @@ GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& vtx_decl) GLVertexFormat::~GLVertexFormat() { + ProgramShaderCache::InvalidateVertexFormatIfBound(VAO); glDeleteVertexArrays(1, &VAO); } } // namespace OGL diff --git a/Source/Core/VideoBackends/OGL/OGLShader.cpp b/Source/Core/VideoBackends/OGL/OGLShader.cpp index fc13b5b975..ee96f1c352 100644 --- a/Source/Core/VideoBackends/OGL/OGLShader.cpp +++ b/Source/Core/VideoBackends/OGL/OGLShader.cpp @@ -24,15 +24,16 @@ static GLenum GetGLShaderTypeForStage(ShaderStage stage) } } -OGLShader::OGLShader(ShaderStage stage, GLenum gl_type, GLuint gl_id) +OGLShader::OGLShader(ShaderStage stage, GLenum gl_type, GLuint gl_id, std::string source) : AbstractShader(stage), m_id(ProgramShaderCache::GenerateShaderID()), m_type(gl_type), - m_gl_id(gl_id) + m_gl_id(gl_id), m_source(std::move(source)) { } -OGLShader::OGLShader(GLuint gl_compute_program_id) +OGLShader::OGLShader(GLuint gl_compute_program_id, std::string source) : AbstractShader(ShaderStage::Compute), m_id(ProgramShaderCache::GenerateShaderID()), - m_type(GL_COMPUTE_SHADER), m_gl_compute_program_id(gl_compute_program_id) + m_type(GL_COMPUTE_SHADER), m_gl_compute_program_id(gl_compute_program_id), + m_source(std::move(source)) { } @@ -47,22 +48,22 @@ OGLShader::~OGLShader() std::unique_ptr OGLShader::CreateFromSource(ShaderStage stage, const char* source, size_t length) { + std::string source_str(source, length); if (stage != ShaderStage::Compute) { GLenum shader_type = GetGLShaderTypeForStage(stage); - GLuint shader_id = - ProgramShaderCache::CompileSingleShader(shader_type, std::string(source, length)); + GLuint shader_id = ProgramShaderCache::CompileSingleShader(shader_type, source_str); if (!shader_id) return nullptr; - return std::make_unique(stage, shader_type, shader_id); + return std::make_unique(stage, shader_type, shader_id, std::move(source_str)); } // Compute shaders. SHADER prog; - if (!ProgramShaderCache::CompileComputeShader(prog, std::string(source, length))) + if (!ProgramShaderCache::CompileComputeShader(prog, source_str)) return nullptr; - return std::make_unique(prog.glprogid); + return std::make_unique(prog.glprogid, std::move(source_str)); } } // namespace OGL diff --git a/Source/Core/VideoBackends/OGL/OGLShader.h b/Source/Core/VideoBackends/OGL/OGLShader.h index ad0432ada4..5289e1933f 100644 --- a/Source/Core/VideoBackends/OGL/OGLShader.h +++ b/Source/Core/VideoBackends/OGL/OGLShader.h @@ -16,14 +16,15 @@ namespace OGL class OGLShader final : public AbstractShader { public: - explicit OGLShader(ShaderStage stage, GLenum gl_type, GLuint gl_id); - explicit OGLShader(GLuint gl_compute_program_id); + explicit OGLShader(ShaderStage stage, GLenum gl_type, GLuint gl_id, std::string source); + explicit OGLShader(GLuint gl_compute_program_id, std::string source); ~OGLShader() override; u64 GetID() const { return m_id; } GLenum GetGLShaderType() const { return m_type; } GLuint GetGLShaderID() const { return m_gl_id; } GLuint GetGLComputeProgramID() const { return m_gl_compute_program_id; } + const std::string& GetSource() const { return m_source; } static std::unique_ptr CreateFromSource(ShaderStage stage, const char* source, size_t length); @@ -33,6 +34,7 @@ private: GLenum m_type; GLuint m_gl_id = 0; GLuint m_gl_compute_program_id = 0; + std::string m_source; }; } // namespace OGL diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index 414f7dfa57..f3ed0424e7 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -267,73 +267,6 @@ void ProgramShaderCache::UploadConstants(const void* data, u32 data_size) ADDSTAT(stats.thisFrame.bytesUniformStreamed, data_size); } -bool ProgramShaderCache::CompileShader(SHADER& shader, const std::string& vcode, - const std::string& pcode, const std::string& gcode) -{ -#if defined(_DEBUG) || defined(DEBUGFAST) - if (g_ActiveConfig.iLog & CONF_SAVESHADERS) - { - static int counter = 0; - std::string filename = - StringFromFormat("%svs_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); - SaveData(filename, vcode.c_str()); - - filename = StringFromFormat("%sps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); - SaveData(filename, pcode.c_str()); - - if (!gcode.empty()) - { - filename = - StringFromFormat("%sgs_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); - SaveData(filename, gcode.c_str()); - } - } -#endif - - shader.vsid = CompileSingleShader(GL_VERTEX_SHADER, vcode); - shader.psid = CompileSingleShader(GL_FRAGMENT_SHADER, pcode); - - // Optional geometry shader - shader.gsid = 0; - if (!gcode.empty()) - shader.gsid = CompileSingleShader(GL_GEOMETRY_SHADER, gcode); - - if (!shader.vsid || !shader.psid || (!gcode.empty() && !shader.gsid)) - { - shader.Destroy(); - return false; - } - - // Create and link the program. - shader.glprogid = glCreateProgram(); - - glAttachShader(shader.glprogid, shader.vsid); - glAttachShader(shader.glprogid, shader.psid); - if (shader.gsid) - glAttachShader(shader.glprogid, shader.gsid); - - if (g_ActiveConfig.backend_info.bSupportsPipelineCacheData) - glProgramParameteri(shader.glprogid, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE); - - shader.SetProgramBindings(false); - - glLinkProgram(shader.glprogid); - - if (!CheckProgramLinkResult(shader.glprogid, vcode, pcode, gcode)) - { - // Don't try to use this shader - shader.Destroy(); - return false; - } - - // For drivers that don't support binding layout, we need to bind it here. - shader.SetProgramVariables(); - - // Original shaders aren't needed any more. - shader.DestroyShaders(); - return true; -} - bool ProgramShaderCache::CompileComputeShader(SHADER& shader, const std::string& code) { // We need to enable GL_ARB_compute_shader for drivers that support the extension, @@ -358,7 +291,7 @@ bool ProgramShaderCache::CompileComputeShader(SHADER& shader, const std::string& // original shaders aren't needed any more glDeleteShader(shader_id); - if (!CheckProgramLinkResult(shader.glprogid, full_code, "", "")) + if (!CheckProgramLinkResult(shader.glprogid, &full_code, nullptr, nullptr)) { shader.Destroy(); return false; @@ -441,8 +374,8 @@ bool ProgramShaderCache::CheckShaderCompileResult(GLuint id, GLenum type, const return true; } -bool ProgramShaderCache::CheckProgramLinkResult(GLuint id, const std::string& vcode, - const std::string& pcode, const std::string& gcode) +bool ProgramShaderCache::CheckProgramLinkResult(GLuint id, const std::string* vcode, + const std::string* pcode, const std::string* gcode) { GLint linkStatus; glGetProgramiv(id, GL_LINK_STATUS, &linkStatus); @@ -460,9 +393,13 @@ bool ProgramShaderCache::CheckProgramLinkResult(GLuint id, const std::string& vc StringFromFormat("%sbad_p_%d.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++); std::ofstream file; File::OpenFStream(file, filename, std::ios_base::out); - file << s_glsl_header << vcode << s_glsl_header << pcode; - if (!gcode.empty()) - file << s_glsl_header << gcode; + if (vcode) + file << s_glsl_header << *vcode << '\n'; + if (gcode) + file << s_glsl_header << *gcode << '\n'; + if (pcode) + file << s_glsl_header << *pcode << '\n'; + file << info_log; file.close(); @@ -557,6 +494,12 @@ void ProgramShaderCache::InvalidateVertexFormat() s_last_VAO = 0; } +void ProgramShaderCache::InvalidateVertexFormatIfBound(GLuint vao) +{ + if (s_last_VAO == vao) + s_last_VAO = 0; +} + void ProgramShaderCache::InvalidateLastProgram() { CurrentProgram = 0; @@ -640,7 +583,10 @@ PipelineProgram* ProgramShaderCache::GetPipelineProgram(const GLVertexFormat* ve if (!s_is_shared_context && vao != s_last_VAO) glBindVertexArray(s_last_VAO); - if (!ProgramShaderCache::CheckProgramLinkResult(prog->shader.glprogid, {}, {}, {})) + if (!ProgramShaderCache::CheckProgramLinkResult( + prog->shader.glprogid, vertex_shader ? &vertex_shader->GetSource() : nullptr, + geometry_shader ? &geometry_shader->GetSource() : nullptr, + pixel_shader ? &pixel_shader->GetSource() : nullptr)) { prog->shader.Destroy(); return nullptr; @@ -906,6 +852,18 @@ bool SharedContextAsyncShaderCompiler::WorkerThreadInitWorkerThread(void* param) return false; s_is_shared_context = true; + + // Make the state match the main context to have a better chance of avoiding recompiles. + if (!context->IsGLES()) + glEnable(GL_PROGRAM_POINT_SIZE); + if (g_ActiveConfig.backend_info.bSupportsClipControl) + glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE); + if (g_ActiveConfig.backend_info.bSupportsDepthClamp) + { + glEnable(GL_CLIP_DISTANCE0); + glEnable(GL_CLIP_DISTANCE1); + glEnable(GL_DEPTH_CLAMP); + } if (g_ActiveConfig.backend_info.bSupportsPrimitiveRestart) GLUtil::EnablePrimitiveRestart(context); diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h index b7e4dd6d00..bc93445c55 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h @@ -72,15 +72,14 @@ public: static void BindVertexFormat(const GLVertexFormat* vertex_format); static bool IsValidVertexFormatBound(); static void InvalidateVertexFormat(); + static void InvalidateVertexFormatIfBound(GLuint vao); static void InvalidateLastProgram(); - static bool CompileShader(SHADER& shader, const std::string& vcode, const std::string& pcode, - const std::string& gcode = ""); static bool CompileComputeShader(SHADER& shader, const std::string& code); static GLuint CompileSingleShader(GLenum type, const std::string& code); static bool CheckShaderCompileResult(GLuint id, GLenum type, const std::string& code); - static bool CheckProgramLinkResult(GLuint id, const std::string& vcode, const std::string& pcode, - const std::string& gcode); + static bool CheckProgramLinkResult(GLuint id, const std::string* vcode, const std::string* pcode, + const std::string* gcode); static StreamBuffer* GetUniformBuffer(); static u32 GetUniformBufferAlignment(); static void UploadConstants(); diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 1e263b6422..546556c440 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -652,6 +652,10 @@ Renderer::Renderer(std::unique_ptr main_gl_context, float backbuffer_ // Desktop OpenGL can't have the Android Extension Pack g_ogl_config.bSupportsAEP = false; + + // Desktop GL requires GL_PROGRAM_POINT_SIZE set to use gl_PointSize in shaders. + // It is implicitly enabled in GLES. + glEnable(GL_PROGRAM_POINT_SIZE); } // Either method can do early-z tests. See PixelShaderGen for details. @@ -932,8 +936,8 @@ void Renderer::DispatchComputeShader(const AbstractShader* shader, u32 groups_x, glMemoryBarrier(GL_TEXTURE_UPDATE_BARRIER_BIT); } -void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, - u32 color, u32 z) +void Renderer::ClearScreen(const MathUtil::Rectangle& rc, bool colorEnable, bool alphaEnable, + bool zEnable, u32 color, u32 z) { g_framebuffer_manager->FlushEFBPokes(); g_framebuffer_manager->FlagPeekCacheAsOutOfDate(); @@ -974,7 +978,7 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE BPFunctions::SetScissor(); } -void Renderer::RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc) +void Renderer::RenderXFBToScreen(const AbstractTexture* texture, const MathUtil::Rectangle& rc) { // Quad-buffered stereo is annoying on GL. if (g_ActiveConfig.stereo_mode != StereoMode::QuadBuffer) @@ -1108,8 +1112,6 @@ void Renderer::CheckForSurfaceResize() void Renderer::BeginUtilityDrawing() { ::Renderer::BeginUtilityDrawing(); - - glEnable(GL_PROGRAM_POINT_SIZE); if (g_ActiveConfig.backend_info.bSupportsDepthClamp) { glDisable(GL_CLIP_DISTANCE0); @@ -1120,8 +1122,6 @@ void Renderer::BeginUtilityDrawing() void Renderer::EndUtilityDrawing() { ::Renderer::EndUtilityDrawing(); - - glDisable(GL_PROGRAM_POINT_SIZE); if (g_ActiveConfig.backend_info.bSupportsDepthClamp) { glEnable(GL_CLIP_DISTANCE0); diff --git a/Source/Core/VideoBackends/OGL/Render.h b/Source/Core/VideoBackends/OGL/Render.h index 842a6d9570..1cd2aa2e2d 100644 --- a/Source/Core/VideoBackends/OGL/Render.h +++ b/Source/Core/VideoBackends/OGL/Render.h @@ -134,11 +134,12 @@ public: void Flush() override; void WaitForGPUIdle() override; - void RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc) override; + void RenderXFBToScreen(const AbstractTexture* texture, + const MathUtil::Rectangle& rc) override; void OnConfigChanged(u32 bits) override; - void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, - u32 color, u32 z) override; + void ClearScreen(const MathUtil::Rectangle& rc, bool colorEnable, bool alphaEnable, + bool zEnable, u32 color, u32 z) override; std::unique_ptr CreateAsyncShaderCompiler() override; diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp index bb3cfeda90..8eebb375d3 100644 --- a/Source/Core/VideoBackends/Software/EfbInterface.cpp +++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp @@ -549,8 +549,8 @@ u8* GetPixelPointer(u16 x, u16 y, bool depth) return &efb[GetColorOffset(x, y)]; } -void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect, float y_scale, - float gamma) +void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const MathUtil::Rectangle& source_rect, + float y_scale, float gamma) { if (!xfb_in_ram) { @@ -628,8 +628,9 @@ void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rec src_ptr += memory_stride; } - auto dest_rect = EFBRectangle{source_rect.left, source_rect.top, source_rect.right, - static_cast(static_cast(source_rect.bottom) * y_scale)}; + auto dest_rect = + MathUtil::Rectangle{source_rect.left, source_rect.top, source_rect.right, + static_cast(static_cast(source_rect.bottom) * y_scale)}; const std::size_t destination_size = dest_rect.GetWidth() * dest_rect.GetHeight() * 2; static std::vector destination; diff --git a/Source/Core/VideoBackends/Software/EfbInterface.h b/Source/Core/VideoBackends/Software/EfbInterface.h index 518395d7c9..ea3bfc4bf9 100644 --- a/Source/Core/VideoBackends/Software/EfbInterface.h +++ b/Source/Core/VideoBackends/Software/EfbInterface.h @@ -54,8 +54,8 @@ u32 GetDepth(u16 x, u16 y); u8* GetPixelPointer(u16 x, u16 y, bool depth); -void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect, float y_scale, - float gamma); +void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const MathUtil::Rectangle& source_rect, + float y_scale, float gamma); u32 GetPerfQueryResult(PerfQueryType type); void ResetPerfQuery(); diff --git a/Source/Core/VideoBackends/Software/SWOGLWindow.cpp b/Source/Core/VideoBackends/Software/SWOGLWindow.cpp index 91c8cf0806..e0e0e236c0 100644 --- a/Source/Core/VideoBackends/Software/SWOGLWindow.cpp +++ b/Source/Core/VideoBackends/Software/SWOGLWindow.cpp @@ -84,7 +84,8 @@ bool SWOGLWindow::Initialize(const WindowSystemInfo& wsi) return true; } -void SWOGLWindow::ShowImage(const AbstractTexture* image, const EFBRectangle& xfb_region) +void SWOGLWindow::ShowImage(const AbstractTexture* image, + const MathUtil::Rectangle& xfb_region) { const SW::SWTexture* sw_image = static_cast(image); m_gl_context->Update(); // just updates the render window position and the backbuffer size diff --git a/Source/Core/VideoBackends/Software/SWOGLWindow.h b/Source/Core/VideoBackends/Software/SWOGLWindow.h index f1eadc4dd5..ce95c87694 100644 --- a/Source/Core/VideoBackends/Software/SWOGLWindow.h +++ b/Source/Core/VideoBackends/Software/SWOGLWindow.h @@ -25,7 +25,7 @@ public: bool IsHeadless() const; // Image to show, will be swapped immediately - void ShowImage(const AbstractTexture* image, const EFBRectangle& xfb_region); + void ShowImage(const AbstractTexture* image, const MathUtil::Rectangle& xfb_region); static std::unique_ptr Create(const WindowSystemInfo& wsi); diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index 3893320c26..b63e530a03 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -94,7 +94,8 @@ std::unique_ptr SWRenderer::CreatePipeline(const AbstractPipel } // Called on the GPU thread -void SWRenderer::RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& xfb_region) +void SWRenderer::RenderXFBToScreen(const AbstractTexture* texture, + const MathUtil::Rectangle& xfb_region) { if (!IsHeadless()) m_window->ShowImage(texture, xfb_region); @@ -136,7 +137,7 @@ void SWRenderer::BBoxWrite(int index, u16 value) BoundingBox::coords[index] = value; } -void SWRenderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, +void SWRenderer::ClearScreen(const MathUtil::Rectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) { EfbCopy::ClearEfb(); diff --git a/Source/Core/VideoBackends/Software/SWRenderer.h b/Source/Core/VideoBackends/Software/SWRenderer.h index 21ebf2dea7..9e478b0f50 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.h +++ b/Source/Core/VideoBackends/Software/SWRenderer.h @@ -42,10 +42,11 @@ public: u16 BBoxRead(int index) override; void BBoxWrite(int index, u16 value) override; - void RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc) override; + void RenderXFBToScreen(const AbstractTexture* texture, + const MathUtil::Rectangle& rc) override; - void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, - u32 color, u32 z) override; + void ClearScreen(const MathUtil::Rectangle& rc, bool colorEnable, bool alphaEnable, + bool zEnable, u32 color, u32 z) override; void ReinterpretPixelData(EFBReinterpretType convtype) override {} diff --git a/Source/Core/VideoBackends/Software/TextureCache.h b/Source/Core/VideoBackends/Software/TextureCache.h index 62f9198dcc..9ffa8fa4f4 100644 --- a/Source/Core/VideoBackends/Software/TextureCache.h +++ b/Source/Core/VideoBackends/Software/TextureCache.h @@ -11,16 +11,18 @@ class TextureCache : public TextureCacheBase { protected: void CopyEFB(AbstractStagingTexture* dst, const EFBCopyParams& params, u32 native_width, - u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, - bool scale_by_half, bool linear_filter, float y_scale, float gamma, bool clamp_top, - bool clamp_bottom, const EFBCopyFilterCoefficients& filter_coefficients) override + u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, + const MathUtil::Rectangle& src_rect, bool scale_by_half, bool linear_filter, + float y_scale, float gamma, bool clamp_top, bool clamp_bottom, + const EFBCopyFilterCoefficients& filter_coefficients) override { TextureEncoder::Encode(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride, src_rect, scale_by_half, y_scale, gamma); } - void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy, const EFBRectangle& src_rect, - bool scale_by_half, bool linear_filter, EFBCopyFormat dst_format, - bool is_intensity, float gamma, bool clamp_top, bool clamp_bottom, + void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy, + const MathUtil::Rectangle& src_rect, bool scale_by_half, + bool linear_filter, EFBCopyFormat dst_format, bool is_intensity, + float gamma, bool clamp_top, bool clamp_bottom, const EFBCopyFilterCoefficients& filter_coefficients) override { // TODO: If we ever want to "fake" vram textures, we would need to implement this diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.cpp b/Source/Core/VideoBackends/Software/TextureEncoder.cpp index 07eba31530..d3e76aa997 100644 --- a/Source/Core/VideoBackends/Software/TextureEncoder.cpp +++ b/Source/Core/VideoBackends/Software/TextureEncoder.cpp @@ -1422,7 +1422,7 @@ static void EncodeZ24halfscale(u8* dst, const u8* src, EFBCopyFormat format) namespace { void EncodeEfbCopy(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row, - u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, + u32 num_blocks_y, u32 memory_stride, const MathUtil::Rectangle& src_rect, bool scale_by_half) { const u8* src = EfbInterface::GetPixelPointer(src_rect.left, src_rect.top, params.depth); @@ -1471,8 +1471,9 @@ void EncodeEfbCopy(u8* dst, const EFBCopyParams& params, u32 native_width, u32 b } void Encode(AbstractStagingTexture* dst, const EFBCopyParams& params, u32 native_width, - u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, - bool scale_by_half, float y_scale, float gamma) + u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, + const MathUtil::Rectangle& src_rect, bool scale_by_half, float y_scale, + float gamma) { // HACK: Override the memory stride for this staging texture with new copy stride. // This is required because the texture encoder assumes that we're writing directly to memory, diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.h b/Source/Core/VideoBackends/Software/TextureEncoder.h index 705fa2e81b..a1e1f09cef 100644 --- a/Source/Core/VideoBackends/Software/TextureEncoder.h +++ b/Source/Core/VideoBackends/Software/TextureEncoder.h @@ -11,6 +11,7 @@ namespace TextureEncoder { void Encode(AbstractStagingTexture* dst, const EFBCopyParams& params, u32 native_width, - u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, - bool scale_by_half, float y_scale, float gamma); + u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, + const MathUtil::Rectangle& src_rect, bool scale_by_half, float y_scale, + float gamma); } diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index 5d918eda96..8d702adb45 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -147,14 +147,14 @@ void Renderer::BBoxFlush() m_bounding_box->Invalidate(); } -void Renderer::ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable, +void Renderer::ClearScreen(const MathUtil::Rectangle& rc, bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z) { g_framebuffer_manager->FlushEFBPokes(); g_framebuffer_manager->FlagPeekCacheAsOutOfDate(); // Native -> EFB coordinates - TargetRectangle target_rc = Renderer::ConvertEFBRectangle(rc); + MathUtil::Rectangle target_rc = Renderer::ConvertEFBRectangle(rc); // Size we pass this size to vkBeginRenderPass, it has to be clamped to the framebuffer // dimensions. The other backends just silently ignore this case. diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.h b/Source/Core/VideoBackends/Vulkan/Renderer.h index f28b4f94c1..bcc416af88 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.h +++ b/Source/Core/VideoBackends/Vulkan/Renderer.h @@ -62,8 +62,8 @@ public: void WaitForGPUIdle() override; void OnConfigChanged(u32 bits) override; - void ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable, bool z_enable, - u32 color, u32 z) override; + void ClearScreen(const MathUtil::Rectangle& rc, bool color_enable, bool alpha_enable, + bool z_enable, u32 color, u32 z) override; void SetPipeline(const AbstractPipeline* pipeline) override; void SetFramebuffer(AbstractFramebuffer* framebuffer) override; diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index 7db9d58cad..2aa325f8f7 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -49,8 +49,8 @@ void SetScissor() const int xoff = bpmem.scissorOffset.x * 2; const int yoff = bpmem.scissorOffset.y * 2; - EFBRectangle native_rc(bpmem.scissorTL.x - xoff, bpmem.scissorTL.y - yoff, - bpmem.scissorBR.x - xoff + 1, bpmem.scissorBR.y - yoff + 1); + MathUtil::Rectangle native_rc(bpmem.scissorTL.x - xoff, bpmem.scissorTL.y - yoff, + bpmem.scissorBR.x - xoff + 1, bpmem.scissorBR.y - yoff + 1); native_rc.ClampUL(0, 0, EFB_WIDTH, EFB_HEIGHT); auto target_rc = g_renderer->ConvertEFBRectangle(native_rc); @@ -172,7 +172,7 @@ void SetBlendMode() - convert the RGBA8 color to RGBA6/RGB8/RGB565 and convert it to RGBA8 again - convert the Z24 depth value to Z16 and back to Z24 */ -void ClearScreen(const EFBRectangle& rc) +void ClearScreen(const MathUtil::Rectangle& rc) { bool colorEnable = (bpmem.blendmode.colorupdate != 0); bool alphaEnable = (bpmem.blendmode.alphaupdate != 0); diff --git a/Source/Core/VideoCommon/BPFunctions.h b/Source/Core/VideoCommon/BPFunctions.h index 24ebee7a21..93fd5b0d78 100644 --- a/Source/Core/VideoCommon/BPFunctions.h +++ b/Source/Core/VideoCommon/BPFunctions.h @@ -20,7 +20,7 @@ void SetScissor(); void SetViewport(); void SetDepthMode(); void SetBlendMode(); -void ClearScreen(const EFBRectangle& rc); +void ClearScreen(const MathUtil::Rectangle& rc); void OnPixelFormatChange(); void SetInterlacingMode(const BPCmd& bp); } diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 925619e797..12fc46b209 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -219,7 +219,7 @@ static void BPWritten(const BPCmd& bp) u32 destAddr = bpmem.copyTexDest << 5; u32 destStride = bpmem.copyMipMapStrideChannels << 5; - EFBRectangle srcRect; + MathUtil::Rectangle srcRect; srcRect.left = static_cast(bpmem.copyTexSrcXY.x); srcRect.top = static_cast(bpmem.copyTexSrcXY.y); diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 67bc9ede9e..523a681884 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -158,8 +158,8 @@ bool Renderer::EFBHasAlphaChannel() const return m_prev_efb_format == PEControl::RGBA6_Z24; } -void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, - u32 color, u32 z) +void Renderer::ClearScreen(const MathUtil::Rectangle& rc, bool colorEnable, bool alphaEnable, + bool zEnable, u32 color, u32 z) { g_framebuffer_manager->ClearEFB(rc, colorEnable, alphaEnable, zEnable, color, z); } @@ -258,8 +258,8 @@ void Renderer::PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num } } -void Renderer::RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbStride, u32 fbHeight, - float Gamma) +void Renderer::RenderToXFB(u32 xfbAddr, const MathUtil::Rectangle& sourceRc, u32 fbStride, + u32 fbHeight, float Gamma) { CheckFifoRecording(); @@ -332,11 +332,11 @@ bool Renderer::CalculateTargetSize() return false; } -std::tuple -Renderer::ConvertStereoRectangle(const TargetRectangle& rc) const +std::tuple, MathUtil::Rectangle> +Renderer::ConvertStereoRectangle(const MathUtil::Rectangle& rc) const { // Resize target to half its original size - TargetRectangle draw_rc = rc; + auto draw_rc = rc; if (g_ActiveConfig.stereo_mode == StereoMode::TAB) { // The height may be negative due to flipped rectangles @@ -352,8 +352,8 @@ Renderer::ConvertStereoRectangle(const TargetRectangle& rc) const } // Create two target rectangle offset to the sides of the backbuffer - TargetRectangle left_rc = draw_rc; - TargetRectangle right_rc = draw_rc; + auto left_rc = draw_rc; + auto right_rc = draw_rc; if (g_ActiveConfig.stereo_mode == StereoMode::TAB) { left_rc.top -= m_backbuffer_height / 4; @@ -649,9 +649,9 @@ MathUtil::Rectangle Renderer::ConvertFramebufferRectangle(const MathUtil::R return ret; } -TargetRectangle Renderer::ConvertEFBRectangle(const EFBRectangle& rc) +MathUtil::Rectangle Renderer::ConvertEFBRectangle(const MathUtil::Rectangle& rc) { - TargetRectangle result; + MathUtil::Rectangle result; result.left = EFBToScaledX(rc.left); result.top = EFBToScaledY(rc.top); result.right = EFBToScaledX(rc.right); @@ -1285,13 +1285,13 @@ void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u6 } } -void Renderer::RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc) +void Renderer::RenderXFBToScreen(const AbstractTexture* texture, const MathUtil::Rectangle& rc) { const auto target_rc = GetTargetRectangle(); if (g_ActiveConfig.stereo_mode == StereoMode::SBS || g_ActiveConfig.stereo_mode == StereoMode::TAB) { - TargetRectangle left_rc, right_rc; + MathUtil::Rectangle left_rc, right_rc; std::tie(left_rc, right_rc) = ConvertStereoRectangle(target_rc); m_post_processor->BlitFromTexture(left_rc, rc, texture, 0); diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index a7cfe5e867..c10d8d155b 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -166,17 +166,17 @@ public: // EFB coordinate conversion functions // Use this to convert a whole native EFB rect to backbuffer coordinates - TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc); + MathUtil::Rectangle ConvertEFBRectangle(const MathUtil::Rectangle& rc); - const TargetRectangle& GetTargetRectangle() const { return m_target_rectangle; } + const MathUtil::Rectangle& GetTargetRectangle() const { return m_target_rectangle; } float CalculateDrawAspectRatio() const; std::tuple ScaleToDisplayAspectRatio(int width, int height) const; void UpdateDrawRectangle(); // Use this to convert a single target rectangle to two stereo rectangles - std::tuple - ConvertStereoRectangle(const TargetRectangle& rc) const; + std::tuple, MathUtil::Rectangle> + ConvertStereoRectangle(const MathUtil::Rectangle& rc) const; unsigned int GetEFBScale() const; @@ -195,11 +195,11 @@ public: // ImGui initialization depends on being able to create textures and pipelines, so do it last. bool InitializeImGui(); - virtual void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, - u32 color, u32 z); + virtual void ClearScreen(const MathUtil::Rectangle& rc, bool colorEnable, bool alphaEnable, + bool zEnable, u32 color, u32 z); virtual void ReinterpretPixelData(EFBReinterpretType convtype); - void RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbStride, u32 fbHeight, - float Gamma = 1.0f); + void RenderToXFB(u32 xfbAddr, const MathUtil::Rectangle& sourceRc, u32 fbStride, + u32 fbHeight, float Gamma = 1.0f); virtual u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data); virtual void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points); @@ -216,7 +216,8 @@ public: // Draws the specified XFB buffer to the screen, performing any post-processing. // Assumes that the backbuffer has already been bound and cleared. - virtual void RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc); + virtual void RenderXFBToScreen(const AbstractTexture* texture, + const MathUtil::Rectangle& rc); // Called when the configuration changes, and backend structures need to be updated. virtual void OnConfigChanged(u32 bits) {} @@ -294,7 +295,7 @@ protected: int m_backbuffer_height = 0; float m_backbuffer_scale = 1.0f; AbstractTextureFormat m_backbuffer_format = AbstractTextureFormat::Undefined; - TargetRectangle m_target_rectangle = {}; + MathUtil::Rectangle m_target_rectangle = {}; int m_frame_count = 0; FPSCounter m_fps_counter; diff --git a/Source/Core/VideoCommon/ShaderCache.cpp b/Source/Core/VideoCommon/ShaderCache.cpp index 3e4ed24662..6ac4827165 100644 --- a/Source/Core/VideoCommon/ShaderCache.cpp +++ b/Source/Core/VideoCommon/ShaderCache.cpp @@ -94,7 +94,9 @@ void ShaderCache::Shutdown() { // This may leave shaders uncommitted to the cache, but it's better than blocking shutdown // until everything has finished compiling. - m_async_shader_compiler->StopWorkerThreads(); + if (m_async_shader_compiler) + m_async_shader_compiler->StopWorkerThreads(); + ClosePipelineUIDCache(); } diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 4e0d2547f2..01d7a675eb 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -1527,8 +1527,9 @@ bool TextureCacheBase::NeedsCopyFilterInShader(const EFBCopyFilterCoefficients& void TextureCacheBase::CopyRenderTargetToTexture( u32 dstAddr, EFBCopyFormat dstFormat, u32 width, u32 height, u32 dstStride, bool is_depth_copy, - const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf, float y_scale, float gamma, - bool clamp_top, bool clamp_bottom, const CopyFilterCoefficients::Values& filter_coefficients) + const MathUtil::Rectangle& srcRect, bool isIntensity, bool scaleByHalf, float y_scale, + float gamma, bool clamp_top, bool clamp_bottom, + const CopyFilterCoefficients::Values& filter_coefficients) { // Emulation methods: // @@ -2158,10 +2159,10 @@ bool TextureCacheBase::CreateUtilityTextures() } void TextureCacheBase::CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy, - const EFBRectangle& src_rect, bool scale_by_half, - bool linear_filter, EFBCopyFormat dst_format, - bool is_intensity, float gamma, bool clamp_top, - bool clamp_bottom, + const MathUtil::Rectangle& src_rect, + bool scale_by_half, bool linear_filter, + EFBCopyFormat dst_format, bool is_intensity, float gamma, + bool clamp_top, bool clamp_bottom, const EFBCopyFilterCoefficients& filter_coefficients) { // Flush EFB pokes first, as they're expected to be included. @@ -2229,9 +2230,9 @@ void TextureCacheBase::CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_cop void TextureCacheBase::CopyEFB(AbstractStagingTexture* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row, u32 num_blocks_y, - u32 memory_stride, const EFBRectangle& src_rect, bool scale_by_half, - bool linear_filter, float y_scale, float gamma, bool clamp_top, - bool clamp_bottom, + u32 memory_stride, const MathUtil::Rectangle& src_rect, + bool scale_by_half, bool linear_filter, float y_scale, float gamma, + bool clamp_top, bool clamp_bottom, const EFBCopyFilterCoefficients& filter_coefficients) { // Flush EFB pokes first, as they're expected to be included. diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index c33dd4b7df..6c647359dd 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -213,9 +213,10 @@ public: virtual void BindTextures(); void CopyRenderTargetToTexture(u32 dstAddr, EFBCopyFormat dstFormat, u32 width, u32 height, - u32 dstStride, bool is_depth_copy, const EFBRectangle& srcRect, - bool isIntensity, bool scaleByHalf, float y_scale, float gamma, - bool clamp_top, bool clamp_bottom, + u32 dstStride, bool is_depth_copy, + const MathUtil::Rectangle& srcRect, bool isIntensity, + bool scaleByHalf, float y_scale, float gamma, bool clamp_top, + bool clamp_bottom, const CopyFilterCoefficients::Values& filter_coefficients); void ScaleTextureCacheEntryTo(TCacheEntry* entry, u32 new_width, u32 new_height); @@ -243,11 +244,11 @@ protected: virtual void CopyEFB(AbstractStagingTexture* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, - const EFBRectangle& src_rect, bool scale_by_half, bool linear_filter, - float y_scale, float gamma, bool clamp_top, bool clamp_bottom, - const EFBCopyFilterCoefficients& filter_coefficients); + const MathUtil::Rectangle& src_rect, bool scale_by_half, + bool linear_filter, float y_scale, float gamma, bool clamp_top, + bool clamp_bottom, const EFBCopyFilterCoefficients& filter_coefficients); virtual void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy, - const EFBRectangle& src_rect, bool scale_by_half, + const MathUtil::Rectangle& src_rect, bool scale_by_half, bool linear_filter, EFBCopyFormat dst_format, bool is_intensity, float gamma, bool clamp_top, bool clamp_bottom, const EFBCopyFilterCoefficients& filter_coefficients); diff --git a/Source/Core/VideoCommon/VideoCommon.h b/Source/Core/VideoCommon/VideoCommon.h index 32843701c8..e727edd0b0 100644 --- a/Source/Core/VideoCommon/VideoCommon.h +++ b/Source/Core/VideoCommon/VideoCommon.h @@ -3,11 +3,6 @@ // Refer to the license.txt file included. #pragma once - -#ifdef _WIN32 -#include -#endif - #include "Common/CommonTypes.h" #include "Common/MathUtil.h" @@ -31,34 +26,6 @@ const u32 MAX_XFB_WIDTH = 720; // that are next to each other in memory (TODO: handle that situation). const u32 MAX_XFB_HEIGHT = 576; -// This structure should only be used to represent a rectangle in EFB -// coordinates, where the origin is at the upper left and the frame dimensions -// are 640 x 528. -typedef MathUtil::Rectangle EFBRectangle; - -// This structure should only be used to represent a rectangle in standard target -// coordinates, where the origin is at the lower left and the frame dimensions -// depend on the resolution settings. Use Renderer::ConvertEFBRectangle to -// convert an EFBRectangle to a TargetRectangle. -struct TargetRectangle : public MathUtil::Rectangle -{ -#ifdef _WIN32 - // Only used by D3D backend. - const RECT* AsRECT() const - { - // The types are binary compatible so this works. - return (const RECT*)this; - } - RECT* AsRECT() - { - // The types are binary compatible so this works. - return (RECT*)this; - } -#endif - TargetRectangle(const MathUtil::Rectangle& other) : MathUtil::Rectangle(other) {} - TargetRectangle() = default; -}; - #ifdef _WIN32 #define PRIM_LOG(...) DEBUG_LOG(VIDEO, __VA_ARGS__) #else