diff options
| author | vimene <vincent.menegaux@gmail.com> | 2025-12-18 16:24:32 +0100 |
|---|---|---|
| committer | vimene <vincent.menegaux@gmail.com> | 2025-12-18 16:24:32 +0100 |
| commit | 0639c2e9a3e1a1ecf36a66a5f2dd844b772856db (patch) | |
| tree | 005f2d57fdfb3ddd3801d4478993ba1cfb72f088 /src/shaders/shader.slang | |
| parent | 79e2e5394e25a03022301f7e9c30ff256f2aaddc (diff) | |
| download | engine-0639c2e9a3e1a1ecf36a66a5f2dd844b772856db.tar.gz | |
added basic graphics pipeline and shaders
Diffstat (limited to 'src/shaders/shader.slang')
| -rw-r--r-- | src/shaders/shader.slang | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/shaders/shader.slang b/src/shaders/shader.slang new file mode 100644 index 0000000..b5f7a54 --- /dev/null +++ b/src/shaders/shader.slang @@ -0,0 +1,30 @@ +static float2 positions[3] = float2[] ( + float2( 0.0, -0.5), + float2( 0.5, 0.5), + float2(-0.5, 0.5), +); + +static float3 colors[3] = float3[] ( + float3(1.0, 0.0, 0.0), + float3(0.0, 1.0, 0.0), + float3(0.0, 0.0, 1.0), +); + +struct VertexOutput { + float3 color; + float4 sv_position : SV_Position; +}; + +[shader("vertex")] +VertexOutput vert_main(uint vid : SV_VertexID) { + VertexOutput output; + output.color = colors[vid]; + output.sv_position = float4(positions[vid], 0.0, 1.0); + return output; +} + +[shader("fragment")] +float4 frag_main(VertexOutput vert) : SV_Target { + float3 color = vert.color; + return float4(color, 1.0); +} |
