nuclear@0: #include nuclear@4: #include "wsys.h" nuclear@3: #include "vku.h" nuclear@13: #include "vkpipe.h" nuclear@7: #include "vkgl.h" nuclear@0: nuclear@4: static void display(void); nuclear@4: static void reshape(int x, int y); nuclear@4: static void keyboard(int key, int pressed); nuclear@4: nuclear@13: static struct vku_pipeline pipeline; nuclear@13: static VkShaderModule vsdr, psdr; nuclear@13: nuclear@0: int main(void) nuclear@0: { nuclear@3: if(vku_create_dev() == -1) { nuclear@4: return 1; nuclear@0: } nuclear@0: nuclear@4: if(wsys_create_window(800, 600) == -1) { nuclear@4: return 1; nuclear@4: } nuclear@4: wsys_set_window_title("Vulkan test 2"); nuclear@4: nuclear@4: wsys_display_callback(display); nuclear@4: wsys_reshape_callback(reshape); nuclear@4: wsys_keyboard_callback(keyboard); nuclear@4: nuclear@13: wsys_process_events(WSYS_NONBLOCK); nuclear@13: nuclear@13: if(!(vsdr = vku_load_shader("sdr/vertex.spv")) || nuclear@13: !(psdr = vku_load_shader("sdr/pixel.spv"))) { nuclear@13: return 1; nuclear@13: } nuclear@13: nuclear@13: vku_init_pipeline(&pipeline); nuclear@13: vku_pipeline_shader(&pipeline, vsdr, VK_SHADER_STAGE_VERTEX_BIT); nuclear@13: vku_pipeline_shader(&pipeline, psdr, VK_SHADER_STAGE_FRAGMENT_BIT); nuclear@13: vku_pipeline_viewport(&pipeline, 0, 0, 800, 600); nuclear@13: vku_pipeline_renderpass(&pipeline, vkrpass); nuclear@13: if(!vku_create_pipeline(&pipeline)) { nuclear@13: return 1; nuclear@13: } nuclear@13: nuclear@13: nuclear@4: while(wsys_process_events(WSYS_BLOCKING) != -1); nuclear@4: nuclear@4: wsys_destroy_window(); nuclear@3: vku_cleanup(); nuclear@0: return 0; nuclear@0: } nuclear@4: nuclear@4: static void display(void) nuclear@4: { nuclear@7: vkgl_clear_color(1, 0, 0, 1); nuclear@7: vkgl_clear(VKGL_COLOR_BUFFER_BIT); nuclear@7: nuclear@4: wsys_swap_buffers(); nuclear@4: } nuclear@4: nuclear@4: static void reshape(int x, int y) nuclear@4: { nuclear@4: } nuclear@4: nuclear@4: static void keyboard(int key, int pressed) nuclear@4: { nuclear@4: if(key == 27) { nuclear@4: wsys_quit(); nuclear@4: } nuclear@4: }