anv: Delete dead shader constant pushing code
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 6 Nov 2019 20:13:44 +0000 (14:13 -0600)
committerJason Ekstrand <jason@jlekstrand.net>
Mon, 18 Nov 2019 18:35:14 +0000 (18:35 +0000)
As of 2d78e55a8c5481, nir_intrinsic_load_constant with a constant offset
is constant-folded so we should never end up with any that trigger
brw_nir_analyze_ubo_ranges.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_nir_apply_pipeline_layout.c
src/intel/vulkan/genX_cmd_buffer.c

index c4717ea7665f104cfe62e102264f3d615d9ba3a7..da64ea0bdf9b54362348b8f1e1109793fec8e1dc 100644 (file)
@@ -782,6 +782,11 @@ lower_load_constant(nir_intrinsic_instr *intrin,
 
    b->cursor = nir_before_instr(&intrin->instr);
 
+   /* Any constant-offset load_constant instructions should have been removed
+    * by constant folding.
+    */
+   assert(!nir_src_is_const(intrin->src[0]));
+
    nir_ssa_def *index = nir_imm_int(b, state->constants_offset);
    nir_ssa_def *offset = nir_iadd(b, nir_ssa_for_src(b, intrin->src[0], 1),
                                   nir_imm_int(b, nir_intrinsic_base(intrin)));
index b52aabdd984cd21d4fd7579d8689b3b4a4883a91..d5477ee43281165e782735bb05cc6cc2d2f525c4 100644 (file)
@@ -2561,19 +2561,7 @@ cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer,
 
                struct anv_address read_addr;
                uint32_t read_len;
-               if (binding->set == ANV_DESCRIPTOR_SET_SHADER_CONSTANTS) {
-                  struct anv_address constant_data = {
-                     .bo = pipeline->device->dynamic_state_pool.block_pool.bo,
-                     .offset = pipeline->shaders[stage]->constant_data.offset,
-                  };
-                  unsigned constant_data_size =
-                     pipeline->shaders[stage]->constant_data_size;
-
-                  read_len = MIN2(range->length,
-                     DIV_ROUND_UP(constant_data_size, 32) - range->start);
-                  read_addr = anv_address_add(constant_data,
-                                              range->start * 32);
-               } else if (binding->set == ANV_DESCRIPTOR_SET_DESCRIPTORS) {
+               if (binding->set == ANV_DESCRIPTOR_SET_DESCRIPTORS) {
                   /* This is a descriptor set buffer so the set index is
                    * actually given by binding->binding.  (Yes, that's
                    * confusing.)
@@ -2589,6 +2577,7 @@ cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer,
                   read_addr = anv_address_add(desc_buffer_addr,
                                               range->start * 32);
                } else {
+                  assert(binding->set < MAX_SETS);
                   struct anv_descriptor_set *set =
                      gfx_state->base.descriptors[binding->set];
                   const struct anv_descriptor *desc =