Skip to content

Commit

Permalink
vkd3d: Use vk_prepend_struct for PSO pNext.
Browse files Browse the repository at this point in the history
Signed-off-by: Hans-Kristian Arntzen <[email protected]>
  • Loading branch information
HansKristian-Work committed Feb 19, 2024
1 parent ea18f1f commit be4d563
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions libs/vkd3d/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -5311,7 +5311,6 @@ static VkResult d3d12_pipeline_state_link_pipeline_variant(struct d3d12_pipeline

memset(&create_info, 0, sizeof(create_info));
create_info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
create_info.pNext = &library_info;
create_info.flags = graphics->library_create_flags;
create_info.layout = graphics->pipeline_layout;
create_info.basePipelineIndex = -1;
Expand All @@ -5325,6 +5324,8 @@ static VkResult d3d12_pipeline_state_link_pipeline_variant(struct d3d12_pipeline
if (!key)
create_info.flags |= VK_PIPELINE_CREATE_LINK_TIME_OPTIMIZATION_BIT_EXT;

vk_prepend_struct(&create_info, &library_info);

vr = VK_CALL(vkCreateGraphicsPipelines(state->device->vk_device,
vk_cache, 1, &create_info, NULL, vk_pipeline));

Expand Down Expand Up @@ -5404,7 +5405,7 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st

memset(&pipeline_desc, 0, sizeof(pipeline_desc));
pipeline_desc.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
pipeline_desc.pNext = &fragment_output_desc.rt_info;
vk_prepend_struct(&pipeline_desc, &fragment_output_desc.rt_info);
pipeline_desc.stageCount = graphics->stage_count;
pipeline_desc.pStages = graphics->stages;
pipeline_desc.pViewportState = &vp_desc;
Expand Down Expand Up @@ -5437,15 +5438,13 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
TRACE("Compiling pipeline library for %p with flags %#x.\n", state, library_flags);

library_create_info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT;
/* Explicit cast to silence a constness warning, this seems to be a Vulkan header bug */
library_create_info.pNext = (void*)pipeline_desc.pNext;
library_create_info.flags = library_flags;

pipeline_desc.pNext = &library_create_info;
pipeline_desc.flags |= VK_PIPELINE_CREATE_LIBRARY_BIT_KHR |
VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT;

graphics->library_flags = library_flags;
vk_prepend_struct(&pipeline_desc, &library_create_info);
}

/* A workaround for SottR, which creates pipelines with DSV_UNKNOWN, but still insists on using a depth buffer.
Expand Down Expand Up @@ -5504,11 +5503,11 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_PIPELINE_LIBRARY_LOG)
{
feedback_info.sType = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO_EXT;
feedback_info.pNext = pipeline_desc.pNext;
feedback_info.pPipelineStageCreationFeedbacks = feedbacks;
feedback_info.pipelineStageCreationFeedbackCount = pipeline_desc.stageCount;
feedback_info.pPipelineCreationFeedback = &feedback;
pipeline_desc.pNext = &feedback_info;

vk_prepend_struct(&pipeline_desc, &feedback_info);
}
else
feedback_info.pipelineStageCreationFeedbackCount = 0;
Expand Down

0 comments on commit be4d563

Please sign in to comment.