mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 21:37:42 -07:00
Tie BinCombined's local_size_x to the coarse tiles' area
This commit is contained in:
parent
57b5e16e6d
commit
f097cc3b4e
@ -57,6 +57,8 @@ bool ComputeRenderer::CompileShader(GLuint& shader, const std::string& source, c
|
||||
shaderSource += std::to_string(TileSize);
|
||||
shaderSource += "\nconst int CoarseTileCountY = ";
|
||||
shaderSource += std::to_string(CoarseTileCountY) + ";";
|
||||
shaderSource += "\n#define CoarseTileArea ";
|
||||
shaderSource += std::to_string(CoarseTileArea);
|
||||
|
||||
shaderSource += ComputeRendererShaders::Common;
|
||||
shaderSource += source;
|
||||
@ -330,6 +332,7 @@ void ComputeRenderer::SetRenderSettings(int scale, bool highResolutionCoordinate
|
||||
|
||||
TileSize = std::min(8 * TileScale, 32);
|
||||
CoarseTileCountY = TileSize < 32 ? 4 : 6;
|
||||
CoarseTileArea = CoarseTileCountX * CoarseTileCountY;
|
||||
CoarseTileW = CoarseTileCountX * TileSize;
|
||||
CoarseTileH = CoarseTileCountY * TileSize;
|
||||
|
||||
@ -959,7 +962,7 @@ void ComputeRenderer::RenderFrame(GPU& gpu)
|
||||
|
||||
// bin polygons
|
||||
glUseProgram(ShaderBinCombined);
|
||||
glDispatchCompute(((gpu.GPU3D.RenderNumPolygons + 31) / 32), ScreenWidth/CoarseTileW, ScreenHeight/CoarseTileH);
|
||||
glDispatchCompute(((gpu.GPU3D.RenderNumPolygons + CoarseTileArea - 1) / CoarseTileArea), ScreenWidth/CoarseTileW, ScreenHeight/CoarseTileH);
|
||||
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);
|
||||
|
||||
// calculate list offsets
|
||||
|
@ -166,6 +166,7 @@ private:
|
||||
int TileSize;
|
||||
static constexpr int CoarseTileCountX = 8;
|
||||
int CoarseTileCountY;
|
||||
int CoarseTileArea;
|
||||
int CoarseTileW;
|
||||
int CoarseTileH;
|
||||
|
||||
|
@ -862,7 +862,7 @@ const std::string BinCombined =
|
||||
XSpanSetupBuffer +
|
||||
WorkDescBuffer + R"(
|
||||
|
||||
layout (local_size_x = 32) in;
|
||||
layout (local_size_x = CoarseTileArea) in;
|
||||
|
||||
bool BinPolygon(Polygon polygon, ivec2 topLeft, ivec2 botRight)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user