radv: don't pass shader key by copy
authorDave Airlie <airlied@redhat.com>
Thu, 4 Oct 2018 23:17:45 +0000 (09:17 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 11 Oct 2018 00:18:43 +0000 (10:18 +1000)
Coverity pointed out we were copying 168 bytes here unnecessarily.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_pipeline.c

index b39e8b62bb6157d1970e97c536997b2460c60f33..1e7d7dc945ff8e925aa49f5925deb555487de1fb 100644 (file)
@@ -1986,7 +1986,7 @@ static
 void radv_create_shaders(struct radv_pipeline *pipeline,
                          struct radv_device *device,
                          struct radv_pipeline_cache *cache,
-                         struct radv_pipeline_key key,
+                         const struct radv_pipeline_key *key,
                          const VkPipelineShaderStageCreateInfo **pStages,
                          const VkPipelineCreateFlags flags)
 {
@@ -2010,7 +2010,7 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
                }
        }
 
-       radv_hash_shaders(hash, pStages, pipeline->layout, &key, get_hash_flags(device));
+       radv_hash_shaders(hash, pStages, pipeline->layout, key, get_hash_flags(device));
        memcpy(gs_copy_hash, hash, 20);
        gs_copy_hash[0] ^= 1;
 
@@ -2091,7 +2091,7 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
                        nir_print_shader(nir[i], stderr);
        }
 
-       radv_fill_shader_keys(keys, &key, nir);
+       radv_fill_shader_keys(keys, key, nir);
 
        if (nir[MESA_SHADER_FRAGMENT]) {
                if (!pipeline->shaders[MESA_SHADER_FRAGMENT]) {
@@ -3493,9 +3493,8 @@ radv_pipeline_init(struct radv_pipeline *pipeline,
                pStages[stage] = &pCreateInfo->pStages[i];
        }
 
-       radv_create_shaders(pipeline, device, cache, 
-                           radv_generate_graphics_pipeline_key(pipeline, pCreateInfo, &blend, has_view_index),
-                           pStages, pCreateInfo->flags);
+       struct radv_pipeline_key key = radv_generate_graphics_pipeline_key(pipeline, pCreateInfo, &blend, has_view_index);
+       radv_create_shaders(pipeline, device, cache, &key, pStages, pCreateInfo->flags);
 
        pipeline->graphics.spi_baryc_cntl = S_0286E0_FRONT_FACE_ALL_BITS(1);
        radv_pipeline_init_multisample_state(pipeline, &blend, pCreateInfo);
@@ -3728,7 +3727,7 @@ static VkResult radv_compute_pipeline_create(
        assert(pipeline->layout);
 
        pStages[MESA_SHADER_COMPUTE] = &pCreateInfo->stage;
-       radv_create_shaders(pipeline, device, cache, (struct radv_pipeline_key) {0}, pStages, pCreateInfo->flags);
+       radv_create_shaders(pipeline, device, cache, &(struct radv_pipeline_key) {0}, pStages, pCreateInfo->flags);
 
        pipeline->user_data_0[MESA_SHADER_COMPUTE] = radv_pipeline_stage_to_user_data_0(pipeline, MESA_SHADER_COMPUTE, device->physical_device->rad_info.chip_class);
        pipeline->need_indirect_descriptor_sets |= pipeline->shaders[MESA_SHADER_COMPUTE]->info.need_indirect_descriptor_sets;