https://github.com/shader-slang/slang
Raw File
Tip revision: adb1131d08f28f0bc5f729e88b73cf22846c86c5 authored by Tim Foley on 05 February 2021, 17:01:36 UTC
Initial implementation of interface conjunctions (#1691)
Tip revision: adb1131
closesthit.slang.glsl
// closesthit.slang.glsl
#version 460
#extension GL_NV_ray_tracing : require

#define tmp_shaderrecord    _S1
#define tmp_colors          _S2
#define tmp_hitattrs        _S3
#define tmp_payload         _S4
#define tmp_customidx       _S5
#define tmp_instanceid      _S6
#define tmp_add_0           _S7
#define tmp_primid          _S8
#define tmp_add_1           _S9
#define tmp_hitkind         _S10
#define tmp_hitt            _S11
#define tmp_tmin            _S12

struct SLANG_ParameterGroup_ShaderRecord_0
{
    uint shaderRecordID_0;    
};

layout(shaderRecordNV)
buffer tmp_shaderrecord
{
    SLANG_ParameterGroup_ShaderRecord_0 _data;
} ShaderRecord_0;

layout(std430, binding = 0) readonly buffer tmp_colors
{
    vec4 _data[];
} colors_0;
 
struct BuiltInTriangleIntersectionAttributes_0
{
    vec2 barycentrics_0;
};


hitAttributeNV BuiltInTriangleIntersectionAttributes_0 tmp_hitattrs;

struct ReflectionRay_0
{
    vec4 color_0;
};

rayPayloadInNV ReflectionRay_0 tmp_payload;

void main()
{
    uint tmp_customidx = gl_InstanceCustomIndexNV;
    uint tmp_instanceid = gl_InstanceID;

    uint tmp_add_0 = tmp_customidx + tmp_instanceid;
    uint tmp_primid = gl_PrimitiveID;

    uint tmp_add_1 = tmp_add_0 + tmp_primid;
    uint tmp_hitkind = gl_HitKindNV;

    vec4 color_1 = colors_0._data[tmp_add_1 + tmp_hitkind + ShaderRecord_0._data.shaderRecordID_0];

    float tmp_hitt = gl_RayTmaxNV;
    float tmp_tmin = gl_RayTminNV;

    tmp_payload.color_0 = color_1 * (tmp_hitt - tmp_tmin);

    return;
}

back to top