[Mesa-dev] [PATCH 5/6] radeonsi/nir: parse more information about bindless usage

Marek Olšák maraeo at gmail.com
Tue Nov 20 04:09:41 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_shader_nir.c | 36 +++++++++++++++++---
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 87ca0161b45..e7ba282b075 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -136,43 +136,71 @@ static void scan_instruction(struct tgsi_shader_info *info,
 		case nir_intrinsic_load_primitive_id:
 			info->uses_primid = 1;
 			break;
 		case nir_intrinsic_load_sample_mask_in:
 			info->reads_samplemask = true;
 			break;
 		case nir_intrinsic_load_tess_level_inner:
 		case nir_intrinsic_load_tess_level_outer:
 			info->reads_tess_factors = true;
 			break;
-		case nir_intrinsic_image_deref_load:
+		case nir_intrinsic_image_deref_load: {
+			nir_variable *var = intrinsic_get_var(intr);
+			if (var->data.bindless) {
+				info->uses_bindless_images = true;
+
+				if (glsl_get_sampler_dim(var->type) == GLSL_SAMPLER_DIM_BUF)
+					info->uses_bindless_buffer_load = true;
+				else
+					info->uses_bindless_image_load = true;
+			}
+			break;
+		}
 		case nir_intrinsic_image_deref_size:
 		case nir_intrinsic_image_deref_samples: {
 			nir_variable *var = intrinsic_get_var(intr);
 			if (var->data.bindless)
 				info->uses_bindless_images = true;
+			break;
+		}
+		case nir_intrinsic_image_deref_store: {
+			nir_variable *var = intrinsic_get_var(intr);
+			if (var->data.bindless) {
+				info->uses_bindless_images = true;
 
+				if (glsl_get_sampler_dim(var->type) == GLSL_SAMPLER_DIM_BUF)
+					info->uses_bindless_buffer_store = true;
+				else
+					info->uses_bindless_image_store = true;
+			}
+			info->writes_memory = true;
 			break;
 		}
-		case nir_intrinsic_image_deref_store:
 		case nir_intrinsic_image_deref_atomic_add:
 		case nir_intrinsic_image_deref_atomic_min:
 		case nir_intrinsic_image_deref_atomic_max:
 		case nir_intrinsic_image_deref_atomic_and:
 		case nir_intrinsic_image_deref_atomic_or:
 		case nir_intrinsic_image_deref_atomic_xor:
 		case nir_intrinsic_image_deref_atomic_exchange:
 		case nir_intrinsic_image_deref_atomic_comp_swap: {
 			nir_variable *var = intrinsic_get_var(intr);
-			if (var->data.bindless)
+			if (var->data.bindless) {
 				info->uses_bindless_images = true;
 
-			/* fall-through */
+				if (glsl_get_sampler_dim(var->type) == GLSL_SAMPLER_DIM_BUF)
+					info->uses_bindless_buffer_atomic = true;
+				else
+					info->uses_bindless_image_atomic = true;
+			}
+			info->writes_memory = true;
+			break;
 		}
 		case nir_intrinsic_store_ssbo:
 		case nir_intrinsic_ssbo_atomic_add:
 		case nir_intrinsic_ssbo_atomic_imin:
 		case nir_intrinsic_ssbo_atomic_umin:
 		case nir_intrinsic_ssbo_atomic_imax:
 		case nir_intrinsic_ssbo_atomic_umax:
 		case nir_intrinsic_ssbo_atomic_and:
 		case nir_intrinsic_ssbo_atomic_or:
 		case nir_intrinsic_ssbo_atomic_xor:
-- 
2.17.1



More information about the mesa-dev mailing list