Skip to content

Commit

Permalink
Tear down hoist layouts.
Browse files Browse the repository at this point in the history
  • Loading branch information
HansKristian-Work committed Nov 20, 2023
1 parent c702452 commit 7134ec8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions libs/vkd3d/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -2240,6 +2240,7 @@ void d3d12_pipeline_state_dec_ref(struct d3d12_pipeline_state *state)
struct d3d12_device *device = state->device;
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
ULONG refcount = InterlockedDecrement(&state->internal_refcount);
unsigned int i;

if (!refcount)
{
Expand All @@ -2257,6 +2258,10 @@ void d3d12_pipeline_state_dec_ref(struct d3d12_pipeline_state *state)
if (state->root_signature)
d3d12_root_signature_dec_ref(state->root_signature);

for (i = 0; i < ARRAY_SIZE(state->hoist_template.vk_hoist_descriptor_set_layouts); i++)
VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, state->hoist_template.vk_hoist_descriptor_set_layouts[i], NULL));
VK_CALL(vkDestroyPipelineLayout(device->vk_device, state->hoist_template.vk_hoist_descriptor_layout, NULL));

if (state->pipeline_type == VKD3D_PIPELINE_TYPE_GRAPHICS || state->pipeline_type == VKD3D_PIPELINE_TYPE_MESH_GRAPHICS)
d3d12_pipeline_state_free_cached_desc(&state->graphics.cached_desc);
rwlock_destroy(&state->lock);
Expand Down
4 changes: 2 additions & 2 deletions libs/vkd3d/vkd3d_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -2040,8 +2040,8 @@ struct d3d12_descriptor_copy_template
unsigned int num_entries;

/* For descriptor hoisting. Each pipeline stage gets its own set. */
VkDescriptorSetLayout vk_hoist_descriptor_sets[VKD3D_MAX_HOIST_SHADER_STAGES];
VkPipelineLayout vk_hoist_descriptor_set_layout;
VkDescriptorSetLayout vk_hoist_descriptor_set_layouts[VKD3D_MAX_HOIST_SHADER_STAGES];
VkPipelineLayout vk_hoist_descriptor_layout;

/* On draw time if table offsets are out of date:
* - Allocate descriptor_allocation_words from d3d12_command_list_descriptor_copy_batch::descriptor_buffer.
Expand Down

0 comments on commit 7134ec8

Please sign in to comment.