From 5e134b6b602bdafee7c222b93fbbe453297f86dc Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 20 May 2020 00:02:29 +0430 Subject: [PATCH] wined3d: Implement scissor rectangle support for the Vulkan adapter. No multi-viewport support yet. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/context_vk.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 19351d4b953..c114f8be7b9 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -1462,7 +1462,9 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte update = true; } - if (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_VIEWPORT)) + if (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_VIEWPORT) + || wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_SCISSORRECT) + || wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_RASTERIZER)) { key->viewport.x = state->viewports[0].x; key->viewport.y = state->viewports[0].y; @@ -1471,10 +1473,22 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte key->viewport.minDepth = state->viewports[0].min_z; key->viewport.maxDepth = state->viewports[0].max_z; - key->scissor.offset.x = key->viewport.x; - key->scissor.offset.y = key->viewport.y; - key->scissor.extent.width = key->viewport.width; - key->scissor.extent.height = key->viewport.height; + if (state->rasterizer_state && state->rasterizer_state->desc.scissor) + { + const RECT *r = &state->scissor_rects[0]; + + key->scissor.offset.x = r->left; + key->scissor.offset.y = r->top; + key->scissor.extent.width = r->right - r->left; + key->scissor.extent.height = r->bottom - r->top; + } + else + { + key->scissor.offset.x = key->viewport.x; + key->scissor.offset.y = key->viewport.y; + key->scissor.extent.width = key->viewport.width; + key->scissor.extent.height = key->viewport.height; + } key->viewport.y += key->viewport.height; key->viewport.height = -key->viewport.height;