I get very strange error in my small vulkan project. I get div by zero error deep inside amdvlk64.dll (ver. 25.20.15031.1000) after call to vkCreateGraphicsPipelines.
In short, when i try to pass as attrib data in VkFormat = VK_FORMAT_R8G8B8_UNORM or VK_FORMAT_R16G16B16_UNORM app crash without any usefull info.
Solution: In every VkPipelineVertexInputStateCreateInfo struct passed to vkCreateGraphicsPipelines, replace VK_FORMAT_R8G8B8_UNORM with VK_FORMAT_R8G8B8A8_UNORM (or VK_FORMAT_R16G16B16_UNORM with VK_FORMAT_R16G16B16A16_UNORM)
To make things clear:
- there is no problem with nvidia gfx cards
- vertex data stride is 16 bytes (for vertex: 3x4 bytes, offset = 0, for color 3x1 bytes, offset=12, 1 byte wasted at end)
- when i changed R8G8B8_UNORM to R8G8B8A8_UNORM as param for vkCreateGraphicsPipelines all start working (no change in shader programs or datas)
- when i changed R8G8B8_UNORM to R8G8_UNORM or R8_UNORM also program was working (with missing blue or green color on screen as expected)
- same crash when i use R16G16B16_UNORM (with vertex data stride = 20 byes and 2 bytes wasted)
- Vulkan vaidation layer was enabled.
I put this here, because i wasted 2 day to find source of problem and it may save time for somebody else.
I know, that it is not a big problem. Attrib input R8G8B8 gives no benefits and can be safely replaced with R8G8B8A8.
Questions:
1. Is VK_FORMAT_R8G8B8_UNORM or VK_FORMAT_R16G16B16_UNORM forbiden as attrib for vertex data only on AMD gfx cards? Drivers bug?
2. Is there way in Vulkan API to query what attrib formats are supported by drivers?