dawn-cmake/test/tint/bug/chromium/1430309.wgsl.expected.msl
Ben Clayton 47dd30117d tint/resolver: Resolve builtin structs
Allow the resolver to understand builtin structures, like
__frexp_result_f16. This allows backend transforms to declare the types,
even if they're "untypable" by the user.

Bug: chromium:1430309
Change-Id: I392709118182a058f737ccf1b7b46fc6b0b7264d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129482
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-04-26 18:27:53 +00:00

35 lines
801 B
Plaintext

#include <metal_stdlib>
using namespace metal;
struct frexp_result_f32_1 {
float fract;
int exp;
};
struct frexp_result_f32 {
float f;
};
struct tint_private_vars_struct {
frexp_result_f32 a;
frexp_result_f32_1 b;
};
struct tint_symbol_1 {
float4 value [[color(0)]];
};
float4 tint_symbol_inner(thread tint_private_vars_struct* const tint_private_vars) {
return float4((*(tint_private_vars)).a.f, (*(tint_private_vars)).b.fract, 0.0f, 0.0f);
}
fragment tint_symbol_1 tint_symbol() {
thread tint_private_vars_struct tint_private_vars = {};
tint_private_vars.b = frexp_result_f32_1{.fract=0.5f, .exp=1};
float4 const inner_result = tint_symbol_inner(&(tint_private_vars));
tint_symbol_1 wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}