anv: constify pipeline layout in nir passes
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 6 Dec 2019 10:57:10 +0000 (12:57 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 16 Dec 2019 12:35:22 +0000 (14:35 +0200)
Was hoping to find potential issues but nothing. Still probably a good
idea.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_nir.h
src/intel/vulkan/anv_nir_apply_pipeline_layout.c
src/intel/vulkan/anv_nir_lower_ycbcr_textures.c

index 361023e1593fda2e793abd8d1340cd933441bc92..ad56ea14b60272331a68f73d6ff603cc7a6d3904 100644 (file)
@@ -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);
index 3fdc3520025977584fc1d97be7f522ca1c11cac8..25cd83faf78e146259ebd0a5c909861d41df64fb 100644 (file)
@@ -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;
 
index 799749d5db0d60ed5f88ece08cbda919d2512519..d18d8f6dd3ba170b950207def0d9e31de80840d6 100644 (file)
@@ -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;