Starts but segfaults sometimes, yay
This commit is contained in:
@@ -18,16 +18,16 @@ struct VertexStageOutput
|
||||
{
|
||||
ShaderAttributeInterpolation shaderAttributeInterpolation : Interpolation;
|
||||
VertexValueCache cache : ShaderCache;
|
||||
float4 position : SV_Position;
|
||||
float4 position : SV_Position;
|
||||
};
|
||||
|
||||
[shader("vertex")]
|
||||
VertexStageOutput vertexMain(
|
||||
VertexShaderInput input)
|
||||
VertexShaderInput input)
|
||||
{
|
||||
VertexStageOutput output;
|
||||
VertexValueCache cache = input.getVertexCache();
|
||||
float3 worldPosition = input.getWorldPosition();
|
||||
float3 worldPosition = input.getWorldPosition();
|
||||
worldPosition += gMaterial.getWorldOffset();
|
||||
float4 clipSpacePosition;
|
||||
|
||||
@@ -50,9 +50,9 @@ float4 fragmentMain(
|
||||
) : SV_Target
|
||||
{
|
||||
MaterialFragmentParameter materialParams = input.getMaterialParameter(position);
|
||||
TMaterial.BRDF brdf = gMaterial.prepare(materialParams);
|
||||
|
||||
float3 viewDir = normalize(materialParams.viewDir);
|
||||
TMaterial.BRDF brdf = gMaterial.prepare(materialParams);
|
||||
|
||||
float3 viewDir = normalize(materialParams.viewDir);
|
||||
|
||||
float3 result = float3(0, 0, 0);
|
||||
|
||||
@@ -61,15 +61,15 @@ float4 fragmentMain(
|
||||
result += directionalLights[i].illuminate(materialParams, brdf, viewDir);
|
||||
}
|
||||
|
||||
uint2 tileIndex = uint2(floor(position.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 = gridValue.x;
|
||||
uint lightCount = gridValue.y;
|
||||
|
||||
for (int j = 0; j < lightCount; ++j)
|
||||
{
|
||||
uint lightIndex = lightIndexList[startOffset + j];
|
||||
PointLight pointLight = pointLights[lightIndex];
|
||||
uint lightIndex = lightIndexList[startOffset + j];
|
||||
PointLight pointLight = pointLights[lightIndex];
|
||||
result += pointLight.illuminate(materialParams, brdf, viewDir);
|
||||
}
|
||||
return float4(result, 1);
|
||||
|
||||
Reference in New Issue
Block a user