From 457306fa4c747db5a8f19eb6561b252ddcd211cf Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 27 Sep 2017 21:56:20 +0200 Subject: [PATCH] radv: do not need to double zero-init the meta state structures Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_meta_blit.c | 1 - src/amd/vulkan/radv_meta_blit2d.c | 2 -- src/amd/vulkan/radv_meta_buffer.c | 2 -- src/amd/vulkan/radv_meta_bufimage.c | 8 -------- src/amd/vulkan/radv_meta_clear.c | 2 -- src/amd/vulkan/radv_meta_decompress.c | 2 -- src/amd/vulkan/radv_meta_fast_clear.c | 2 -- src/amd/vulkan/radv_meta_resolve.c | 2 -- src/amd/vulkan/radv_meta_resolve_cs.c | 1 - src/amd/vulkan/radv_meta_resolve_fs.c | 2 -- src/amd/vulkan/radv_private.h | 2 -- src/amd/vulkan/radv_query.c | 2 -- 12 files changed, 28 deletions(-) diff --git a/src/amd/vulkan/radv_meta_blit.c b/src/amd/vulkan/radv_meta_blit.c index 2c1a13228d2..7d9f7f90263 100644 --- a/src/amd/vulkan/radv_meta_blit.c +++ b/src/amd/vulkan/radv_meta_blit.c @@ -1210,7 +1210,6 @@ radv_device_init_meta_blit_state(struct radv_device *device) { VkResult result; struct radv_shader_module vs = {0}; - zero(device->meta_state.blit); VkDescriptorSetLayoutCreateInfo ds_layout_info = { .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, diff --git a/src/amd/vulkan/radv_meta_blit2d.c b/src/amd/vulkan/radv_meta_blit2d.c index f7809b44861..751f5914fce 100644 --- a/src/amd/vulkan/radv_meta_blit2d.c +++ b/src/amd/vulkan/radv_meta_blit2d.c @@ -1136,8 +1136,6 @@ radv_device_init_meta_blit2d_state(struct radv_device *device) { VkResult result; - zero(device->meta_state.blit2d); - const VkPushConstantRange push_constant_ranges[] = { {VK_SHADER_STAGE_VERTEX_BIT, 0, 16}, {VK_SHADER_STAGE_FRAGMENT_BIT, 16, 4}, diff --git a/src/amd/vulkan/radv_meta_buffer.c b/src/amd/vulkan/radv_meta_buffer.c index 14f848664c2..f95d8823fcc 100644 --- a/src/amd/vulkan/radv_meta_buffer.c +++ b/src/amd/vulkan/radv_meta_buffer.c @@ -121,8 +121,6 @@ VkResult radv_device_init_meta_buffer_state(struct radv_device *device) struct radv_shader_module fill_cs = { .nir = NULL }; struct radv_shader_module copy_cs = { .nir = NULL }; - zero(device->meta_state.buffer); - fill_cs.nir = build_buffer_fill_shader(device); copy_cs.nir = build_buffer_copy_shader(device); diff --git a/src/amd/vulkan/radv_meta_bufimage.c b/src/amd/vulkan/radv_meta_bufimage.c index b460143df2e..d73420aef9c 100644 --- a/src/amd/vulkan/radv_meta_bufimage.c +++ b/src/amd/vulkan/radv_meta_bufimage.c @@ -127,8 +127,6 @@ radv_device_init_meta_itob_state(struct radv_device *device) VkResult result; struct radv_shader_module cs = { .nir = NULL }; - zero(device->meta_state.itob); - cs.nir = build_nir_itob_compute_shader(device); /* @@ -327,8 +325,6 @@ radv_device_init_meta_btoi_state(struct radv_device *device) VkResult result; struct radv_shader_module cs = { .nir = NULL }; - zero(device->meta_state.btoi); - cs.nir = build_nir_btoi_compute_shader(device); /* @@ -521,8 +517,6 @@ radv_device_init_meta_itoi_state(struct radv_device *device) VkResult result; struct radv_shader_module cs = { .nir = NULL }; - zero(device->meta_state.itoi); - cs.nir = build_nir_itoi_compute_shader(device); /* @@ -677,8 +671,6 @@ radv_device_init_meta_cleari_state(struct radv_device *device) VkResult result; struct radv_shader_module cs = { .nir = NULL }; - zero(device->meta_state.cleari); - cs.nir = build_nir_cleari_compute_shader(device); /* diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c index 7ca4bc34920..3317debd878 100644 --- a/src/amd/vulkan/radv_meta_clear.c +++ b/src/amd/vulkan/radv_meta_clear.c @@ -768,8 +768,6 @@ radv_device_init_meta_clear_state(struct radv_device *device) VkResult res; struct radv_meta_state *state = &device->meta_state; - memset(&device->meta_state.clear, 0, sizeof(device->meta_state.clear)); - VkPipelineLayoutCreateInfo pl_color_create_info = { .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 0, diff --git a/src/amd/vulkan/radv_meta_decompress.c b/src/amd/vulkan/radv_meta_decompress.c index 1a1a5612e2b..23bc2e6dfd4 100644 --- a/src/amd/vulkan/radv_meta_decompress.c +++ b/src/amd/vulkan/radv_meta_decompress.c @@ -232,8 +232,6 @@ radv_device_init_meta_depth_decomp_state(struct radv_device *device) struct radv_meta_state *state = &device->meta_state; VkResult res = VK_SUCCESS; - zero(state->depth_decomp); - struct radv_shader_module vs_module = { .nir = radv_meta_build_nir_vs_generate_vertices() }; if (!vs_module.nir) { /* XXX: Need more accurate error */ diff --git a/src/amd/vulkan/radv_meta_fast_clear.c b/src/amd/vulkan/radv_meta_fast_clear.c index b92fb7cd5ad..e006c721a80 100644 --- a/src/amd/vulkan/radv_meta_fast_clear.c +++ b/src/amd/vulkan/radv_meta_fast_clear.c @@ -266,8 +266,6 @@ radv_device_init_meta_fast_clear_flush_state(struct radv_device *device) { VkResult res = VK_SUCCESS; - zero(device->meta_state.fast_clear_flush); - struct radv_shader_module vs_module = { .nir = radv_meta_build_nir_vs_generate_vertices() }; if (!vs_module.nir) { /* XXX: Need more accurate error */ diff --git a/src/amd/vulkan/radv_meta_resolve.c b/src/amd/vulkan/radv_meta_resolve.c index dd811c25142..80b44c89e97 100644 --- a/src/amd/vulkan/radv_meta_resolve.c +++ b/src/amd/vulkan/radv_meta_resolve.c @@ -238,8 +238,6 @@ radv_device_init_meta_resolve_state(struct radv_device *device) { VkResult res = VK_SUCCESS; - zero(device->meta_state.resolve); - struct radv_shader_module vs_module = { .nir = radv_meta_build_nir_vs_generate_vertices() }; if (!vs_module.nir) { /* XXX: Need more accurate error */ diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c b/src/amd/vulkan/radv_meta_resolve_cs.c index 05a212b6d93..55bf72071e8 100644 --- a/src/amd/vulkan/radv_meta_resolve_cs.c +++ b/src/amd/vulkan/radv_meta_resolve_cs.c @@ -250,7 +250,6 @@ radv_device_init_meta_resolve_compute_state(struct radv_device *device) { struct radv_meta_state *state = &device->meta_state; VkResult res; - memset(&device->meta_state.resolve_compute, 0, sizeof(device->meta_state.resolve_compute)); res = create_layout(device); if (res != VK_SUCCESS) diff --git a/src/amd/vulkan/radv_meta_resolve_fs.c b/src/amd/vulkan/radv_meta_resolve_fs.c index 373dd9665a7..50d5ed7d5aa 100644 --- a/src/amd/vulkan/radv_meta_resolve_fs.c +++ b/src/amd/vulkan/radv_meta_resolve_fs.c @@ -332,9 +332,7 @@ fail: VkResult radv_device_init_meta_resolve_fragment_state(struct radv_device *device) { - struct radv_meta_state *state = &device->meta_state; VkResult res; - memset(&state->resolve_fragment, 0, sizeof(state->resolve_fragment)); res = create_layout(device); if (res != VK_SUCCESS) diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 73a9a328be3..93898a6ad13 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -197,8 +197,6 @@ radv_clear_mask(uint32_t *inout_mask, uint32_t clear_mask) memcpy((dest), (src), (count) * sizeof(*(src))); \ }) -#define zero(x) (memset(&(x), 0, sizeof(x))) - /* Whenever we generate an error, pass it through this function. Useful for * debugging, where we can break on it. Only call at error site, not when * propagating errors. Might be useful to plug in a stack trace here. diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c index f63497a4457..40faf22b082 100644 --- a/src/amd/vulkan/radv_query.c +++ b/src/amd/vulkan/radv_query.c @@ -519,8 +519,6 @@ VkResult radv_device_init_meta_query_state(struct radv_device *device) struct radv_shader_module occlusion_cs = { .nir = NULL }; struct radv_shader_module pipeline_statistics_cs = { .nir = NULL }; - zero(device->meta_state.query); - occlusion_cs.nir = build_occlusion_query_shader(device); pipeline_statistics_cs.nir = build_pipeline_statistics_query_shader(device); -- 2.30.2