PacktPublishing / Mastering-Graphics-Programming-with-Vulkan

MIT License
562 stars 77 forks source link

Can't run chapters 8,9,10,11,13,14 on Windows with the same error. #53

Open MarcosDanielTorres opened 8 months ago

MarcosDanielTorres commented 8 months ago

Hi. I'm receiving the following errors when running chapters 8 through 15 except for chapter 12 which runs fine.

Specs:

OS: Windows 11
GPU: AMD Radeon RX 6700 XT
Driver: 24.3.1 AMD Adrenaline
Vulkan SDK: 1.3.268.0

Error It is the output from running chapter 8, but all other chapters in the title at least show this error

Created technique main in 0.548359 seconds
Parsing GPU Technique pbr_lighting
Created technique pbr_lighting in 0.040583 seconds
Parsing GPU Technique depth_of_field
Created technique depth_of_field in 0.016138 seconds
Parsing GPU Technique cloth
Cannot find render pass . Defaulting to swapchain
Created technique cloth in 0.011523 seconds
Parsing GPU Technique debug
temp.shader

temp.shader

 MessageID: UNASSIGNED-CoreValidation-Shader-OutputNotConsumed 101294395
Message: Validation Performance Warning: [ UNASSIGNED-CoreValidation-Shader-OutputNotConsumed ] Object 0: handle = 0x7efb46000000018f, name = debug_line, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x609a13b | vkCreateGraphicsPipelines(): pCreateInfos[0].pVertexInputState Vertex attribute at location 0 not consumed by vertex shader.

Created technique debug in 0.302037 seconds
Parsing GPU Technique culling
Cannot find render pass culling_pass. Defaulting to swapchain
Created technique culling in 0.027143 seconds
Loaded scene Sponza.gltf in 0.481570 seconds.
Stats:
        Reading GLTF file 0.115696 seconds
        Textures Creating 0.062430 seconds
        Creating Samplers 0.000031 seconds
        Reading Buffers Data 0.002655 seconds
        Creating Buffers 0.300756 seconds
Total meshlet instances 3521
 MessageID: VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 -1094930823
Message: Validation Error: [ VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 ] | MessageID = 0xbebcae79 | vkCreateImage(): pCreateInfo The following parameters -
format (VK_FORMAT_D16_UNORM)
type (VK_IMAGE_TYPE_2D)
tiling (VK_IMAGE_TILING_OPTIMAL)
usage (VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)
flags (VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT|VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT)
returned (VK_ERROR_FORMAT_NOT_SUPPORTED) when calling vkGetPhysicalDeviceImageFormatProperties2. The Vulkan spec states: Each of the following values (as described in Image Creation Limits) must not be undefined : imageCreateMaxMipLevels, imageCreateMaxArrayLayers, imageCreateMaxExtent, and imageCreateSampleCounts (https://vulkan.lunarg.com/doc/view/1.3.268.0/windows/1.3-extensions/vkspec.html#VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251)

D:\Mastering-Graphics-Programming-with-Vulkan\source\chapter8\graphics\gpu_device.cpp(3347) : FALSE

image

theWatchmen commented 8 months ago

Hi, thanks for this report. I'll take a proper look later, but it looks like your GPU might not support a sparse texture for this format. You could try and change the format to D32_SFLOAT here and see if this works.

EDIT: I had a look at this and the GPU does support sparse binding (https://vulkan.gpuinfo.org/displayreport.php?id=28910#features). So it should be an issue just with the format. Unfortunately the SDK report doesn't include support for individual formats. In a robust implementation we would query support first before using a given format :)

MarcosDanielTorres commented 8 months ago

Hi @theWatchmen thank you for the fast response. I edited the format but unfortunately, that didn't solve the issue. I tried with VK_FORMAT_D32_SFLOAT and VK_FORMAT_D24_UNORM_S8_UINT, the error was the same as before.
Later I tried with VK_FORMAT_D32_SFLOAT_S8_UINT but it failed in vkCreateImage with the same error. As shown below:

Created technique main in 0.380937 seconds
Parsing GPU Technique pbr_lighting
Created technique pbr_lighting in 0.014041 seconds
Parsing GPU Technique depth_of_field
Created technique depth_of_field in 0.003713 seconds
Parsing GPU Technique cloth
Cannot find render pass . Defaulting to swapchain
Created technique cloth in 0.004475 seconds
Parsing GPU Technique debug
temp.shader

temp.shader

 MessageID: UNASSIGNED-CoreValidation-Shader-OutputNotConsumed 101294395
Message: Validation Performance Warning: [ UNASSIGNED-CoreValidation-Shader-OutputNotConsumed ] Object 0: handle = 0x7efb46000000018f, name = debug_line, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x609a13b | vkCreateGraphicsPipelines(): pCreateInfos[0].pVertexInputState Vertex attribute at location 0 not consumed by vertex shader.

Created technique debug in 0.178270 seconds
Parsing GPU Technique culling
Cannot find render pass culling_pass. Defaulting to swapchain
Created technique culling in 0.007678 seconds
Loaded scene Sponza.gltf in 0.456404 seconds.
Stats:
        Reading GLTF file 0.103197 seconds
        Textures Creating 0.057722 seconds
        Creating Samplers 0.000028 seconds
        Reading Buffers Data 0.002469 seconds
        Creating Buffers 0.292987 seconds
Total meshlet instances 3521
 MessageID: VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 -1094930823
Message: Validation Error: [ VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 ] | MessageID = 0xbebcae79 | vkCreateImage(): pCreateInfo The following parameters -
format (VK_FORMAT_D32_SFLOAT_S8_UINT)
type (VK_IMAGE_TYPE_2D)
tiling (VK_IMAGE_TILING_OPTIMAL)
usage (VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)
flags (VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT|VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT)
returned (VK_ERROR_FORMAT_NOT_SUPPORTED) when calling vkGetPhysicalDeviceImageFormatProperties2. The Vulkan spec states: Each of the following values (as described in Image Creation Limits) must not be undefined : imageCreateMaxMipLevels, imageCreateMaxArrayLayers, imageCreateMaxExtent, and imageCreateSampleCounts (https://vulkan.lunarg.com/doc/view/1.3.268.0/windows/1.3-extensions/vkspec.html#VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251)

 MessageID: VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 -1094930823
Message: Validation Error: [ VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 ] | MessageID = 0xbebcae79 | vkCreateImage(): pCreateInfo The following parameters -
format (VK_FORMAT_D32_SFLOAT_S8_UINT)
type (VK_IMAGE_TYPE_2D)
tiling (VK_IMAGE_TILING_OPTIMAL)
usage (VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)
flags (VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT|VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT)
returned (VK_ERROR_FORMAT_NOT_SUPPORTED) when calling vkGetPhysicalDeviceImageFormatProperties2. The Vulkan spec states: Each of the following values (as described in Image Creation Limits) must not be undefined : imageCreateMaxMipLevels, imageCreateMaxArrayLayers, imageCreateMaxExtent, and imageCreateSampleCounts (https://vulkan.lunarg.com/doc/view/1.3.268.0/windows/1.3-extensions/vkspec.html#VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251)

 MessageID: VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 -1094930823
Message: Validation Error: [ VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 ] | MessageID = 0xbebcae79 | vkCreateImage(): pCreateInfo The following parameters -
format (VK_FORMAT_D32_SFLOAT_S8_UINT)
type (VK_IMAGE_TYPE_2D)
tiling (VK_IMAGE_TILING_OPTIMAL)
usage (VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)
flags (VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT|VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT)
returned (VK_ERROR_FORMAT_NOT_SUPPORTED) when calling vkGetPhysicalDeviceImageFormatProperties2. The Vulkan spec states: Each of the following values (as described in Image Creation Limits) must not be undefined : imageCreateMaxMipLevels, imageCreateMaxArrayLayers, imageCreateMaxExtent, and imageCreateSampleCounts (https://vulkan.lunarg.com/doc/view/1.3.268.0/windows/1.3-extensions/vkspec.html#VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251)

D:\Mastering-Graphics-Programming-with-Vulkan\source\chapter8\graphics\gpu_device.cpp(1243) : Vulkan assert code 4294967293, 'VK_ERROR_INITIALIZATION_FAILED'

image

theWatchmen commented 6 months ago

Hey Marcos, apologies for the late reply. I'll try to reproduce this on AMD card and let you know.