Vulkan: Fix scissor in menu driver.

This commit is contained in:
Themaister 2018-11-08 21:44:44 +01:00
parent 3f344660c0
commit afcd25a3f8
3 changed files with 22 additions and 17 deletions

View File

@ -979,10 +979,18 @@ static void vulkan_check_dynamic_state(
{ {
VkRect2D sci; VkRect2D sci;
sci.offset.x = vk->vp.x; if (vk->tracker.use_scissor)
sci.offset.y = vk->vp.y; {
sci.extent.width = vk->vp.width; sci = vk->tracker.scissor;
sci.extent.height = vk->vp.height; }
else
{
/* No scissor -> viewport */
sci.offset.x = vk->vp.x;
sci.offset.y = vk->vp.y;
sci.extent.width = vk->vp.width;
sci.extent.height = vk->vp.height;
}
vkCmdSetViewport(vk->cmd, 0, 1, &vk->vk_vp); vkCmdSetViewport(vk->cmd, 0, 1, &vk->vk_vp);
vkCmdSetScissor (vk->cmd, 0, 1, &sci); vkCmdSetScissor (vk->cmd, 0, 1, &sci);

View File

@ -423,6 +423,8 @@ typedef struct vk
struct struct
{ {
uint64_t dirty; uint64_t dirty;
VkRect2D scissor;
bool use_scissor;
VkPipeline pipeline; VkPipeline pipeline;
VkImageView view; VkImageView view;
VkSampler sampler; VkSampler sampler;

View File

@ -352,25 +352,20 @@ static void menu_display_vk_scissor_begin(video_frame_info_t *video_info,
VkRect2D sci; VkRect2D sci;
vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL; vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL;
sci.offset.x = x; vk->tracker.use_scissor = true;
sci.offset.y = video_info->height - y - height; vk->tracker.scissor.offset.x = x;
sci.extent.width = width; vk->tracker.scissor.offset.y = y;
sci.extent.height = height; vk->tracker.scissor.extent.width = width;
vk->tracker.scissor.extent.height = height;
vkCmdSetScissor (vk->cmd, 0, 1, &sci); vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
} }
static void menu_display_vk_scissor_end(video_frame_info_t *video_info) static void menu_display_vk_scissor_end(video_frame_info_t *video_info)
{ {
VkRect2D sci; VkRect2D sci;
vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL; vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL;
vk->tracker.use_scissor = false;
sci.offset.x = 0; vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
sci.offset.y = 0;
sci.extent.width = video_info->width;
sci.extent.height = video_info->height;
vkCmdSetScissor (vk->cmd, 0, 1, &sci);
} }
menu_display_ctx_driver_t menu_display_ctx_vulkan = { menu_display_ctx_driver_t menu_display_ctx_vulkan = {