doudihuang7642 2019-08-02 04:06
浏览 276

尽管枚举图层属性时出现,Vulkan实例图层仍返回VK_ERROR_LAYER_NOT_PRESENT?

I'm working with vulkan using vulkan-go bindings. I successfully enumerate through validation layers and confirm that VK_LAYER_KHRONOS_validation is in that list. I then pass that as a validation layer (and the only validation layer) to my create instance call. It returns a VK_ERROR_LAYER_NOT_PRESENT.

I've verified my registry is correct and all the layers have correct entries. I've verified the files in the entries exist I'm using the latest SDK from LunarG at the time of writing (1.1.114.0) I'm using go bindings from vulkan-go but that appears to not be the issue as it's the call into C that returns the error, and the error is a vulkan response code. Also happens for any other layer returned in the enumerated layer properties Extensions work fine, using the same enumeration tactic etc

Enumeration (outputs 12 layers including the one mentioned in the question):

// FindAvailableInstanceValidationLayers returns a list of available validation layers on your device
func (vkctx *VulkanContext) FindAvailableInstanceValidationLayers() ([]string, error) {
    var count uint32
    if res := vk.EnumerateInstanceLayerProperties(&count, nil); res != vk.Success {
        dbg.Error("Failed to get instance validation layer count!")
        return nil, errors.New("failed to get instance validation layer count")
    }

    properties := make([]vk.LayerProperties, count, count)
    if res := vk.EnumerateInstanceLayerProperties(&count, properties); res != vk.Success {
        dbg.Error("Failed to enumerate instance validation layers!")
        return nil, errors.New("failed to get instance validation layer count")
    }

    var layers []string

    for _, prop := range properties {
        prop.Deref()
        name := string(bytes.Trim(prop.LayerName[:], "\x00"))
        layers = append(layers, name)
    }

    return layers, nil
}
// returns => [VK_LAYER_NV_optimus VK_LAYER_VALVE_steam_overlay VK_LAYER_VALVE_steam_fossilize VK_LAYER_LUNARG_api_dump VK_LAYER_LUNARG_assistant_layer VK_LAYER_LUNARG_core_validation VK_LAYER_LUNARG_device_simulation VK_LAYER_KHRONOS_validation VK_LAYER_LUNARG_monitor VK_LAYER_LUNARG_object_tracker VK_LAYER_LUNARG_screenshot VK_LAYER_LUNARG_standard_validation VK_LAYER_LUNARG_parameter_validation VK_LAYER_GOOGLE_threading VK_LAYER_GOOGLE_unique_objects VK_LAYER_LUNARG_vktrace]

create instance call:

// declare app info
    appinfo := &vk.ApplicationInfo{
        SType:              vk.StructureTypeApplicationInfo,
        PApplicationName:   "Stack Overflow Example",
        ApplicationVersion: vk.MakeVersion(1, 0, 0),
        PEngineName:        "no engine",
        EngineVersion:      vk.MakeVersion(1, 0, 0),
        ApiVersion:         vk.ApiVersion11,
    }

    // declare create info (supported layers contains correct string)
    createinfo := &vk.InstanceCreateInfo{
        SType:                   vk.StructureTypeInstanceCreateInfo,
        PApplicationInfo:        appinfo,
        EnabledExtensionCount:   uint32(2),
        PpEnabledExtensionNames: []string{ "VK_KHR_surface", "VK_KHR_win32_surface" },
        EnabledLayerCount:       uint32(1),
        PpEnabledLayerNames:     []string{ "VK_LAYER_KHRONOS_validation" },
    }


    // create the instance
    inst := new(vk.Instance)
    if result := vk.CreateInstance(createinfo, nil, inst); result != vk.Success {
        // result => vk.ErrorLayerNotPresent
        dbg.Error("Failed to create vulkan instance!")
        return nil, errors.New("vulkan instance creation failed")
    }

I expect CreateInstance to pass (or fail for other reasons) but instead it enters the if statement and the "result" variable is set to VK_ERROR_LAYER_NOT_PRESENT. It is using the same string from that list of available layers, so there's no doubt it's the same. It's the only layer. If I use any other layer (say VK_LAYER_LUNARG_core_validation) then it will have the same result. No matter the layer listed in the enumeration.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿
    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘