mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-30 23:04:57 +01:00
Clear for debugging
- Nsight explodes with the scatter shader resetting the indirect dispatch buffer - Instead, issue a clear buffer and buffer update barrier
This commit is contained in:
parent
861009ed11
commit
0151364b8a
3 changed files with 8 additions and 8 deletions
|
@ -14,7 +14,7 @@ import java.util.EnumMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
import org.lwjgl.opengl.GL46;
|
||||
|
||||
import dev.engine_room.flywheel.api.instance.Instance;
|
||||
import dev.engine_room.flywheel.api.instance.InstanceType;
|
||||
|
@ -129,12 +129,7 @@ public class IndirectCullingGroup<I extends Instance> {
|
|||
|
||||
uploadDraws(stagingBuffer);
|
||||
|
||||
stagingBuffer.enqueueCopy(4 * Integer.BYTES, buffers.passTwoDispatch.handle(), 0, ptr -> {
|
||||
MemoryUtil.memPutInt(ptr, 0);
|
||||
MemoryUtil.memPutInt(ptr + 4, 1);
|
||||
MemoryUtil.memPutInt(ptr + 8, 1);
|
||||
MemoryUtil.memPutInt(ptr + 12, 0);
|
||||
});
|
||||
GL46.nglClearNamedBufferData(buffers.passTwoDispatch.handle(), GL46.GL_R32UI, GL46.GL_RED, GL46.GL_UNSIGNED_INT, 0);
|
||||
}
|
||||
|
||||
public void dispatchCull() {
|
||||
|
|
|
@ -107,7 +107,7 @@ public class IndirectDrawManager extends DrawManager<IndirectInstancer<?>> {
|
|||
matrixBuffer.bind();
|
||||
Uniforms.bindAll();
|
||||
|
||||
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);
|
||||
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT | GL_BUFFER_UPDATE_BARRIER_BIT);
|
||||
|
||||
visibilityBuffer.bind();
|
||||
|
||||
|
|
|
@ -112,6 +112,11 @@ void main() {
|
|||
if (targetIndex % 32u == 0u) {
|
||||
// This thread wrote an index that will be at the start of a new workgroup later
|
||||
atomicAdd(_flw_lateCullDispatch.x, 1);
|
||||
|
||||
if (targetIndex == 0) {
|
||||
_flw_lateCullDispatch.y = 1;
|
||||
_flw_lateCullDispatch.z = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue