mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 04:20:08 +01:00
agx: Optimize lower_resinfo for cube maps
We can avoid reading both width and height when the texture is a cube map, and we do so more simply by relying on CSE+DCE (Alyssa). Closes: #7541 Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20628>
This commit is contained in:
parent
9ab1c0d83b
commit
b73b5cc71a
1 changed files with 6 additions and 0 deletions
|
|
@ -117,6 +117,12 @@ agx_txs(nir_builder *b, nir_tex_instr *tex)
|
|||
if (!(nr_comps == 3 && tex->is_array))
|
||||
depth = nir_imax(b, nir_ushr(b, depth, lod), nir_imm_int(b, 1));
|
||||
|
||||
/* Cube maps have equal width and height, we save some instructions by only
|
||||
* reading one. Dead code elimination will remove the redundant instructions.
|
||||
*/
|
||||
if (tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE)
|
||||
height = width;
|
||||
|
||||
comp[0] = width;
|
||||
comp[1] = height;
|
||||
comp[2] = depth;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue