Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d/state.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 4537e319..c60478be 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -1190,6 +1190,18 @@ static void d3d12_pipeline_state_destroy_graphics(struct d3d12_pipeline_state *s } }
+static void d3d12_pipeline_state_uav_counter_cleanup(struct d3d12_pipeline_state *state, struct d3d12_device *device) +{ + const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; + + if (state->vk_set_layout) + VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, state->vk_set_layout, NULL)); + if (state->vk_pipeline_layout) + VK_CALL(vkDestroyPipelineLayout(device->vk_device, state->vk_pipeline_layout, NULL)); + + vkd3d_free(state->uav_counters); +} + static ULONG STDMETHODCALLTYPE d3d12_pipeline_state_Release(ID3D12PipelineState *iface) { struct d3d12_pipeline_state *state = impl_from_ID3D12PipelineState(iface); @@ -1209,12 +1221,7 @@ static ULONG STDMETHODCALLTYPE d3d12_pipeline_state_Release(ID3D12PipelineState else if (d3d12_pipeline_state_is_compute(state)) VK_CALL(vkDestroyPipeline(device->vk_device, state->u.compute.vk_pipeline, NULL));
- if (state->vk_set_layout) - VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, state->vk_set_layout, NULL)); - if (state->vk_pipeline_layout) - VK_CALL(vkDestroyPipelineLayout(device->vk_device, state->vk_pipeline_layout, NULL)); - - vkd3d_free(state->uav_counters); + d3d12_pipeline_state_uav_counter_cleanup(state, device);
vkd3d_free(state);
@@ -1574,22 +1581,14 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st vk_pipeline_layout, &state->u.compute.vk_pipeline))) { WARN("Failed to create Vulkan compute pipeline, hr %#x.\n", hr); - if (state->vk_set_layout) - VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, state->vk_set_layout, NULL)); - if (state->vk_pipeline_layout) - VK_CALL(vkDestroyPipelineLayout(device->vk_device, state->vk_pipeline_layout, NULL)); - vkd3d_free(state->uav_counters); + d3d12_pipeline_state_uav_counter_cleanup(state, device); return hr; }
if (FAILED(hr = vkd3d_private_store_init(&state->private_store))) { VK_CALL(vkDestroyPipeline(device->vk_device, state->u.compute.vk_pipeline, NULL)); - if (state->vk_set_layout) - VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, state->vk_set_layout, NULL)); - if (state->vk_pipeline_layout) - VK_CALL(vkDestroyPipelineLayout(device->vk_device, state->vk_pipeline_layout, NULL)); - vkd3d_free(state->uav_counters); + d3d12_pipeline_state_uav_counter_cleanup(state, device); return hr; }