Blaze/Triangle.slang

35 lines
771 B
Plaintext

const static float4 vertexPos[] = {
float4(0.0f, 0.5f, 0.5f, 1.0f),
float4(-0.5f, -0.5f, 0.5f, 1.0f),
float4(0.5f, -0.5f, 0.5f, 1.0f),
};
const static float4 vertexColors[] = {
float4(1.0f, 0.0f, 0.0f, 1.0f),
float4(0.0f, 1.0f, 0.0f, 1.0f),
float4(0.0f, 0.0f, 1.0f, 1.0f),
};
struct VertexOut {
float4 outPosition : SV_Position;
float4 vertexColor : CoarseColor;
};
[shader("vertex")]
VertexOut VertexMain(
uint vertexId: SV_VertexID
) {
VertexOut output;
output.outPosition = vertexPos[vertexId];
output.vertexColor = vertexColors[vertexId];
return output;
}
[shader("fragment")]
float4 FragmentMain(
float4 interpolatedColors: CoarseColor,
) : SV_Target0 {
return float4(interpolatedColors.rgb, 1.0f);
}