| 371 | } |
| 372 | |
| 373 | void vkRenderer::createRenderPass() { |
| 374 | VkAttachmentDescription colorAttachment = {}; |
| 375 | colorAttachment.format = swapChainImageFormat; |
| 376 | colorAttachment.samples = VK_SAMPLE_COUNT_1_BIT; |
| 377 | colorAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; |
| 378 | colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE; |
| 379 | colorAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; |
| 380 | colorAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; |
| 381 | colorAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; |
| 382 | colorAttachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; |
| 383 | |
| 384 | VkAttachmentReference colorAttachmentRef = {}; |
| 385 | colorAttachmentRef.attachment = 0; |
| 386 | colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; |
| 387 | |
| 388 | VkSubpassDescription subpass = {}; |
| 389 | subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; |
| 390 | subpass.colorAttachmentCount = 1; |
| 391 | subpass.pColorAttachments = &colorAttachmentRef; |
| 392 | |
| 393 | VkSubpassDependency dependency = {}; |
| 394 | dependency.srcSubpass = VK_SUBPASS_EXTERNAL; |
| 395 | dependency.dstSubpass = 0; |
| 396 | dependency.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; |
| 397 | dependency.srcAccessMask = 0; |
| 398 | dependency.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; |
| 399 | dependency.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; |
| 400 | |
| 401 | VkRenderPassCreateInfo renderPassInfo = {}; |
| 402 | renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; |
| 403 | renderPassInfo.attachmentCount = 1; |
| 404 | renderPassInfo.pAttachments = &colorAttachment; |
| 405 | renderPassInfo.subpassCount = 1; |
| 406 | renderPassInfo.pSubpasses = &subpass; |
| 407 | renderPassInfo.dependencyCount = 1; |
| 408 | renderPassInfo.pDependencies = &dependency; |
| 409 | |
| 410 | if (vkCreateRenderPass(device, &renderPassInfo, nullptr, &renderPass) != VK_SUCCESS) { |
| 411 | throw std::runtime_error("failed to create render pass!"); |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | void vkRenderer::createDescriptorSetLayout() { |
| 416 | VkDescriptorSetLayoutBinding uboLayoutBinding = {}; |
nothing calls this directly
no outgoing calls
no test coverage detected