procedural-3d-engine/shaders/hlsl/raytracingcallable/closesthit.rchit
Sascha Willems 66dce3c991 Fixed HLSL shaders (mostly ray tracing related)
Updated HLSL compile script
2023-10-13 17:26:51 +02:00

26 lines
587 B
GLSL

// Copyright 2021-2023 Sascha Willems
struct Payload
{
[[vk::location(0)]] float3 hitValue;
};
struct CallData
{
float3 outColor;
};
struct Attributes
{
float2 bary;
};
[shader("closesthit")]
void main(inout Payload p, in Attributes 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;
}