Finished first version of shader compiler. HLSL -> DXIL.

Submitting vertex and frag shader needed to display a triangle.
This commit is contained in:
2025-03-08 22:36:15 -05:00
parent f9f292b6d6
commit da203c80f3
27 changed files with 837 additions and 173 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,4 @@
float4 main(float4 Color : TEXCOORD0) : SV_Target0
{
return Color;
}

View File

@@ -0,0 +1,39 @@
struct Input
{
uint VertexIndex : SV_VertexID;
};
struct Output
{
float4 Color : TEXCOORD0;
float4 Position : SV_Position;
};
Output main(Input input)
{
Output output;
float2 pos;
if (input.VertexIndex == 0)
{
pos = (-1.0f).xx;
output.Color = float4(1.0f, 0.0f, 0.0f, 1.0f);
}
else
{
if (input.VertexIndex == 1)
{
pos = float2(1.0f, -1.0f);
output.Color = float4(0.0f, 1.0f, 0.0f, 1.0f);
}
else
{
if (input.VertexIndex == 2)
{
pos = float2(0.0f, 1.0f);
output.Color = float4(0.0f, 0.0f, 1.0f, 1.0f);
}
}
}
output.Position = float4(pos, 0.0f, 1.0f);
return output;
}