yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f4d5372d3
master
1//TEST(smoke):COMPARE_HLSL_RENDER: 2// TODO: Investigate Metal failure 3//DISABLE_TEST(smoke):COMPARE_HLSL_RENDER: -mtl 4 5// Confirm that the `nointerpolation` modifier 6// makes it through Slang codegen with the 7// same effect as for HLSL. 8 9cbuffer Uniforms 10{ 11float4x4 modelViewProjection ; 12} 13 14struct AssembledVertex 15{ 16float3 position ; 17float3 color ; 18}; 19 20struct CoarseVertex 21{ 22 nointerpolationfloat3 color ; 23}; 24 25struct Fragment 26{ 27float4 color ; 28}; 29 30 31// Vertex Shader 32 33struct VertexStageInput 34{ 35AssembledVertex assembledVertex : A ; 36}; 37 38struct VertexStageOutput 39{ 40CoarseVertex coarseVertex : CoarseVertex ; 41float4 sv_position : SV_Position ; 42}; 43 44[ shader ( "vertex" )] 45VertexStageOutput vertexMain ( VertexStageInput input ) 46{ 47VertexStageOutput output ; 48 49float3 position = input . assembledVertex . position ; 50float3 color = input . assembledVertex . color ; 51 52output . coarseVertex . color = color ; 53output . sv_position = mul ( modelViewProjection , float4 ( position , 1.0 )); 54 55return output ; 56} 57 58// Fragment Shader 59 60struct FragmentStageInput 61{ 62CoarseVertex coarseVertex : CoarseVertex ; 63}; 64 65struct FragmentStageOutput 66{ 67Fragment fragment : SV_Target ; 68}; 69 70[ shader ( "fragment" )] 71FragmentStageOutput fragmentMain ( FragmentStageInput input ) 72{ 73FragmentStageOutput output ; 74 75float3 color = input . coarseVertex . color ; 76 77output . fragment . color = float4 ( color , 1.0 ); 78 79return output ; 80} 81