Adding a simple example demonstrating how to use SBT record data

This commit is contained in:
n8vm 2022-09-08 12:57:00 -06:00
parent d02a039188
commit 9e58ad5377
14 changed files with 1078 additions and 0 deletions

View file

@ -0,0 +1,27 @@
// Copyright 2020 Google LLC
struct Attribute
{
float2 attribs;
};
struct Payload
{
[[vk::location(0)]] float3 hitValue;
};
struct SBT {
float r;
float g;
float b;
};
[[vk::shader_record_ext]]
ConstantBuffer<SBT> sbt;
[shader("closesthit")]
void main(inout Payload p, in float2 attribs)
{
// Update the hit value to the hit record SBT data associated with this
// geometry ID and ray ID
p.hitValue = float3(sbt.r, sbt.g, sbt.g);
}