vulkan_test2

diff src/wsys_x11.c @ 6:1dd2c7398afc

swapchain images and other tales of woe
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 22 Sep 2017 18:13:03 +0300
parents cec4b0e7fce8
children 20eb42197ab8
line diff
     1.1 --- a/src/wsys_x11.c	Fri Sep 22 17:48:18 2017 +0300
     1.2 +++ b/src/wsys_x11.c	Fri Sep 22 18:13:03 2017 +0300
     1.3 @@ -26,6 +26,8 @@
     1.4  static Window win;
     1.5  static VkSurfaceKHR surf;
     1.6  static VkSwapchainKHR swapchain;
     1.7 +static VkImage *swapchain_images;
     1.8 +static int next_swapchain_image;
     1.9  static Atom xa_wm_delete;
    1.10  static int win_width, win_height;
    1.11  static int win_mapped;
    1.12 @@ -198,7 +200,8 @@
    1.13  
    1.14  void wsys_swap_buffers(void)
    1.15  {
    1.16 -	/* TODO */
    1.17 +	vku_present(swapchain, next_swapchain_image);
    1.18 +	next_swapchain_image = vku_get_next_image(swapchain);
    1.19  }
    1.20  
    1.21  void wsys_redisplay(void)
    1.22 @@ -223,6 +226,10 @@
    1.23  		}
    1.24  		swapchain = sc;
    1.25  
    1.26 +		free(swapchain_images);
    1.27 +		swapchain_images = vku_get_swapchain_images(sc, 0);
    1.28 +		next_swapchain_image = vku_get_next_image(swapchain);
    1.29 +
    1.30  		if(cb.reshape) {
    1.31  			cb.reshape(win_width, win_height);
    1.32  		}