Skip to main content

RT_TYPES

Constant RT_TYPES 

Source
pub const RT_TYPES: &str = "// The CPU-visible records the ray-traced passes bind, spliced into a shader at\n// its RT_TYPES marker (see slang_source.rs). Declares no resource and no entry\n// point: the records have to exist before a shader\'s bindings name them, while\n// the traversal that reads them (RT_TRACE) comes after. Nothing here may spell\n// either marker -- the splice would reintroduce it.\n\n// Layout matches `RtParams` in render_types.rs (144 B).\nstruct RtParams\n{\n    float intensity;\n    float max_distance;\n    float tan_half_fov_y;\n    float aspect;\n    // IBL prefilter cubemap mip count; 0 means no EnvironmentMap is bound.\n    float prefilter_mip_count;\n    float _pad0;\n    float _pad1;\n    float _pad2;\n    // float4 rather than float3 + scalar: MSL sizes a constant-buffer float3 at\n    // 16 bytes, so only the padded form matches the CPU layout on every target.\n    float4 cam_pos;    // xyz: world camera position\n    float4 sun_dir;    // xyz: world unit direction toward the sun (= L)\n    float4 sun_color;  // xyz: sun radiance\n    float4x4 inv_view; // camera-to-world\n};\n\n// One traced instance\'s geometry range + material, indexed by the hit\'s\n// instance index. Scalar `tint` / `emissive` components rather than float3\n// fields, so the offsets match the 128-byte `#[repr(C)]` `RtGeomEntry` on every\n// target: a float3 would be 16-byte aligned and shift `model`, which faults the\n// trace rather than merely shading it wrong.\nstruct RtGeomEntry\n{\n    uint index_offset;  // element offset of this object\'s first index\n    uint base_vertex;   // added to each fetched index\n    uint albedo_index;  // bindless albedo pool index\n    uint normal_index;  // bindless normal-map index, RT_SKINNED_FLAG in bit 31\n    float tint_r;\n    float tint_g;\n    float tint_b;\n    float roughness;\n    float metallic;\n    float emissive_r;\n    float emissive_g;\n    float emissive_b;\n    float4x4 model;          // object-to-world\n    uint emissive_map_index; // bindless emissive-map index (0 = none)\n    uint _pad0;\n    uint _pad1;\n    uint _pad2;\n};\n";
Expand description

rt_types.slang.