Fixed intel

This commit is contained in:
mcrcortex
2024-02-17 15:41:26 +10:00
parent a50b115068
commit 56997ee80a
4 changed files with 18 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
import me.cortex.voxy.client.core.gl.GlBuffer;
import me.cortex.voxy.client.core.gl.shader.Shader;
import me.cortex.voxy.client.core.gl.shader.ShaderType;
import me.cortex.voxy.client.core.rendering.util.DownloadStream;
import me.cortex.voxy.client.core.rendering.util.UploadStream;
import me.cortex.voxy.client.mixin.joml.AccessFrustumIntersection;
import net.minecraft.block.Blocks;
@@ -138,16 +139,26 @@ public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer {
glClearNamedBufferData(this.glCommandCountBuffer.id, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, new int[1]);
this.commandGen.bind();
glDispatchCompute((this.geometry.getSectionCount() + 127) / 128, 1, 1);
glDispatchCompute((this.geometry.getSectionCount()+127)/128, 1, 1);
glMemoryBarrier(GL_COMMAND_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT | GL_UNIFORM_BARRIER_BIT);
this.lodShader.bind();
glDisable(GL_CULL_FACE);
//glPointSize(10);
glMultiDrawElementsIndirectCountARB(GL_TRIANGLES, GL_UNSIGNED_SHORT, 0, 0, (int) (this.geometry.getSectionCount()*4.4), 0);
//glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT, 0, (int) (this.geometry.getSectionCount()*4.4), 0);
//glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT, 0, 100, 0);
glEnable(GL_CULL_FACE);
/*
glFinish();
DownloadStream.INSTANCE.download(this.glCommandCountBuffer, 0, 4, (ptr, siz) -> {
int cnt = MemoryUtil.memGetInt(ptr);
System.out.println(cnt);
});
DownloadStream.INSTANCE.commit();
DownloadStream.INSTANCE.tick();
*/
glMemoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT);
this.cullShader.bind();

View File

@@ -81,7 +81,7 @@ public class DownloadStream {
public void commit() {
//Copies all the data from target buffers into the download stream
for (var entry : this.downloadList) {
glCopyNamedBufferSubData(entry.target.id, this.downloadBuffer.id, entry.downloadOffset, entry.targetOffset, entry.size);
glCopyNamedBufferSubData(entry.target.id, this.downloadBuffer.id, entry.targetOffset, entry.downloadStreamOffset, entry.size);
}
thisFrameDownloadList.addAll(this.downloadList);
this.downloadList.clear();
@@ -110,7 +110,7 @@ public class DownloadStream {
//Apply all the callbacks
for (var data : frame.data) {
data.resultConsumer.consume(this.downloadBuffer.addr() + data.downloadOffset, data.size);
data.resultConsumer.consume(this.downloadBuffer.addr() + data.downloadStreamOffset, data.size);
}
frame.allocations.forEach(this.allocationArena::free);
@@ -119,7 +119,7 @@ public class DownloadStream {
}
private record DownloadFrame(GlFence fence, LongArrayList allocations, ArrayList<DownloadData> data) {}
private record DownloadData(GlBuffer target, long downloadOffset, long targetOffset, long size, DownloadResultConsumer resultConsumer) {}
private record DownloadData(GlBuffer target, long downloadStreamOffset, long targetOffset, long size, DownloadResultConsumer resultConsumer) {}
// Global download stream

View File

@@ -1,7 +1,7 @@
#version 450
#extension GL_ARB_gpu_shader_int64 : enable
layout(local_size_x = 128, local_size_y = 1, local_size_x = 1) in;
layout(local_size_x = 128) in;
#import <voxy:lod/gl46/quad_format.glsl>
#import <voxy:lod/gl46/bindings.glsl>

View File

@@ -1,5 +1,5 @@
#version 450
layout(local_size_x = 32, local_size_y = 32, local_size_x = 1) in;
layout(local_size_x = 32, local_size_y = 32) in;
layout(binding = 0, rgba8) uniform restrict image2D colourTex;