pan/mdg: Move sampler_type emission to pack time
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 27 Apr 2020 23:23:17 +0000 (19:23 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Apr 2020 15:35:54 +0000 (15:35 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4793>

src/panfrost/midgard/midgard_compile.c
src/panfrost/midgard/midgard_emit.c

index 9287e1405b018e240a5bdcd5f5df92d6157190d9..ae03750b08e98b525801c09796cf886b32fa7636 100644 (file)
@@ -1722,21 +1722,6 @@ pan_attach_constant_bias(
         return true;
 }
 
-static enum mali_sampler_type
-midgard_sampler_type(nir_alu_type t) {
-        switch (nir_alu_type_get_base_type(t))
-        {
-        case nir_type_float:
-                                return MALI_SAMPLER_FLOAT;
-        case nir_type_int:
-                return MALI_SAMPLER_SIGNED;
-        case nir_type_uint:
-                return MALI_SAMPLER_UNSIGNED;
-        default:
-                unreachable("Unknown sampler type");
-        }
-}
-
 static void
 emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
                   unsigned midgard_texop)
@@ -1762,7 +1747,6 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
                         .format = midgard_tex_format(instr->sampler_dim),
                         .texture_handle = texture_index,
                         .sampler_handle = sampler_index,
-                        .sampler_type = midgard_sampler_type(instr->dest_type),
                         .shadow = instr->is_shadow,
                 }
         };
index 02e6291a67abbb3d262c3f4c24bc4ee3a0855756..6f6a395b430ec83fc4df56efe9ba0cc82eb2a515 100644 (file)
@@ -397,6 +397,21 @@ mir_ldst_imm_shift(midgard_load_store_op op)
                 return 1;
 }
 
+static enum mali_sampler_type
+midgard_sampler_type(nir_alu_type t) {
+        switch (nir_alu_type_get_base_type(t))
+        {
+        case nir_type_float:
+                return MALI_SAMPLER_FLOAT;
+        case nir_type_int:
+                return MALI_SAMPLER_SIGNED;
+        case nir_type_uint:
+                return MALI_SAMPLER_UNSIGNED;
+        default:
+                unreachable("Unknown sampler type");
+        }
+}
+
 /* After everything is scheduled, emit whole bundles at a time */
 
 void
@@ -482,6 +497,7 @@ emit_binary_bundle(compiler_context *ctx,
 
                 ins->texture.out_full = (osz == 32);
                 ins->texture.in_reg_full = (isz == 32);
+                ins->texture.sampler_type = midgard_sampler_type(ins->dest_type);
 
                 ctx->texture_op_count--;