diff options
author | Jason Ekstrand <[email protected]> | 2020-04-03 12:38:32 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-15 21:51:55 +0000 |
commit | 26a1adce5bd2f0e44900f21e58ea09fea9f6690f (patch) | |
tree | 6760682a40f44b43107989ed2dbb2781ca948fa4 /src | |
parent | b2e4157143439a211d2f8e761dc8afd750fa791d (diff) |
anv: Fix UBO range detection in anv_nir_compute_push_layout
This fixes two bugs: First, if the same block index showed up twice, we
only pick the first one. Second, we weren't multiplying by 32. This
didn't show up in tests because RBA testing is garbage. Found while
looking at shaders from the UE4 Shooter demo.
Fixes: e03f9652 "anv: Bounds-check pushed UBOs when..."
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4578>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/vulkan/anv_nir_compute_push_layout.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/intel/vulkan/anv_nir_compute_push_layout.c b/src/intel/vulkan/anv_nir_compute_push_layout.c index 3f9572644df..960fb1ca4a3 100644 --- a/src/intel/vulkan/anv_nir_compute_push_layout.c +++ b/src/intel/vulkan/anv_nir_compute_push_layout.c @@ -208,8 +208,11 @@ anv_nir_compute_push_layout(const struct anv_physical_device *pdevice, int ubo_range_idx = -1; for (unsigned i = 0; i < 4; i++) { - if (prog_data->ubo_ranges[i].length > 0 && - prog_data->ubo_ranges[i].block == index) { + const struct brw_ubo_range *range = + &prog_data->ubo_ranges[i]; + if (range->block == index && + offset + size > range->start * 32 && + offset < (range->start + range->length) * 32) { ubo_range_idx = i; break; } @@ -218,14 +221,6 @@ anv_nir_compute_push_layout(const struct anv_physical_device *pdevice, if (ubo_range_idx < 0) break; - const struct brw_ubo_range *range = - &prog_data->ubo_ranges[ubo_range_idx]; - const uint32_t range_end = - (range->start + range->length) * 32; - - if (range_end < offset || offset + size <= range->start) - break; - b.cursor = nir_after_instr(&intrin->instr); assert(push_range_idx_map[ubo_range_idx] >= 0); |