mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d: Take the root signature from shaders when creating graphics pipelines.
If the root signature wasn't explicitly specified. This fixes a failure in The Touryst.
This commit is contained in:
committed by
Henri Verbeet
parent
42b65e80cf
commit
2feb3a3bba
Notes:
Henri Verbeet
2025-02-20 16:07:51 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1384
@@ -3206,7 +3206,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
|
|||||||
struct vkd3d_shader_spirv_target_info ps_target_info;
|
struct vkd3d_shader_spirv_target_info ps_target_info;
|
||||||
struct vkd3d_shader_interface_info shader_interface;
|
struct vkd3d_shader_interface_info shader_interface;
|
||||||
struct vkd3d_shader_spirv_target_info target_info;
|
struct vkd3d_shader_spirv_target_info target_info;
|
||||||
const struct d3d12_root_signature *root_signature;
|
struct d3d12_root_signature *root_signature;
|
||||||
bool have_attachment, is_dsv_format_unknown;
|
bool have_attachment, is_dsv_format_unknown;
|
||||||
VkShaderStageFlagBits xfb_stage = 0;
|
VkShaderStageFlagBits xfb_stage = 0;
|
||||||
VkSampleCountFlagBits sample_count;
|
VkSampleCountFlagBits sample_count;
|
||||||
@@ -3261,10 +3261,25 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state->implicit_root_signature = NULL;
|
||||||
if (!(root_signature = unsafe_impl_from_ID3D12RootSignature(desc->root_signature)))
|
if (!(root_signature = unsafe_impl_from_ID3D12RootSignature(desc->root_signature)))
|
||||||
{
|
{
|
||||||
WARN("Root signature is NULL.\n");
|
TRACE("Root signature is NULL, looking for an embedded signature in the vertex shader.\n");
|
||||||
return E_INVALIDARG;
|
if (FAILED(hr = d3d12_root_signature_create(device,
|
||||||
|
desc->vs.pShaderBytecode, desc->vs.BytecodeLength, &root_signature))
|
||||||
|
&& FAILED(hr = d3d12_root_signature_create(device,
|
||||||
|
desc->ps.pShaderBytecode, desc->ps.BytecodeLength, &root_signature))
|
||||||
|
&& FAILED(hr = d3d12_root_signature_create(device,
|
||||||
|
desc->ds.pShaderBytecode, desc->ds.BytecodeLength, &root_signature))
|
||||||
|
&& FAILED(hr = d3d12_root_signature_create(device,
|
||||||
|
desc->hs.pShaderBytecode, desc->hs.BytecodeLength, &root_signature))
|
||||||
|
&& FAILED(hr = d3d12_root_signature_create(device,
|
||||||
|
desc->gs.pShaderBytecode, desc->gs.BytecodeLength, &root_signature)))
|
||||||
|
{
|
||||||
|
WARN("Failed to find an embedded root signature, hr %s.\n", debugstr_hresult(hr));
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
state->implicit_root_signature = &root_signature->ID3D12RootSignature_iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
sample_count = vk_samples_from_dxgi_sample_desc(&desc->sample_desc);
|
sample_count = vk_samples_from_dxgi_sample_desc(&desc->sample_desc);
|
||||||
@@ -3711,12 +3726,14 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
|
|||||||
|
|
||||||
vkd3d_shader_free_scan_signature_info(&signature_info);
|
vkd3d_shader_free_scan_signature_info(&signature_info);
|
||||||
state->vk_bind_point = VK_PIPELINE_BIND_POINT_GRAPHICS;
|
state->vk_bind_point = VK_PIPELINE_BIND_POINT_GRAPHICS;
|
||||||
state->implicit_root_signature = NULL;
|
|
||||||
d3d12_device_add_ref(state->device = device);
|
d3d12_device_add_ref(state->device = device);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
if (state->implicit_root_signature)
|
||||||
|
ID3D12RootSignature_Release(state->implicit_root_signature);
|
||||||
|
|
||||||
for (i = 0; i < graphics->stage_count; ++i)
|
for (i = 0; i < graphics->stage_count; ++i)
|
||||||
{
|
{
|
||||||
VK_CALL(vkDestroyShaderModule(device->vk_device, state->u.graphics.stages[i].module, NULL));
|
VK_CALL(vkDestroyShaderModule(device->vk_device, state->u.graphics.stages[i].module, NULL));
|
||||||
|
@@ -3491,7 +3491,6 @@ static void test_create_graphics_pipeline_state(void)
|
|||||||
pso_desc.VS = shader_bytecode(vs_with_rs_code, sizeof(vs_with_rs_code));
|
pso_desc.VS = shader_bytecode(vs_with_rs_code, sizeof(vs_with_rs_code));
|
||||||
hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc,
|
hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc,
|
||||||
&IID_ID3D12PipelineState, (void **)&pipeline_state);
|
&IID_ID3D12PipelineState, (void **)&pipeline_state);
|
||||||
todo
|
|
||||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
ID3D12PipelineState_Release(pipeline_state);
|
ID3D12PipelineState_Release(pipeline_state);
|
||||||
@@ -3501,7 +3500,6 @@ static void test_create_graphics_pipeline_state(void)
|
|||||||
pso_desc.PS = shader_bytecode(ps_with_rs_code, sizeof(ps_with_rs_code));
|
pso_desc.PS = shader_bytecode(ps_with_rs_code, sizeof(ps_with_rs_code));
|
||||||
hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc,
|
hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc,
|
||||||
&IID_ID3D12PipelineState, (void **)&pipeline_state);
|
&IID_ID3D12PipelineState, (void **)&pipeline_state);
|
||||||
todo
|
|
||||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
ID3D12PipelineState_Release(pipeline_state);
|
ID3D12PipelineState_Release(pipeline_state);
|
||||||
@@ -3512,7 +3510,6 @@ static void test_create_graphics_pipeline_state(void)
|
|||||||
pso_desc.PS = shader_bytecode(ps_with_rs_code, sizeof(ps_with_rs_code));
|
pso_desc.PS = shader_bytecode(ps_with_rs_code, sizeof(ps_with_rs_code));
|
||||||
hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc,
|
hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc,
|
||||||
&IID_ID3D12PipelineState, (void **)&pipeline_state);
|
&IID_ID3D12PipelineState, (void **)&pipeline_state);
|
||||||
todo
|
|
||||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
ID3D12PipelineState_Release(pipeline_state);
|
ID3D12PipelineState_Release(pipeline_state);
|
||||||
|
Reference in New Issue
Block a user