Open royward opened 1 month ago
Do you get any validation errors if you enable the validation layer?
Also see next comment. I think these are spurious.
I turned on "VK_LAYER_KHRONOS_validation"
I get (short version):
vkGetPhysicalDeviceProperties2: pProperties->pNext chain includes a structure with unknown VkStructureType, with the following two VkStructureTypes:
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT (1000254002) VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT (1000353000)
Full messages:
primusrun ./target/debug/triangle
List of Vulkan debugging layers available to use: VK_LAYER_NV_optimus VK_LAYER_PRIMUS_PrimusVK VK_LAYER_MESA_device_select VK_LAYER_KHRONOS_validation VK_LAYER_MESA_overlay MESA-INTEL: warning: Haswell Vulkan support is incomplete VUID-VkPhysicalDeviceProperties2-pNext-pNext(ERROR / SPEC): msgNum: -579609649 - Validation Error: [ VUID-VkPhysicalDeviceProperties2-pNext-pNext ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xdd73dbcf | vkGetPhysicalDeviceProperties2: pProperties->pNext chain includes a structure with unknown VkStructureType (1000254002); Allowed structures are [VkPhysicalDeviceAccelerationStructurePropertiesKHR, VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT, VkPhysicalDeviceConservativeRasterizationPropertiesEXT, VkPhysicalDeviceCooperativeMatrixPropertiesNV, VkPhysicalDeviceCustomBorderColorPropertiesEXT, VkPhysicalDeviceDepthStencilResolveProperties, VkPhysicalDeviceDescriptorIndexingProperties, VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV, VkPhysicalDeviceDiscardRectanglePropertiesEXT, VkPhysicalDeviceDriverProperties, VkPhysicalDeviceExternalMemoryHostPropertiesEXT, VkPhysicalDeviceFloatControlsProperties, VkPhysicalDeviceFragmentDensityMap2PropertiesEXT, VkPhysicalDeviceFragmentDensityMapPropertiesEXT, VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV, VkPhysicalDeviceFragmentShadingRatePropertiesKHR, VkPhysicalDeviceIDProperties, VkPhysicalDeviceInlineUniformBlockPropertiesEXT, VkPhysicalDeviceLineRasterizationPropertiesEXT, VkPhysicalDeviceMaintenance3Properties, VkPhysicalDeviceMeshShaderPropertiesNV, VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX, VkPhysicalDeviceMultiviewProperties, VkPhysicalDevicePCIBusInfoPropertiesEXT, VkPhysicalDevicePerformanceQueryPropertiesKHR, VkPhysicalDevicePointClippingProperties, VkPhysicalDevicePortabilitySubsetPropertiesKHR, VkPhysicalDeviceProtectedMemoryProperties, VkPhysicalDevicePushDescriptorPropertiesKHR, VkPhysicalDeviceRayTracingPipelinePropertiesKHR, VkPhysicalDeviceRayTracingPropertiesNV, VkPhysicalDeviceRobustness2PropertiesEXT, VkPhysicalDeviceSampleLocationsPropertiesEXT, VkPhysicalDeviceSamplerFilterMinmaxProperties, VkPhysicalDeviceShaderCoreProperties2AMD, VkPhysicalDeviceShaderCorePropertiesAMD, VkPhysicalDeviceShaderSMBuiltinsPropertiesNV, VkPhysicalDeviceShadingRateImagePropertiesNV, VkPhysicalDeviceSubgroupProperties, VkPhysicalDeviceSubgroupSizeControlPropertiesEXT, VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT, VkPhysicalDeviceTimelineSemaphoreProperties, VkPhysicalDeviceTransformFeedbackPropertiesEXT, VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT, VkPhysicalDeviceVulkan11Properties, VkPhysicalDeviceVulkan12Properties]. This error is based on the Valid Usage documentation for version 162 of the Vulkan header. It is possible that you are using a struct from a private extension or an extension that was added to a later version of the Vulkan header, in which case the use of pProperties->pNext is undefined and may not work correctly with validation enabled The Vulkan spec states: Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkPhysicalDeviceAccelerationStructurePropertiesKHR, VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT, VkPhysicalDeviceConservativeRasterizationPropertiesEXT, VkPhysicalDeviceCooperativeMatrixPropertiesNV, VkPhysicalDeviceCustomBorderColorPropertiesEXT, VkPhysicalDeviceDepthStencilResolveProperties, VkPhysicalDeviceDescriptorIndexingProperties, VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV, VkPhysicalDeviceDiscardRectanglePropertiesEXT, VkPhysicalDeviceDriverProperties, VkPhysicalDeviceExternalMemoryHostPropertiesEXT, VkPhysicalDeviceFloatControlsProperties, VkPhysicalDeviceFragmentDensityMap2PropertiesEXT, VkPhysicalDeviceFragmentDensityMapPropertiesEXT, VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV, VkPhysicalDeviceFragmentShadingRatePropertiesKHR, VkPhysicalDeviceIDProperties, VkPhysicalDeviceInlineUniformBlockPropertiesEXT, VkPhysicalDeviceLineRasterizationPropertiesEXT, VkPhysicalDeviceMaintenance3Properties, VkPhysicalDeviceMeshShaderPropertiesNV, VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX, VkPhysicalDeviceMultiviewProperties, VkPhysicalDevicePCIBusInfoPropertiesEXT, VkPhysicalDevicePerformanceQueryPropertiesKHR, VkPhysicalDevicePointClippingProperties, VkPhysicalDevicePortabilitySubsetPropertiesKHR, VkPhysicalDeviceProtectedMemoryProperties, VkPhysicalDevicePushDescriptorPropertiesKHR, VkPhysicalDeviceRayTracingPipelinePropertiesKHR, VkPhysicalDeviceRayTracingPropertiesNV, VkPhysicalDeviceRobustness2PropertiesEXT, VkPhysicalDeviceSampleLocationsPropertiesEXT, VkPhysicalDeviceSamplerFilterMinmaxProperties, VkPhysicalDeviceShaderCoreProperties2AMD, VkPhysicalDeviceShaderCorePropertiesAMD, VkPhysicalDeviceShaderSMBuiltinsPropertiesNV, VkPhysicalDeviceShadingRateImagePropertiesNV, VkPhysicalDeviceSubgroupProperties, VkPhysicalDeviceSubgroupSizeControlPropertiesEXT, VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT, VkPhysicalDeviceTimelineSemaphoreProperties, VkPhysicalDeviceTransformFeedbackPropertiesEXT, VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT, VkPhysicalDeviceVulkan11Properties, or VkPhysicalDeviceVulkan12Properties (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-VkPhysicalDeviceProperties2-pNext-pNext) Objects: 1 [0] 0, type: 3, name: NULL VUID-VkPhysicalDeviceProperties2-pNext-pNext(ERROR / SPEC): msgNum: -579609649 - Validation Error: [ VUID-VkPhysicalDeviceProperties2-pNext-pNext ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xdd73dbcf | vkGetPhysicalDeviceProperties2: pProperties->pNext chain includes a structure with unknown VkStructureType (1000353000); Allowed structures are [VkPhysicalDeviceAccelerationStructurePropertiesKHR, VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT, VkPhysicalDeviceConservativeRasterizationPropertiesEXT, VkPhysicalDeviceCooperativeMatrixPropertiesNV, VkPhysicalDeviceCustomBorderColorPropertiesEXT, VkPhysicalDeviceDepthStencilResolveProperties, VkPhysicalDeviceDescriptorIndexingProperties, VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV, VkPhysicalDeviceDiscardRectanglePropertiesEXT, VkPhysicalDeviceDriverProperties, VkPhysicalDeviceExternalMemoryHostPropertiesEXT, VkPhysicalDeviceFloatControlsProperties, VkPhysicalDeviceFragmentDensityMap2PropertiesEXT, VkPhysicalDeviceFragmentDensityMapPropertiesEXT, VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV, VkPhysicalDeviceFragmentShadingRatePropertiesKHR, VkPhysicalDeviceIDProperties, VkPhysicalDeviceInlineUniformBlockPropertiesEXT, VkPhysicalDeviceLineRasterizationPropertiesEXT, VkPhysicalDeviceMaintenance3Properties, VkPhysicalDeviceMeshShaderPropertiesNV, VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX, VkPhysicalDeviceMultiviewProperties, VkPhysicalDevicePCIBusInfoPropertiesEXT, VkPhysicalDevicePerformanceQueryPropertiesKHR, VkPhysicalDevicePointClippingProperties, VkPhysicalDevicePortabilitySubsetPropertiesKHR, VkPhysicalDeviceProtectedMemoryProperties, VkPhysicalDevicePushDescriptorPropertiesKHR, VkPhysicalDeviceRayTracingPipelinePropertiesKHR, VkPhysicalDeviceRayTracingPropertiesNV, VkPhysicalDeviceRobustness2PropertiesEXT, VkPhysicalDeviceSampleLocationsPropertiesEXT, VkPhysicalDeviceSamplerFilterMinmaxProperties, VkPhysicalDeviceShaderCoreProperties2AMD, VkPhysicalDeviceShaderCorePropertiesAMD, VkPhysicalDeviceShaderSMBuiltinsPropertiesNV, VkPhysicalDeviceShadingRateImagePropertiesNV, VkPhysicalDeviceSubgroupProperties, VkPhysicalDeviceSubgroupSizeControlPropertiesEXT, VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT, VkPhysicalDeviceTimelineSemaphoreProperties, VkPhysicalDeviceTransformFeedbackPropertiesEXT, VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT, VkPhysicalDeviceVulkan11Properties, VkPhysicalDeviceVulkan12Properties]. This error is based on the Valid Usage documentation for version 162 of the Vulkan header. It is possible that you are using a struct from a private extension or an extension that was added to a later version of the Vulkan header, in which case the use of pProperties->pNext is undefined and may not work correctly with validation enabled The Vulkan spec states: Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkPhysicalDeviceAccelerationStructurePropertiesKHR, VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT, VkPhysicalDeviceConservativeRasterizationPropertiesEXT, VkPhysicalDeviceCooperativeMatrixPropertiesNV, VkPhysicalDeviceCustomBorderColorPropertiesEXT, VkPhysicalDeviceDepthStencilResolveProperties, VkPhysicalDeviceDescriptorIndexingProperties, VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV, VkPhysicalDeviceDiscardRectanglePropertiesEXT, VkPhysicalDeviceDriverProperties, VkPhysicalDeviceExternalMemoryHostPropertiesEXT, VkPhysicalDeviceFloatControlsProperties, VkPhysicalDeviceFragmentDensityMap2PropertiesEXT, VkPhysicalDeviceFragmentDensityMapPropertiesEXT, VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV, VkPhysicalDeviceFragmentShadingRatePropertiesKHR, VkPhysicalDeviceIDProperties, VkPhysicalDeviceInlineUniformBlockPropertiesEXT, VkPhysicalDeviceLineRasterizationPropertiesEXT, VkPhysicalDeviceMaintenance3Properties, VkPhysicalDeviceMeshShaderPropertiesNV, VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX, VkPhysicalDeviceMultiviewProperties, VkPhysicalDevicePCIBusInfoPropertiesEXT, VkPhysicalDevicePerformanceQueryPropertiesKHR, VkPhysicalDevicePointClippingProperties, VkPhysicalDevicePortabilitySubsetPropertiesKHR, VkPhysicalDeviceProtectedMemoryProperties, VkPhysicalDevicePushDescriptorPropertiesKHR, VkPhysicalDeviceRayTracingPipelinePropertiesKHR, VkPhysicalDeviceRayTracingPropertiesNV, VkPhysicalDeviceRobustness2PropertiesEXT, VkPhysicalDeviceSampleLocationsPropertiesEXT, VkPhysicalDeviceSamplerFilterMinmaxProperties, VkPhysicalDeviceShaderCoreProperties2AMD, VkPhysicalDeviceShaderCorePropertiesAMD, VkPhysicalDeviceShaderSMBuiltinsPropertiesNV, VkPhysicalDeviceShadingRateImagePropertiesNV, VkPhysicalDeviceSubgroupProperties, VkPhysicalDeviceSubgroupSizeControlPropertiesEXT, VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT, VkPhysicalDeviceTimelineSemaphoreProperties, VkPhysicalDeviceTransformFeedbackPropertiesEXT, VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT, VkPhysicalDeviceVulkan11Properties, or VkPhysicalDeviceVulkan12Properties (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-VkPhysicalDeviceProperties2-pNext-pNext) Objects: 1 [0] 0, type: 3, name: NULL Using device: NVIDIA GeForce GT 730M (type: DiscreteGpu) Segmentation fault
Stack trace:
old_swapchain=...) at vulkano/src/swapchain/mod.rs:1117
I think those message may be spurious the the crash: If I turn on the layers:
"VK_LAYER_KHRONOS_validation","VK_LAYER_PRIMUS_PrimusVK"
primusrun ./target/debug/triangle
gives the same messages, but then runs correctly.
With those same layers, if I then run without the 'primusrun', it fails to find a rendering GPU:
./target/debug/triangle
Can't open bumblebee display.
List of Vulkan debugging layers available to use:
VK_LAYER_NV_optimus
VK_LAYER_PRIMUS_PrimusVK
VK_LAYER_MESA_device_select
VK_LAYER_KHRONOS_validation
VK_LAYER_MESA_overlay
MESA-INTEL: warning: Haswell Vulkan support is incomplete
PrimusVK: Searching for display GPU:
PrimusVK: 0x561178d90c70: 32902;1046
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) HD Graphics 4600 (HSW GT2)
PrimusVK: Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x561178d90c70.
PrimusVK: 0x561178d90ca0.
PrimusVK: No device for the rendering GPU found. Is the correct driver installed?
PrimusVK: VK_ICD_FILENAMES not set
PrimusVK: Searching for display GPU:
PrimusVK: 0x561178d90c70: 32902;1046
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) HD Graphics 4600 (HSW GT2)
PrimusVK: Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x561178d90c70.
PrimusVK: 0x561178d90ca0.
PrimusVK: No device for the rendering GPU found. Is the correct driver installed?
PrimusVK: VK_ICD_FILENAMES not set
PrimusVK: Searching for display GPU:
PrimusVK: 0x561178d90c70: 32902;1046
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) HD Graphics 4600 (HSW GT2)
PrimusVK: Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x561178d90c70.
PrimusVK: 0x561178d90ca0.
PrimusVK: No device for the rendering GPU found. Is the correct driver installed?
PrimusVK: VK_ICD_FILENAMES not set
thread 'main' panicked at examples/triangle/main.rs:180:10:
called Result::unwrap()
on an Err
value: InitializationFailed
To reproduce the error:
Checkout the master branch from github , build it with 'cargo build' and:
Output: MESA-INTEL: warning: Haswell Vulkan support is incomplete Using device: NVIDIA GeForce GT 730M (type: DiscreteGpu) Segmentation fault
Stack trace:
0 0x00007fffefc0f004 in ?? () from /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.0
1 0x00007fffee783b31 in ?? () from /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.470.256.02
2 0x00007fffee7823ea in ?? () from /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.470.256.02
3 0x00007fffee7826c8 in ?? () from /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.470.256.02
4 0x00007fffee78411e in ?? () from /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.470.256.02
5 0x00007fffee7789b5 in ?? () from /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.470.256.02
6 0x00007fffee783fff in ?? () from /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.470.256.02
7 0x00007ffff72a189c in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan.so.1
8 0x000055555600716a in vulkano::swapchain::Swapchain::new_inner_unchecked (device=0x5555571c7880, surface=0x55555690d330, create_info=0x7fffffff80a0,
9 0x0000555555709f5f in vulkano::swapchain::Swapchain::new_unchecked (device=..., surface=..., create_info=...) at vulkano/src/swapchain/mod.rs:432
10 0x000055555570a421 in vulkano::swapchain::Swapchain::new (device=..., surface=..., create_info=...) at vulkano/src/swapchain/mod.rs:421
11 0x000055555578654b in triangle::main () at examples/triangle/main.rs:209
print create_info_vk $1 = ash::vk::definitions::SwapchainCreateInfoKHR {s_type: ash::vk::enums::StructureType (1000001000), p_next: 0x0, flags: ash::vk::bitflags::SwapchainCreateFlagsKHR (0), surface: ash::vk::definitions::SurfaceKHR (93825018532320), min_image_count: 2, image_format: ash::vk::enums::Format (44), image_color_space: ash::vk::enums::ColorSpaceKHR (0), image_extent: ash::vk::definitions::Extent2D {width: 800, height: 600}, image_array_layers: 1, image_usage: ash::vk::bitflags::ImageUsageFlags (16), image_sharing_mode: ash::vk::enums::SharingMode (0), queue_family_index_count: 0, p_queue_family_indices: 0x0, pre_transform: ash::vk::bitflags::SurfaceTransformFlagsKHR (1), composite_alpha: ash::vk::bitflags::CompositeAlphaFlagsKHR (1), present_mode: ash::vk::enums::PresentModeKHR (2), clipped: 1, old_swapchain: ash::vk::definitions::SwapchainKHR (0), _marker: core::marker::PhantomData<&()>}
SurfaceKHR (93825018532320) is SurfaceKHR (0x555556e691e0)
For comparison, it does work correctly on the internal Intel(R) HD Graphics 4600 (HSW GT2). With break mod.rs:1117:
print create_info_vk $1 = ash::vk::definitions::SwapchainCreateInfoKHR {s_type: ash::vk::enums::StructureType (1000001000), p_next: 0x0, flags: ash::vk::bitflags::SwapchainCreateFlagsKHR (0), surface: ash::vk::definitions::SurfaceKHR (93825014261712), min_image_count: 3, image_format: ash::vk::enums::Format (50), image_color_space: ash::vk::enums::ColorSpaceKHR (0), image_extent: ash::vk::definitions::Extent2D {width: 800, height: 600}, image_array_layers: 1, image_usage: ash::vk::bitflags::ImageUsageFlags (16), image_sharing_mode: ash::vk::enums::SharingMode (0), queue_family_index_count: 0, p_queue_family_indices: 0x0, pre_transform: ash::vk::bitflags::SurfaceTransformFlagsKHR (1), composite_alpha: ash::vk::bitflags::CompositeAlphaFlagsKHR (1), present_mode: ash::vk::enums::PresentModeKHR (2), clipped: 1, old_swapchain: ash::vk::definitions::SwapchainKHR (0), _marker: core::marker::PhantomData<&()>}
It also works correctly in a C++ implementation with primusrun (so it's not just an Nvidia driver issue):
print createInfo {sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, pNext = 0x0, flags = 0, surface = 0x20000000002, minImageCount = 4, imageFormat = VK_FORMAT_B8G8R8A8_SRGB, imageColorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, imageExtent = {width = 1200, height = 800}, imageArrayLayers = 1, imageUsage = 16, imageSharingMode = VK_SHARING_MODE_EXCLUSIVE, queueFamilyIndexCount = 0, pQueueFamilyIndices = 0x0, preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR, compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, presentMode = VK_PRESENT_MODE_FIFO_KHR, clipped = 1, oldSwapchain = 0x0}
I can provide any more information that is requested.
I think it's odd that surface is a pointer into main memory in the vulkano version, and a special value in the C++ version - that was the only major difference that I could find (the different minImageCount doesn't matter).