vkd3d: Streamline vkd3d_create_compute_pipeline.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
Hans-Kristian Arntzen 2022-03-18 17:20:10 +01:00
parent 73fa8b9588
commit a098cce48a
1 changed files with 9 additions and 11 deletions

View File

@ -2312,9 +2312,7 @@ static void vkd3d_report_pipeline_creation_feedback_results(const VkPipelineCrea
static HRESULT vkd3d_create_compute_pipeline(struct d3d12_pipeline_state *state,
struct d3d12_device *device,
const D3D12_SHADER_BYTECODE *code,
VkPipelineLayout vk_pipeline_layout, VkPipelineCache vk_cache, VkPipeline *vk_pipeline,
struct vkd3d_shader_code *spirv_code)
const D3D12_SHADER_BYTECODE *code)
{
VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT required_subgroup_size_info;
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
@ -2323,9 +2321,14 @@ static HRESULT vkd3d_create_compute_pipeline(struct d3d12_pipeline_state *state,
VkPipelineCreationFeedbackEXT feedbacks[1];
VkComputePipelineCreateInfo pipeline_info;
VkPipelineCreationFeedbackEXT feedback;
struct vkd3d_shader_code *spirv_code;
VkPipelineCache vk_cache;
VkResult vr;
HRESULT hr;
vk_cache = state->vk_pso_cache;
spirv_code = &state->compute.code;
pipeline_info.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
pipeline_info.pNext = NULL;
pipeline_info.flags = 0;
@ -2334,7 +2337,7 @@ static HRESULT vkd3d_create_compute_pipeline(struct d3d12_pipeline_state *state,
VK_SHADER_STAGE_COMPUTE_BIT, &required_subgroup_size_info,
code, spirv_code)))
return hr;
pipeline_info.layout = vk_pipeline_layout;
pipeline_info.layout = state->root_signature->compute.vk_pipeline_layout;
pipeline_info.basePipelineHandle = VK_NULL_HANDLE;
pipeline_info.basePipelineIndex = -1;
@ -2360,7 +2363,7 @@ static HRESULT vkd3d_create_compute_pipeline(struct d3d12_pipeline_state *state,
feedback_info.pipelineStageCreationFeedbackCount = 0;
vr = VK_CALL(vkCreateComputePipelines(device->vk_device,
vk_cache, 1, &pipeline_info, NULL, vk_pipeline));
vk_cache, 1, &pipeline_info, NULL, &state->compute.vk_pipeline));
TRACE("Called vkCreateComputePipelines.\n");
VK_CALL(vkDestroyShaderModule(device->vk_device, pipeline_info.stage.module, NULL));
@ -2401,12 +2404,7 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
vkd3d_load_spirv_from_cached_state(device, cached_pso,
VK_SHADER_STAGE_COMPUTE_BIT, &state->compute.code);
hr = vkd3d_create_compute_pipeline(state, device,
&desc->cs,
state->root_signature->compute.vk_pipeline_layout,
state->vk_pso_cache,
&state->compute.vk_pipeline,
&state->compute.code);
hr = vkd3d_create_compute_pipeline(state, device, &desc->cs);
if (FAILED(hr))
{