More light culling changes

This commit is contained in:
Dynamitos
2024-02-02 11:39:40 +01:00
parent 829c4937c0
commit 97d96a6bc1
2 changed files with 13 additions and 8 deletions
+4 -3
View File
@@ -11,7 +11,7 @@ struct ComputeShaderInput
};
struct CullingParams
{
Texture2D depthTextureVS;
Texture2D depthTexture;
globallycoherent RWStructuredBuffer<uint> oLightIndexCounter;
globallycoherent RWStructuredBuffer<uint> tLightIndexCounter;
@@ -67,7 +67,7 @@ void tAppendLight(uint lightIndex)
void cullLights(ComputeShaderInput in)
{
int2 texCoord = int2(in.dispatchThreadID.xy);
float fDepth = pCullingParams.depthTextureVS.Load(int3(texCoord, 0)).r;
float fDepth = pCullingParams.depthTexture.Load(int3(texCoord, 0)).r;
uint uDepth = asuint(fDepth);
if(in.groupIndex == 0)
@@ -98,8 +98,9 @@ void cullLights(ComputeShaderInput in)
for ( uint i = in.groupIndex; i < pLightEnv.numPointLights; i += BLOCK_SIZE * BLOCK_SIZE )
{
PointLight light = pLightEnv.pointLights[i];
light.updatePosition();
//TODO: why doesn't this check go through?
if(light.insideFrustum(groupFrustum, nearClipVS))
if(light.insideFrustum(groupFrustum, nearClipVS, maxDepthVS))
{
tAppendLight(i);
if(!light.insidePlane(minPlane))