Skip to content

Commit

Permalink
bump up compute shader renderer tile amount factor to 16
Browse files Browse the repository at this point in the history
also why did I think DS could render 4096 polygons? Use that extra bit for larger work offset
  • Loading branch information
RSDuck committed May 13, 2024
1 parent 347f4a7 commit 5df83c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/GPU3D_Compute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void ComputeRenderer::SetRenderSettings(int scale, bool highResolutionCoordinate

HiresCoordinates = highResolutionCoordinates;

MaxWorkTiles = TilesPerLine*TileLines*8;
MaxWorkTiles = TilesPerLine*TileLines*16;

for (int i = 0; i < tilememoryLayer_Num; i++)
{
Expand Down
12 changes: 6 additions & 6 deletions src/GPU3D_Compute_shaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ void main()
int variantIdx = Polygons[polygonIdx].Variant;
int inVariantOffset = int(atomicAdd(VariantWorkCount[variantIdx].z, 1));
WorkDescs[WorkDescsUnsortedStart + workOffset + idx] = uvec2(tilePositionCombined, bitfieldInsert(polygonIdx, inVariantOffset, 12, 20));
WorkDescs[WorkDescsUnsortedStart + workOffset + idx] = uvec2(tilePositionCombined, bitfieldInsert(polygonIdx, inVariantOffset, 11, 21));
idx++;
}
Expand Down Expand Up @@ -1042,12 +1042,12 @@ void main()
if (gl_GlobalInvocationID.x < VariantWorkCount[0].w)
{
uvec2 workDesc = WorkDescs[WorkDescsUnsortedStart + gl_GlobalInvocationID.x];
int inVariantOffset = int(bitfieldExtract(workDesc.y, 12, 20));
int polygonIdx = int(bitfieldExtract(workDesc.y, 0, 12));
int inVariantOffset = int(bitfieldExtract(workDesc.y, 11, 21));
int polygonIdx = int(bitfieldExtract(workDesc.y, 0, 11));
int variantIdx = Polygons[polygonIdx].Variant;
int sortedIndex = int(SortedWorkOffset[variantIdx]) + inVariantOffset;
WorkDescs[WorkDescsSortedStart + sortedIndex] = uvec2(workDesc.x, bitfieldInsert(workDesc.y, gl_GlobalInvocationID.x, 12, 20));
WorkDescs[WorkDescsSortedStart + sortedIndex] = uvec2(workDesc.x, bitfieldInsert(workDesc.y, gl_GlobalInvocationID.x, 11, 21));
}
}
Expand All @@ -1070,9 +1070,9 @@ layout (location = 1) uniform vec2 InvTextureSize;
void main()
{
uvec2 workDesc = WorkDescs[WorkDescsSortedStart + SortedWorkOffset[CurVariant] + gl_WorkGroupID.z];
Polygon polygon = Polygons[bitfieldExtract(workDesc.y, 0, 12)];
Polygon polygon = Polygons[bitfieldExtract(workDesc.y, 0, 11)];
ivec2 position = ivec2(bitfieldExtract(workDesc.x, 0, 16), bitfieldExtract(workDesc.x, 16, 16)) + ivec2(gl_LocalInvocationID.xy);
int tileOffset = int(bitfieldExtract(workDesc.y, 12, 20)) * TileSize * TileSize + TileSize * int(gl_LocalInvocationID.y) + int(gl_LocalInvocationID.x);
int tileOffset = int(bitfieldExtract(workDesc.y, 11, 21)) * TileSize * TileSize + TileSize * int(gl_LocalInvocationID.y) + int(gl_LocalInvocationID.x);
uint color = 0U;
if (position.y >= polygon.YTop && position.y < polygon.YBot)
Expand Down

0 comments on commit 5df83c9

Please sign in to comment.