Skip to content

Commit

Permalink
Adjust ClearCoarseBinMask's local size according to TileSize
Browse files Browse the repository at this point in the history
  • Loading branch information
FireNX70 committed Jun 13, 2024
1 parent 9c87d99 commit 6f8ce9f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/GPU3D_Compute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ bool ComputeRenderer::CompileShader(GLuint& shader, const std::string& source, c
shaderSource += std::to_string(CoarseTileCountY) + ";";
shaderSource += "\n#define CoarseTileArea ";
shaderSource += std::to_string(CoarseTileArea);
shaderSource += "\n#define ClearCoarseBinMaskLocalSize ";
shaderSource += std::to_string(ClearCoarseBinMaskLocalSize);

shaderSource += ComputeRendererShaders::Common;
shaderSource += source;
Expand Down Expand Up @@ -332,6 +334,7 @@ void ComputeRenderer::SetRenderSettings(int scale, bool highResolutionCoordinate

TileSize = std::min(8 * TileScale, 32);
CoarseTileCountY = TileSize < 32 ? 4 : 6;
ClearCoarseBinMaskLocalSize = TileSize < 32 ? 64 : 48;
CoarseTileArea = CoarseTileCountX * CoarseTileCountY;
CoarseTileW = CoarseTileCountX * TileSize;
CoarseTileH = CoarseTileCountY * TileSize;
Expand Down Expand Up @@ -944,7 +947,7 @@ void ComputeRenderer::RenderFrame(GPU& gpu)
glBindBufferBase(GL_UNIFORM_BUFFER, 0, MetaUniformMemory);

glUseProgram(ShaderClearCoarseBinMask);
glDispatchCompute(TilesPerLine*TileLines/32, 1, 1);
glDispatchCompute(TilesPerLine*TileLines/ClearCoarseBinMaskLocalSize, 1, 1);

bool wbuffer = false;
if (numYSpans > 0)
Expand Down
1 change: 1 addition & 0 deletions src/GPU3D_Compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class ComputeRenderer : public Renderer3D
int CoarseTileArea;
int CoarseTileW;
int CoarseTileH;
int ClearCoarseBinMaskLocalSize;

static constexpr int BinStride = 2048/32;
static constexpr int CoarseBinStride = BinStride/32;
Expand Down
2 changes: 1 addition & 1 deletion src/GPU3D_Compute_shaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ void main()

const std::string ClearCoarseBinMask =
BinningBuffer + R"(
layout (local_size_x = 32) in;
layout (local_size_x = ClearCoarseBinMaskLocalSize) in;
void main()
{
Expand Down

0 comments on commit 6f8ce9f

Please sign in to comment.