From 528501149e21e380898dd77a4c527087f0d8651e Mon Sep 17 00:00:00 2001 From: FireNX70 Date: Sun, 9 Jun 2024 20:07:26 +0200 Subject: [PATCH] Scale TileSize with internal resolution --- src/GPU3D_Compute.cpp | 7 +++++++ src/GPU3D_Compute.h | 6 +++--- src/GPU3D_Compute_shaders.h | 1 - 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/GPU3D_Compute.cpp b/src/GPU3D_Compute.cpp index 027d6806..6d6115fe 100644 --- a/src/GPU3D_Compute.cpp +++ b/src/GPU3D_Compute.cpp @@ -19,6 +19,7 @@ #include "GPU3D_Compute.h" #include +#include #include "OpenGLSupport.h" @@ -50,6 +51,8 @@ bool ComputeRenderer::CompileShader(GLuint& shader, const std::string& source, c shaderSource += std::to_string(ScreenHeight); shaderSource += "\n#define MaxWorkTiles "; shaderSource += std::to_string(MaxWorkTiles); + shaderSource += "\n#define TileSize "; + shaderSource += std::to_string(TileSize); shaderSource += ComputeRendererShaders::Common; shaderSource += source; @@ -310,6 +313,10 @@ void ComputeRenderer::SetRenderSettings(int scale, bool highResolutionCoordinate ScreenWidth = 256 * ScaleFactor; ScreenHeight = 192 * ScaleFactor; + TileSize = std::min(8 * (1 << (ScaleFactor / 5)), 32); + CoarseTileW = CoarseTileCountX * TileSize; + CoarseTileH = CoarseTileCountY * TileSize; + TilesPerLine = ScreenWidth/TileSize; TileLines = ScreenHeight/TileSize; diff --git a/src/GPU3D_Compute.h b/src/GPU3D_Compute.h index 7544c09e..1e225948 100644 --- a/src/GPU3D_Compute.h +++ b/src/GPU3D_Compute.h @@ -163,11 +163,11 @@ private: float TextureLayer; }; - static constexpr int TileSize = 8; + int TileSize; static constexpr int CoarseTileCountX = 8; static constexpr int CoarseTileCountY = 4; - static constexpr int CoarseTileW = CoarseTileCountX * TileSize; - static constexpr int CoarseTileH = CoarseTileCountY * TileSize; + int CoarseTileW; + int CoarseTileH; static constexpr int BinStride = 2048/32; static constexpr int CoarseBinStride = BinStride/32; diff --git a/src/GPU3D_Compute_shaders.h b/src/GPU3D_Compute_shaders.h index 572f9ad6..0ad57dbd 100644 --- a/src/GPU3D_Compute_shaders.h +++ b/src/GPU3D_Compute_shaders.h @@ -339,7 +339,6 @@ const uint ResultAttrStart = ResultDepthStart+ScreenWidth*ScreenHeight*2; const char* Common = R"( -#define TileSize 8 const int CoarseTileCountX = 8; const int CoarseTileCountY = 4; const int CoarseTileW = (CoarseTileCountX * TileSize);