mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-09 15:29:43 -06:00
Tie BinCombined's local_size_x to the coarse tiles' area
This commit is contained in:
@ -57,6 +57,8 @@ bool ComputeRenderer::CompileShader(GLuint& shader, const std::string& source, c
|
|||||||
shaderSource += std::to_string(TileSize);
|
shaderSource += std::to_string(TileSize);
|
||||||
shaderSource += "\nconst int CoarseTileCountY = ";
|
shaderSource += "\nconst int CoarseTileCountY = ";
|
||||||
shaderSource += std::to_string(CoarseTileCountY) + ";";
|
shaderSource += std::to_string(CoarseTileCountY) + ";";
|
||||||
|
shaderSource += "\n#define CoarseTileArea ";
|
||||||
|
shaderSource += std::to_string(CoarseTileArea);
|
||||||
|
|
||||||
shaderSource += ComputeRendererShaders::Common;
|
shaderSource += ComputeRendererShaders::Common;
|
||||||
shaderSource += source;
|
shaderSource += source;
|
||||||
@ -330,6 +332,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;
|
||||||
|
CoarseTileArea = CoarseTileCountX * CoarseTileCountY;
|
||||||
CoarseTileW = CoarseTileCountX * TileSize;
|
CoarseTileW = CoarseTileCountX * TileSize;
|
||||||
CoarseTileH = CoarseTileCountY * TileSize;
|
CoarseTileH = CoarseTileCountY * TileSize;
|
||||||
|
|
||||||
@ -959,7 +962,7 @@ void ComputeRenderer::RenderFrame(GPU& gpu)
|
|||||||
|
|
||||||
// bin polygons
|
// bin polygons
|
||||||
glUseProgram(ShaderBinCombined);
|
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);
|
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);
|
||||||
|
|
||||||
// calculate list offsets
|
// calculate list offsets
|
||||||
|
@ -166,6 +166,7 @@ private:
|
|||||||
int TileSize;
|
int TileSize;
|
||||||
static constexpr int CoarseTileCountX = 8;
|
static constexpr int CoarseTileCountX = 8;
|
||||||
int CoarseTileCountY;
|
int CoarseTileCountY;
|
||||||
|
int CoarseTileArea;
|
||||||
int CoarseTileW;
|
int CoarseTileW;
|
||||||
int CoarseTileH;
|
int CoarseTileH;
|
||||||
|
|
||||||
|
@ -862,7 +862,7 @@ const std::string BinCombined =
|
|||||||
XSpanSetupBuffer +
|
XSpanSetupBuffer +
|
||||||
WorkDescBuffer + R"(
|
WorkDescBuffer + R"(
|
||||||
|
|
||||||
layout (local_size_x = 32) in;
|
layout (local_size_x = CoarseTileArea) in;
|
||||||
|
|
||||||
bool BinPolygon(Polygon polygon, ivec2 topLeft, ivec2 botRight)
|
bool BinPolygon(Polygon polygon, ivec2 topLeft, ivec2 botRight)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user