From ce509dc70e106b39b3fd221efa51f26c15299d2e Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 6 Oct 2016 21:46:33 +0200 Subject: [PATCH] libs/vkd3d: Implement d3d12_command_list_IASetPrimitiveTopology(). --- libs/vkd3d/command.c | 36 +++++++++++++++++++++++++++++++++--- libs/vkd3d/vkd3d_private.h | 2 ++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 66c835a5..c3863f20 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -1207,10 +1207,34 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveSubresource(ID3D12Graphi iface, dst_resource, dst_sub_resource, src_resource, src_sub_resource, format); } -static void STDMETHODCALLTYPE d3d12_command_list_IASetPrimitiveTopology(ID3D12GraphicsCommandList *iface, - D3D12_PRIMITIVE_TOPOLOGY primitive_topology) +static enum VkPrimitiveTopology vk_topology_from_d3d12_topology(D3D12_PRIMITIVE_TOPOLOGY topology) { - FIXME("iface %p, primitive_topology %#x stub!\n", iface, primitive_topology); + switch (topology) + { + case D3D_PRIMITIVE_TOPOLOGY_POINTLIST: + return VK_PRIMITIVE_TOPOLOGY_POINT_LIST; + case D3D_PRIMITIVE_TOPOLOGY_LINELIST: + return VK_PRIMITIVE_TOPOLOGY_LINE_LIST; + case D3D_PRIMITIVE_TOPOLOGY_LINESTRIP: + return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP; + case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST: + return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; + case D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: + return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; + default: + FIXME("Unhandled primitive topology %#x.\n", topology); + return VK_PRIMITIVE_TOPOLOGY_POINT_LIST; + } +} + +static void STDMETHODCALLTYPE d3d12_command_list_IASetPrimitiveTopology(ID3D12GraphicsCommandList *iface, + D3D12_PRIMITIVE_TOPOLOGY topology) +{ + struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface); + + TRACE("iface %p, topology %#x.\n", iface, topology); + + list->ia_desc.topology = vk_topology_from_d3d12_topology(topology); } static void STDMETHODCALLTYPE d3d12_command_list_RSSetViewports(ID3D12GraphicsCommandList *iface, @@ -1715,6 +1739,12 @@ static HRESULT d3d12_command_list_init(struct d3d12_command_list *list, struct d return hr; } + list->ia_desc.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; + list->ia_desc.pNext = NULL; + list->ia_desc.flags = 0; + list->ia_desc.topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST; + list->ia_desc.primitiveRestartEnable = VK_FALSE; + return S_OK; } diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 2e5cec96..8f6de660 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -229,6 +229,8 @@ struct d3d12_command_list VkCommandBuffer vk_command_buffer; BOOL is_recording; + struct VkPipelineInputAssemblyStateCreateInfo ia_desc; + struct d3d12_command_allocator *allocator; struct d3d12_device *device; };