Added some code for the viewport

This commit is contained in:
Warwick 2025-01-15 12:55:00 +00:00
parent 829e3fd3d8
commit 0a4cb972e2

View file

@ -713,6 +713,30 @@ void createGraphicsPipeline(Application *app) {
vertexInputInfo.vertexAttributeDescriptionCount = 0; vertexInputInfo.vertexAttributeDescriptionCount = 0;
vertexInputInfo.pVertexAttributeDescriptions = NULL; // Optional 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, fragShaderModule, NULL);
vkDestroyShaderModule(app->device, vertShaderModule, NULL); vkDestroyShaderModule(app->device, vertShaderModule, NULL);
} }