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