vkd3d: Remove some useless null pointer checks in d3d12_root_signature_cleanup.

All vkDestroy* functions are defined to perform no operation when passed
a null handle. vkd3d_free should follow regular free semantics.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
This commit is contained in:
Philip Rebohle 2020-03-03 12:43:08 +01:00 committed by Hans-Kristian Arntzen
parent 5e8821d561
commit 287f4e525b
1 changed files with 13 additions and 25 deletions

View File

@ -63,35 +63,23 @@ static void d3d12_root_signature_cleanup(struct d3d12_root_signature *root_signa
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
unsigned int i;
if (root_signature->vk_pipeline_layout)
VK_CALL(vkDestroyPipelineLayout(device->vk_device, root_signature->vk_pipeline_layout, NULL));
if (root_signature->vk_set_layout)
VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, root_signature->vk_set_layout, NULL));
if (root_signature->vk_push_set_layout)
VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, root_signature->vk_push_set_layout, NULL));
if (root_signature->parameters)
{
for (i = 0; i < root_signature->parameter_count; ++i)
{
if (root_signature->parameters[i].parameter_type == D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE)
vkd3d_free(root_signature->parameters[i].u.descriptor_table.ranges);
}
vkd3d_free(root_signature->parameters);
}
if (root_signature->bindings)
vkd3d_free(root_signature->bindings);
if (root_signature->root_constants)
vkd3d_free(root_signature->root_constants);
VK_CALL(vkDestroyPipelineLayout(device->vk_device, root_signature->vk_pipeline_layout, NULL));
VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, root_signature->vk_set_layout, NULL));
VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, root_signature->vk_push_set_layout, NULL));
for (i = 0; i < root_signature->static_sampler_count; ++i)
VK_CALL(vkDestroySampler(device->vk_device, root_signature->static_samplers[i], NULL));
for (i = 0; i < root_signature->parameter_count; ++i)
{
if (root_signature->static_samplers[i])
VK_CALL(vkDestroySampler(device->vk_device, root_signature->static_samplers[i], NULL));
if (root_signature->parameters[i].parameter_type == D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE)
vkd3d_free(root_signature->parameters[i].u.descriptor_table.ranges);
}
if (root_signature->static_samplers)
vkd3d_free(root_signature->static_samplers);
vkd3d_free(root_signature->parameters);
vkd3d_free(root_signature->bindings);
vkd3d_free(root_signature->root_constants);
vkd3d_free(root_signature->static_samplers);
}
static ULONG STDMETHODCALLTYPE d3d12_root_signature_Release(ID3D12RootSignature *iface)