From 0f3fcdd3112b13b7457143de835febd86ff40d76 Mon Sep 17 00:00:00 2001 From: natinusala Date: Mon, 28 Jan 2019 19:31:27 +0100 Subject: [PATCH] Implement scissoring for d2d12 --- menu/drivers_display/menu_display_d3d12.c | 38 +++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/menu/drivers_display/menu_display_d3d12.c b/menu/drivers_display/menu_display_d3d12.c index 1703cac367..a579c16245 100644 --- a/menu/drivers_display/menu_display_d3d12.c +++ b/menu/drivers_display/menu_display_d3d12.c @@ -295,6 +295,40 @@ static bool menu_display_d3d12_font_init_first( return true; } +void menu_display_d3d12_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) +{ + D3D12_RECT rect = {0}; + d3d12_video_t *d3d12 = video_info ? + (d3d12_video_t*)video_info->userdata : NULL; + + rect.left = x; + rect.top = y; + rect.right = width + x; + rect.bottom = height + y; + + if (!d3d12 || !width || !height) + return; + + D3D12RSSetScissorRects(d3d12->queue.cmd, 1, &rect); +} + +void menu_display_d3d12_scissor_end(video_frame_info_t *video_info) +{ + D3D12_RECT rect = {0}; + d3d12_video_t *d3d12 = video_info ? + (d3d12_video_t*)video_info->userdata : NULL; + + if (!d3d12) + return; + + rect.left = d3d12->vp.x; + rect.top = d3d12->vp.y; + rect.right = d3d12->vp.width; + rect.bottom = d3d12->vp.height; + + D3D12RSSetScissorRects(d3d12->queue.cmd, 1, &rect); +} + menu_display_ctx_driver_t menu_display_ctx_d3d12 = { menu_display_d3d12_draw, menu_display_d3d12_draw_pipeline, @@ -310,6 +344,6 @@ menu_display_ctx_driver_t menu_display_ctx_d3d12 = { MENU_VIDEO_DRIVER_DIRECT3D12, "d3d12", true, - NULL, - NULL + menu_display_d3d12_scissor_begin, + menu_display_d3d12_scissor_end };