| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- // Hit information, aka ray payload
- // This sample only carries a shading color and hit distance.
- // Note that the payload should be kept as small as possible,
- // and that its size must be declared in the corresponding
- // D3D12_RAYTRACING_SHADER_CONFIG pipeline subobjet.
- #pragma pack_matrix(row_major)
- #define MAX_TRANSPACENT_HITS 5
- struct [raypayload] HitInfo
- {
- float4 color[MAX_TRANSPACENT_HITS] : write(caller, closesthit, anyhit, miss) : read(caller, anyhit, closesthit, miss);
- float distance[MAX_TRANSPACENT_HITS] : write(caller, closesthit, anyhit) : read(caller, anyhit, closesthit);
- uint hitCount : write(caller, anyhit, closesthit, miss) : read(caller, anyhit, closesthit, miss);
- };
- // Attributes output by the raytracing when hitting a surface,
- // here the barycentric coordinates
- struct Attributes
- {
- float2 bary;
- };
- // global root signature resources
- Texture2D<float4> textures[] : register(t0, space1);
- SamplerState gSampler : register(s0, space0);
- // Raytracing output texture, accessed as a UAV
- RWTexture2D<float4> gOutput : register(u0);
- RWTexture2D<float4> guiTexture : register(u1);
- // Raytracing acceleration structure, accessed as a SRV
- RaytracingAccelerationStructure TLAS : register(t0, space0);
- cbuffer RayGenerationSettings : register(b0)
- {
- int renderGui;
- int useRays;
- float minDistance;
- float maxDistance;
- float4x4 inverseView;
- float4x4 inverseProjection;
- }
|