mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-05 11:45:54 +00:00
Metal 1.x does not support swizzling on packed_vec types. Use array-index for single element selection (permitted on LHS and RHS of assignment) Cast the packed_vec to a vec for multiple element swizzles (not permitted as the LHS of an assignment). Fixed: tint:1249 Change-Id: I70cbb0c22a935b06b3905d24484bdc2edfb95fc2 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67060 Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Ben Clayton <bclayton@google.com> Reviewed-by: James Price <jrprice@google.com>
37 lines
1.2 KiB
Plaintext
37 lines
1.2 KiB
Plaintext
#include <metal_stdlib>
|
|
|
|
using namespace metal;
|
|
struct Output {
|
|
float4 Position;
|
|
float4 color;
|
|
};
|
|
struct tint_symbol_1 {
|
|
float4 color [[user(locn0)]];
|
|
float4 Position [[position]];
|
|
};
|
|
struct tint_array_wrapper {
|
|
float2 arr[4];
|
|
};
|
|
struct tint_array_wrapper_1 {
|
|
float4 arr[4];
|
|
};
|
|
|
|
Output tint_symbol_inner(uint VertexIndex, uint InstanceIndex) {
|
|
tint_array_wrapper 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][0];
|
|
Output output = {};
|
|
output.Position = float4(0.5f, 0.5f, z, 1.0f);
|
|
tint_array_wrapper_1 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];
|
|
return output;
|
|
}
|
|
|
|
vertex tint_symbol_1 tint_symbol(uint VertexIndex [[vertex_id]], uint InstanceIndex [[instance_id]]) {
|
|
Output const inner_result = tint_symbol_inner(VertexIndex, InstanceIndex);
|
|
tint_symbol_1 wrapper_result = {};
|
|
wrapper_result.Position = inner_result.Position;
|
|
wrapper_result.color = inner_result.color;
|
|
return wrapper_result;
|
|
}
|
|
|