[PATCH vkd3d 5/6] vkd3d: Add FIXME() for unsupported strip cut values.
Józef Kucia
joseph.kucia at gmail.com
Mon Dec 3 04:31:30 CST 2018
From: Józef Kucia <jkucia at codeweavers.com>
In Vulkan, the strip cut value is derived from the current index buffer
format. We could recompile the pipeline to handle more cases.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
libs/vkd3d/command.c | 18 ++++++++++++++++++
libs/vkd3d/state.c | 6 ++----
libs/vkd3d/vkd3d_private.h | 4 +++-
3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index 3d5e898b4adb..2e6357ac3c3f 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -1703,6 +1703,8 @@ static void d3d12_command_list_reset_state(struct d3d12_command_list *list,
memset(list->strides, 0, sizeof(list->strides));
list->primitive_topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
+ list->index_buffer_format = DXGI_FORMAT_UNKNOWN;
+
memset(list->views, 0, sizeof(list->views));
list->fb_width = 0;
list->fb_height = 0;
@@ -2293,6 +2295,20 @@ static void STDMETHODCALLTYPE d3d12_command_list_DrawIndexedInstanced(ID3D12Grap
return;
}
+ switch (list->state->u.graphics.index_buffer_strip_cut_value)
+ {
+ case D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFF:
+ if (list->index_buffer_format != DXGI_FORMAT_R16_UINT)
+ FIXME("Strip cut value 0xffff is not supported with index buffer format %#x.\n", list->index_buffer_format);
+ break;
+ case D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFFFFFF:
+ if (list->index_buffer_format != DXGI_FORMAT_R32_UINT)
+ FIXME("Strip cut value 0xffffffff is not supported with index buffer format %#x.\n", list->index_buffer_format);
+ break;
+ default:
+ break;
+ }
+
VK_CALL(vkCmdDrawIndexed(list->vk_command_buffer, index_count_per_instance,
instance_count, start_vertex_location, base_vertex_location, start_instance_location));
}
@@ -3475,6 +3491,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_IASetIndexBuffer(ID3D12Graphics
return;
}
+ list->index_buffer_format = view->Format;
+
resource = vkd3d_gpu_va_allocator_dereference(&list->device->gpu_va_allocator, view->BufferLocation);
VK_CALL(vkCmdBindIndexBuffer(list->vk_command_buffer, resource->u.vk_buffer,
view->BufferLocation - resource->gpu_address, index_type));
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 03d8ef35ffd2..64c21588a825 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -2236,11 +2236,9 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
switch (desc->IBStripCutValue)
{
case D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED:
- graphics->primitive_restart_enable = VK_FALSE;
- break;
case D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFF:
case D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFFFFFF:
- graphics->primitive_restart_enable = VK_TRUE;
+ graphics->index_buffer_strip_cut_value = desc->IBStripCutValue;
break;
default:
WARN("Invalid index buffer strip cut value %#x.\n", desc->IBStripCutValue);
@@ -2506,7 +2504,7 @@ VkPipeline d3d12_pipeline_state_get_or_create_pipeline(struct d3d12_pipeline_sta
ia_desc.pNext = NULL;
ia_desc.flags = 0;
ia_desc.topology = topology;
- ia_desc.primitiveRestartEnable = graphics->primitive_restart_enable;
+ ia_desc.primitiveRestartEnable = !!graphics->index_buffer_strip_cut_value;
blend_desc.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
blend_desc.pNext = NULL;
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index f97755925888..7e04dc31a0c8 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -531,7 +531,7 @@ struct d3d12_graphics_pipeline_state
size_t attachment_count, rt_idx;
VkRenderPass render_pass;
- VkBool32 primitive_restart_enable;
+ D3D12_INDEX_BUFFER_STRIP_CUT_VALUE index_buffer_strip_cut_value;
struct VkPipelineRasterizationStateCreateInfo rs_desc;
struct VkPipelineMultisampleStateCreateInfo ms_desc;
struct VkPipelineDepthStencilStateCreateInfo ds_desc;
@@ -696,6 +696,8 @@ struct d3d12_command_list
uint32_t strides[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
VkPrimitiveTopology primitive_topology;
+ DXGI_FORMAT index_buffer_format;
+
VkImageView views[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT + 1];
unsigned int fb_width;
unsigned int fb_height;
--
2.18.1
More information about the wine-devel
mailing list