nir: Add nir_intrinsic_texture_base_agx sysval
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 9 Sep 2022 20:59:56 +0000 (16:59 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 13 Sep 2022 16:04:28 +0000 (16:04 +0000)
For non-bindless textures, get the base address of the texture
descriptor array, so we can crawl descriptors in the shader. For
bindless, this isn't needed (since the bindless handle will be the
address itself).

jekstrand suggested the idea of the descriptor crawl. It worked out
pretty well, all considered.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18525>

src/compiler/nir/nir_intrinsics.py

index 3032621..0b830cc 100644 (file)
@@ -1449,6 +1449,10 @@ intrinsic("load_fb_layers_v3d", dest_comp=1, flags=[CAN_ELIMINATE, CAN_REORDER])
 # Logical complement of load_front_face, mapping to an AGX system value
 system_value("back_face_agx", 1, bit_sizes=[1, 32])
 
+# Loads the texture descriptor base for indexed (non-bindless) textures. On G13,
+# the referenced array has stride 24.
+system_value("texture_base_agx", 1, bit_sizes=[64])
+
 # Intel-specific query for loading from the brw_image_param struct passed
 # into the shader as a uniform.  The variable is a deref to the image
 # variable. The const index specifies which of the six parameters to load.