Module: Mesa Branch: main Commit: 9674d968209c18d8b798706da1e87142dc566bd9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9674d968209c18d8b798706da1e87142dc566bd9
Author: Emma Anholt <[email protected]> Date: Thu Apr 7 12:02:43 2022 -0700 r600: Stop using ArrayID to look up atomic counters. Even if you find a matching array ID, you still need to offset by Index compared to .start, so the ArrayID lookup didn't help. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15824> --- src/gallium/drivers/r600/ci/r600-turks-fails.txt | 1 - src/gallium/drivers/r600/r600_dump.c | 1 - src/gallium/drivers/r600/r600_shader.c | 28 +++++++++--------------- src/gallium/drivers/r600/r600_shader.h | 1 - 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/gallium/drivers/r600/ci/r600-turks-fails.txt b/src/gallium/drivers/r600/ci/r600-turks-fails.txt index 2b4ea28e2a6..f33f5afc6f9 100644 --- a/src/gallium/drivers/r600/ci/r600-turks-fails.txt +++ b/src/gallium/drivers/r600/ci/r600-turks-fails.txt @@ -36,7 +36,6 @@ KHR-GLES31.core.layout_binding.image2D_layout_binding_imageLoad_FragmentShader,F KHR-GLES31.core.shader_atomic_counters.advanced-usage-many-dispatches,Fail KHR-GLES31.core.shader_atomic_counters.advanced-usage-many-draw-calls2,Fail KHR-GLES31.core.shader_atomic_counters.advanced-usage-multi-stage,Fail -KHR-GLES31.core.shader_atomic_counters.advanced-usage-multidim-array-small,Fail KHR-GLES31.core.shader_image_load_store.basic-allFormats-loadStoreComputeStage,Fail KHR-GLES31.core.shader_image_load_store.basic-allTargets-loadStoreCS,Fail diff --git a/src/gallium/drivers/r600/r600_dump.c b/src/gallium/drivers/r600/r600_dump.c index ea565956940..793ac6fb60a 100644 --- a/src/gallium/drivers/r600/r600_dump.c +++ b/src/gallium/drivers/r600/r600_dump.c @@ -87,7 +87,6 @@ void print_shader_info(FILE *f , int id, struct r600_shader *shader) PRINT_UINT_ARRAY_ELM(atomics, end); PRINT_UINT_ARRAY_ELM(atomics, buffer_id); PRINT_UINT_ARRAY_ELM(atomics, hw_idx); - PRINT_UINT_ARRAY_ELM(atomics, array_id); } PRINT_UINT_MEMBER(nhwatomic_ranges); diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index a05ce0213c0..7b0b83a80fb 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1206,7 +1206,6 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx) ctx->shader->atomics[i].start = d->Range.First; ctx->shader->atomics[i].end = d->Range.Last; ctx->shader->atomics[i].hw_idx = ctx->shader->atomic_base + ctx->shader->nhwatomic; - ctx->shader->atomics[i].array_id = d->Array.ArrayID; ctx->shader->atomics[i].buffer_id = d->Dim.Index2D; ctx->shader->nhwatomic_ranges++; ctx->shader->nhwatomic += count; @@ -8665,23 +8664,16 @@ static int find_hw_atomic_counter(struct r600_shader_ctx *ctx, { unsigned i; - if (src->Register.Indirect) { - for (i = 0; i < ctx->shader->nhwatomic_ranges; i++) { - if (src->Indirect.ArrayID == ctx->shader->atomics[i].array_id) - return ctx->shader->atomics[i].hw_idx; - } - } else { - uint32_t index = src->Register.Index; - for (i = 0; i < ctx->shader->nhwatomic_ranges; i++) { - if (ctx->shader->atomics[i].buffer_id != (unsigned)src->Dimension.Index) - continue; - if (index > ctx->shader->atomics[i].end) - continue; - if (index < ctx->shader->atomics[i].start) - continue; - uint32_t offset = (index - ctx->shader->atomics[i].start); - return ctx->shader->atomics[i].hw_idx + offset; - } + uint32_t index = src->Register.Index; + for (i = 0; i < ctx->shader->nhwatomic_ranges; i++) { + if (ctx->shader->atomics[i].buffer_id != (unsigned)src->Dimension.Index) + continue; + if (index > ctx->shader->atomics[i].end) + continue; + if (index < ctx->shader->atomics[i].start) + continue; + uint32_t offset = (index - ctx->shader->atomics[i].start); + return ctx->shader->atomics[i].hw_idx + offset; } assert(0); return -1; diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h index ba84a98d422..39afb6fdd14 100644 --- a/src/gallium/drivers/r600/r600_shader.h +++ b/src/gallium/drivers/r600/r600_shader.h @@ -61,7 +61,6 @@ struct r600_shader_atomic { unsigned start, end; unsigned buffer_id; unsigned hw_idx; - unsigned array_id; }; struct r600_shader {
