Esempio n. 1
0
static bool gfx_ctx_wgl_set_resize(void *data,
      unsigned width, unsigned height)
{
   (void)data;
   (void)width;
   (void)height;

   switch (win32_api)
   {
      case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
         if (!vulkan_create_swapchain(&win32_vk, width, height, win32_interval))
         {
            RARCH_ERR("[Win32/Vulkan]: Failed to update swapchain.\n");
            return false;
         }

         if (win32_vk.created_new_swapchain)
            vulkan_acquire_next_image(&win32_vk);
         win32_vk.context.invalid_swapchain = true;
         win32_vk.need_new_swapchain        = false;
#endif
         break;

      case GFX_CTX_NONE:
      default:
         break;
   }

   return false;
}
Esempio n. 2
0
static bool gfx_ctx_x_set_resize(void *data,
      unsigned width, unsigned height)
{
#ifdef HAVE_VULKAN
   gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;
#endif
   (void)data;
   (void)width;
   (void)height;

   switch (x_api)
   {
      case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
         if (!vulkan_create_swapchain(&x->vk, width, height, x->g_interval))
         {
            RARCH_ERR("[X/Vulkan]: Failed to update swapchain.\n");
            return false;
         }

         x->vk.context.invalid_swapchain = true;
         x->vk.need_new_swapchain        = false;
#endif
         break;

      case GFX_CTX_NONE:
      default:
         break;
   }
   return false;
}
Esempio n. 3
0
static bool gfx_ctx_khr_display_set_resize(void *data,
      unsigned width, unsigned height)
{
   khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;

   khr->width = width;
   khr->height = height;
   if (!vulkan_create_swapchain(&khr->vk, khr->width, khr->height, khr->swap_interval))
   {
      RARCH_ERR("[Vulkan]: Failed to update swapchain.\n");
      return false;
   }

   khr->vk.context.invalid_swapchain = true;
   khr->vk.need_new_swapchain = false;
   return false;
}
Esempio n. 4
0
static bool gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height)
{
   gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;

   switch (wl_api)
   {
      case GFX_CTX_OPENGL_API:
      case GFX_CTX_OPENGL_ES_API:
      case GFX_CTX_OPENVG_API:
#ifdef HAVE_EGL
         wl_egl_window_resize(wl->win, width, height, 0, 0);
#endif
         break;
      case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
         wl->width  = width;
         wl->height = height;

         if (vulkan_create_swapchain(&wl->vk, width, height, wl->swap_interval))
         {
            wl->vk.context.invalid_swapchain = true;
            vulkan_acquire_next_image(&wl->vk);
         }
         else
         {
            RARCH_ERR("[Wayland/Vulkan]: Failed to update swapchain.\n");
            return false;
         }

         wl->vk.need_new_swapchain = false;
#endif
         break;
      case GFX_CTX_NONE:
      default:
         break;
   }

   return true;
}
Esempio n. 5
0
static bool gfx_ctx_x_set_resize(void *data,
      unsigned width, unsigned height)
{
   (void)data;
   (void)width;
   (void)height;

   switch (x_api)
   {
      case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
         {
            gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;

            /* FIXME/TODO - threading error here */

            if (!vulkan_create_swapchain(&x->vk, width, height, x->g_interval))
            {
               RARCH_ERR("[X/Vulkan]: Failed to update swapchain.\n");
               x->vk.swapchain = VK_NULL_HANDLE;
               return false;
            }

            if (x->vk.created_new_swapchain)
               vulkan_acquire_next_image(&x->vk);
            x->vk.context.invalid_swapchain = true;
            x->vk.need_new_swapchain        = false;
         }
#endif
         break;

      case GFX_CTX_NONE:
      default:
         break;
   }
   return true;
}
Esempio n. 6
0
static bool android_gfx_ctx_set_resize(void *data,
      unsigned width, unsigned height)
{
#ifdef HAVE_VULKAN
   android_ctx_data_t        *and  = (android_ctx_data_t*)data;
   struct android_app *android_app = (struct android_app*)g_android;
#endif
   (void)data;
   (void)width;
   (void)height;

   switch (android_api)
   {
      case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
         and->width  = ANativeWindow_getWidth(android_app->window);
         and->height = ANativeWindow_getHeight(android_app->window);
         RARCH_LOG("[Android]: Native window size: %u x %u.\n", and->width, and->height);
         if (!vulkan_create_swapchain(&and->vk, and->width, and->height, and->swap_interval))
         {
            RARCH_ERR("[Android]: Failed to update swapchain.\n");
            return false;
         }

         and->vk.context.invalid_swapchain = true;
         and->vk.need_new_swapchain        = false;
#endif
         break;

      case GFX_CTX_NONE:
      default:
         break;
   }

   return false;
}