From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/state.c | 12 ++++++++++-- libs/vkd3d/vkd3d_private.h | 2 ++ tests/d3d12.c | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index a9a463de97e2..e9f73e82b44f 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -899,11 +899,12 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa root_signature->vk_push_set_layout = VK_NULL_HANDLE; root_signature->vk_set_layout = VK_NULL_HANDLE; root_signature->parameters = NULL; + root_signature->flags = desc->Flags; root_signature->descriptor_mapping = NULL; root_signature->static_sampler_count = 0; root_signature->static_samplers = NULL;
- if (desc->Flags) + if (desc->Flags & ~D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT) FIXME("Ignoring root signature flags %#x.\n", desc->Flags);
if (FAILED(hr = d3d12_root_signature_info_from_desc(&info, desc))) @@ -2168,10 +2169,17 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s graphics->xfb_enabled = false; if (so_desc->NumEntries) { + if (!(root_signature->flags & D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT)) + { + WARN("Stream output is used without D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT.\n"); + hr = E_INVALIDARG; + goto fail; + } + if (!vk_info->EXT_transform_feedback) { - hr = E_NOTIMPL; FIXME("Transform feedback is not supported by Vulkan implementation.\n"); + hr = E_NOTIMPL; goto fail; }
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 65fcd9f5ce11..c4b0a4c06513 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -568,6 +568,8 @@ struct d3d12_root_signature unsigned int parameter_count; uint32_t main_set;
+ D3D12_ROOT_SIGNATURE_FLAGS flags; + unsigned int descriptor_count; struct vkd3d_shader_resource_binding *descriptor_mapping; struct vkd3d_shader_descriptor_binding dummy_sampler; diff --git a/tests/d3d12.c b/tests/d3d12.c index 5be8e0d9b967..97af4c1a9f67 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -2425,6 +2425,12 @@ static void test_create_graphics_pipeline_state(void) unsigned int i; HRESULT hr;
+ static const D3D12_SO_DECLARATION_ENTRY so_declaration[] = + { + {0, "SV_Position", 0, 0, 4, 0}, + }; + static const unsigned int strides[] = {16}; + if (!(device = create_device())) { skip("Failed to create device.\n"); @@ -2537,6 +2543,16 @@ static void test_create_graphics_pipeline_state(void) &IID_ID3D12PipelineState, (void **)&pipeline_state); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ /* Stream output without D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT. */ + init_pipeline_state_desc(&pso_desc, root_signature, DXGI_FORMAT_R8G8B8A8_UNORM, NULL, NULL, NULL); + pso_desc.StreamOutput.NumEntries = ARRAY_SIZE(so_declaration); + pso_desc.StreamOutput.pSODeclaration = so_declaration; + pso_desc.StreamOutput.pBufferStrides = strides; + pso_desc.StreamOutput.NumStrides = ARRAY_SIZE(strides); + hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc, + &IID_ID3D12PipelineState, (void **)&pipeline_state); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + refcount = ID3D12RootSignature_Release(root_signature); ok(!refcount, "ID3D12RootSignature has %u references left.\n", (unsigned int)refcount); refcount = ID3D12Device_Release(device);