mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-10 04:20:06 +00:00
bf56773517
refs: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_shader_atomic_counter_ops.txt Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
28 lines
787 B
GLSL
28 lines
787 B
GLSL
#version 450 core
|
|
#extension GL_ARB_shader_atomic_counters: enable
|
|
#extension GL_ARB_shader_atomic_counter_ops:enable
|
|
|
|
layout(binding = 0) uniform atomic_uint counter;
|
|
|
|
out highp vec4 vsColor;
|
|
|
|
void main(){
|
|
vec4 outColor = vec4(1.0);
|
|
uint ret;
|
|
|
|
ret = atomicCounterAddARB(counter, 4u);
|
|
ret = atomicCounterSubtractARB(counter, 4u);
|
|
ret = atomicCounterMinARB(counter, 4u);
|
|
ret = atomicCounterMaxARB(counter, 4u);
|
|
ret = atomicCounterAndARB(counter, 4u);
|
|
ret = atomicCounterOrARB(counter, 4u);
|
|
ret = atomicCounterXorARB(counter, 4u);
|
|
ret = atomicCounterExchangeARB(counter, 4u);
|
|
ret = atomicCounterCompSwapARB(counter, 4u, 4u);
|
|
|
|
uint after = atomicCounter(counter);
|
|
if (after == ret)
|
|
outColor = vec4(0.0);
|
|
|
|
vsColor = outColor;
|
|
} |