Small change

This commit is contained in:
mcrcortex
2024-07-11 19:55:19 +10:00
parent 1e855a0ed0
commit 6ba56a133e
3 changed files with 24 additions and 17 deletions

View File

@@ -2,6 +2,7 @@ package me.cortex.voxy.client.core.rendering.hierarchical;
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
import me.cortex.voxy.client.core.rendering.building.BuiltSection;
import me.cortex.voxy.client.core.rendering.util.DownloadStream;
import me.cortex.voxy.client.core.rendering.util.MarkedObjectList;
import me.cortex.voxy.common.util.HierarchicalBitSet;
import me.cortex.voxy.common.world.WorldEngine;
@@ -341,7 +342,16 @@ public class NodeManager2 {
private void pushNode(int node) {
}
public void nodeUpload() {
private void writeNode(long dst, int id) {
}
//2 parts upload and download
private void download() {
//Download the request queue then clear the counter (first 4 bytes)
DownloadStream.INSTANCE.download(this.);
}

View File

@@ -1,9 +1,8 @@
#define SCENE_UNIFORM_INDEX 0
#define NODE_DATA_INDEX 1
#define ATOMIC_DATA_INDEX 2
#define REQUEST_QUEUE_INDEX 3
#define RENDER_QUEUE_INDEX 4
#define TRANSFORM_ARRAY_INDEX 5
#define REQUEST_QUEUE_INDEX 2
#define RENDER_QUEUE_INDEX 3
#define TRANSFORM_ARRAY_INDEX 4
//Samplers
#define HIZ_BINDING_INDEX 0

View File

@@ -21,21 +21,17 @@ layout(binding = SCENE_UNIFORM_INDEX, std140) uniform SceneUniform {
uint screenW;
vec3 camSubSecPos;
uint screenH;
uint requestQueueMaxSize;
uint renderQueueMaxSize;
};
layout(binding = ATOMIC_DATA_INDEX, std430) restrict buffer Atomics {
layout(binding = REQUEST_QUEUE_INDEX, std430) restrict buffer RequestQueue {
uint requestQueueIndex;
uint requestQueueMaxSize;
uint renderQueueIndex;
uint renderQueueMaxSize;
} atomics;
layout(binding = REQUEST_QUEUE_INDEX, std430) restrict writeonly buffer RequestQueue {
uint[] requestQueue;
};
layout(binding = RENDER_QUEUE_INDEX, std430) restrict writeonly buffer RenderQueue {
layout(binding = RENDER_QUEUE_INDEX, std430) restrict buffer RenderQueue {
uint renderQueueIndex;
uint[] renderQueue;
};
@@ -77,9 +73,9 @@ layout(binding = 2, std430) restrict buffer QueueData {
void addRequest(inout UnpackedNode node) {
if (!hasRequested(node)) {
//TODO: maybe try using only 1 variable and it being <0 being bad
if (atomics.requestQueueIndex < atomics.requestQueueMaxSize) {
if (requestQueueIndex < requestQueueMaxSize) {
//Mark node as having a request submitted to prevent duplicate submissions
requestQueue[atomicAdd(atomics.requestQueueIndex, 1)] = getId(node);
requestQueue[atomicAdd(requestQueueIndex, 1)] = getId(node);
markRequested(node);
}
}
@@ -90,7 +86,9 @@ void enqueueChildren(in UnpackedNode node) {
}
void enqueueSelfForRender(in UnpackedNode node) {
renderQueue[atomicAdd(atomics.renderQueueIndex, 1)] = getMesh(node);
if (renderQueueIndex < renderQueueMaxSize) {
renderQueue[atomicAdd(renderQueueIndex, 1)] = getMesh(node);
}
}
//TODO: need to add an empty mesh, as a parent node might not have anything to render but the children do??