From d045fe8dea9509b6def4c7e4c678bcd55aec807e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BB=D1=8C=D1=8F=20=D0=91=D0=B5=D0=BB=D0=BE=D0=B2?= Date: Mon, 4 Nov 2024 21:44:42 +0300 Subject: [PATCH] Fix for one block --- prismarine-viewer/examples/Cube.comp.wgsl | 2 +- prismarine-viewer/examples/CubeSort.comp.wgsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/prismarine-viewer/examples/Cube.comp.wgsl b/prismarine-viewer/examples/Cube.comp.wgsl index 4df42a3dd..82288c275 100644 --- a/prismarine-viewer/examples/Cube.comp.wgsl +++ b/prismarine-viewer/examples/Cube.comp.wgsl @@ -58,7 +58,7 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { var depthPrev = atomicMin(&depthAtomic.locks[pos.x][pos.y], depth); //depthPrev = atomicLoad(&depthAtomic.locks[pos.x][pos.y]); if (depth < depthPrev) { - atomicStore(&occlusion.locks[pos.x][pos.y], index); + atomicStore(&occlusion.locks[pos.x][pos.y], index + 1); } diff --git a/prismarine-viewer/examples/CubeSort.comp.wgsl b/prismarine-viewer/examples/CubeSort.comp.wgsl index aa86dadb3..510ea01e9 100644 --- a/prismarine-viewer/examples/CubeSort.comp.wgsl +++ b/prismarine-viewer/examples/CubeSort.comp.wgsl @@ -33,6 +33,6 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { if (occlusionData != 0) { let visibleIndex = atomicAdd(&drawParams.instanceCount, 1); - visibleCubes[visibleIndex].ptr = occlusionData; + visibleCubes[visibleIndex].ptr = occlusionData - 1; } }