mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-14 09:06:11 +00:00
Also fixed implementation of this atomic in GLSL. It was emitting code that would not compile because, as for HLSL, we must pass in the variable directly to atomic funcs, not via an in/out arg to a function. Bug: tint:1185 Change-Id: Id0e9f99d6368717511ef3a94473634c512e10cb8 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91881 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
63 lines
1.3 KiB
GLSL
63 lines
1.3 KiB
GLSL
#version 310 es
|
|
precision mediump float;
|
|
|
|
struct atomic_compare_exchange_resulti32 {
|
|
int old_value;
|
|
bool exchanged;
|
|
};
|
|
|
|
|
|
struct SB_RW {
|
|
int arg_0;
|
|
};
|
|
|
|
layout(binding = 0, std430) buffer SB_RW_1 {
|
|
int arg_0;
|
|
} sb_rw;
|
|
void atomicCompareExchangeWeak_1bd40a() {
|
|
atomic_compare_exchange_resulti32 atomic_compare_result;
|
|
atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1, 1);
|
|
atomic_compare_result.exchanged = atomic_compare_result.old_value == 1;
|
|
atomic_compare_exchange_resulti32 res = atomic_compare_result;
|
|
}
|
|
|
|
void fragment_main() {
|
|
atomicCompareExchangeWeak_1bd40a();
|
|
}
|
|
|
|
void main() {
|
|
fragment_main();
|
|
return;
|
|
}
|
|
#version 310 es
|
|
|
|
struct atomic_compare_exchange_resulti32 {
|
|
int old_value;
|
|
bool exchanged;
|
|
};
|
|
|
|
|
|
struct SB_RW {
|
|
int arg_0;
|
|
};
|
|
|
|
layout(binding = 0, std430) buffer SB_RW_1 {
|
|
int arg_0;
|
|
} sb_rw;
|
|
void atomicCompareExchangeWeak_1bd40a() {
|
|
atomic_compare_exchange_resulti32 atomic_compare_result;
|
|
atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1, 1);
|
|
atomic_compare_result.exchanged = atomic_compare_result.old_value == 1;
|
|
atomic_compare_exchange_resulti32 res = atomic_compare_result;
|
|
}
|
|
|
|
void compute_main() {
|
|
atomicCompareExchangeWeak_1bd40a();
|
|
}
|
|
|
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
|
void main() {
|
|
compute_main();
|
|
return;
|
|
}
|