go - Vulkan 实例层返回 VK_ERROR_LAYER_NOT_PRESENT 尽管在枚举层属性时出现?
问题描述
我正在使用 vulkan-go 绑定与 vulkan 合作。我成功枚举了验证层并确认 VK_LAYER_KHRONOS_validation 在该列表中。然后我将它作为验证层(也是唯一的验证层)传递给我的创建实例调用。它返回一个 VK_ERROR_LAYER_NOT_PRESENT。
我已经验证我的注册表是正确的,并且所有层都有正确的条目。我已经验证条目中的文件存在 我正在使用 LunarG 在撰写本文时的最新 SDK (1.1.114.0) 我正在使用来自 vulkan-go 的 go 绑定,但这似乎不是问题,因为它是调用返回错误的C,错误是一个vulkan响应代码。枚举层属性中返回的任何其他层也会发生扩展工作正常,使用相同的枚举策略等
枚举(输出 12 层,包括问题中提到的那一层):
// 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]
创建实例调用:
// 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")
}
我希望 CreateInstance 通过(或由于其他原因失败),但它进入 if 语句,并且“结果”变量设置为 VK_ERROR_LAYER_NOT_PRESENT。它使用可用层列表中的相同字符串,所以毫无疑问它是相同的。这是唯一的一层。如果我使用任何其他层(比如 VK_LAYER_LUNARG_core_validation),那么它会得到相同的结果。无论枚举中列出的层。
解决方案
推荐阅读
- react-native - React Native:错误:捆绑失败:index.js:“”不是有效的标识符名称
- angularjs - 从Angularjs中的数组中获取特定元素
- c# - 外键关系没有出现在 edmx 与 mysql 数据库与 asp mvc 与数据库第一
- angularjs - 在ajax formdata中获取415(不支持的媒体类型)发布到spring
- flutter - 如何在颤动中从 SelectableText 小部件中获取选定的文本
- json - 使用 Spark 2.4 识别空 JSON 文件
- c# - 在 Unity 中捕获 360 度屏幕截图会忽略 UI 层
- sql - 如何将一个 SQL 列转换为同一行的多个列?
- java - 在 Android 中,我如何实现一个全局触摸跟踪服务,即使屏幕上正在运行其他应用程序也能正常工作
- java - Spring Boot 配置问题中的 JWT 令牌