From 42c1e0c0fbd5160f4c774d2a73b12c62272cfc92 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 28 Sep 2016 13:24:50 +0200 Subject: [PATCH] libs/vkd3d: Implement d3d12_command_list_RSSetScissorRects(). --- libs/vkd3d/command.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index ec1acc12..d661e72b 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -809,8 +809,31 @@ static void STDMETHODCALLTYPE d3d12_command_list_RSSetViewports(ID3D12GraphicsCo static void STDMETHODCALLTYPE d3d12_command_list_RSSetScissorRects(ID3D12GraphicsCommandList *iface, UINT rect_count, const D3D12_RECT *rects) { - FIXME("iface %p, rect_count %u, rects %p stub!\n", - iface, rect_count, rects); + struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface); + const struct vkd3d_vk_device_procs *vk_procs; + struct VkRect2D *vk_rects; + unsigned int i; + + TRACE("iface %p, rect_count %u, rects %p.\n", iface, rect_count, rects); + + if (!(vk_rects = vkd3d_calloc(rect_count, sizeof(*vk_rects)))) + { + ERR("Failed to allocate Vulkan scissor rects.\n"); + return; + } + + for (i = 0; i < rect_count; ++i) + { + vk_rects[i].offset.x = rects[i].left; + vk_rects[i].offset.y = rects[i].top; + vk_rects[i].extent.width = rects[i].right - rects[i].left; + vk_rects[i].extent.height = rects[i].bottom - rects[i].top; + } + + vk_procs = &list->device->vk_procs; + VK_CALL(vkCmdSetScissor(list->vk_command_buffer, 0, rect_count, vk_rects)); + + free(vk_rects); } static void STDMETHODCALLTYPE d3d12_command_list_OMSetBlendFactor(ID3D12GraphicsCommandList *iface,