[Mesa-dev] [PATCH] st/mesa: Don't set atomic counter size != 0 with atomic buffers == 0.

Eric Anholt eric at anholt.net
Wed Aug 1 23:07:45 UTC 2018


This is just asking for tests to get confused about the HW supporting
atomics in this shader stage or not, such as
dEQP-GLES31.functional.shaders.opaque_type_indexing.atomic_counter.const_expression_vertex.
---
 src/mesa/state_tracker/st_extensions.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index dbaf7f6f8fe5..cd17f026fed2 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -243,9 +243,10 @@ void st_init_limits(struct pipe_screen *screen,
          pc->MaxAtomicBuffers = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTER_BUFFERS);
          pc->MaxShaderStorageBlocks = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_SHADER_BUFFERS);
       } else {
-         pc->MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
          pc->MaxAtomicBuffers = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_SHADER_BUFFERS) / 2;
          pc->MaxShaderStorageBlocks = pc->MaxAtomicBuffers;
+         if (pc->MaxAtomicBuffers)
+            pc->MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
       }
       pc->MaxImageUniforms = screen->get_shader_param(
             screen, sh, PIPE_SHADER_CAP_MAX_SHADER_IMAGES);
-- 
2.18.0



More information about the mesa-dev mailing list