mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 05:57:51 +00:00
Add transform/WrapArraysInStructs
And replace the MSL writer's logic to do this with the transform. We need to do the same thing in HLSL, and in the future GLSL too. Partially reverts fbfde720 Change-Id: Ie280e011bc3ded8e15ccacc0aeb12da3c2407389 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54242 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper_0 {
|
||||
int array[2];
|
||||
struct tint_array_wrapper {
|
||||
int arr[2];
|
||||
};
|
||||
|
||||
void foo() {
|
||||
tint_array_wrapper_0 tint_symbol = {0};
|
||||
tint_array_wrapper_0 implict = {0};
|
||||
tint_array_wrapper tint_symbol = {};
|
||||
tint_array_wrapper implict = {};
|
||||
implict = tint_symbol;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,20 +9,20 @@ struct tint_symbol_2 {
|
||||
float4 color [[user(locn0)]];
|
||||
float4 Position [[position]];
|
||||
};
|
||||
struct tint_array_wrapper_0 {
|
||||
float2 array[4];
|
||||
struct tint_array_wrapper {
|
||||
float2 arr[4];
|
||||
};
|
||||
struct tint_array_wrapper_1 {
|
||||
float4 array[4];
|
||||
float4 arr[4];
|
||||
};
|
||||
|
||||
vertex tint_symbol_2 tint_symbol(uint VertexIndex [[vertex_id]], uint InstanceIndex [[instance_id]]) {
|
||||
tint_array_wrapper_0 const zv = {float2(0.200000003f, 0.200000003f), float2(0.300000012f, 0.300000012f), float2(-0.100000001f, -0.100000001f), float2(1.100000024f, 1.100000024f)};
|
||||
float const z = zv.array[InstanceIndex].x;
|
||||
tint_array_wrapper const zv = {.arr={float2(0.200000003f, 0.200000003f), float2(0.300000012f, 0.300000012f), float2(-0.100000001f, -0.100000001f), float2(1.100000024f, 1.100000024f)}};
|
||||
float const z = zv.arr[InstanceIndex].x;
|
||||
Output output = {};
|
||||
output.Position = float4(0.5f, 0.5f, z, 1.0f);
|
||||
tint_array_wrapper_1 const colors = {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.array[InstanceIndex];
|
||||
tint_array_wrapper_1 const colors = {.arr={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.arr[InstanceIndex];
|
||||
tint_symbol_2 const tint_symbol_3 = {.color=output.color, .Position=output.Position};
|
||||
return tint_symbol_3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user