summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/builtin_functions.cpp
diff options
context:
space:
mode:
authorMarc Di Luzio <[email protected]>2017-02-06 09:07:30 +0000
committerKenneth Graunke <[email protected]>2017-02-06 21:12:33 -0800
commit21efe2528cd88cb09ba9f69222f69a8ee47611c9 (patch)
tree0627dfc00868d730537c53b2d2841c9743983460 /src/compiler/glsl/builtin_functions.cpp
parent83fb63d31de51cd49a947f68393672e97b307f37 (diff)
glsl: correct compute shader checks for memoryBarrier functions
As per the spec - "The functions memoryBarrierShared() and groupMemoryBarrier() are available only in compute shaders; the other functions are available in all shader types." Conform to this by adding another delegate to check for compute shader support instead of only whether the current stage is compute This allows some fragment shaders in Dirt Rally to compile Cc: "17.0" <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/glsl/builtin_functions.cpp')
-rw-r--r--src/compiler/glsl/builtin_functions.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index b8f9d8fe8ac..e03a50c8438 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -558,6 +558,12 @@ compute_shader(const _mesa_glsl_parse_state *state)
}
static bool
+compute_shader_supported(const _mesa_glsl_parse_state *state)
+{
+ return state->has_compute_shader();
+}
+
+static bool
buffer_atomics_supported(const _mesa_glsl_parse_state *state)
{
return compute_shader(state) || shader_storage_buffer_object(state);
@@ -1133,15 +1139,15 @@ builtin_builder::create_intrinsics()
ir_intrinsic_group_memory_barrier),
NULL);
add_function("__intrinsic_memory_barrier_atomic_counter",
- _memory_barrier_intrinsic(compute_shader,
+ _memory_barrier_intrinsic(compute_shader_supported,
ir_intrinsic_memory_barrier_atomic_counter),
NULL);
add_function("__intrinsic_memory_barrier_buffer",
- _memory_barrier_intrinsic(compute_shader,
+ _memory_barrier_intrinsic(compute_shader_supported,
ir_intrinsic_memory_barrier_buffer),
NULL);
add_function("__intrinsic_memory_barrier_image",
- _memory_barrier_intrinsic(compute_shader,
+ _memory_barrier_intrinsic(compute_shader_supported,
ir_intrinsic_memory_barrier_image),
NULL);
add_function("__intrinsic_memory_barrier_shared",
@@ -3070,15 +3076,15 @@ builtin_builder::create_builtins()
NULL);
add_function("memoryBarrierAtomicCounter",
_memory_barrier("__intrinsic_memory_barrier_atomic_counter",
- compute_shader),
+ compute_shader_supported),
NULL);
add_function("memoryBarrierBuffer",
_memory_barrier("__intrinsic_memory_barrier_buffer",
- compute_shader),
+ compute_shader_supported),
NULL);
add_function("memoryBarrierImage",
_memory_barrier("__intrinsic_memory_barrier_image",
- compute_shader),
+ compute_shader_supported),
NULL);
add_function("memoryBarrierShared",
_memory_barrier("__intrinsic_memory_barrier_shared",