Exemplo n.º 1
0
    def __createRenderPass(self):
        colorAttachment = _vk.AttachmentDescription()
        colorAttachment.format = self.__swapChainImageFormat
        colorAttachment.samples = _vk.VK_SAMPLE_COUNT_1_BIT
        colorAttachment.loadOp = _vk.VK_ATTACHMENT_LOAD_OP_CLEAR
        colorAttachment.storeOp = _vk.VK_ATTACHMENT_STORE_OP_STORE
        colorAttachment.stencilLoadOp = _vk.VK_ATTACHMENT_LOAD_OP_DONT_CARE
        colorAttachment.stencilStoreOp = _vk.VK_ATTACHMENT_STORE_OP_DONT_CARE
        colorAttachment.initialLayout = _vk.VK_IMAGE_LAYOUT_UNDEFINED
        colorAttachment.finalLayout = _vk.VK_IMAGE_LAYOUT_PRESENT_SRC_KHR

        colorAttachmentRef = _vk.AttachmentReference()
        colorAttachmentRef.attachment = 0
        colorAttachmentRef.layout = _vk.VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL

        subpass = _vk.SubpassDescription()
        subpass.pipelineBindPoint = _vk.VK_PIPELINE_BIND_POINT_GRAPHICS
        subpass.colorAttachments = [
            colorAttachmentRef,
        ]

        renderPassInfo = _vk.RenderPassCreateInfo()
        renderPassInfo.attachments = [
            colorAttachment,
        ]
        renderPassInfo.subpasses = [
            subpass,
        ]

        #print('renderpass attachmentCount')

        self.__renderPass = self.__device.createRenderPass(renderPassInfo)
        print('render pass is valid: {}'.format(self.__renderPass.isValid))
Exemplo n.º 2
0
    def __createRenderPass(self):
        colorAttachment = _vk.AttachmentDescription()
        colorAttachment.format = self.__swapChainImageFormat
        colorAttachment.samples = _vk.VK_SAMPLE_COUNT_1_BIT
        colorAttachment.loadOp = _vk.VK_ATTACHMENT_LOAD_OP_CLEAR
        colorAttachment.storeOp = _vk.VK_ATTACHMENT_STORE_OP_STORE
        colorAttachment.stencilLoadOp = _vk.VK_ATTACHMENT_LOAD_OP_DONT_CARE
        colorAttachment.stencilStoreOp = _vk.VK_ATTACHMENT_STORE_OP_DONT_CARE
        colorAttachment.initialLayout = _vk.VK_IMAGE_LAYOUT_UNDEFINED
        colorAttachment.finalLayout = _vk.VK_IMAGE_LAYOUT_PRESENT_SRC_KHR

        colorAttachmentRef = _vk.AttachmentReference()
        colorAttachmentRef.attachment = 0
        colorAttachmentRef.layout = _vk.VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL

        subpass = _vk.SubpassDescription()
        subpass.pipelineBindPoint = _vk.VK_PIPELINE_BIND_POINT_GRAPHICS
        subpass.colorAttachments = [
            colorAttachmentRef,
        ]

        dependency = _vk.SubpassDependency()
        dependency.srcSubpass = _vk.VK_SUBPASS_EXTERNAL
        dependency.dstSubpass = 0
        dependency.srcStageMask = _vk.VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT
        dependency.srcAccessMask = 0
        dependency.dstStageMask = _vk.VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT
        dependency.dstAccessMask = _vk.VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | _vk.VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT

        renderPassInfo = _vk.RenderPassCreateInfo()
        renderPassInfo.attachments = [
            colorAttachment,
        ]
        renderPassInfo.subpasses = [
            subpass,
        ]
        renderPassInfo.dependencies = [
            dependency,
        ]

        self.__renderPass = self.__device.createRenderPass(renderPassInfo)