Skip to content

Commit f9d1d99

Browse files
committed
Attempt to fix some woopsies
1 parent efda204 commit f9d1d99

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/main/java/me/cortex/voxy/client/core/rendering/section/MDICSectionRenderer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ public class MDICSectionRenderer extends AbstractSectionRenderer<MDICViewport, B
8080

8181
.compile();
8282

83-
private final GlBuffer uniform = new GlBuffer(1024).zero();
83+
private final GlBuffer uniform = new GlBuffer(1024).zero();//TODO move to viewport?
8484

8585
//TODO: needs to be in the viewport, since it contains the compute indirect call/values
86-
private final GlBuffer distanceCountBuffer = new GlBuffer(1024*4+100_000*4).zero();
86+
private final GlBuffer distanceCountBuffer = new GlBuffer(1024*4+100_000*4).zero();//TODO move to viewport?
8787

8888
//Statistics
8989
private final GlBuffer statisticsBuffer = new GlBuffer(1024).zero();

src/main/resources/assets/voxy/shaders/lod/gl46/buildtranslucents.comp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ layout(binding = TRANSLUCENT_DISTANCE_BUFFER_BINDING, std430) restrict buffer Tr
2323
uint[] translucentCommandData;
2424
};
2525

26-
//Note: if i want reverse indexing i need to use the index buffer offset to offset
2726
void writeCmd(uint idx, uint instance, uint offset, uint quadCount) {
2827
DrawCommand cmd;
2928
cmd.count = quadCount * 6;
@@ -44,7 +43,8 @@ void main() {
4443

4544
uvec3 rel = abs(extractPosition(meta)-(baseSectionPos>>detail));
4645
uint dist = (rel.x+rel.y+rel.z)<<detail;
47-
dist = TRANSLUCENT_WRITE_BASE-min(dist, TRANSLUCENT_WRITE_BASE);
46+
//The -1 is because we want 0 to TRANSLUCENT_WRITE_BASE, exclusive of ending, not inclusive (0->1023)
47+
dist = (TRANSLUCENT_WRITE_BASE-1)-min(dist, (TRANSLUCENT_WRITE_BASE-1));
4848

4949
uint drawPtr = atomicAdd(translucentCommandData[dist],1)+TRANSLUCENT_OFFSET;
5050
writeCmd(drawPtr, drawId, extractQuadStart(meta), meta.cntA&0xFFFF);

src/main/resources/assets/voxy/shaders/lod/gl46/cmdgen.comp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ void main() {
113113
translucentCommandData[tp] = drawId;
114114
uvec3 absRel = abs(relative);
115115
uint distToCamera = (absRel.x+absRel.y+absRel.z)<<detail;
116-
distToCamera = TRANSLUCENT_WRITE_BASE-min(distToCamera, TRANSLUCENT_WRITE_BASE);
116+
//The -1 is because we want 0 to TRANSLUCENT_WRITE_BASE, exclusive of ending, not inclusive (0->1023)
117+
distToCamera = (TRANSLUCENT_WRITE_BASE-1)-min(distToCamera, (TRANSLUCENT_WRITE_BASE-1));
117118
atomicAdd(translucentCommandData[distToCamera], 1);
118119
#ifdef HAS_STATISTICS
119120
totalQuads += count;

src/main/resources/assets/voxy/shaders/util/prefixsum/inital3.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void main() {
8787
memoryBarrierShared();
8888
barrier();
8989

90-
if (gl_SubgroupID == 0) {
90+
if (subgroupId == 0) {
9191
uint val = warpPrefixSum[gl_SubgroupInvocationID];
9292
subgroupBarrier();
9393
//Use warp to do entire add in 1 reduction

0 commit comments

Comments
 (0)