adding aftermath debugging and fixing forward plus
This commit is contained in:
@@ -56,22 +56,21 @@ float4 fragmentMain(
|
||||
|
||||
float3 result = float3(0, 0, 0);
|
||||
|
||||
for (int i = 0; i < gLightEnv[0].numDirectionalLights; i++)
|
||||
for (int i = 0; i < gLightEnv.numDirectionalLights; i++)
|
||||
{
|
||||
result += gLightEnv[0].directionalLights[i].illuminate(materialParams, brdf, viewDir);
|
||||
result += gLightEnv.directionalLights[i].illuminate(materialParams, brdf, viewDir);
|
||||
}
|
||||
|
||||
uint2 tileIndex = uint2(floor(materialParams.clipPosition.xy) / BLOCK_SIZE);
|
||||
uint2 tileIndex = uint2(floor(position.xy / BLOCK_SIZE));
|
||||
uint2 gridValue = lightGrid[tileIndex];
|
||||
uint startOffset = gridValue.x;
|
||||
uint lightCount = gridValue.y;
|
||||
|
||||
uint startOffset = lightGrid[tileIndex].x;
|
||||
uint lightCount = lightGrid[tileIndex].y;
|
||||
|
||||
for (int j = 0; j < gLightEnv[0].numPointLights; ++j)
|
||||
for (int j = 0; j < lightCount; ++j)
|
||||
{
|
||||
uint lightIndex = lightIndexList[startOffset + j];
|
||||
PointLight pointLight = gLightEnv[0].pointLights[lightIndex];
|
||||
PointLight pointLight = gLightEnv.pointLights[lightIndex];
|
||||
result += pointLight.illuminate(materialParams, brdf, viewDir);
|
||||
}
|
||||
|
||||
return float4(result, 0);
|
||||
return float4(result, 1);
|
||||
}
|
||||
|
||||
@@ -102,16 +102,11 @@ void cullLights(ComputeShaderInput in)
|
||||
|
||||
Plane minPlane = {float3(0, 0, -1), -minDepthVS};
|
||||
|
||||
for ( uint i = in.groupIndex; i < gLightEnv[0].numPointLights; i += BLOCK_SIZE * BLOCK_SIZE )
|
||||
for ( uint i = in.groupIndex; i < gLightEnv.numPointLights; i += BLOCK_SIZE * BLOCK_SIZE )
|
||||
{
|
||||
PointLight light = gLightEnv[0].pointLights[i];
|
||||
PointLight light = gLightEnv.pointLights[i];
|
||||
//if(gLightEnv.insideFrustum(groupFrustum, nearClipVS, maxDepthVS))
|
||||
{
|
||||
//InterlockedAdd(tLightCount, 1, index);
|
||||
//if(index < 1024)
|
||||
//{
|
||||
// tLightList[index] = i;
|
||||
//}
|
||||
//if(!light.insidePlane(minPlane))
|
||||
//{
|
||||
oAppendLight(i);
|
||||
@@ -131,15 +126,11 @@ void cullLights(ComputeShaderInput in)
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
if(in.groupIndex == 0)
|
||||
{
|
||||
for (uint j = 0; j < (uint)oLightCount; j += 1/*BLOCK_SIZE * BLOCK_SIZE*/)
|
||||
{
|
||||
oLightIndexList[oLightIndexStartOffset + j] = oLightList[j];
|
||||
}
|
||||
}
|
||||
for (uint j = in.groupIndex; j < (uint)oLightCount; j += BLOCK_SIZE * BLOCK_SIZE)
|
||||
{
|
||||
oLightIndexList[oLightIndexStartOffset + j] = oLightList[j];
|
||||
}
|
||||
|
||||
|
||||
// For transparent geometry.
|
||||
for ( uint k = in.groupIndex; k < (uint)tLightCount; k += BLOCK_SIZE * BLOCK_SIZE )
|
||||
{
|
||||
|
||||
@@ -7,8 +7,8 @@ struct ViewParameter
|
||||
float4x4 viewMatrix;
|
||||
float4x4 projectionMatrix;
|
||||
float4x4 inverseProjection;
|
||||
float2 screenDimensions;
|
||||
float4 cameraPos_WS;
|
||||
float2 screenDimensions;
|
||||
}
|
||||
layout(set = INDEX_VIEW_PARAMS, binding = 0, std430)
|
||||
ConstantBuffer<ViewParameter> gViewParams;
|
||||
|
||||
@@ -69,4 +69,4 @@ struct Lights
|
||||
};
|
||||
|
||||
layout(set = INDEX_LIGHT_ENV, binding = 0, std430)
|
||||
StructuredBuffer<Lights> gLightEnv;
|
||||
ConstantBuffer<Lights> gLightEnv;
|
||||
|
||||
Reference in New Issue
Block a user