mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-05 03:35:56 +00:00
FXC has trouble dealing with these. This was originally added to handle returning arrays as structures. HLSL supports typedefs, which is a much simpiler solution, and doesn't upset FXC. Bug: tint:848 Bug: tint:904 Change-Id: Ie841c9c454461a885a35c41476fd4d05d3f34cbf Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56774 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
26 lines
966 B
HLSL
26 lines
966 B
HLSL
struct Output {
|
|
float4 Position;
|
|
float4 color;
|
|
};
|
|
struct tint_symbol_1 {
|
|
uint VertexIndex : SV_VertexID;
|
|
uint InstanceIndex : SV_InstanceID;
|
|
};
|
|
struct tint_symbol_2 {
|
|
float4 color : TEXCOORD0;
|
|
float4 Position : SV_Position;
|
|
};
|
|
|
|
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
|
const uint VertexIndex = tint_symbol.VertexIndex;
|
|
const uint InstanceIndex = tint_symbol.InstanceIndex;
|
|
float2 zv[4] = {float2(0.200000003f, 0.200000003f), float2(0.300000012f, 0.300000012f), float2(-0.100000001f, -0.100000001f), float2(1.100000024f, 1.100000024f)};
|
|
const float z = zv[InstanceIndex].x;
|
|
Output output = (Output)0;
|
|
output.Position = float4(0.5f, 0.5f, z, 1.0f);
|
|
float4 colors[4] = {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), float4(1.0f, 1.0f, 1.0f, 1.0f)};
|
|
output.color = colors[InstanceIndex];
|
|
const tint_symbol_2 tint_symbol_3 = {output.color, output.Position};
|
|
return tint_symbol_3;
|
|
}
|