diff options
| author | vimene <vincent.menegaux@gmail.com> | 2025-12-22 23:09:30 +0100 |
|---|---|---|
| committer | vimene <vincent.menegaux@gmail.com> | 2025-12-22 23:09:30 +0100 |
| commit | 236b6a3160cd3d8c217a966aaa2795c779c13a91 (patch) | |
| tree | c11909bd95668a105180d3926333eb081dabee72 /src/shaders/shader.slang | |
| parent | a90d440e5e02712a9718d3cb30fcc31687439893 (diff) | |
| download | engine-236b6a3160cd3d8c217a966aaa2795c779c13a91.tar.gz | |
added {vertex,index} buffers
Diffstat (limited to 'src/shaders/shader.slang')
| -rw-r--r-- | src/shaders/shader.slang | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/src/shaders/shader.slang b/src/shaders/shader.slang index b5f7a54..37041c6 100644 --- a/src/shaders/shader.slang +++ b/src/shaders/shader.slang @@ -1,30 +1,22 @@ -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 VertexInput { + float2 pos; + float3 col; +}; struct VertexOutput { - float3 color; - float4 sv_position : SV_Position; + float4 pos : SV_Position; + float3 col; }; [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; +VertexOutput vert_main(VertexInput vi) { + VertexOutput vo; + vo.pos = float4(vi.pos, 0., 1.); + vo.col = vi.col; + return vo; } [shader("fragment")] -float4 frag_main(VertexOutput vert) : SV_Target { - float3 color = vert.color; - return float4(color, 1.0); +float4 frag_main(VertexOutput vo) : SV_Target { + return float4(vo.col, 1.); } |
