Crafter.Graphics/examples/SponzaBench/closesthit.glsl

19 lines
715 B
Text
Raw Permalink Normal View History

2026-07-22 18:09:06 +02:00
//SPDX-License-Identifier: MIT
//SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
#version 460
#extension GL_EXT_ray_tracing : enable
// Benchmark closest-hit: shade from the hit's barycentric coordinates.
// SponzaBench deliberately avoids the descriptor-heap texture sample the
// interactive Sponza example uses — the point here is to measure the
// ray-tracing traversal + frame-loop cost, not texturing, and a
// texture-free hit keeps the host setup portable across library
// revisions (issue #155).
hitAttributeEXT vec2 hitAttrs;
layout(location = 0) rayPayloadInEXT vec3 hitValue;
void main() {
vec3 bary = vec3(1.0 - hitAttrs.x - hitAttrs.y, hitAttrs.x, hitAttrs.y);
hitValue = bary;
}