Very strange mask bug
This commit is contained in:
@@ -60,7 +60,33 @@ static const uint32_t OCBT_depth_offset[18] = { 0, // Level 0
|
||||
0, // Level 18
|
||||
};
|
||||
|
||||
static const uint64_t OCBT_bit_mask[18] = { 0xffffffff, // Root 17
|
||||
|
||||
static const uint OCBT_bit_mask_high[18] = {
|
||||
0x0, // Root 17
|
||||
0x0, // Level 16
|
||||
0x0, // level 15
|
||||
0x0, // level 14
|
||||
0x0, // level 13
|
||||
0x0, // level 12
|
||||
0x0, // level 11
|
||||
|
||||
0x0, // level 10
|
||||
0x0, // level 9
|
||||
0x0, // level 8
|
||||
0x0, // level 8
|
||||
|
||||
0xffffffff, // level 7
|
||||
0x0, // Level 6
|
||||
0x0, // level 5
|
||||
0x0, // level 4
|
||||
0x0, // level 3
|
||||
0x0, // level 2
|
||||
0x0, // level 1
|
||||
};
|
||||
|
||||
|
||||
static const uint OCBT_bit_mask_low[18] = {
|
||||
0xffffffff, // Root 17
|
||||
0xffffffff, // Level 16
|
||||
0xffffffff, // level 15
|
||||
0xffffffff, // level 14
|
||||
@@ -73,7 +99,7 @@ static const uint64_t OCBT_bit_mask[18] = { 0xffffffff, // Root 17
|
||||
0xffff, // level 8
|
||||
0xff, // level 8
|
||||
|
||||
0xffffffffffffffff, // level 7
|
||||
0xffffffff, // level 7
|
||||
0xffffffff, // Level 6
|
||||
0xffff, // level 5
|
||||
0xff, // level 4
|
||||
@@ -172,14 +198,16 @@ uint get_heap_element(uint id, inout HeapDebug debug)
|
||||
{
|
||||
uint32_t slot = first_bit / 32;
|
||||
uint32_t local_id = first_bit % 32;
|
||||
uint32_t target_bits = (gs_cbtTree[slot] >> local_id) & uint32_t(OCBT_bit_mask[depth]);
|
||||
return (gs_cbtTree[slot] >> local_id) & uint32_t(OCBT_bit_mask[depth]);
|
||||
return (pParams.cbtBuffer[slot] >> local_id) & OCBT_bit_mask_low[depth];
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t slot = first_bit / 64;
|
||||
uint32_t local_id = first_bit % 64;
|
||||
uint64_t target_bits = (pParams.bitFieldBuffer[slot] >> local_id) & OCBT_bit_mask[depth];
|
||||
uint64_t mask = OCBT_bit_mask_high[depth];
|
||||
mask = (mask << 32) | OCBT_bit_mask_low[depth];
|
||||
uint64_t target_bits = (pParams.bitFieldBuffer[slot] >> local_id) & mask;
|
||||
debug.target_bits = target_bits;
|
||||
return countbits(uint(target_bits >> 32)) + countbits(uint(target_bits));
|
||||
}
|
||||
}
|
||||
@@ -198,8 +226,8 @@ void set_heap_element(uint id, uint value)
|
||||
uint local_id = first_bit % 32;
|
||||
|
||||
// Extract the relevant bits
|
||||
gs_cbtTree[slot] &= ~(uint32_t(OCBT_bit_mask[depth]) << local_id);
|
||||
gs_cbtTree[slot] |= ((uint32_t(OCBT_bit_mask[depth]) & value) << local_id);
|
||||
gs_cbtTree[slot] &= ~(uint32_t(OCBT_bit_mask_low[depth]) << local_id);
|
||||
gs_cbtTree[slot] |= ((uint32_t(OCBT_bit_mask_low[depth]) & value) << local_id);
|
||||
}
|
||||
|
||||
// Should not be called if depth > TREE_LAST_LEVEL
|
||||
@@ -216,8 +244,8 @@ void set_heap_element_atomic(uint id, uint value)
|
||||
uint local_id = first_bit % 32;
|
||||
|
||||
// Extract the relevant bits
|
||||
InterlockedAnd(gs_cbtTree[slot], ~(uint32_t(OCBT_bit_mask[depth]) << local_id));
|
||||
InterlockedOr(gs_cbtTree[slot], ((uint32_t(OCBT_bit_mask[depth]) & value) << local_id));
|
||||
InterlockedAnd(gs_cbtTree[slot], ~(uint32_t(OCBT_bit_mask_low[depth]) << local_id));
|
||||
InterlockedOr(gs_cbtTree[slot], ((uint32_t(OCBT_bit_mask_low[depth]) & value) << local_id));
|
||||
}
|
||||
|
||||
// Function that returns the number of active bits
|
||||
@@ -233,37 +261,49 @@ uint bit_count(uint depth, uint element)
|
||||
}
|
||||
|
||||
// decodes the position of the i-th zero in the bitfield
|
||||
uint decode_bit_complement(uint handle, uint dispatchID)
|
||||
uint decode_bit_complement(uint handle, inout DebugStruct debug)
|
||||
{
|
||||
uint temp = handle;
|
||||
DebugStruct debug;
|
||||
uint x = 0;
|
||||
uint bitID = 1u;
|
||||
uint c = OCBT_NUM_ELEMENTS / 2u;
|
||||
|
||||
while (bitID < OCBT_NUM_ELEMENTS) {
|
||||
uint heapValue = c - get_heap_element(2u * bitID, debug.heapValues[x++]);
|
||||
uint b = handle < heapValue ? 0u : 1u;
|
||||
|
||||
bitID = 2u * bitID + b;
|
||||
handle -= heapValue * b;
|
||||
uint b2 = 2u * bitID;
|
||||
uint h = get_heap_element(b2, debug.heapValues[x]);
|
||||
uint heapValue = c - h;
|
||||
uint b;
|
||||
if(handle < heapValue)
|
||||
{
|
||||
b = 0u;
|
||||
}
|
||||
else
|
||||
{
|
||||
b = 1u;
|
||||
}
|
||||
debug.heapValues[x].handle = handle;
|
||||
debug.heapValues[x].heapValue = heapValue;
|
||||
debug.heapValues[x].c = c;
|
||||
debug.heapValues[x].h = h;
|
||||
x++;
|
||||
bitID = b2 + b;
|
||||
uint t = heapValue * b;
|
||||
handle = handle - t;
|
||||
c /= 2u;
|
||||
}
|
||||
|
||||
uint result = (bitID ^ OCBT_NUM_ELEMENTS);
|
||||
handle = temp;
|
||||
for(uint i = 0; i < OCBT_NUM_ELEMENTS; ++i)
|
||||
{
|
||||
if(get_bit(i) == 0)
|
||||
{
|
||||
if(handle == 0)
|
||||
{
|
||||
pParams.debugBuffer[dispatchID] = debug;
|
||||
return i;
|
||||
}
|
||||
handle--;
|
||||
}
|
||||
}
|
||||
return (bitID ^ OCBT_NUM_ELEMENTS);
|
||||
//handle = temp;
|
||||
//for(uint i = 0; i < OCBT_NUM_ELEMENTS; ++i)
|
||||
//{
|
||||
// if(get_bit(i) == 0)
|
||||
// {
|
||||
// if(handle == 0)
|
||||
// {
|
||||
// return i;
|
||||
// }
|
||||
// handle--;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
void reduce(uint groupIndex)
|
||||
|
||||
@@ -10,46 +10,48 @@ void Reset()
|
||||
ResetBuffers();
|
||||
}
|
||||
|
||||
[numthreads(WORKGROUP_SIZE, 1, 1)]
|
||||
[numthreads(1, 1, 1)]
|
||||
void Classify(uint dispatchID : SV_DispatchThreadID)
|
||||
{
|
||||
//if(dispatchID > 0)
|
||||
// This thread doesn't have any work to do, we're done
|
||||
//if (dispatchID >= pParams.indirectDrawBuffer[9])
|
||||
// return;
|
||||
//for(uint i = 0; i < pParams.indirectDrawBuffer[9]; ++i)
|
||||
//{
|
||||
// This thread doesn't have any work to do, we're done
|
||||
if (dispatchID >= pParams.indirectDrawBuffer[9])
|
||||
if(dispatchID > 0)
|
||||
return;
|
||||
for(dispatchID = 0; dispatchID < pParams.indirectDrawBuffer[9]; ++dispatchID)
|
||||
{
|
||||
|
||||
// Operate the indirection
|
||||
uint currentID = pParams.indexedBisectorBuffer[dispatchID];
|
||||
// Operate the indirection
|
||||
uint currentID = pParams.indexedBisectorBuffer[dispatchID];
|
||||
|
||||
// Read the current geometry data
|
||||
BisectorGeometry bis;
|
||||
bis.p[0] = pParams.currentVertexBuffer[3 * currentID].xyz;
|
||||
bis.p[1] = pParams.currentVertexBuffer[3 * currentID + 1].xyz;
|
||||
bis.p[2] = pParams.currentVertexBuffer[3 * currentID + 2].xyz;
|
||||
bis.p[3] = pParams.currentVertexBuffer[3 * pParams.geometry.totalNumElements + currentID].xyz;
|
||||
// Read the current geometry data
|
||||
BisectorGeometry bis;
|
||||
bis.p[0] = pParams.currentVertexBuffer[3 * currentID].xyz;
|
||||
bis.p[1] = pParams.currentVertexBuffer[3 * currentID + 1].xyz;
|
||||
bis.p[2] = pParams.currentVertexBuffer[3 * currentID + 2].xyz;
|
||||
bis.p[3] = pParams.currentVertexBuffer[3 * pParams.geometry.totalNumElements + currentID].xyz;
|
||||
|
||||
// Classify the element
|
||||
ClassifyElement(currentID, bis, pParams.geometry.totalNumElements, pParams.geometry.baseDepth);
|
||||
// Classify the element
|
||||
ClassifyElement(currentID, bis, pParams.geometry.totalNumElements, pParams.geometry.baseDepth);
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(WORKGROUP_SIZE, 1, 1)]
|
||||
[numthreads(1, 1, 1)]
|
||||
void Split(uint dispatchID : SV_DispatchThreadID)
|
||||
{
|
||||
//if(dispatchID > 0)
|
||||
//if (dispatchID >= pParams.classificationBuffer[SPLIT_COUNTER])
|
||||
// return;
|
||||
//for(dispatchID = 0; dispatchID < pParams.classificationBuffer[SPLIT_COUNTER]; ++dispatchID)
|
||||
//{
|
||||
if (dispatchID >= pParams.classificationBuffer[SPLIT_COUNTER])
|
||||
if(dispatchID > 0)
|
||||
return;
|
||||
for(dispatchID = 0; dispatchID < pParams.classificationBuffer[SPLIT_COUNTER]; ++dispatchID)
|
||||
{
|
||||
// Grab the real elementID
|
||||
uint currentID = pParams.classificationBuffer[CLASSIFY_COUNTER_OFFSET + dispatchID];
|
||||
|
||||
// Grab the real elementID
|
||||
uint currentID = pParams.classificationBuffer[CLASSIFY_COUNTER_OFFSET + dispatchID];
|
||||
// Split the element
|
||||
SplitElement(currentID, pParams.geometry.baseDepth);
|
||||
}
|
||||
|
||||
// Split the element
|
||||
SplitElement(currentID, pParams.geometry.baseDepth);
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
@@ -60,102 +62,102 @@ void PrepareIndirect(uint currentID : SV_DispatchThreadID)
|
||||
pParams.indirectDispatchBuffer[currentID * 3 + 2] = 1;
|
||||
}
|
||||
|
||||
[numthreads(WORKGROUP_SIZE, 1, 1)]
|
||||
[numthreads(1, 1, 1)]
|
||||
void Allocate(uint groupIndex : SV_GroupIndex, uint dispatchID : SV_DispatchThreadID)
|
||||
{
|
||||
//if(dispatchID > 0)
|
||||
// return;
|
||||
//
|
||||
//for(uint i = 0; i < 64; ++i)
|
||||
//{
|
||||
if(dispatchID > 0)
|
||||
return;
|
||||
|
||||
for(uint i = 0; i < 64; ++i)
|
||||
{
|
||||
// Load the CBT to the LDS
|
||||
load_buffer_to_shared_memory(groupIndex);
|
||||
|
||||
load_buffer_to_shared_memory(groupIndex);
|
||||
}
|
||||
|
||||
// If this element doesn't need to be processed, we're done
|
||||
if (dispatchID >= pParams.allocateBuffer[0])
|
||||
return;
|
||||
//for(uint i = 0; i < pParams.allocateBuffer[0]; ++i)
|
||||
//{
|
||||
for(dispatchID = 0; dispatchID < pParams.allocateBuffer[0]; ++dispatchID)
|
||||
{
|
||||
// Allocate the required bits
|
||||
AllocateElement(pParams.allocateBuffer[1 + dispatchID], dispatchID);
|
||||
//}
|
||||
AllocateElement(pParams.allocateBuffer[1 + dispatchID], dispatchID);
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(WORKGROUP_SIZE, 1, 1)]
|
||||
[numthreads(1, 1, 1)]
|
||||
void Bisect(uint groupIndex : SV_GroupIndex, uint dispatchID : SV_DispatchThreadID)
|
||||
{
|
||||
//if(dispatchID > 0)
|
||||
// return;
|
||||
// If this element doesn't need to be processed, we're done
|
||||
if (dispatchID >= pParams.allocateBuffer[0])
|
||||
//if (dispatchID >= pParams.allocateBuffer[0])
|
||||
// return;
|
||||
if(dispatchID > 0)
|
||||
return;
|
||||
//for(uint i = 0; i < pParams.allocateBuffer[0]; ++i)
|
||||
//{
|
||||
for(dispatchID = 0; dispatchID < pParams.allocateBuffer[0]; ++dispatchID)
|
||||
{
|
||||
// Operation the bisection of this element
|
||||
BisectElement(pParams.allocateBuffer[1 + dispatchID]);
|
||||
//}
|
||||
BisectElement(pParams.allocateBuffer[1 + dispatchID]);
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(WORKGROUP_SIZE, 1, 1)]
|
||||
[numthreads(1, 1, 1)]
|
||||
void PropagateBisect(uint dispatchID : SV_DispatchThreadID)
|
||||
{
|
||||
//if(dispatchID > 0)
|
||||
// return;
|
||||
// If this element doesn't need to be processed, we're done
|
||||
if (dispatchID >= pParams.propagateBuffer[0])
|
||||
//if (dispatchID >= pParams.propagateBuffer[0])
|
||||
// return;
|
||||
if(dispatchID > 0)
|
||||
return;
|
||||
//for(uint i = 0; i < pParams.propagateBuffer[0]; ++i)
|
||||
//{
|
||||
PropagateBisectElement(pParams.propagateBuffer[2 + dispatchID]);
|
||||
//}
|
||||
for(dispatchID = 0; dispatchID < pParams.propagateBuffer[0]; ++dispatchID)
|
||||
{
|
||||
PropagateBisectElement(pParams.propagateBuffer[2 + dispatchID]);
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(WORKGROUP_SIZE, 1, 1)]
|
||||
[numthreads(1, 1, 1)]
|
||||
void PrepareSimplify(uint dispatchID : SV_DispatchThreadID)
|
||||
{
|
||||
//if(dispatchID > 0)
|
||||
// return;
|
||||
// If this element doesn't need to be processed, we're done
|
||||
if (dispatchID >= pParams.classificationBuffer[SIMPLIFY_COUNTER])
|
||||
return;
|
||||
//for(uint i = 0; i < pParams.classificationBuffer[SIMPLIFY_COUNTER]; ++i)
|
||||
//{
|
||||
// Grab the real elementID
|
||||
uint currentID = pParams.classificationBuffer[CLASSIFY_COUNTER_OFFSET + pParams.geometry.totalNumElements + dispatchID];
|
||||
if(dispatchID > 0)
|
||||
return;
|
||||
for(dispatchID = 0; dispatchID < pParams.classificationBuffer[SIMPLIFY_COUNTER]; ++dispatchID)
|
||||
{
|
||||
// Grab the real elementID
|
||||
uint currentID = pParams.classificationBuffer[CLASSIFY_COUNTER_OFFSET + pParams.geometry.totalNumElements + dispatchID];
|
||||
|
||||
// Simplify an element
|
||||
PrepareSimplifyElement(currentID);
|
||||
//}
|
||||
// Simplify an element
|
||||
PrepareSimplifyElement(currentID);
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(WORKGROUP_SIZE, 1, 1)]
|
||||
[numthreads(1, 1, 1)]
|
||||
void Simplify(uint dispatchID : SV_DispatchThreadID)
|
||||
{
|
||||
//if(dispatchID > 0)
|
||||
// return;
|
||||
// This thread doesn't have any work to do, we're done
|
||||
if (dispatchID >= pParams.simplifyBuffer[0])
|
||||
return;
|
||||
//for(uint i = 0; i < pParams.simplifyBuffer[0]; ++i)
|
||||
//{
|
||||
// Simplify an element
|
||||
SimplifyElement(pParams.simplifyBuffer[1 + dispatchID]);
|
||||
//}
|
||||
if(dispatchID > 0)
|
||||
return;
|
||||
for(dispatchID = 0; dispatchID < pParams.simplifyBuffer[0]; ++dispatchID)
|
||||
{
|
||||
// Simplify an element
|
||||
SimplifyElement(pParams.simplifyBuffer[1 + dispatchID]);
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(WORKGROUP_SIZE, 1, 1)]
|
||||
[numthreads(1, 1, 1)]
|
||||
void PropagateSimplify(uint dispatchID : SV_DispatchThreadID)
|
||||
{
|
||||
//if(dispatchID > 0)
|
||||
// return;
|
||||
// If this element doesn't need to be processed, we're done
|
||||
if (dispatchID >= pParams.propagateBuffer[1])
|
||||
return;
|
||||
//for(uint i = 0; i < pParams.propagateBuffer[1]; ++i)
|
||||
//{
|
||||
PropagateElementSimplify(pParams.propagateBuffer[2 + dispatchID]);
|
||||
//}
|
||||
if(dispatchID > 0)
|
||||
return;
|
||||
for(dispatchID = 0; dispatchID < pParams.propagateBuffer[1]; ++dispatchID)
|
||||
{
|
||||
PropagateElementSimplify(pParams.propagateBuffer[2 + dispatchID]);
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(WORKGROUP_SIZE, 1, 1)]
|
||||
@@ -178,20 +180,20 @@ void ReduceSecondPass(uint groupIndex : SV_GroupIndex)
|
||||
reduce_second_pass(groupIndex);
|
||||
}
|
||||
|
||||
[numthreads(WORKGROUP_SIZE, 1, 1)]
|
||||
[numthreads(1, 1, 1)]
|
||||
void BisectorIndexation(uint currentID : SV_DispatchThreadID)
|
||||
{
|
||||
//if(currentID > 0)
|
||||
// return;
|
||||
// This thread doesn't have any work to do, we're done
|
||||
if (currentID >= pParams.geometry.totalNumElements)
|
||||
//if (currentID >= pParams.geometry.totalNumElements)
|
||||
// return;
|
||||
if(currentID > 0)
|
||||
return;
|
||||
|
||||
//for(uint i = 0; i < pParams.geometry.totalNumElements; ++i)
|
||||
//{
|
||||
// Indexate this bisector
|
||||
BisectorElementIndexation(currentID);
|
||||
//}
|
||||
|
||||
for(currentID = 0; currentID < pParams.geometry.totalNumElements; ++currentID)
|
||||
{
|
||||
// Indexate this bisector
|
||||
BisectorElementIndexation(currentID);
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
|
||||
@@ -1,455 +1,25 @@
|
||||
#version 450
|
||||
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require
|
||||
#extension GL_KHR_memory_scope_semantics : require
|
||||
layout(row_major) uniform;
|
||||
layout(row_major) buffer;
|
||||
|
||||
#line 178 0
|
||||
layout(std430, binding = 2) buffer StructuredBuffer_uint_t_0 {
|
||||
uint _data[];
|
||||
} pParams_classificationBuffer_0;
|
||||
|
||||
#line 178
|
||||
layout(std430, binding = 9) buffer StructuredBuffer_uint_t_1 {
|
||||
uint _data[];
|
||||
} pParams_cbtBuffer_0;
|
||||
|
||||
#line 63
|
||||
layout(std430, binding = 10) buffer StructuredBuffer_uint64_t_0 {
|
||||
#line 35 0
|
||||
layout(std430, binding = 0) buffer StructuredBuffer_uint64_t_0 {
|
||||
uint64_t _data[];
|
||||
} pParams_bitFieldBuffer_0;
|
||||
|
||||
#line 119
|
||||
const uint64_t OCBT_bit_mask_0[18] = { 18446744073709551615UL, 18446744073709551615UL, 18446744073709551615UL, 18446744073709551615UL, 18446744073709551615UL, 18446744073709551615UL, 18446744073709551615UL, 65535UL, 65535UL, 65535UL, 255UL, 18446744073709551615UL, 18446744073709551615UL, 65535UL, 255UL, 15UL, 3UL, 1UL };
|
||||
#line 8
|
||||
const uint OCBT_bit_mask_0[18] = { 4294967295U, 4294967295U, 4294967295U, 4294967295U, 4294967295U, 4294967295U, 4294967295U, 65535U, 65535U, 65535U, 255U, 4294967295U, 4294967295U, 65535U, 255U, 15U, 3U, 1U };
|
||||
|
||||
#line 141
|
||||
const uint OCBT_bit_count_0[18] = { 32U, 32U, 32U, 32U, 32U, 32U, 32U, 16U, 16U, 16U, 8U, 64U, 32U, 16U, 8U, 4U, 2U, 1U };
|
||||
|
||||
#line 97
|
||||
const uint OCBT_depth_offset_0[18] = { 0U, 32U, 96U, 224U, 480U, 992U, 2016U, 4064U, 6112U, 10208U, 18400U, 0U, 0U, 0U, 0U, 0U, 0U, 0U };
|
||||
|
||||
#line 163
|
||||
shared uint gs_cbtTree_0[831];
|
||||
|
||||
|
||||
#line 171
|
||||
void load_buffer_to_shared_memory_0(uint groupIndex_0)
|
||||
{
|
||||
|
||||
#line 171
|
||||
uint e_0 = 0U;
|
||||
|
||||
|
||||
for(;;)
|
||||
{
|
||||
|
||||
#line 174
|
||||
if(int(e_0) < 13)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#line 174
|
||||
break;
|
||||
}
|
||||
uint target_element_0 = uint(13 * int(groupIndex_0) + int(e_0));
|
||||
if(int(target_element_0) < 831)
|
||||
{
|
||||
|
||||
#line 178
|
||||
gs_cbtTree_0[target_element_0] = pParams_cbtBuffer_0._data[uint(target_element_0)];
|
||||
|
||||
#line 177
|
||||
}
|
||||
|
||||
#line 174
|
||||
e_0 = e_0 + 1U;
|
||||
|
||||
#line 174
|
||||
}
|
||||
|
||||
#line 180
|
||||
controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsShared, gl_SemanticsAcquireRelease);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#line 183
|
||||
uint get_heap_element_0(uint id_0)
|
||||
{
|
||||
|
||||
uint real_heap_id_0 = id_0 - 1U;
|
||||
uint depth_0 = uint(log2(float(real_heap_id_0 + 1U)));
|
||||
|
||||
|
||||
uint first_bit_0 = OCBT_depth_offset_0[depth_0] + OCBT_bit_count_0[depth_0] * (real_heap_id_0 - ((1U << depth_0) - 1U));
|
||||
if(depth_0 < 11U)
|
||||
{
|
||||
|
||||
|
||||
|
||||
return gs_cbtTree_0[first_bit_0 / 32U] >> first_bit_0 % 32U & uint(OCBT_bit_mask_0[depth_0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
uint64_t target_bits_0 = pParams_bitFieldBuffer_0._data[uint(first_bit_0 / 64U)] >> first_bit_0 % 64U & OCBT_bit_mask_0[depth_0];
|
||||
|
||||
|
||||
return bitCount(uint(target_bits_0 >> 32)) + bitCount(uint(target_bits_0));
|
||||
}
|
||||
|
||||
#line 205
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
uint decode_bit_0(uint handle_0)
|
||||
{
|
||||
|
||||
#line 210
|
||||
uint b_0;
|
||||
|
||||
#line 210
|
||||
uint heapElementID_0 = 1U;
|
||||
|
||||
#line 210
|
||||
uint currentDepth_0 = 0U;
|
||||
|
||||
#line 210
|
||||
uint bitCount_0 = handle_0;
|
||||
|
||||
#line 227
|
||||
for(;;)
|
||||
{
|
||||
|
||||
#line 227
|
||||
if(currentDepth_0 < 11U)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#line 227
|
||||
break;
|
||||
}
|
||||
|
||||
uint heapValue_0 = get_heap_element_0(2U * heapElementID_0);
|
||||
|
||||
|
||||
if(bitCount_0 < heapValue_0)
|
||||
{
|
||||
|
||||
#line 233
|
||||
b_0 = 0U;
|
||||
|
||||
#line 233
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#line 233
|
||||
b_0 = 1U;
|
||||
|
||||
#line 233
|
||||
}
|
||||
|
||||
|
||||
uint _S1 = 2U * heapElementID_0 + b_0;
|
||||
|
||||
|
||||
uint _S2 = bitCount_0 - heapValue_0 * b_0;
|
||||
|
||||
#line 227
|
||||
uint currentDepth_1 = currentDepth_0 + 1U;
|
||||
|
||||
#line 227
|
||||
heapElementID_0 = _S1;
|
||||
|
||||
#line 227
|
||||
currentDepth_0 = currentDepth_1;
|
||||
|
||||
#line 227
|
||||
bitCount_0 = _S2;
|
||||
|
||||
#line 227
|
||||
}
|
||||
|
||||
#line 243
|
||||
uint _S3 = currentDepth_0 + 1U;
|
||||
|
||||
|
||||
uint64_t _S4 = pParams_bitFieldBuffer_0._data[uint(int(heapElementID_0) - 2048)];
|
||||
|
||||
#line 210
|
||||
uint _S5 = bitCount_0;
|
||||
|
||||
#line 210
|
||||
uint64_t mask_0 = 18446744073709551615UL;
|
||||
|
||||
#line 210
|
||||
currentDepth_0 = _S3;
|
||||
|
||||
#line 210
|
||||
bitCount_0 = 32U;
|
||||
|
||||
#line 210
|
||||
uint _S6 = _S5;
|
||||
|
||||
#line 249
|
||||
for(;;)
|
||||
{
|
||||
|
||||
#line 249
|
||||
if(currentDepth_0 < uint(log2(1.31072e+05)) + 1U)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#line 249
|
||||
break;
|
||||
}
|
||||
|
||||
#line 257
|
||||
uint64_t target_bits_1 = _S4 >> bitCount_0 * (2U * heapElementID_0 - 1U - ((1U << currentDepth_0) - 1U)) % 64U & mask_0;
|
||||
uint heapValue_1 = bitCount(uint(target_bits_1 >> 32)) + bitCount(uint(target_bits_1));
|
||||
|
||||
|
||||
if(_S6 < heapValue_1)
|
||||
{
|
||||
|
||||
#line 261
|
||||
b_0 = 0U;
|
||||
|
||||
#line 261
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#line 261
|
||||
b_0 = 1U;
|
||||
|
||||
#line 261
|
||||
}
|
||||
|
||||
|
||||
uint _S7 = 2U * heapElementID_0 + b_0;
|
||||
|
||||
|
||||
uint _S8 = _S6 - heapValue_1 * b_0;
|
||||
|
||||
|
||||
uint bitCount_1 = bitCount_0 / 2U;
|
||||
uint64_t _S9 = mask_0 >> bitCount_1;
|
||||
|
||||
#line 249
|
||||
uint currentDepth_2 = currentDepth_0 + 1U;
|
||||
|
||||
#line 249
|
||||
heapElementID_0 = _S7;
|
||||
|
||||
#line 249
|
||||
mask_0 = _S9;
|
||||
|
||||
#line 249
|
||||
currentDepth_0 = currentDepth_2;
|
||||
|
||||
#line 249
|
||||
bitCount_0 = bitCount_1;
|
||||
|
||||
#line 249
|
||||
_S6 = _S8;
|
||||
|
||||
#line 249
|
||||
}
|
||||
|
||||
#line 273
|
||||
return heapElementID_0 ^ 131072U;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint decode_bit_complement_0(uint handle_1)
|
||||
{
|
||||
|
||||
#line 278
|
||||
uint b_1;
|
||||
|
||||
#line 278
|
||||
uint heapElementID_1 = 1U;
|
||||
|
||||
#line 278
|
||||
uint currentDepth_3 = 0U;
|
||||
|
||||
#line 278
|
||||
uint c_0 = 65536U;
|
||||
|
||||
#line 278
|
||||
uint bitCount_2 = handle_1;
|
||||
|
||||
#line 299
|
||||
for(;;)
|
||||
{
|
||||
|
||||
#line 299
|
||||
if(currentDepth_3 < 11U)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#line 299
|
||||
break;
|
||||
}
|
||||
uint heapValue_2 = c_0 - get_heap_element_0(2U * heapElementID_1);
|
||||
if(bitCount_2 < heapValue_2)
|
||||
{
|
||||
|
||||
#line 302
|
||||
b_1 = 0U;
|
||||
|
||||
#line 302
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#line 302
|
||||
b_1 = 1U;
|
||||
|
||||
#line 302
|
||||
}
|
||||
|
||||
uint _S10 = 2U * heapElementID_1 + b_1;
|
||||
uint _S11 = bitCount_2 - heapValue_2 * b_1;
|
||||
uint c_1 = c_0 / 2U;
|
||||
|
||||
#line 299
|
||||
uint currentDepth_4 = currentDepth_3 + 1U;
|
||||
|
||||
#line 299
|
||||
heapElementID_1 = _S10;
|
||||
|
||||
#line 299
|
||||
currentDepth_3 = currentDepth_4;
|
||||
|
||||
#line 299
|
||||
c_0 = c_1;
|
||||
|
||||
#line 299
|
||||
bitCount_2 = _S11;
|
||||
|
||||
#line 299
|
||||
}
|
||||
|
||||
#line 310
|
||||
uint _S12 = currentDepth_3 + 1U;
|
||||
|
||||
|
||||
uint64_t _S13 = pParams_bitFieldBuffer_0._data[uint(int(heapElementID_1) - 2048)];
|
||||
|
||||
#line 278
|
||||
uint _S14 = bitCount_2;
|
||||
|
||||
#line 278
|
||||
uint64_t mask_1 = 18446744073709551615UL;
|
||||
|
||||
#line 278
|
||||
currentDepth_3 = _S12;
|
||||
|
||||
#line 278
|
||||
bitCount_2 = 32U;
|
||||
|
||||
#line 278
|
||||
uint _S15 = _S14;
|
||||
|
||||
#line 316
|
||||
for(;;)
|
||||
{
|
||||
|
||||
#line 316
|
||||
if(currentDepth_3 < uint(log2(1.31072e+05)) + 1U)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#line 316
|
||||
break;
|
||||
}
|
||||
|
||||
#line 324
|
||||
uint64_t target_bits_2 = _S13 >> bitCount_2 * (2U * heapElementID_1 - 1U - ((1U << currentDepth_3) - 1U)) % 64U & mask_1;
|
||||
uint heapValue_3 = c_0 - bitCount(uint(target_bits_2 >> 32)) + bitCount(uint(target_bits_2));
|
||||
|
||||
if(_S15 < heapValue_3)
|
||||
{
|
||||
|
||||
#line 327
|
||||
b_1 = 0U;
|
||||
|
||||
#line 327
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#line 327
|
||||
b_1 = 1U;
|
||||
|
||||
#line 327
|
||||
}
|
||||
|
||||
uint _S16 = 2U * heapElementID_1 + b_1;
|
||||
uint _S17 = _S15 - heapValue_3 * b_1;
|
||||
uint c_2 = c_0 / 2U;
|
||||
|
||||
|
||||
uint bitCount_3 = bitCount_2 / 2U;
|
||||
uint64_t _S18 = mask_1 >> bitCount_3;
|
||||
|
||||
#line 316
|
||||
uint currentDepth_5 = currentDepth_3 + 1U;
|
||||
|
||||
#line 316
|
||||
heapElementID_1 = _S16;
|
||||
|
||||
#line 316
|
||||
mask_1 = _S18;
|
||||
|
||||
#line 316
|
||||
currentDepth_3 = currentDepth_5;
|
||||
|
||||
#line 316
|
||||
bitCount_2 = bitCount_3;
|
||||
|
||||
#line 316
|
||||
c_0 = c_2;
|
||||
|
||||
#line 316
|
||||
_S15 = _S17;
|
||||
|
||||
#line 316
|
||||
}
|
||||
|
||||
#line 338
|
||||
return heapElementID_1 ^ 131072U;
|
||||
}
|
||||
|
||||
|
||||
|
||||
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
|
||||
#line 33
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main()
|
||||
{
|
||||
|
||||
#line 343
|
||||
uint _S19 = gl_GlobalInvocationID.x;
|
||||
#line 33
|
||||
uint _S1 = gl_GlobalInvocationID.x;
|
||||
|
||||
load_buffer_to_shared_memory_0(gl_LocalInvocationIndex);
|
||||
pParams_classificationBuffer_0._data[uint(_S19)] = decode_bit_0(_S19);
|
||||
pParams_classificationBuffer_0._data[uint(_S19 * 2U)] = decode_bit_complement_0(_S19);
|
||||
pParams_bitFieldBuffer_0._data[uint(_S1)] = uint64_t(OCBT_bit_mask_0[_S1]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,122 +1,12 @@
|
||||
// Pointer to an invalid neighbor or index
|
||||
const static int INVALID_POINTER = 4294967295;
|
||||
|
||||
// Possible culling state
|
||||
const static int BACK_FACE_CULLED = -3;
|
||||
const static int FRUSTUM_CULLED = -2;
|
||||
const static int TOO_SMALL = -1;
|
||||
const static int UNCHANGED_ELEMENT = 0;
|
||||
const static int BISECT_ELEMENT = 1;
|
||||
const static int SIMPLIFY_ELEMENT = 2;
|
||||
const static int MERGED_ELEMENT = 3;
|
||||
|
||||
// Bisector flags
|
||||
const static int VISIBLE_BISECTOR = 0x1;
|
||||
const static int MODIFIED_BISECTOR = 0x2;
|
||||
|
||||
|
||||
// Possible splits
|
||||
static const uint64_t NO_SPLIT = 0x00;
|
||||
static const uint64_t CENTER_SPLIT = 0x01;
|
||||
static const uint64_t RIGHT_SPLIT = 0x02;
|
||||
static const uint64_t LEFT_SPLIT = 0x04;
|
||||
static const uint64_t RIGHT_DOUBLE_SPLIT = (CENTER_SPLIT | RIGHT_SPLIT);
|
||||
static const uint64_t LEFT_DOUBLE_SPLIT = (CENTER_SPLIT | LEFT_SPLIT);
|
||||
static const uint64_t TRIPLE_SPLIT = (CENTER_SPLIT | RIGHT_SPLIT | LEFT_SPLIT);
|
||||
|
||||
// Split buffer slots
|
||||
static const uint64_t SPLIT_COUNTER = 0;
|
||||
static const uint64_t SIMPLIFY_COUNTER = 1;
|
||||
static const uint64_t CLASSIFY_COUNTER_OFFSET = 2;
|
||||
|
||||
|
||||
struct BisectorData
|
||||
{
|
||||
// Allocated indices for this bisector
|
||||
uint32_t indices[3];
|
||||
|
||||
// Subvision that should be applied to this bisector
|
||||
uint32_t subdivisionPattern;
|
||||
|
||||
// Neighbor that should be processed
|
||||
uint32_t problematicNeighbor;
|
||||
|
||||
// State of this bisector (split, merge, etc)
|
||||
uint32_t bisectorState;
|
||||
|
||||
// Visibility and modification flags of a bisector
|
||||
uint32_t flags;
|
||||
|
||||
// ID used for the propagation
|
||||
uint32_t propagationID;
|
||||
};
|
||||
|
||||
uint HeapIDDepth(uint64_t x)
|
||||
{
|
||||
uint depth = 0;
|
||||
while (x > 0u) {
|
||||
++depth;
|
||||
x >>= 1u;
|
||||
}
|
||||
return depth;
|
||||
}
|
||||
struct ComputeParams
|
||||
{
|
||||
RWStructuredBuffer<uint> indirectDrawBuffer;
|
||||
RWStructuredBuffer<uint64_t> heapIDBuffer;
|
||||
RWStructuredBuffer<uint> classificationBuffer;
|
||||
RWStructuredBuffer<int> allocateBuffer;
|
||||
RWStructuredBuffer<int> memoryBuffer;
|
||||
RWStructuredBuffer<uint4> neighboursBuffer;
|
||||
RWStructuredBuffer<BisectorData> bisectorDataBuffer;
|
||||
RWStructuredBuffer<int> propagateBuffer;
|
||||
RWStructuredBuffer<uint> simplifyBuffer;
|
||||
RWStructuredBuffer<uint> cbtBuffer;
|
||||
RWStructuredBuffer<uint64_t> bitFieldBuffer;
|
||||
};
|
||||
ParameterBlock<ComputeParams> pParams;
|
||||
|
||||
#define WORKGROUP_SIZE 64
|
||||
|
||||
// Num elements
|
||||
#define OCBT_NUM_ELEMENTS 131072
|
||||
// Tree sizes
|
||||
#define OCBT_TREE_SIZE_BITS (32 * 1 + 32 * 2 + 32 * 4 + 32 * 8 + 32 * 16 + 32 * 32 + 32 * 64 + 16 * 128 + 16 * 256 + 16 * 512 + 8 * 1024)
|
||||
#define OCBT_TREE_NUM_SLOTS (OCBT_TREE_SIZE_BITS / 32)
|
||||
#define OCBT_BITFIELD_NUM_SLOTS (OCBT_NUM_ELEMENTS / 64)
|
||||
#define OCBT_LAST_LEVEL_SIZE 1024
|
||||
|
||||
// Tree last level
|
||||
#define TREE_LAST_LEVEL 10
|
||||
// First virtual level
|
||||
#define FIRST_VIRTUAL_LEVEL 11
|
||||
// Leaf level
|
||||
#define LEAF_LEVEL 17
|
||||
|
||||
// per level offset
|
||||
static const uint32_t OCBT_depth_offset[18] = { 0, // Level 0
|
||||
32 * 1, // level 1
|
||||
32 * 1 + 32 * 2, // level 2
|
||||
32 * 1 + 32 * 2 + 32 * 4, // level 3
|
||||
32 * 1 + 32 * 2 + 32 * 4 + 32 * 8, // Level 4
|
||||
32 * 1 + 32 * 2 + 32 * 4 + 32 * 8 + 32 * 16, // Level 5
|
||||
32 * 1 + 32 * 2 + 32 * 4 + 32 * 8 + 32 * 16 + 32 * 32, // Level 6
|
||||
32 * 1 + 32 * 2 + 32 * 4 + 32 * 8 + 32 * 16 + 32 * 32 + 32 * 64, // Level 7
|
||||
|
||||
32 * 1 + 32 * 2 + 32 * 4 + 32 * 8 + 32 * 16 + 32 * 32 + 32 * 64 + 16 * 128, // Level 8
|
||||
32 * 1 + 32 * 2 + 32 * 4 + 32 * 8 + 32 * 16 + 32 * 32 + 32 * 64 + 16 * 128 + 16 * 256, // Level 9
|
||||
32 * 1 + 32 * 2 + 32 * 4 + 32 * 8 + 32 * 16 + 32 * 32 + 32 * 64 + 16 * 128 + 16 * 256 + 16 * 512, // Level 10
|
||||
|
||||
0, // Level 12
|
||||
0, // Level 13
|
||||
0, // Level 14
|
||||
0, // Level 15
|
||||
0, // Level 16
|
||||
0, // Level 17
|
||||
0, // Level 18
|
||||
};
|
||||
|
||||
static const uint64_t OCBT_bit_mask[18] = { 0xffffffff, // Root 17
|
||||
static const uint32_t OCBT_bit_mask[18] = {
|
||||
0xffffffff, // Root 17
|
||||
0xffffffff, // Level 16
|
||||
0xffffffff, // level 15
|
||||
0xffffffff, // level 14
|
||||
@@ -129,7 +19,7 @@ static const uint64_t OCBT_bit_mask[18] = { 0xffffffff, // Root 17
|
||||
0xffff, // level 8
|
||||
0xff, // level 8
|
||||
|
||||
0xffffffffffffffff, // level 7
|
||||
0xffffffff, // level 7
|
||||
0xffffffff, // Level 6
|
||||
0xffff, // level 5
|
||||
0xff, // level 4
|
||||
@@ -138,211 +28,9 @@ static const uint64_t OCBT_bit_mask[18] = { 0xffffffff, // Root 17
|
||||
0x1, // level 1
|
||||
};
|
||||
|
||||
static const uint32_t OCBT_bit_count[18] = { 32, // Root 17
|
||||
32, // Level 16
|
||||
32, // level 15
|
||||
32, // level 14
|
||||
32, // level 13
|
||||
32, // level 12
|
||||
32, // level 11
|
||||
|
||||
16, // level 10
|
||||
16, // level 9
|
||||
16, // level 8
|
||||
8, // level 8
|
||||
|
||||
64, // Level 5
|
||||
32, // Level 5
|
||||
16, // Level 4
|
||||
8, // level 3
|
||||
4, // level 2
|
||||
2, // level 1
|
||||
1, // level 0
|
||||
};
|
||||
|
||||
groupshared uint gs_cbtTree[OCBT_TREE_NUM_SLOTS];
|
||||
|
||||
// Define the remaining values
|
||||
#define BUFFER_ELEMENT_PER_LANE ((OCBT_TREE_NUM_SLOTS + WORKGROUP_SIZE - 1) / WORKGROUP_SIZE)
|
||||
#define BUFFER_ELEMENT_PER_LANE_NO_BITFIELD ((OCBT_TREE_NUM_SLOTS + WORKGROUP_SIZE - 1) / WORKGROUP_SIZE)
|
||||
#define BITFIELD_ELEMENT_PER_LANE ((OCBT_BITFIELD_NUM_SLOTS + WORKGROUP_SIZE - 1) / WORKGROUP_SIZE)
|
||||
#define WAVE_TREE_DEPTH uint(log2(OCBT_NUM_ELEMENTS))
|
||||
|
||||
void load_buffer_to_shared_memory(uint groupIndex)
|
||||
[numthreads(1, 1, 1)]
|
||||
[shader("compute")]
|
||||
void TestHeap(uint dispatchID: SV_DispatchThreadID)
|
||||
{
|
||||
// Load the bitfield to the LDS
|
||||
for (uint e = 0; e < BUFFER_ELEMENT_PER_LANE; ++e)
|
||||
{
|
||||
uint target_element = BUFFER_ELEMENT_PER_LANE * groupIndex + e;
|
||||
if (target_element < OCBT_TREE_NUM_SLOTS)
|
||||
gs_cbtTree[target_element] = pParams.cbtBuffer[target_element];
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
pParams.bitFieldBuffer[dispatchID] = OCBT_bit_mask[dispatchID];
|
||||
}
|
||||
|
||||
uint get_heap_element(uint id)
|
||||
{
|
||||
// Figure out the location of the first bit of this element
|
||||
uint32_t real_heap_id = id - 1;
|
||||
uint32_t depth = uint32_t(log2(real_heap_id + 1));
|
||||
uint32_t level_first_element = (1u << depth) - 1;
|
||||
uint32_t id_in_level = real_heap_id - level_first_element;
|
||||
uint32_t first_bit = OCBT_depth_offset[depth] + OCBT_bit_count[depth] * id_in_level;
|
||||
if (depth < FIRST_VIRTUAL_LEVEL)
|
||||
{
|
||||
uint32_t slot = first_bit / 32;
|
||||
uint32_t local_id = first_bit % 32;
|
||||
uint32_t target_bits = (gs_cbtTree[slot] >> local_id) & uint32_t(OCBT_bit_mask[depth]);
|
||||
return (gs_cbtTree[slot] >> local_id) & uint32_t(OCBT_bit_mask[depth]);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t slot = first_bit / 64;
|
||||
uint32_t local_id = first_bit % 64;
|
||||
uint64_t target_bits = (pParams.bitFieldBuffer[slot] >> local_id) & OCBT_bit_mask[depth];
|
||||
uint32_t high = uint(target_bits >> 32);
|
||||
uint32_t low = uint(target_bits);
|
||||
return countbits(high) + countbits(low);
|
||||
}
|
||||
}
|
||||
|
||||
// decodes the position of the i-th one in the bitfield
|
||||
uint decode_bit(uint handle)
|
||||
{
|
||||
#if defined(NAIVE_DECODE)
|
||||
uint bitID = 1;
|
||||
for (uint currentDepth = 0; currentDepth < WAVE_TREE_DEPTH; ++currentDepth)
|
||||
{
|
||||
uint heapValue = get_heap_element(2 * bitID);
|
||||
uint b = handle < heapValue ? 0 : 1;
|
||||
|
||||
bitID = 2 * bitID + b;
|
||||
handle -= heapValue * b;
|
||||
}
|
||||
|
||||
return (bitID ^ OCBT_NUM_ELEMENTS);
|
||||
#else
|
||||
uint currentDepth = 0;
|
||||
uint heapElementID = 1u;
|
||||
for (currentDepth = 0; currentDepth < FIRST_VIRTUAL_LEVEL; ++currentDepth)
|
||||
{
|
||||
// Read the left element
|
||||
uint heapValue = get_heap_element(2u * heapElementID);
|
||||
|
||||
// Does it fall in the right or left subtree?
|
||||
uint b = handle < heapValue ? 0u : 1u;
|
||||
|
||||
// Pick a subtree
|
||||
heapElementID = 2u * heapElementID + b;
|
||||
|
||||
// Move the iterator to exclude the right subtree if required
|
||||
handle -= heapValue * b;
|
||||
}
|
||||
|
||||
// Align with the internal depth
|
||||
currentDepth++;
|
||||
|
||||
// Ok we have our subtree, now we need to pick the right bit
|
||||
uint64_t heapValue = pParams.bitFieldBuffer[heapElementID - OCBT_LAST_LEVEL_SIZE * 2];
|
||||
uint64_t mask = 0xffffffff;
|
||||
uint32_t bitCount = 32;
|
||||
for (; currentDepth < (WAVE_TREE_DEPTH + 1); ++currentDepth)
|
||||
{
|
||||
// Figure out the location of the first bit of this element
|
||||
uint real_heap_id = 2 * heapElementID - 1;
|
||||
uint level_first_element = (1u << currentDepth) - 1;
|
||||
uint id_in_level = real_heap_id - level_first_element;
|
||||
uint first_bit = bitCount * id_in_level;
|
||||
uint local_id = first_bit % 64;
|
||||
uint64_t target_bits = (heapValue >> local_id) & mask;
|
||||
uint heapValue = countbits(uint(target_bits >> 32)) + countbits(uint(target_bits));
|
||||
|
||||
// Does it fall in the right or left subtree?
|
||||
uint b = handle < heapValue ? 0u : 1u;
|
||||
|
||||
// Pick a subtree
|
||||
heapElementID = 2u * heapElementID + b;
|
||||
|
||||
// Move the iterator to exclude the right subtree if required
|
||||
handle -= heapValue * b;
|
||||
|
||||
// Adjust the mask and bitcount
|
||||
bitCount /= 2;
|
||||
mask = mask >> bitCount;
|
||||
}
|
||||
return (heapElementID ^ OCBT_NUM_ELEMENTS);
|
||||
#endif
|
||||
}
|
||||
|
||||
// decodes the position of the i-th zero in the bitfield
|
||||
uint decode_bit_complement(uint handle)
|
||||
{
|
||||
#if defined(NAIVE_DECODE)
|
||||
uint bitID = 1u;
|
||||
uint c = OCBT_NUM_ELEMENTS / 2u;
|
||||
|
||||
while (bitID < OCBT_NUM_ELEMENTS) {
|
||||
uint heapValue = c - get_heap_element(2u * bitID);
|
||||
uint b = handle < heapValue ? 0u : 1u;
|
||||
|
||||
bitID = 2u * bitID + b;
|
||||
handle -= heapValue * b;
|
||||
c /= 2u;
|
||||
}
|
||||
|
||||
return (bitID ^ OCBT_NUM_ELEMENTS);
|
||||
#else
|
||||
uint heapElementID = 1u;
|
||||
uint c = OCBT_NUM_ELEMENTS / 2u;
|
||||
uint currentDepth = 0;
|
||||
|
||||
for (currentDepth = 0; currentDepth < FIRST_VIRTUAL_LEVEL; ++currentDepth)
|
||||
{
|
||||
uint heapValue = c - get_heap_element(2u * heapElementID);
|
||||
uint b = handle < heapValue ? 0u : 1u;
|
||||
|
||||
heapElementID = 2u * heapElementID + b;
|
||||
handle -= heapValue * b;
|
||||
c /= 2u;
|
||||
}
|
||||
|
||||
// Align with the internal depth
|
||||
currentDepth++;
|
||||
|
||||
// Ok we have our subtree, now we need to pick the right bit
|
||||
uint64_t heapValue = pParams.bitFieldBuffer[heapElementID - OCBT_LAST_LEVEL_SIZE * 2];
|
||||
uint64_t mask = 0xffffffff;
|
||||
uint32_t bitCount = 32;
|
||||
for (; currentDepth < (WAVE_TREE_DEPTH + 1); ++currentDepth)
|
||||
{
|
||||
// Figure out the location of the first bit of this element
|
||||
uint real_heap_id = 2 * heapElementID - 1;
|
||||
uint level_first_element = (1u << currentDepth) - 1;
|
||||
uint id_in_level = real_heap_id - level_first_element;
|
||||
uint first_bit = bitCount * id_in_level;
|
||||
uint local_id = first_bit % 64;
|
||||
uint64_t target_bits = (heapValue >> local_id) & mask;
|
||||
uint heapValue = c - countbits(uint(target_bits >> 32)) + countbits(uint(target_bits));;
|
||||
|
||||
uint b = handle < heapValue ? 0u : 1u;
|
||||
|
||||
heapElementID = 2u * heapElementID + b;
|
||||
handle -= heapValue * b;
|
||||
c /= 2u;
|
||||
|
||||
// Adjust the mask and bitcount
|
||||
bitCount /= 2;
|
||||
mask = mask >> bitCount;
|
||||
}
|
||||
|
||||
return (heapElementID ^ OCBT_NUM_ELEMENTS);
|
||||
#endif
|
||||
}
|
||||
|
||||
[numthreads(64, 1, 1)]
|
||||
void GetHeap(uint groupIndex : SV_GroupIndex, uint dispatchID : SV_DispatchThreadID)
|
||||
{
|
||||
load_buffer_to_shared_memory(groupIndex);
|
||||
pParams.classificationBuffer[dispatchID] = decode_bit(dispatchID);
|
||||
pParams.classificationBuffer[dispatchID * 2] = decode_bit_complement(dispatchID);
|
||||
}
|
||||
Binary file not shown.
@@ -310,9 +310,9 @@ void EvaluateLEB(uint currentID : SV_DispatchThreadID, uint groupIndex: SV_Group
|
||||
EvaluateElementPosition(cHeapID, 0, pParams.geometry.baseDepth, pParams.currentVertexBuffer, parentTri, childTri);
|
||||
|
||||
// Export the child
|
||||
pParams.lebPositionBuffer[3 * currentID + 0] = float4((childTri.p[0]), 1.0f);
|
||||
pParams.lebPositionBuffer[3 * currentID + 1] = float4((childTri.p[1]), 1.0f);
|
||||
pParams.lebPositionBuffer[3 * currentID + 2] = float4((childTri.p[2]), 1.0f);
|
||||
pParams.lebPositionBuffer[3 * currentID + 0] = float4(normalize(childTri.p[0]), 1.0f);
|
||||
pParams.lebPositionBuffer[3 * currentID + 1] = float4(normalize(childTri.p[1]), 1.0f);
|
||||
pParams.lebPositionBuffer[3 * currentID + 2] = float4(normalize(childTri.p[2]), 1.0f);
|
||||
|
||||
// Export the fourth element
|
||||
if (pParams.geometry.baseDepth < depth)
|
||||
@@ -321,6 +321,6 @@ void EvaluateLEB(uint currentID : SV_DispatchThreadID, uint groupIndex: SV_Group
|
||||
const uint parentOffset = 3 * pParams.geometry.totalNumElements;
|
||||
|
||||
// Transform the coordinate to planet space
|
||||
pParams.lebPositionBuffer[parentOffset + currentID] = float4((cHeapID % 2 == 0 ? parentTri.p[0] : parentTri.p[2]), 1.0f);
|
||||
pParams.lebPositionBuffer[parentOffset + currentID] = float4(normalize(cHeapID % 2 == 0 ? parentTri.p[0] : parentTri.p[2]), 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,16 @@ struct HeapDebug
|
||||
uint level_first_element;
|
||||
uint id_in_level;
|
||||
uint first_bit;
|
||||
uint handle;
|
||||
uint heapValue;
|
||||
uint h;
|
||||
uint c;
|
||||
uint64_t target_bits;
|
||||
};
|
||||
|
||||
struct DebugStruct
|
||||
{
|
||||
HeapDebug heapValues[18];
|
||||
HeapDebug heapValues[17];
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ bool FrustumAABBIntersect(in Frustum frustum, float3 aabbMin, float3 aabbMax)
|
||||
int ClassifyBisector(in BisectorGeometry tri, uint depth)
|
||||
{
|
||||
// Check the triangle's visibility
|
||||
float3 triNormal = normalize(cross(tri.p[2] - tri.p[0], tri.p[1] - tri.p[0]));
|
||||
float3 triNormal = normalize(cross(tri.p[2] - tri.p[1], tri.p[0] - tri.p[1]));
|
||||
float3 triCenter = (tri.p[0] + tri.p[1] + tri.p[2]) / 3.0;
|
||||
float3 viewDir = normalize(-triCenter);
|
||||
float FdotV = dot(viewDir, -pViewParams.cameraForward_WS.xyz);
|
||||
@@ -147,6 +147,9 @@ void ClassifyElement(uint currentID, BisectorGeometry bis, uint totalNumElements
|
||||
BisectorData cbisectorData = pParams.bisectorDataBuffer[currentID];
|
||||
|
||||
// Reset some values
|
||||
cbisectorData.indices[0] = 0;
|
||||
cbisectorData.indices[1] = 0;
|
||||
cbisectorData.indices[2] = 0;
|
||||
cbisectorData.subdivisionPattern = 0;
|
||||
cbisectorData.bisectorState = UNCHANGED_ELEMENT;
|
||||
cbisectorData.problematicNeighbor = INVALID_POINTER;
|
||||
@@ -325,6 +328,7 @@ void AllocateElement(uint currentID, uint dispatchID)
|
||||
// Load the bisector for this element
|
||||
BisectorData bisectorData = pParams.bisectorDataBuffer[currentID];
|
||||
|
||||
DebugStruct debug;
|
||||
// Does this guy need to be subdivided
|
||||
if (bisectorData.subdivisionPattern != 0)
|
||||
{
|
||||
@@ -338,12 +342,13 @@ void AllocateElement(uint currentID, uint dispatchID)
|
||||
// llocate the bits we need
|
||||
for (uint bitId = 0; bitId < numSlots; ++bitId)
|
||||
{
|
||||
bisectorData.indices[bitId] = decode_bit_complement(firstBitIndex + bitId, dispatchID);
|
||||
bisectorData.indices[bitId] = decode_bit_complement(firstBitIndex + bitId, debug);
|
||||
}
|
||||
|
||||
// Output
|
||||
pParams.bisectorDataBuffer[currentID] = bisectorData;
|
||||
}
|
||||
pParams.debugBuffer[dispatchID] = debug;
|
||||
}
|
||||
|
||||
#define SUBLING0_ID 0
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#include "CBT.h"
|
||||
#include "Graphics/Shader.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Graphics/Shader.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
Array<Vector4> basePoints = {
|
||||
//Vector4(0.0f / 3, 0, 0.0f / 3, 1), Vector4(0.0f / 3, 0, 1.0f / 3, 1), Vector4(0.0f / 3, 0, 2.0f / 3, 1),
|
||||
//Vector4(0.0f / 3, 0, 3.0f / 3, 1), Vector4(1.0f / 3, 0, 0.0f / 3, 1), Vector4(1.0f / 3, 0, 1.0f / 3, 1),
|
||||
//Vector4(1.0f / 3, 0, 2.0f / 3, 1), Vector4(1.0f / 3, 0, 3.0f / 3, 1), Vector4(2.0f / 3, 0, 0.0f / 3, 1),
|
||||
//Vector4(2.0f / 3, 0, 1.0f / 3, 1), Vector4(2.0f / 3, 0, 2.0f / 3, 1), Vector4(2.0f / 3, 0, 3.0f / 3, 1),
|
||||
//Vector4(3.0f / 3, 0, 0.0f / 3, 1), Vector4(3.0f / 3, 0, 1.0f / 3, 1), Vector4(3.0f / 3, 0, 2.0f / 3, 1),
|
||||
//Vector4(3.0f / 3, 0, 3.0f / 3, 1),
|
||||
// Vector4(0.0f / 3, 0, 0.0f / 3, 1), Vector4(0.0f / 3, 0, 1.0f / 3, 1), Vector4(0.0f / 3, 0, 2.0f / 3, 1),
|
||||
// Vector4(0.0f / 3, 0, 3.0f / 3, 1), Vector4(1.0f / 3, 0, 0.0f / 3, 1), Vector4(1.0f / 3, 0, 1.0f / 3, 1),
|
||||
// Vector4(1.0f / 3, 0, 2.0f / 3, 1), Vector4(1.0f / 3, 0, 3.0f / 3, 1), Vector4(2.0f / 3, 0, 0.0f / 3, 1),
|
||||
// Vector4(2.0f / 3, 0, 1.0f / 3, 1), Vector4(2.0f / 3, 0, 2.0f / 3, 1), Vector4(2.0f / 3, 0, 3.0f / 3, 1),
|
||||
// Vector4(3.0f / 3, 0, 0.0f / 3, 1), Vector4(3.0f / 3, 0, 1.0f / 3, 1), Vector4(3.0f / 3, 0, 2.0f / 3, 1),
|
||||
// Vector4(3.0f / 3, 0, 3.0f / 3, 1),
|
||||
Vector4(0, -0.525731, 0.850651, 1), Vector4(0.850651, 0, 0.525731, 1), Vector4(0.850651, 0, -0.525731, 1),
|
||||
Vector4(-0.850651, 0, -0.525731, 1), Vector4(-0.850651, 0, 0.525731, 1), Vector4(-0.525731, 0.850651, 0, 1),
|
||||
Vector4(0.525731, 0.850651, 0, 1), Vector4(0.525731, -0.850651, 0, 1), Vector4(-0.525731, -0.850651, 0, 1),
|
||||
@@ -23,77 +23,77 @@ struct Halfedge {
|
||||
uint32 twinID;
|
||||
};
|
||||
Array<Halfedge> edges = {
|
||||
//Halfedge{0, 1, 2, 4294967295},
|
||||
//Halfedge{4, 2, 0, 3},
|
||||
//Halfedge{1, 0, 1, 4294967295},
|
||||
// Halfedge{0, 1, 2, 4294967295},
|
||||
// Halfedge{4, 2, 0, 3},
|
||||
// Halfedge{1, 0, 1, 4294967295},
|
||||
//
|
||||
//Halfedge{4, 4, 5, 1},
|
||||
//Halfedge{5, 5, 3, 8},
|
||||
//Halfedge{1, 3, 4, 18},
|
||||
// Halfedge{4, 4, 5, 1},
|
||||
// Halfedge{5, 5, 3, 8},
|
||||
// Halfedge{1, 3, 4, 18},
|
||||
//
|
||||
//Halfedge{1, 7, 8, 4294967295},
|
||||
//Halfedge{5, 8, 6, 9},
|
||||
//Halfedge{2, 6, 7, 4},
|
||||
// Halfedge{1, 7, 8, 4294967295},
|
||||
// Halfedge{5, 8, 6, 9},
|
||||
// Halfedge{2, 6, 7, 4},
|
||||
//
|
||||
//Halfedge{5, 10, 11, 7},
|
||||
//Halfedge{6, 11, 9, 14},
|
||||
//Halfedge{2, 9, 10, 24},
|
||||
// Halfedge{5, 10, 11, 7},
|
||||
// Halfedge{6, 11, 9, 14},
|
||||
// Halfedge{2, 9, 10, 24},
|
||||
//
|
||||
//Halfedge{2, 13, 14, 4294967295},
|
||||
//Halfedge{6, 14, 12, 15},
|
||||
//Halfedge{3, 12, 13, 10},
|
||||
// Halfedge{2, 13, 14, 4294967295},
|
||||
// Halfedge{6, 14, 12, 15},
|
||||
// Halfedge{3, 12, 13, 10},
|
||||
//
|
||||
//Halfedge{6, 16, 17, 13},
|
||||
//Halfedge{7, 17, 15, 4294967295},
|
||||
//Halfedge{3, 15, 16, 30},
|
||||
// Halfedge{6, 16, 17, 13},
|
||||
// Halfedge{7, 17, 15, 4294967295},
|
||||
// Halfedge{3, 15, 16, 30},
|
||||
//
|
||||
//Halfedge{4, 19, 20, 5},
|
||||
//Halfedge{8, 20, 18, 21},
|
||||
//Halfedge{5, 18, 19, 4294967295},
|
||||
// Halfedge{4, 19, 20, 5},
|
||||
// Halfedge{8, 20, 18, 21},
|
||||
// Halfedge{5, 18, 19, 4294967295},
|
||||
//
|
||||
//Halfedge{8, 22, 23, 19},
|
||||
//Halfedge{9, 23, 21, 26},
|
||||
//Halfedge{5, 21, 22, 36},
|
||||
// Halfedge{8, 22, 23, 19},
|
||||
// Halfedge{9, 23, 21, 26},
|
||||
// Halfedge{5, 21, 22, 36},
|
||||
//
|
||||
//Halfedge{5, 25, 26, 11},
|
||||
//Halfedge{9, 26, 24, 27},
|
||||
//Halfedge{6, 24, 25, 22},
|
||||
// Halfedge{5, 25, 26, 11},
|
||||
// Halfedge{9, 26, 24, 27},
|
||||
// Halfedge{6, 24, 25, 22},
|
||||
//
|
||||
//Halfedge{9, 28, 29, 25},
|
||||
//Halfedge{10, 29, 27, 32},
|
||||
//Halfedge{6, 27, 28, 42},
|
||||
// Halfedge{9, 28, 29, 25},
|
||||
// Halfedge{10, 29, 27, 32},
|
||||
// Halfedge{6, 27, 28, 42},
|
||||
//
|
||||
//Halfedge{6, 31, 32, 17},
|
||||
//Halfedge{10, 32, 30, 33},
|
||||
//Halfedge{7, 30, 31, 28},
|
||||
// Halfedge{6, 31, 32, 17},
|
||||
// Halfedge{10, 32, 30, 33},
|
||||
// Halfedge{7, 30, 31, 28},
|
||||
//
|
||||
//Halfedge{10, 34, 35, 31},
|
||||
//Halfedge{11, 35, 33, 4294967295},
|
||||
//Halfedge{7, 33, 34, 48},
|
||||
// Halfedge{10, 34, 35, 31},
|
||||
// Halfedge{11, 35, 33, 4294967295},
|
||||
// Halfedge{7, 33, 34, 48},
|
||||
//
|
||||
//Halfedge{8, 37, 38, 23},
|
||||
//Halfedge{12, 38, 36, 39},
|
||||
//Halfedge{9, 36, 37, 4294967295},
|
||||
// Halfedge{8, 37, 38, 23},
|
||||
// Halfedge{12, 38, 36, 39},
|
||||
// Halfedge{9, 36, 37, 4294967295},
|
||||
//
|
||||
//Halfedge{12, 40, 41, 37},
|
||||
//Halfedge{13, 41, 39, 44},
|
||||
//Halfedge{9, 39, 40, 4294967295},
|
||||
// Halfedge{12, 40, 41, 37},
|
||||
// Halfedge{13, 41, 39, 44},
|
||||
// Halfedge{9, 39, 40, 4294967295},
|
||||
//
|
||||
//Halfedge{9, 43, 44, 29},
|
||||
//Halfedge{13, 44, 42, 45},
|
||||
//Halfedge{10, 42, 43, 40},
|
||||
// Halfedge{9, 43, 44, 29},
|
||||
// Halfedge{13, 44, 42, 45},
|
||||
// Halfedge{10, 42, 43, 40},
|
||||
//
|
||||
//Halfedge{13, 46, 47, 43},
|
||||
//Halfedge{14, 47, 45, 50},
|
||||
//Halfedge{10, 45, 46, 4294967295},
|
||||
// Halfedge{13, 46, 47, 43},
|
||||
// Halfedge{14, 47, 45, 50},
|
||||
// Halfedge{10, 45, 46, 4294967295},
|
||||
//
|
||||
//Halfedge{10, 49, 50, 35},
|
||||
//Halfedge{14, 50, 48, 51},
|
||||
//Halfedge{11, 48, 49, 46},
|
||||
// Halfedge{10, 49, 50, 35},
|
||||
// Halfedge{14, 50, 48, 51},
|
||||
// Halfedge{11, 48, 49, 46},
|
||||
//
|
||||
//Halfedge{14, 52, 53, 49},
|
||||
//Halfedge{15, 53, 51, 4294967295},
|
||||
//Halfedge{11, 51, 52, 4294967295},
|
||||
// Halfedge{14, 52, 53, 49},
|
||||
// Halfedge{15, 53, 51, 4294967295},
|
||||
// Halfedge{11, 51, 52, 4294967295},
|
||||
|
||||
Halfedge{1, 1, 2, 5}, Halfedge{2, 2, 0, 36}, Halfedge{6, 0, 1, 39}, Halfedge{1, 4, 5, 51}, Halfedge{7, 5, 3, 48},
|
||||
Halfedge{2, 3, 4, 0}, Halfedge{3, 7, 8, 9}, Halfedge{4, 8, 6, 45}, Halfedge{5, 6, 7, 42}, Halfedge{4, 10, 11, 6},
|
||||
@@ -609,7 +609,7 @@ void MeshUpdater::update(CBTMesh& mesh, Gfx::PDescriptorSet viewParamsSet, Gfx::
|
||||
mesh.propagateBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
mesh.gpuCBT.bufferArray[1]->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
graphics->endDebugRegion();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ TerrainRenderer::TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDe
|
||||
Gfx::OPipelineLayout test = graphics->createPipelineLayout();
|
||||
graphics->beginShaderCompilation(ShaderCompilationInfo{
|
||||
.modules = {"CompileTest"},
|
||||
.entryPoints = {{"GetHeap", "CompileTest"}},
|
||||
.entryPoints = {{"TestHeap", "CompileTest"}},
|
||||
.rootSignature = test,
|
||||
});
|
||||
graphics->createComputeShader({0});
|
||||
@@ -302,7 +302,7 @@ void TerrainRenderer::setViewport(Gfx::PViewport _viewport, Gfx::PRenderPass ren
|
||||
.rasterizationState =
|
||||
{
|
||||
.polygonMode = Gfx::SE_POLYGON_MODE_LINE,
|
||||
.cullMode = Gfx::SE_CULL_MODE_BACK_BIT,
|
||||
.cullMode = Gfx::SE_CULL_MODE_NONE,
|
||||
},
|
||||
.colorBlend =
|
||||
{
|
||||
|
||||
@@ -35,6 +35,8 @@ PFN_vkCmdDrawMeshTasksIndirectEXT cmdDrawMeshTasksIndirect;
|
||||
PFN_vkSetDebugUtilsObjectNameEXT setDebugUtilsObjectName;
|
||||
PFN_vkQueueBeginDebugUtilsLabelEXT queueBeginDebugUtilsLabelEXT;
|
||||
PFN_vkQueueEndDebugUtilsLabelEXT queueEndDebugUtilsLabelEXT;
|
||||
PFN_vkCmdBeginDebugUtilsLabelEXT cmdBeginDebugUtilsLabelEXT;
|
||||
PFN_vkCmdEndDebugUtilsLabelEXT cmdEndDebugUtilsLabelEXT;
|
||||
PFN_vkCreateAccelerationStructureKHR createAccelerationStructure;
|
||||
PFN_vkCmdBuildAccelerationStructuresKHR cmdBuildAccelerationStructures;
|
||||
PFN_vkGetAccelerationStructureBuildSizesKHR getAccelerationStructureBuildSize;
|
||||
@@ -71,6 +73,18 @@ void vkQueueEndDebugUtilsLabelEXT(VkQueue queue) {
|
||||
}
|
||||
}
|
||||
|
||||
void vkCmdBeginDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT* pLabelInfo) {
|
||||
if (cmdBeginDebugUtilsLabelEXT != nullptr) {
|
||||
cmdBeginDebugUtilsLabelEXT(commandBuffer, pLabelInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void vkCmdEndDebugUtilsLabelEXT(VkCommandBuffer commandBuffer) {
|
||||
if (cmdEndDebugUtilsLabelEXT != nullptr) {
|
||||
cmdEndDebugUtilsLabelEXT(commandBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
VkResult vkCreateAccelerationStructureKHR(VkDevice device, const VkAccelerationStructureCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator, VkAccelerationStructureKHR* pAccelerationStructure) {
|
||||
return createAccelerationStructure(device, pCreateInfo, pAllocator, pAccelerationStructure);
|
||||
@@ -314,10 +328,10 @@ void Graphics::beginDebugRegion(const std::string& name) {
|
||||
.pNext = nullptr,
|
||||
.pLabelName = name.c_str(),
|
||||
};
|
||||
vkQueueBeginDebugUtilsLabelEXT(queues[graphicsQueue]->getHandle(), &label);
|
||||
vkCmdBeginDebugUtilsLabelEXT(getGraphicsCommands()->getCommands()->getHandle(), &label);
|
||||
}
|
||||
|
||||
void Graphics::endDebugRegion() { vkQueueEndDebugUtilsLabelEXT(queues[graphicsQueue]->getHandle()); }
|
||||
void Graphics::endDebugRegion() { vkCmdEndDebugUtilsLabelEXT(getGraphicsCommands()->getCommands()->getHandle()); }
|
||||
|
||||
void Graphics::resolveTexture(Gfx::PTexture source, Gfx::PTexture destination) {
|
||||
PTextureBase sourceTex = source.cast<TextureBase>();
|
||||
@@ -952,6 +966,8 @@ void Graphics::createDevice(GraphicsInitializer initializer) {
|
||||
setDebugUtilsObjectName = (PFN_vkSetDebugUtilsObjectNameEXT)vkGetInstanceProcAddr(instance, "vkSetDebugUtilsObjectNameEXT");
|
||||
queueBeginDebugUtilsLabelEXT = (PFN_vkQueueBeginDebugUtilsLabelEXT)vkGetInstanceProcAddr(instance, "vkQueueBeginDebugUtilsLabelEXT");
|
||||
queueEndDebugUtilsLabelEXT = (PFN_vkQueueEndDebugUtilsLabelEXT)vkGetInstanceProcAddr(instance, "vkQueueEndDebugUtilsLabelEXT");
|
||||
cmdBeginDebugUtilsLabelEXT = (PFN_vkCmdBeginDebugUtilsLabelEXT)vkGetInstanceProcAddr(instance, "vkCmdBeginDebugUtilsLabelEXT");
|
||||
cmdEndDebugUtilsLabelEXT = (PFN_vkCmdEndDebugUtilsLabelEXT)vkGetInstanceProcAddr(instance, "vkCmdEndDebugUtilsLabelEXT");
|
||||
|
||||
createAccelerationStructure = (PFN_vkCreateAccelerationStructureKHR)vkGetDeviceProcAddr(handle, "vkCreateAccelerationStructureKHR");
|
||||
cmdBuildAccelerationStructures =
|
||||
|
||||
Reference in New Issue
Block a user