yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
de7ccaf12
master
1//TEST:SIMPLE(filecheck=CHECK): -target glsl -entry main 2 3// Test that we can find the correct unused descriptor set index when there is `ParameterBlock` in the shader. 4 5//CHECK: layout(binding = 2, set = 2) 6//CHECK-NEXT: uniform texture2D _slang_resource_heap 7 8struct VSInput{ 9 float3 position; 10} 11 12struct VSOutput{ 13 float4 position : SV_Position; 14} 15 16struct CameraData{ 17 float3 position; 18} 19 20ParameterBlock<CameraData> cameraData; 21 22 23struct Material{ 24 DescriptorHandle<Texture2D> texture; 25 DescriptorHandle<SamplerState> samplerState; 26} 27 28StructuredBuffer<Material> materials; 29 30struct FSOutput{ 31 float4 outColor : SV_Target0; 32} 33 34 35[shader("fragment")] 36FSOutput main(){ 37 FSOutput output; 38 output.outColor = materials[0].texture.Sample(materials[0].samplerState, float2(0)); 39 output.outColor.x *= cameraData.position.x; 40 return output; 41}