Added HLSL shaders for ray tracing callable sample
Minor cleanup
This commit is contained in:
parent
35288a6f2b
commit
5db9781d52
14 changed files with 168 additions and 63 deletions
26
data/shaders/hlsl/raytracingcallable/closesthit.rchit
Normal file
26
data/shaders/hlsl/raytracingcallable/closesthit.rchit
Normal 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue