notes and tweeks

This commit is contained in:
mcrcortex
2025-05-06 20:33:21 +10:00
parent 7a4e01faab
commit 6087dba91b
7 changed files with 27 additions and 9 deletions

View File

@@ -415,6 +415,10 @@ public class ModelFactory {
}
metadata |= fullyOpaque?(1L<<(48+6)):0;
boolean canBeCorrectlyRendered = true;//This represents if a model can be correctly (perfectly) represented
// i.e. no gaps
this.metadataCache[modelId] = metadata;
uploadPtr += 4*6;
@@ -629,6 +633,10 @@ public class ModelFactory {
return res;
}
public int[] _unsafeRawAccess() {
return this.idMappings;
}
public int getModelId(int blockId) {
int map = this.idMappings[blockId];
if (map == -1) {

View File

@@ -282,7 +282,7 @@ public class HierarchicalOcclusionTraverser {
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, NODE_QUEUE_SINK_BINDING, this.scratchQueueB.id);
//Dont need to use indirect to dispatch the first iteration
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT|GL_COMMAND_BARRIER_BIT);
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT|GL_COMMAND_BARRIER_BIT|GL_BUFFER_UPDATE_BARRIER_BIT);
glDispatchCompute(firstDispatchSize, 1,1);
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT|GL_COMMAND_BARRIER_BIT);

View File

@@ -80,7 +80,7 @@ public class UploadStream {
public void commit() {
glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT);
glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT|GL_BUFFER_UPDATE_BARRIER_BIT);
//Execute all the copies
for (var entry : this.uploadList) {
glCopyNamedBufferSubData(this.uploadBuffer.id, entry.target.id, entry.uploadOffset, entry.targetOffset, entry.size);

View File

@@ -12,14 +12,17 @@ import static org.lwjgl.util.zstd.Zstd.*;
public class ZSTDCompressor implements StorageCompressor {
private static final Cleaner CLEANER = Cleaner.create();
private record Ref(long ptr) {}
private static Ref createCleanableCompressionContext() {
long ctx = ZSTD_createCCtx();
var ref = new Ref(ctx);
CLEANER.register(ref, ()->ZSTD_freeCCtx(ctx));
return ref;
}
private static Ref createCleanableDecompressionContext() {
long ctx = ZSTD_createDCtx();
nZSTD_DCtx_setParameter(ctx, ZSTD_d_experimentalParam3, 1);//experimental ZSTD_d_forceIgnoreChecksum
var ref = new Ref(ctx);
CLEANER.register(ref, ()->ZSTD_freeDCtx(ctx));
return ref;

View File

@@ -27,6 +27,7 @@ void main() {
vec2 uv = mod(uv, vec2(1.0))*(1.0/(vec2(3.0,2.0)*256.0));
vec2 texPos = uv + baseUV;
//vec4 colour = solidColour;
//TODO: FIXME, need to manually compute the mip colour
vec4 colour = texture(blockModelAtlas, texPos, ((flags>>1)&1u)*-5.0);//TODO: FIXME mipping needs to be fixed so that it doesnt go cross model bounds
//Also, small quad is really fking over the mipping level somehow
if ((flags&1u) == 1 && colour.a <= 0.25f) {

View File

@@ -21,6 +21,8 @@ uint getCurrentNode() {
return nodeQueueSource[gl_GlobalInvocationID.x];
}
//TODO: limit the size/writing out of bounds
uint nodePushIndex = -1;
void pushNodesInit(uint nodeCount) {
//Debug

View File

@@ -78,14 +78,18 @@ void enqueueSelfForRender(in UnpackedNode node) {
if (renderQueueIndex < renderQueueMaxSize) {
lastRenderFrame[getId(node)] = frameId;
if (!isEmptyMesh(node)) {
renderQueue[atomicAdd(renderQueueIndex, 1)] = getMesh(node);
#ifdef IS_DEBUG
debugRenderNodeQueue[atomicAdd(debugRenderNodeQueueIndex, 1)] = node.nodeId;
#endif
uint renderIndex = atomicAdd(renderQueueIndex, 1);
if (renderIndex < renderQueueMaxSize) {
renderQueue[renderIndex] = getMesh(node);
#ifdef HAS_STATISTICS
atomicAdd(renderCounts[node.lodLevel], 1);
#endif
#ifdef IS_DEBUG
debugRenderNodeQueue[atomicAdd(debugRenderNodeQueueIndex, 1)] = node.nodeId;
#endif
#ifdef HAS_STATISTICS
atomicAdd(renderCounts[node.lodLevel], 1);
#endif
}
}
}
}