anv: Zero initialize pipeline structs

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11890>
This commit is contained in:
Caio Marcelo de Oliveira Filho 2021-07-13 22:24:26 -07:00 committed by Marge Bot
parent 34aae6a1f2
commit dfcb47bcec
2 changed files with 4 additions and 17 deletions

View file

@ -2369,7 +2369,6 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline,
assert(pCreateInfo->pRasterizationState);
pipeline->dynamic_states = 0;
if (pCreateInfo->pDynamicState) {
/* Remove all of the states that are marked as dynamic */
uint32_t count = pCreateInfo->pDynamicState->dynamicStateCount;
@ -2397,11 +2396,6 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline,
pCreateInfo->pMultisampleState &&
pCreateInfo->pMultisampleState->sampleShadingEnable;
/* When we free the pipeline, we detect stages based on the NULL status
* of various prog_data pointers. Make them NULL by default.
*/
memset(pipeline->shaders, 0, sizeof(pipeline->shaders));
result = anv_pipeline_compile_graphics(pipeline, cache, pCreateInfo);
if (result != VK_SUCCESS) {
anv_pipeline_finish(&pipeline->base, device, alloc);
@ -2417,7 +2411,6 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline,
const uint64_t inputs_read = get_vs_prog_data(pipeline)->inputs_read;
pipeline->vb_used = 0;
for (uint32_t i = 0; i < vi_info->vertexAttributeDescriptionCount; i++) {
const VkVertexInputAttributeDescription *desc =
&vi_info->pVertexAttributeDescriptions[i];
@ -3082,10 +3075,6 @@ anv_ray_tracing_pipeline_init(struct anv_ray_tracing_pipeline *pipeline,
{
VkResult result;
/* Zero things out so our clean-up works */
memset(pipeline->groups, 0,
pipeline->group_count * sizeof(*pipeline->groups));
util_dynarray_init(&pipeline->shaders, pipeline->base.mem_ctx);
result = anv_pipeline_compile_ray_tracing(pipeline, cache, pCreateInfo);

View file

@ -2463,7 +2463,7 @@ genX(graphics_pipeline_create)(
if (cache == NULL && device->physical->instance->pipeline_cache_enabled)
cache = &device->default_pipeline_cache;
pipeline = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*pipeline), 8,
pipeline = vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*pipeline), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (pipeline == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
@ -2728,7 +2728,7 @@ compute_pipeline_create(
if (cache == NULL && device->physical->instance->pipeline_cache_enabled)
cache = &device->default_pipeline_cache;
pipeline = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*pipeline), 8,
pipeline = vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*pipeline), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (pipeline == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
@ -2744,8 +2744,6 @@ compute_pipeline_create(
anv_batch_set_storage(&pipeline->base.batch, ANV_NULL_ADDRESS,
pipeline->batch_data, sizeof(pipeline->batch_data));
pipeline->cs = NULL;
assert(pCreateInfo->stage.stage == VK_SHADER_STAGE_COMPUTE_BIT);
VK_FROM_HANDLE(vk_shader_module, module, pCreateInfo->stage.module);
result = anv_pipeline_compile_cs(pipeline, cache, pCreateInfo, module,
@ -2878,8 +2876,8 @@ ray_tracing_pipeline_create(
VK_MULTIALLOC(ma);
VK_MULTIALLOC_DECL(&ma, struct anv_ray_tracing_pipeline, pipeline, 1);
VK_MULTIALLOC_DECL(&ma, struct anv_rt_shader_group, groups, pCreateInfo->groupCount);
if (!vk_multialloc_alloc2(&ma, &device->vk.alloc, pAllocator,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE))
if (!vk_multialloc_zalloc2(&ma, &device->vk.alloc, pAllocator,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE))
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
result = anv_pipeline_init(&pipeline->base, device,