This commit is contained in:
mcrcortex
2024-09-16 15:08:48 +10:00
parent 1c0e0cc666
commit d5045731ad
10 changed files with 117 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
layout(binding = NODE_DATA_INDEX, std430) restrict buffer NodeData {
layout(binding = NODE_DATA_BINDING, std430) restrict buffer NodeData {
//Needs to be read and writeable for marking data,
//(could do an evil violation, make this readonly, then have a writeonly varient, which means that writing might not be visible but will show up by the next frame)
//Nodes are 16 bytes big (or 32 cant decide, 16 might _just_ be enough)
@@ -84,9 +84,10 @@ uint getChildPtr(in UnpackedNode node) {
return node.childPtr;
}
/*
uint getTransformIndex(in UnpackedNode node) {
return (node.flags >> 5)&31u;
}
}*/
//-----------------------------------

View File

@@ -48,3 +48,10 @@ void pushNode(uint nodeId) {
#endif
nodeQueueSink[nodePushIndex++] = nodeId;
}
#define SIMPLE_QUEUE(name, binding) layout(binding = binding, std430) restrict buffer name##Struct { \
uint name##Index; \
uint[] name; \
};

View File

@@ -12,7 +12,7 @@
// substantually for performance (for both persistent threads and incremental)
layout(binding = HIZ_BINDING_INDEX) uniform sampler2DShadow hizDepthSampler;
layout(binding = HIZ_BINDING) uniform sampler2DShadow hizDepthSampler;
//TODO: maybe do spher bounds aswell? cause they have different accuracies but are both over estimates (liberals (non conservative xD))
// so can do &&
@@ -27,9 +27,10 @@ vec2 size;
void setupScreenspace(in UnpackedNode node) {
//TODO: Need to do aabb size for the nodes, it must be an overesimate of all the children
Transform transform = transforms[getTransformIndex(node)];
/*
Transform transform = transforms[getTransformIndex(node)];
vec3 point = VP*(((transform.transform*vec4((node.pos<<node.lodLevel) - transform.originPos.xyz, 1))
+ (transform.worldPos.xyz-camChunkPos))-camSubChunk);
*/

View File

@@ -4,11 +4,29 @@
#define LOCAL_SIZE_MSK ((1<<LOCAL_SIZE_BITS)-1)
#define LOCAL_SIZE (1<<LOCAL_SIZE_BITS)
layout(local_size_x=LOCAL_SIZE) in;//, local_size_y=1
#import <voxy:lod/hierarchical/queue.glsl>
#import <voxy:lod/hierarchical/node.glsl>
#import <voxy:lod/hierarchical/screenspace.glsl>
SIMPLE_QUEUE(requestQueue, REQUEST_QUEUE_BINDING);
SIMPLE_QUEUE(renderQueue, RENDER_QUEUE_BINDING);
/*
layout(binding = REQUEST_QUEUE_INDEX, std430) restrict buffer RequestQueue {
uint requestQueueIndex;
uint[] requestQueue;
};
layout(binding = RENDER_QUEUE_INDEX, std430) restrict buffer RenderQueue {
uint renderQueueIndex;
uint[] renderQueue;
};*/
void main() {
uint node = getCurrentNode();
if (node != SENTINAL_OUT_OF_BOUNDS && queueIdx != 4) {
if (node != SENTINAL_OUT_OF_BOUNDS) {
printf("GID:%d, NODE %d, %d, AA, %d, %d, %d, %d", gl_GlobalInvocationID.x, node, queueIdx, nodeQueueMetadata[queueIdx].x, nodeQueueMetadata[queueIdx].y, nodeQueueMetadata[queueIdx].z, nodeQueueMetadata[queueIdx].w);
pushNodesInit(1);
pushNode(node);