mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-13 08:36:08 +00:00
Add a transform that pushes these into the entry point and then passes them by pointer to any functions that need them. Since WGSL does not allow non-function storage class at function-scope, add a DisableValidation attribute to bypass this check. Fixed: tint/726 Change-Id: Ic1f4cd691a54c19e77a60e8ba178508e4249bfd9 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51962 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com> Auto-Submit: James Price <jrprice@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
58 lines
1.2 KiB
Plaintext
58 lines
1.2 KiB
Plaintext
#include <metal_stdlib>
|
|
|
|
using namespace metal;
|
|
void uses_a(thread int* const tint_symbol) {
|
|
*(tint_symbol) = (*(tint_symbol) + 1);
|
|
}
|
|
|
|
void uses_b(thread int* const tint_symbol_1) {
|
|
*(tint_symbol_1) = (*(tint_symbol_1) * 2);
|
|
}
|
|
|
|
void uses_a_and_b(thread int* const tint_symbol_2, thread int* const tint_symbol_3) {
|
|
*(tint_symbol_2) = *(tint_symbol_3);
|
|
}
|
|
|
|
void no_uses() {
|
|
}
|
|
|
|
void outer(thread int* const tint_symbol_4, thread int* const tint_symbol_5) {
|
|
*(tint_symbol_4) = 0;
|
|
uses_a(tint_symbol_4);
|
|
uses_a_and_b(tint_symbol_5, tint_symbol_4);
|
|
uses_b(tint_symbol_5);
|
|
no_uses();
|
|
}
|
|
|
|
kernel void main1() {
|
|
thread int tint_symbol_7 = 0;
|
|
thread int* const tint_symbol_6 = &(tint_symbol_7);
|
|
*(tint_symbol_6) = 42;
|
|
uses_a(tint_symbol_6);
|
|
return;
|
|
}
|
|
|
|
kernel void main2() {
|
|
thread int tint_symbol_9 = 0;
|
|
thread int* const tint_symbol_8 = &(tint_symbol_9);
|
|
*(tint_symbol_8) = 7;
|
|
uses_b(tint_symbol_8);
|
|
return;
|
|
}
|
|
|
|
kernel void main3() {
|
|
thread int tint_symbol_11 = 0;
|
|
thread int* const tint_symbol_10 = &(tint_symbol_11);
|
|
thread int tint_symbol_13 = 0;
|
|
thread int* const tint_symbol_12 = &(tint_symbol_13);
|
|
outer(tint_symbol_10, tint_symbol_12);
|
|
no_uses();
|
|
return;
|
|
}
|
|
|
|
kernel void main4() {
|
|
no_uses();
|
|
return;
|
|
}
|
|
|