agx: Handle cube arrays when clamping arrays

Need to adjust the component.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25052>
This commit is contained in:
Alyssa Rosenzweig 2023-08-17 13:03:03 -04:00 committed by Marge Bot
parent 54ebddaa0f
commit fb76f6cc6e

View file

@ -354,6 +354,14 @@ lower_regular_texture(nir_builder *b, nir_instr *instr, UNUSED void *data)
if (tex->op != nir_texop_txf && tex->op != nir_texop_txf_ms)
unclamped_layer = nir_f2u32(b, nir_fround_even(b, unclamped_layer));
/* For a cube array, the layer is zero-indexed component 3 of the
* coordinate but the number of layers is component 2 of the txs result.
*/
if (tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE) {
assert(lidx == 3 && "4 components");
lidx = 2;
}
/* Clamp to max layer = (# of layers - 1) for out-of-bounds handling.
* Layer must be 16-bits for the hardware, drop top bits after clamping.
*/