vulkan_test2

diff src/main.c @ 13:d34f84bede17

pipeline madness
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 25 Jun 2018 08:00:57 +0300
parents 20eb42197ab8
children 196122a2b8c2
line diff
     1.1 --- a/src/main.c	Sat Jun 23 07:47:49 2018 +0300
     1.2 +++ b/src/main.c	Mon Jun 25 08:00:57 2018 +0300
     1.3 @@ -1,12 +1,16 @@
     1.4  #include <stdio.h>
     1.5  #include "wsys.h"
     1.6  #include "vku.h"
     1.7 +#include "vkpipe.h"
     1.8  #include "vkgl.h"
     1.9  
    1.10  static void display(void);
    1.11  static void reshape(int x, int y);
    1.12  static void keyboard(int key, int pressed);
    1.13  
    1.14 +static struct vku_pipeline pipeline;
    1.15 +static VkShaderModule vsdr, psdr;
    1.16 +
    1.17  int main(void)
    1.18  {
    1.19  	if(vku_create_dev() == -1) {
    1.20 @@ -22,6 +26,23 @@
    1.21  	wsys_reshape_callback(reshape);
    1.22  	wsys_keyboard_callback(keyboard);
    1.23  
    1.24 +	wsys_process_events(WSYS_NONBLOCK);
    1.25 +
    1.26 +	if(!(vsdr = vku_load_shader("sdr/vertex.spv")) ||
    1.27 +			!(psdr = vku_load_shader("sdr/pixel.spv"))) {
    1.28 +		return 1;
    1.29 +	}
    1.30 +
    1.31 +	vku_init_pipeline(&pipeline);
    1.32 +	vku_pipeline_shader(&pipeline, vsdr, VK_SHADER_STAGE_VERTEX_BIT);
    1.33 +	vku_pipeline_shader(&pipeline, psdr, VK_SHADER_STAGE_FRAGMENT_BIT);
    1.34 +	vku_pipeline_viewport(&pipeline, 0, 0, 800, 600);
    1.35 +	vku_pipeline_renderpass(&pipeline, vkrpass);
    1.36 +	if(!vku_create_pipeline(&pipeline)) {
    1.37 +		return 1;
    1.38 +	}
    1.39 +
    1.40 +
    1.41  	while(wsys_process_events(WSYS_BLOCKING) != -1);
    1.42  
    1.43  	wsys_destroy_window();