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 <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4578>
This commit is contained in:
Jason Ekstrand
2020-04-03 12:38:32 -05:00
committed by Marge Bot
parent b2e4157143
commit 26a1adce5b

View File

@@ -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);