Skip to content

Aggressive GC? #94

@gibki

Description

@gibki

My program started exploding randomly after I refactored this:

vertex_stage = vk.VkPipelineShaderStageCreateInfo(
    stage=vk.VK_SHADER_STAGE_VERTEX_BIT,
    module=vertex_shader,
    pName='main',
)
pipeline = vk.vkCreateGraphicsPipelines(
    pStages=[vertex_stage]
)

Into this:

pipeline = vk.vkCreateGraphicsPipelines(
    pStages=[
        vk.VkPipelineShaderStageCreateInfo(
            stage=vk.VK_SHADER_STAGE_VERTEX_BIT,
            module=vertex_shader,
            pName='main',
        )
    ]
)

The validation layer is (sometimes) reporting
VUID-VkPipelineShaderStageCreateInfo-pName-00707(ERROR / SPEC): msgNum: -1282697375 - Validation Error: [ VUID-VkPipelineShaderStageCreateInfo-pName-00707 ] | MessageID = 0xb38b9761 | vkCreateGraphicsPipelines(): pCreateInfos[0].pStages[0].pName `` entrypoint not found for stage VK_SHADER_STAGE_VERTEX_BIT. The Vulkan spec states: pName must be the name of an OpEntryPoint in module with an execution model that matches stage (https://vulkan.lunarg.com/doc/view/1.3.296.0/windows/1.3-extensions/vkspec.html#VUID-VkPipelineShaderStageCreateInfo-pName-00707)

I think the VkPipelineShaderStageCreateInfo object and the underlying string get garbage collected before the wrapping call to vkCreateGraphicsPipelines happens.

I don't know if this is a bug, maybe I misunderstand object lifetimes, but it's definitely perplexing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions