diff options
author | Hyunjun Ko <[email protected]> | 2020-07-01 03:13:40 +0000 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-07-03 00:45:16 +0000 |
commit | 9190cc9b151004ffec1c6f8c10983853c19af8d2 (patch) | |
tree | 747b897e5f0fc0c48933052b356d8a4407d66123 /src/amd/vulkan | |
parent | e2209e869a5560cb12de040aa5f9db4a305111e8 (diff) |
tu,radv: fix potentially wrong offset of flexible array.
v2. Remove redundant memset and make the expression simpler.
Signed-off-by: Hyunjun Ko <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5703>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r-- | src/amd/vulkan/radv_descriptor_set.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index 21b9de72efb..241ce2c33c6 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -102,8 +102,8 @@ VkResult radv_CreateDescriptorSetLayout( } } - uint32_t samplers_offset = sizeof(struct radv_descriptor_set_layout) + - (max_binding + 1) * sizeof(set_layout->binding[0]); + uint32_t samplers_offset = + offsetof(struct radv_descriptor_set_layout, binding[max_binding + 1]); size_t size = samplers_offset + immutable_sampler_count * 4 * sizeof(uint32_t); if (ycbcr_sampler_count > 0) { size += ycbcr_sampler_count * sizeof(struct radv_sampler_ycbcr_conversion) + (max_binding + 1) * sizeof(uint32_t); @@ -146,8 +146,6 @@ VkResult radv_CreateDescriptorSetLayout( set_layout->has_immutable_samplers = false; set_layout->size = 0; - memset(set_layout->binding, 0, size - sizeof(struct radv_descriptor_set_layout)); - uint32_t buffer_count = 0; uint32_t dynamic_offset_count = 0; |