Changing vertex data interfaces
This commit is contained in:
@@ -20,7 +20,7 @@ ParameterBlock<DepthData> pDepthAttachment;
|
||||
|
||||
bool isBoxVisible(AABB bounding)
|
||||
{
|
||||
uint2 mipDimensions = uint2((uint(pViewParams.screenDimensions.x) + BLOCK_SIZE - 1) / BLOCK_SIZE, (uint(pViewParams.screenDimensions.y) + BLOCK_SIZE - 1) / BLOCK_SIZE);
|
||||
uint2 mipDimensions = uint2(uint(pViewParams.screenDimensions.x), uint(pViewParams.screenDimensions.y));
|
||||
// now we calculate what mip level we need to only sample up to 4 texels covering the entire meshlet
|
||||
uint2 screenCornerMin = mipDimensions;
|
||||
uint2 screenCornerMax = uint2(0, 0);
|
||||
@@ -39,7 +39,7 @@ bool isBoxVisible(AABB bounding)
|
||||
for(uint i = 0; i < 8; ++i)
|
||||
{
|
||||
float4 clipCorner = mul(modelViewProjection, corners[i]);
|
||||
float4 screenCorner = clipToScreen(clipCorner) / BLOCK_SIZE;
|
||||
float4 screenCorner = clipToScreen(clipCorner);
|
||||
screenCornerMin = uint2(min(screenCornerMin.x, uint(screenCorner.x)), min(screenCornerMin.y, uint(screenCorner.y)));
|
||||
screenCornerMax = uint2(max(screenCornerMax.x, uint(screenCorner.x)), max(screenCornerMax.y, uint(screenCorner.y)));
|
||||
maxDepth = max(maxDepth, screenCorner.z);
|
||||
|
||||
@@ -51,32 +51,16 @@ void reduceLevel(
|
||||
setDstDepth(minCoords / 2, minDepth);
|
||||
}
|
||||
|
||||
groupshared uint uMinDepth;
|
||||
|
||||
[numthreads(BLOCK_SIZE, BLOCK_SIZE, 1)]
|
||||
[shader("compute")]
|
||||
void initialReduce(
|
||||
uint3 threadID: SV_GroupThreadID,
|
||||
uint3 groupID: SV_GroupID,
|
||||
) {
|
||||
uint reducedWidth = uint(pViewParams.screenDimensions.x) / BLOCK_SIZE;
|
||||
uint width = uint(pViewParams.screenDimensions.x);
|
||||
int2 groupOffset = groupID.xy * BLOCK_SIZE;
|
||||
int2 texCoord = groupOffset + threadID.xy;
|
||||
float fDepth = pDepthAttachment.texture.Load(int3(texCoord, 0)).r;
|
||||
uint uDepth = asuint(fDepth);
|
||||
if(groupID.x == 0 && groupID.y == 0)
|
||||
{
|
||||
uMinDepth = 0xffffffff;
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
InterlockedMin(uMinDepth, uDepth);
|
||||
pDepthAttachment.buffer[texCoord.x + (texCoord.y * width)] = fDepth;
|
||||
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
float fMinDepth = asfloat(uMinDepth);
|
||||
if(threadID.x == 0 && threadID.y == 0)
|
||||
{
|
||||
pDepthAttachment.buffer[groupID.x + (groupID.y * reducedWidth)] = fMinDepth;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ struct MeshData
|
||||
|
||||
static const uint32_t MAX_VERTICES = 256;
|
||||
static const uint32_t MAX_PRIMITIVES = 256;
|
||||
static const uint32_t TASK_GROUP_SIZE = 128;
|
||||
static const uint32_t TASK_GROUP_SIZE = 32;
|
||||
static const uint32_t MESH_GROUP_SIZE = 32;
|
||||
static const uint32_t MAX_MESHLETS_PER_INSTANCE = 2048;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user