webgpu sponza
This commit is contained in:
parent
5553ded476
commit
b5d0f52da0
21 changed files with 1426 additions and 58 deletions
23
examples/Sponza/closesthit.glsl
Normal file
23
examples/Sponza/closesthit.glsl
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#version 460
|
||||
#extension GL_EXT_ray_tracing : enable
|
||||
#extension GL_EXT_shader_image_load_formatted : enable
|
||||
#extension GL_EXT_shader_explicit_arithmetic_types_int16 : enable
|
||||
#extension GL_EXT_descriptor_heap : enable
|
||||
#extension GL_EXT_nonuniform_qualifier : enable
|
||||
|
||||
// Specialization constant: descriptor-heap slot of the albedo texture.
|
||||
// Set from descriptorHeap.bufferStartElement + the slot allocated for
|
||||
// the Image2D<RGBA8> on the host side. Sampling uses gl_HitAttributeEXT
|
||||
// barycentrics as UVs — proof-of-binding rather than UV-correct shading.
|
||||
// Per-vertex UV interpolation lands when Mesh on Vulkan exposes the
|
||||
// data-region buffer.
|
||||
layout(constant_id = 0) const uint16_t albedoSlot = 0us;
|
||||
layout(descriptor_heap) uniform sampler2D albedo[];
|
||||
|
||||
hitAttributeEXT vec2 hitAttrs;
|
||||
layout(location = 0) rayPayloadInEXT vec3 hitValue;
|
||||
|
||||
void main() {
|
||||
vec2 bary = vec2(hitAttrs.x, hitAttrs.y);
|
||||
hitValue = texture(albedo[albedoSlot], bary).rgb;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue