[PATCH vkd3d 4/5] vkd3d: Do not crash on NULL views in IASetIndexBuffers().

Józef Kucia joseph.kucia at gmail.com
Thu Mar 7 04:01:14 CST 2019


From: Józef Kucia <jkucia at codeweavers.com>

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 libs/vkd3d/command.c | 6 ++++++
 tests/d3d12.c        | 1 +
 2 files changed, 7 insertions(+)

diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index e535f2020012..9ed768d1ac5c 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -3583,6 +3583,12 @@ static void STDMETHODCALLTYPE d3d12_command_list_IASetIndexBuffer(ID3D12Graphics
 
     TRACE("iface %p, view %p.\n", iface, view);
 
+    if (!view)
+    {
+        WARN("Ignoring NULL index buffer view.\n");
+        return;
+    }
+
     vk_procs = &list->device->vk_procs;
 
     switch (view->Format)
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 5f869d229db3..173c576e1855 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -4492,6 +4492,7 @@ static void test_draw_indexed_instanced(void)
     ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature);
     ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state);
     ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+    ID3D12GraphicsCommandList_IASetIndexBuffer(command_list, NULL);
     ID3D12GraphicsCommandList_IASetIndexBuffer(command_list, &ibv);
     ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport);
     ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect);
-- 
2.19.2




More information about the wine-devel mailing list