From: Jason Ekstrand Date: Wed, 6 Nov 2019 20:13:44 +0000 (-0600) Subject: anv: Delete dead shader constant pushing code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ebad00d9e7d38647614eaa4800d7ef7dfbfd5767;p=mesa.git anv: Delete dead shader constant pushing code 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 --- diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c index c4717ea7665..da64ea0bdf9 100644 --- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c +++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c @@ -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))); diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index b52aabdd984..d5477ee4328 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -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 =