diff options
| author | HampusM <hampus@hampusmat.com> | 2026-06-05 21:50:56 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-06-05 21:50:56 +0200 |
| commit | e5d67bf7e36671d290b19064f58bc11616c05b8b (patch) | |
| tree | a529b876e4198bb470113837bfd6dca3fda3409e /engine/res/imgui_shader.slang | |
| parent | 87015a4abcd45d6c69b289467c9e37426e1f0930 (diff) | |
Diffstat (limited to 'engine/res/imgui_shader.slang')
| -rw-r--r-- | engine/res/imgui_shader.slang | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/engine/res/imgui_shader.slang b/engine/res/imgui_shader.slang new file mode 100644 index 0000000..6ce51d6 --- /dev/null +++ b/engine/res/imgui_shader.slang @@ -0,0 +1,54 @@ +struct Vertex +{ + float3 pos; + float4 color; + float2 texture_coords; +}; + +struct VertexData +{ + float4 color; + float2 texture_coords; +}; + +struct VertexStageOutput +{ + VertexData vertex_data : VertexData; + float4 sv_position : SV_Position; +}; + +struct Fragment +{ + float4 color; +}; + +cbuffer Uniforms +{ + float4x4 projection; +}; + +Sampler2D main_texture; + +[shader("vertex")] +VertexStageOutput vertex_main(Vertex vertex: VERTEX) +{ + VertexStageOutput stage_output; + + stage_output.sv_position = mul(projection, float4(vertex.pos.xy, 0.f, 1.f)); + + stage_output.vertex_data.color = vertex.color; + stage_output.vertex_data.texture_coords = vertex.texture_coords; + + return stage_output; +} + +[shader("fragment")] +Fragment fragment_main(VertexData vertex_data: VertexData) : SV_Target +{ + Fragment fragment; + + fragment.color = vertex_data.color * main_texture.Sample(vertex_data.texture_coords); + + return fragment; +} + |
