[Mesa-dev] [PATCH 07/19] radv: do not need to double zero-init the meta state structures

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Sep 29 15:48:54 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 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 2c1a13228d..7d9f7f9026 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 f7809b4486..751f5914fc 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 14f848664c..f95d8823fc 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 b460143df2..d73420aef9 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 8b3745d6d7..5242078a86 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 1a1a5612e2..23bc2e6dfd 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 7e0738f44f..2371a6dc6f 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 dd811c2514..80b44c89e9 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 05a212b6d9..55bf72071e 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 373dd9665a..50d5ed7d5a 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 73a9a328be..93898a6ad1 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 f63497a445..40faf22b08 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.14.2



More information about the mesa-dev mailing list