From: Lionel Landwerlin Date: Fri, 6 Dec 2019 10:57:10 +0000 (+0200) Subject: anv: constify pipeline layout in nir passes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7c223cf3162fe45a0db75dbbf97e750e584bd4c8;p=mesa.git anv: constify pipeline layout in nir passes Was hoping to find potential issues but nothing. Still probably a good idea. Signed-off-by: Lionel Landwerlin Reviewed-by: Jason Ekstrand --- diff --git a/src/intel/vulkan/anv_nir.h b/src/intel/vulkan/anv_nir.h index 361023e1593..ad56ea14b60 100644 --- a/src/intel/vulkan/anv_nir.h +++ b/src/intel/vulkan/anv_nir.h @@ -34,7 +34,7 @@ extern "C" { bool anv_nir_lower_multiview(nir_shader *shader, uint32_t view_mask); bool anv_nir_lower_ycbcr_textures(nir_shader *shader, - struct anv_pipeline_layout *layout); + const struct anv_pipeline_layout *layout); static inline nir_address_format anv_nir_ssbo_addr_format(const struct anv_physical_device *pdevice, @@ -52,7 +52,7 @@ anv_nir_ssbo_addr_format(const struct anv_physical_device *pdevice, void anv_nir_apply_pipeline_layout(const struct anv_physical_device *pdevice, bool robust_buffer_access, - struct anv_pipeline_layout *layout, + const struct anv_pipeline_layout *layout, nir_shader *shader, struct brw_stage_prog_data *prog_data, struct anv_pipeline_bind_map *map); diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c index 3fdc3520025..25cd83faf78 100644 --- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c +++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c @@ -40,7 +40,7 @@ struct apply_pipeline_layout_state { nir_shader *shader; nir_builder builder; - struct anv_pipeline_layout *layout; + const struct anv_pipeline_layout *layout; bool add_bounds_checks; nir_address_format ssbo_addr_format; @@ -1107,7 +1107,7 @@ compare_binding_infos(const void *_a, const void *_b) void anv_nir_apply_pipeline_layout(const struct anv_physical_device *pdevice, bool robust_buffer_access, - struct anv_pipeline_layout *layout, + const struct anv_pipeline_layout *layout, nir_shader *shader, struct brw_stage_prog_data *prog_data, struct anv_pipeline_bind_map *map) @@ -1172,12 +1172,12 @@ anv_nir_apply_pipeline_layout(const struct anv_physical_device *pdevice, rzalloc_array(mem_ctx, struct binding_info, used_binding_count); used_binding_count = 0; for (uint32_t set = 0; set < layout->num_sets; set++) { - struct anv_descriptor_set_layout *set_layout = layout->set[set].layout; + const struct anv_descriptor_set_layout *set_layout = layout->set[set].layout; for (unsigned b = 0; b < set_layout->binding_count; b++) { if (state.set[set].use_count[b] == 0) continue; - struct anv_descriptor_set_binding_layout *binding = + const struct anv_descriptor_set_binding_layout *binding = &layout->set[set].layout->binding[b]; /* Do a fixed-point calculation to generate a score based on the @@ -1212,7 +1212,7 @@ anv_nir_apply_pipeline_layout(const struct anv_physical_device *pdevice, for (unsigned i = 0; i < used_binding_count; i++) { unsigned set = infos[i].set, b = infos[i].binding; - struct anv_descriptor_set_binding_layout *binding = + const struct anv_descriptor_set_binding_layout *binding = &layout->set[set].layout->binding[b]; const uint32_t array_size = binding->array_size; @@ -1299,7 +1299,7 @@ anv_nir_apply_pipeline_layout(const struct anv_physical_device *pdevice, const uint32_t set = var->data.descriptor_set; const uint32_t binding = var->data.binding; - struct anv_descriptor_set_binding_layout *bind_layout = + const struct anv_descriptor_set_binding_layout *bind_layout = &layout->set[set].layout->binding[binding]; const uint32_t array_size = bind_layout->array_size; diff --git a/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c b/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c index 799749d5db0..d18d8f6dd3b 100644 --- a/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c +++ b/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c @@ -320,7 +320,7 @@ swizzle_channel(struct isl_swizzle swizzle, unsigned channel) } static bool -try_lower_tex_ycbcr(struct anv_pipeline_layout *layout, +try_lower_tex_ycbcr(const struct anv_pipeline_layout *layout, nir_builder *builder, nir_tex_instr *tex) { @@ -448,7 +448,7 @@ try_lower_tex_ycbcr(struct anv_pipeline_layout *layout, bool anv_nir_lower_ycbcr_textures(nir_shader *shader, - struct anv_pipeline_layout *layout) + const struct anv_pipeline_layout *layout) { bool progress = false;