Dumb slang...
This commit is contained in:
@@ -134,6 +134,9 @@ public interface IVoxelHit<let N : uint32_t>
|
||||
public bool shouldHit(VoxelCacheParameters<N> parameters, uint32_t node_index, uint32_t child_index);
|
||||
}
|
||||
|
||||
static const uint32_t WG_COUNT = 256;
|
||||
groupshared uint32_t stack[5 * WG_COUNT];
|
||||
|
||||
public struct VoxelCacheTracer<let N : int, H : IVoxelHit<N>> : IVoxelCache
|
||||
{
|
||||
typedef VoxelTraceStack GroupSharedData;
|
||||
@@ -144,7 +147,7 @@ public struct VoxelCacheTracer<let N : int, H : IVoxelHit<N>> : IVoxelCache
|
||||
public H voxel_hit;
|
||||
public VoxelCacheParameters<N> parameters;
|
||||
|
||||
public bool trace<L : ILodPolicy>(uint32_t root, inout VoxelTraceStack stack, Ray r, L lod, float offset_t, out Hit v)
|
||||
public bool trace<L : ILodPolicy>(uint32_t root, uint32_t thread_id, Ray r, L lod, float offset_t, out Hit v)
|
||||
{
|
||||
// Ray mirroring
|
||||
r.origin += float3(1.);
|
||||
@@ -174,7 +177,7 @@ public struct VoxelCacheTracer<let N : int, H : IVoxelHit<N>> : IVoxelCache
|
||||
{
|
||||
this.parameters.usage_buffer[current_node_index] = this.frame_timestamp;
|
||||
}
|
||||
stack.stack[10 - scale_exp / 2] = current_node_index;
|
||||
stack[thread_id + WG_COUNT * (10 - scale_exp / 2)] = current_node_index;
|
||||
|
||||
[loop]
|
||||
for (uint32_t iter = 0; iter < 500; iter++)
|
||||
@@ -186,7 +189,7 @@ public struct VoxelCacheTracer<let N : int, H : IVoxelHit<N>> : IVoxelCache
|
||||
{
|
||||
scale_exp -= 2;
|
||||
current_node_index = current_node.pointer();
|
||||
stack.stack[10 - scale_exp / 2] = current_node_index;
|
||||
stack[thread_id + WG_COUNT * (10 - scale_exp / 2)] = current_node_index;
|
||||
child_index = get_children_index(pos, scale_exp) ^ child_mirror;
|
||||
current_node = this.parameters.structure_pool[current_node_index].pointers[child_index];
|
||||
// Write usage
|
||||
@@ -254,7 +257,7 @@ public struct VoxelCacheTracer<let N : int, H : IVoxelHit<N>> : IVoxelCache
|
||||
}
|
||||
|
||||
scale_exp = 23 - common_depth;
|
||||
current_node_index = stack.stack[10 - scale_exp / 2];
|
||||
current_node_index = stack[thread_id + WG_COUNT * (10 - scale_exp / 2)];
|
||||
}
|
||||
|
||||
v.hit = false;
|
||||
|
||||
Reference in New Issue
Block a user