From 0a4cb972e21a2acc23ed89150144333e7e809201 Mon Sep 17 00:00:00 2001 From: Warwick Date: Wed, 15 Jan 2025 12:55:00 +0000 Subject: [PATCH] Added some code for the viewport --- src/main.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main.c b/src/main.c index 59145d9..227491a 100644 --- a/src/main.c +++ b/src/main.c @@ -713,6 +713,30 @@ void createGraphicsPipeline(Application *app) { vertexInputInfo.vertexAttributeDescriptionCount = 0; vertexInputInfo.pVertexAttributeDescriptions = NULL; // Optional + VkPipelineInputAssemblyStateCreateInfo inputAssembly = {0}; + inputAssembly.sType = + VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; + inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; + inputAssembly.primitiveRestartEnable = VK_FALSE; + + VkViewport viewport = {0}; + viewport.x = 0.0f; + viewport.y = 0.0f; + viewport.width = (float)app->swapChainExtent.width; + viewport.height = (float)app->swapChainExtent.height; + viewport.minDepth = 0.0f; + viewport.maxDepth = 1.0f; + + VkPipelineViewportStateCreateInfo viewportState = {0}; + viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; + viewportState.viewportCount = 1; + viewportState.scissorCount = 1; + + VkRect2D scissor = {0}; + scissor.offset.x = 0; + scissor.offset.y = 0; + scissor.extent = app->swapChainExtent; + vkDestroyShaderModule(app->device, fragShaderModule, NULL); vkDestroyShaderModule(app->device, vertShaderModule, NULL); }