yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
ac8837413
master
1// graphics-smoke.slang 2 3// Per-vertex attributes to be assembled from bound vertex buffers. 4struct AssembledVertex 5{ 6 float3 positionA : POSITIONA; 7 float3 positionB : POSITIONB; 8 float3 color : COLOR; 9}; 10 11// Output of the vertex shader, and input to the fragment shader. 12struct CoarseVertex 13{ 14 float3 color; 15}; 16 17// Output of the fragment shader 18struct Fragment 19{ 20 float4 color; 21}; 22 23// Vertex Shader 24 25struct VertexStageOutput 26{ 27 CoarseVertex coarseVertex : CoarseVertex; 28 float4 sv_position : SV_Position; 29}; 30 31[shader("vertex")] 32VertexStageOutput vertexMain( 33 AssembledVertex assembledVertex) 34{ 35 VertexStageOutput output; 36 37 float3 position = assembledVertex.positionA + assembledVertex.positionB; 38 float3 color = assembledVertex.color; 39 40 output.coarseVertex.color = color; 41 output.sv_position = float4(position, 1.0); 42 43 return output; 44} 45 46// Fragment Shader 47 48[shader("fragment")] 49float4 fragmentMain( 50 CoarseVertex coarseVertex : CoarseVertex) : SV_Target 51{ 52 float3 color = coarseVertex.color; 53 54 return float4(color, 1.0); 55}