|
|
|
@ -54,9 +54,6 @@ typedef struct ApplicationState {
@@ -54,9 +54,6 @@ typedef struct ApplicationState {
|
|
|
|
|
VkExtent2D swapchain_extent; |
|
|
|
|
//describes how to access an image and allows access to it
|
|
|
|
|
VkImageView* swapchain_image_views; |
|
|
|
|
//shaders
|
|
|
|
|
VkShaderModule vertex_shader_module; |
|
|
|
|
VkShaderModule fragment_shader_module; |
|
|
|
|
VkRenderPass render_pass; |
|
|
|
|
VkPipelineLayout pipeline_layout; |
|
|
|
|
|
|
|
|
@ -656,24 +653,27 @@ void create_render_pass(ApplicationState* state) {
@@ -656,24 +653,27 @@ void create_render_pass(ApplicationState* state) {
|
|
|
|
|
//color blending : applies operations to mix different fragments that map to the same pixel
|
|
|
|
|
|
|
|
|
|
void create_graphics_pipeline(ApplicationState* state) { |
|
|
|
|
//shaders
|
|
|
|
|
VkShaderModule vertex_shader_module; |
|
|
|
|
VkShaderModule fragment_shader_module; |
|
|
|
|
size_t vertex_shader_size; |
|
|
|
|
size_t fragment_shader_size; |
|
|
|
|
char* vertex_shader = load_file("./vertex_simple.spv", &vertex_shader_size); |
|
|
|
|
char* fragment_shader = load_file("./fragment_simple.spv", &fragment_shader_size); |
|
|
|
|
|
|
|
|
|
state->vertex_shader_module = create_shader_module(state, vertex_shader, vertex_shader_size); |
|
|
|
|
state->fragment_shader_module = create_shader_module(state, fragment_shader, fragment_shader_size); |
|
|
|
|
vertex_shader_module = create_shader_module(state, vertex_shader, vertex_shader_size); |
|
|
|
|
fragment_shader_module = create_shader_module(state, fragment_shader, fragment_shader_size); |
|
|
|
|
|
|
|
|
|
VkPipelineShaderStageCreateInfo vertex_shader_stage_info = {0}; |
|
|
|
|
vertex_shader_stage_info.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; |
|
|
|
|
vertex_shader_stage_info.stage = VK_SHADER_STAGE_VERTEX_BIT; |
|
|
|
|
vertex_shader_stage_info.module = state->vertex_shader_module; |
|
|
|
|
vertex_shader_stage_info.module = vertex_shader_module; |
|
|
|
|
vertex_shader_stage_info.pName = "main"; |
|
|
|
|
|
|
|
|
|
VkPipelineShaderStageCreateInfo fragment_shader_stage_info = {0}; |
|
|
|
|
fragment_shader_stage_info.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; |
|
|
|
|
fragment_shader_stage_info.stage = VK_SHADER_STAGE_FRAGMENT_BIT; |
|
|
|
|
fragment_shader_stage_info.module = state->fragment_shader_module; |
|
|
|
|
fragment_shader_stage_info.module = fragment_shader_module; |
|
|
|
|
fragment_shader_stage_info.pName = "main"; |
|
|
|
|
|
|
|
|
|
VkPipelineShaderStageCreateInfo shader_stages[] = {vertex_shader_stage_info, fragment_shader_stage_info}; |
|
|
|
@ -820,6 +820,9 @@ void create_graphics_pipeline(ApplicationState* state) {
@@ -820,6 +820,9 @@ void create_graphics_pipeline(ApplicationState* state) {
|
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
printf("created graphics pipeline\n"); |
|
|
|
|
|
|
|
|
|
vkDestroyShaderModule(state->device, vertex_shader_module, NULL); |
|
|
|
|
vkDestroyShaderModule(state->device, fragment_shader_module, NULL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void create_framebuffers(ApplicationState* state) { |
|
|
|
@ -1034,6 +1037,8 @@ void main_loop(ApplicationState* state) {
@@ -1034,6 +1037,8 @@ void main_loop(ApplicationState* state) {
|
|
|
|
|
draw_frame(state, current_frame); |
|
|
|
|
glfwPollEvents(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
vkDeviceWaitIdle(state->device); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void terminate(ApplicationState* state) { |
|
|
|
|