Added HLSL shaders for ray tracing callable sample

Minor cleanup
This commit is contained in:
Sascha Willems 2021-03-06 16:21:09 +01:00
parent 35288a6f2b
commit 5db9781d52
14 changed files with 168 additions and 63 deletions

View file

@ -0,0 +1,26 @@
// Copyright 2021 Sascha Willems
struct Attribute
{
float2 attribs;
};
struct Payload
{
[[vk::location(0)]] float3 hitValue;
};
struct CallData
{
float3 outColor;
};
[shader("closesthit")]
void main(inout Payload p, in float3 attribs)
{
// Execute the callable shader indexed by the current geometry being hit
// For our sample this means that the first callable shader in the SBT is invoked for the first triangle, the second callable shader for the second triangle, etc.
CallData callData;
CallShader(GeometryIndex(), callData);
p.hitValue = callData.outColor;
}