From 86112c72581ad2b005014f88d98d93866e8bcbee Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 3 Oct 2016 06:51:46 -0700 Subject: [PATCH] VideoCommon: Minor changes Make Renderer::GetMaxTextureSize return u32 instead of int. --- Source/Core/VideoBackends/D3D/Render.cpp | 2 +- Source/Core/VideoBackends/D3D/Render.h | 2 +- Source/Core/VideoBackends/D3D12/Render.cpp | 2 +- Source/Core/VideoBackends/D3D12/Render.h | 2 +- Source/Core/VideoBackends/Null/Render.h | 2 +- Source/Core/VideoBackends/OGL/Render.cpp | 4 ++-- Source/Core/VideoBackends/OGL/Render.h | 2 +- Source/Core/VideoBackends/Software/SWRenderer.h | 2 +- Source/Core/VideoBackends/Vulkan/Renderer.h | 2 +- Source/Core/VideoCommon/RenderBase.cpp | 7 +++---- Source/Core/VideoCommon/RenderBase.h | 2 +- 11 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index d82017d3bf..ff0a6f396a 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -1273,7 +1273,7 @@ void Renderer::SetInterlacingMode() // TODO } -int Renderer::GetMaxTextureSize() +u32 Renderer::GetMaxTextureSize() { return DX11::D3D::GetMaxTextureSize(); } diff --git a/Source/Core/VideoBackends/D3D/Render.h b/Source/Core/VideoBackends/D3D/Render.h index 4bde0f05fb..6dec232d33 100644 --- a/Source/Core/VideoBackends/D3D/Render.h +++ b/Source/Core/VideoBackends/D3D/Render.h @@ -58,7 +58,7 @@ public: static bool CheckForResize(); - int GetMaxTextureSize() override; + u32 GetMaxTextureSize() override; private: void BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D* src_texture, diff --git a/Source/Core/VideoBackends/D3D12/Render.cpp b/Source/Core/VideoBackends/D3D12/Render.cpp index bb58280ac6..3691f967be 100644 --- a/Source/Core/VideoBackends/D3D12/Render.cpp +++ b/Source/Core/VideoBackends/D3D12/Render.cpp @@ -1287,7 +1287,7 @@ void Renderer::SetInterlacingMode() // EXISTINGD3D11TODO } -int Renderer::GetMaxTextureSize() +u32 Renderer::GetMaxTextureSize() { return DX12::D3D::GetMaxTextureSize(); } diff --git a/Source/Core/VideoBackends/D3D12/Render.h b/Source/Core/VideoBackends/D3D12/Render.h index 21bb00cc76..7d6a6ee82d 100644 --- a/Source/Core/VideoBackends/D3D12/Render.h +++ b/Source/Core/VideoBackends/D3D12/Render.h @@ -58,7 +58,7 @@ public: static bool CheckForResize(); - int GetMaxTextureSize() override; + u32 GetMaxTextureSize() override; static D3D12_BLEND_DESC GetResetBlendDesc(); static D3D12_DEPTH_STENCIL_DESC GetResetDepthStencilDesc(); diff --git a/Source/Core/VideoBackends/Null/Render.h b/Source/Core/VideoBackends/Null/Render.h index e436ce8123..6ef5428185 100644 --- a/Source/Core/VideoBackends/Null/Render.h +++ b/Source/Core/VideoBackends/Null/Render.h @@ -19,7 +19,7 @@ public: void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points) override {} u16 BBoxRead(int index) override { return 0; } void BBoxWrite(int index, u16 value) override {} - int GetMaxTextureSize() override { return 16 * 1024; } + u32 GetMaxTextureSize() override { return 16 * 1024; } TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, const EFBRectangle& rc, diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 93ca315c3e..f3e4d3c2cb 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1809,14 +1809,14 @@ bool Renderer::SaveScreenshot(const std::string& filename, const TargetRectangle return TextureToPng(data.get(), W * 4, filename, W, H, false); } -int Renderer::GetMaxTextureSize() +u32 Renderer::GetMaxTextureSize() { // Right now nvidia seems to do something very weird if we try to cache GL_MAX_TEXTURE_SIZE in // init. This is a workaround that lets // us keep the perf improvement that caching it gives us. if (s_max_texture_size == 0) glGetIntegerv(GL_MAX_TEXTURE_SIZE, &s_max_texture_size); - return s_max_texture_size; + return static_cast(s_max_texture_size); } void Renderer::ChangeSurface(void* new_surface_handle) diff --git a/Source/Core/VideoBackends/OGL/Render.h b/Source/Core/VideoBackends/OGL/Render.h index 57611f6856..edfdd0090c 100644 --- a/Source/Core/VideoBackends/OGL/Render.h +++ b/Source/Core/VideoBackends/OGL/Render.h @@ -103,7 +103,7 @@ public: bool SaveScreenshot(const std::string& filename, const TargetRectangle& rc) override; - int GetMaxTextureSize() override; + u32 GetMaxTextureSize() override; void ChangeSurface(void* new_surface_handle) override; diff --git a/Source/Core/VideoBackends/Software/SWRenderer.h b/Source/Core/VideoBackends/Software/SWRenderer.h index 0c9bca29a5..73cc977b31 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.h +++ b/Source/Core/VideoBackends/Software/SWRenderer.h @@ -30,7 +30,7 @@ public: u16 BBoxRead(int index) override; void BBoxWrite(int index, u16 value) override; - int GetMaxTextureSize() override { return 16 * 1024; }; + u32 GetMaxTextureSize() override { return 16 * 1024; }; TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc, diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.h b/Source/Core/VideoBackends/Vulkan/Renderer.h index 3110a090e5..4568899d7e 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.h +++ b/Source/Core/VideoBackends/Vulkan/Renderer.h @@ -38,7 +38,7 @@ public: void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points) override; u16 BBoxRead(int index) override; void BBoxWrite(int index, u16 value) override; - int GetMaxTextureSize() override { return 16 * 1024; } + u32 GetMaxTextureSize() override { return 16 * 1024; } TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, const EFBRectangle& rc, diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 8fb77a341f..4f093c4ee6 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -237,11 +237,10 @@ bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int efb_scale_numeratorX = efb_scale_numeratorY = s_last_efb_scale - 3; efb_scale_denominatorX = efb_scale_denominatorY = 1; - int maxSize; - maxSize = GetMaxTextureSize(); - if ((unsigned)maxSize < EFB_WIDTH * efb_scale_numeratorX / efb_scale_denominatorX) + const u32 max_size = GetMaxTextureSize(); + if (max_size < EFB_WIDTH * efb_scale_numeratorX / efb_scale_denominatorX) { - efb_scale_numeratorX = efb_scale_numeratorY = (maxSize / EFB_WIDTH); + efb_scale_numeratorX = efb_scale_numeratorY = (max_size / EFB_WIDTH); efb_scale_denominatorX = efb_scale_denominatorY = 1; } diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index 44a0b982b7..b0d2ac1234 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -133,7 +133,7 @@ public: static void StorePixelFormat(PEControl::PixelFormat new_format) { prev_efb_format = new_format; } PostProcessingShaderImplementation* GetPostProcessor() { return m_post_processor.get(); } // Max height/width - virtual int GetMaxTextureSize() = 0; + virtual u32 GetMaxTextureSize() = 0; static Common::Event s_screenshotCompleted;