yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
e0b912575
master
1// vk-sampler-getdimension.slang 2 3//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry main -stage fragment -emit-spirv-directly 4 5// Input to the fragment shader. 6struct PSin 7{ 8 float3 position : POSITION; 9}; 10 11// Output of the fragment shader 12struct PSout 13{ 14 float4 color : SV_Target; 15}; 16 17[[vk::binding(1)]] Sampler3D g_Volume; 18 19// Fragment Shader 20[shader("pixel")] 21PSout main(PSin stage, bool isFrontFacing : SV_IsFrontFace) 22{ 23 // CHECK: %image{{.*}} = OpImage 24 // CHECK: OpImageQuerySizeLod %{{.*}} %image{{.*}} %uint_1 25 PSout output; 26 // Find normal at position 27 uint3 dim; 28 uint levels; 29 g_Volume.GetDimensions(1, dim.x, dim.y, dim.z, levels); 30 output.color = g_Volume.Sample(float3(dim)); 31 32 return output; 33}