Adjust ClearCoarseBinMask's local size according to TileSize

This commit is contained in:
FireNX70 2024-06-13 07:57:49 +02:00
parent 9c87d9998f
commit 6f8ce9fe89
3 changed files with 6 additions and 2 deletions

View File

@ -59,6 +59,8 @@ bool ComputeRenderer::CompileShader(GLuint& shader, const std::string& source, c
shaderSource += std::to_string(CoarseTileCountY) + ";"; shaderSource += std::to_string(CoarseTileCountY) + ";";
shaderSource += "\n#define CoarseTileArea "; shaderSource += "\n#define CoarseTileArea ";
shaderSource += std::to_string(CoarseTileArea); shaderSource += std::to_string(CoarseTileArea);
shaderSource += "\n#define ClearCoarseBinMaskLocalSize ";
shaderSource += std::to_string(ClearCoarseBinMaskLocalSize);
shaderSource += ComputeRendererShaders::Common; shaderSource += ComputeRendererShaders::Common;
shaderSource += source; shaderSource += source;
@ -332,6 +334,7 @@ void ComputeRenderer::SetRenderSettings(int scale, bool highResolutionCoordinate
TileSize = std::min(8 * TileScale, 32); TileSize = std::min(8 * TileScale, 32);
CoarseTileCountY = TileSize < 32 ? 4 : 6; CoarseTileCountY = TileSize < 32 ? 4 : 6;
ClearCoarseBinMaskLocalSize = TileSize < 32 ? 64 : 48;
CoarseTileArea = CoarseTileCountX * CoarseTileCountY; CoarseTileArea = CoarseTileCountX * CoarseTileCountY;
CoarseTileW = CoarseTileCountX * TileSize; CoarseTileW = CoarseTileCountX * TileSize;
CoarseTileH = CoarseTileCountY * TileSize; CoarseTileH = CoarseTileCountY * TileSize;
@ -944,7 +947,7 @@ void ComputeRenderer::RenderFrame(GPU& gpu)
glBindBufferBase(GL_UNIFORM_BUFFER, 0, MetaUniformMemory); glBindBufferBase(GL_UNIFORM_BUFFER, 0, MetaUniformMemory);
glUseProgram(ShaderClearCoarseBinMask); glUseProgram(ShaderClearCoarseBinMask);
glDispatchCompute(TilesPerLine*TileLines/32, 1, 1); glDispatchCompute(TilesPerLine*TileLines/ClearCoarseBinMaskLocalSize, 1, 1);
bool wbuffer = false; bool wbuffer = false;
if (numYSpans > 0) if (numYSpans > 0)

View File

@ -169,6 +169,7 @@ private:
int CoarseTileArea; int CoarseTileArea;
int CoarseTileW; int CoarseTileW;
int CoarseTileH; int CoarseTileH;
int ClearCoarseBinMaskLocalSize;
static constexpr int BinStride = 2048/32; static constexpr int BinStride = 2048/32;
static constexpr int CoarseBinStride = BinStride/32; static constexpr int CoarseBinStride = BinStride/32;

View File

@ -846,7 +846,7 @@ void main()
const std::string ClearCoarseBinMask = const std::string ClearCoarseBinMask =
BinningBuffer + R"( BinningBuffer + R"(
layout (local_size_x = 32) in; layout (local_size_x = ClearCoarseBinMaskLocalSize) in;
void main() void main()
{ {