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;
sci.offset.x = vk->vp.x;
sci.offset.y = vk->vp.y;
sci.extent.width = vk->vp.width;
sci.extent.height = vk->vp.height;
if (vk->tracker.use_scissor)
{
sci = vk->tracker.scissor;
}
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);
vkCmdSetScissor (vk->cmd, 0, 1, &sci);

View File

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

View File

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