Skip to content

Commit dd2caba

Browse files
committed
fix: metal grid shader conflict
1 parent 9410a47 commit dd2caba

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

extensions/pl_graphics_metal.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3404,7 +3404,7 @@
34043404
for(uint32_t i = 0; i < pl_sb_size(ptGarbage->sbtTextures); i++)
34053405
{
34063406
const uint16_t uTextureIndex = ptGarbage->sbtTextures[i].uIndex;
3407-
if( uSignaledValue > ptDevice->sbtTexturesCold[uTextureIndex]._uFrameBoundaryValueForDeletion)
3407+
if( uSignaledValue > ptDevice->sbtTexturesCold[uTextureIndex]._uFrameBoundaryValueForDeletion + 1)
34083408
{
34093409
plMetalTexture* ptMetalTexture = &ptDevice->sbtTexturesHot[uTextureIndex];
34103410
[ptMetalTexture->tTexture release];
@@ -3418,7 +3418,7 @@
34183418
for(uint32_t i = 0; i < pl_sb_size(ptGarbage->sbtBuffers); i++)
34193419
{
34203420
const uint16_t iBufferIndex = ptGarbage->sbtBuffers[i].uIndex;
3421-
if( uSignaledValue > ptDevice->sbtBuffersCold[iBufferIndex]._uFrameBoundaryValueForDeletion)
3421+
if( uSignaledValue > ptDevice->sbtBuffersCold[iBufferIndex]._uFrameBoundaryValueForDeletion + 1)
34223422
{
34233423
[ptDevice->sbtBuffersHot[iBufferIndex].tBuffer release];
34243424
ptDevice->sbtBuffersHot[iBufferIndex].tBuffer = nil;
@@ -3431,7 +3431,7 @@
34313431

34323432
for(uint32_t i = 0; i < pl_sb_size(ptGarbage->sbtMemory); i++)
34333433
{
3434-
if( uSignaledValue > ptGarbage->sbtMemory[i]._uFrameBoundaryValueForDeletion)
3434+
if( uSignaledValue > ptGarbage->sbtMemory[i]._uFrameBoundaryValueForDeletion + 1)
34353435
{
34363436
if(ptGarbage->sbtMemory[i].ptAllocator)
34373437
{
@@ -3713,4 +3713,4 @@
37133713
pl_get_metal_bind_group_texture(plDevice* ptDevice, plBindGroupHandle tHandle)
37143714
{
37153715
return ptDevice->sbtBindGroupsHot[tHandle.uIndex].tFirstTexture;
3716-
}
3716+
}

shaders/grid.frag

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ layout (location=1) in vec2 camPos;
1212
layout (location=0) out vec4 fragColor;
1313

1414
float
15-
log10(float x)
15+
pl_log10(float x)
1616
{
1717
return log(x) / log(10.0);
1818
}
@@ -43,7 +43,7 @@ gridColor(vec2 uv, vec2 camPos)
4343
length(vec2(dFdx(uv.y), dFdy(uv.y)))
4444
);
4545

46-
float lodLevel = max(0.0, log10((length(dudv) * tObjectInfo.tData.fGridMinPixelsBetweenCells) / tObjectInfo.tData.fGridCellSize) + 1.0);
46+
float lodLevel = max(0.0, pl_log10((length(dudv) * tObjectInfo.tData.fGridMinPixelsBetweenCells) / tObjectInfo.tData.fGridCellSize) + 1.0);
4747
float lodFade = fract(lodLevel);
4848

4949
// cell sizes for lod0, lod1 and lod2

0 commit comments

Comments
 (0)