Fixed ray tracing callable shader sample HLSL shaders

This commit is contained in:
Sascha Willems 2021-10-18 22:01:07 +02:00
parent f00568f482
commit 1c6c08d41f
6 changed files with 9 additions and 7 deletions

View file

@ -2,13 +2,14 @@
struct CallData struct CallData
{ {
vec3 outColor; float3 outColor;
}; };
[shader("callable")] [shader("callable")]
void main(inout CallData data) void main(inout CallData data)
{ {
// Generate a checker board pattern // Generate a checker board pattern
float2 pos = float2(DispatchRaysIndex() / 8); float2 pos = float2(DispatchRaysIndex().x / 8, DispatchRaysIndex().y / 8);
data.outColor = float3(mod(pos.x + mod(pos.y, 2.0), 2.0)); float col = (pos.x + (pos.y % 2.0)) % 2.0;
data.outColor = float3(col, col, col);
} }

View file

@ -2,7 +2,7 @@
struct CallData struct CallData
{ {
vec3 outColor; float3 outColor;
}; };
[shader("callable")] [shader("callable")]

View file

@ -2,13 +2,14 @@
struct CallData struct CallData
{ {
vec3 outColor; float3 outColor;
}; };
[shader("callable")] [shader("callable")]
void main(inout CallData data) void main(inout CallData data)
{ {
// Generate a checker board pattern // Generate a checker board pattern
float2 pos = float2(DispatchRaysIndex() / 8); float2 pos = float2(DispatchRaysIndex().x / 8, DispatchRaysIndex().y / 8);
data.outColor = float3(mod(pos.y, 2.0)); float col = pos.y % 2.0;
data.outColor = float3(col, col, col);
} }