dawn-cmake/test/bug/tint/827.wgsl.expected.msl
Ben Clayton 7103f51603 writer/msl: Fix swizzling on packed vectors
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>
2021-10-20 16:12:33 +00:00

18 lines
675 B
Plaintext

#include <metal_stdlib>
using namespace metal;
struct Result {
/* 0x0000 */ float values[1];
};
constant uint width = 128u;
void tint_symbol_inner(device Result& result, uint3 GlobalInvocationId, depth2d<float, access::sample> tint_symbol_1) {
result.values[((GlobalInvocationId[1] * width) + GlobalInvocationId[0])] = tint_symbol_1.read(uint2(int2(int(GlobalInvocationId[0]), int(GlobalInvocationId[1]))), 0);
}
kernel void tint_symbol(depth2d<float, access::sample> tint_symbol_2 [[texture(0)]], uint3 GlobalInvocationId [[thread_position_in_grid]], device Result& result [[buffer(0)]]) {
tint_symbol_inner(result, GlobalInvocationId, tint_symbol_2);
return;
}