I am in the middle of porting a DX11 game to Vulkan and I have hit a problem with descriptor sets
I am getting a lot of these…
Type mismatch on descriptor slot 0.0 (expected VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) but descriptor of type VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
And the error is totally correct.
The code was already started by some other person and they just hacked in 2 descriptor sets for the 2 shaders used by the GUI. They totally ignored the 30,000 + other shaders the game uses.
I have written a tool that converted all the original shaders to Spir-v and they all get precompiled and packed into archives, so I don’t have the source code for the shaders available at run time.
So now I have to create descriptor set layout bindings for all the shaders
The DX11 version of the renderer doesn’t have to do this, it just treats everything as a block of memory that gets written to the command buffer and if it is in the wrong layout, well, tough
- Can you query a compiled shader to get the expected layout?
If you can it would make things a lot easier, read the layout, hash it, get/create matching VkDescriptorSetLayoutBinding, store/retrieve
- I don’t really see the point of layout bindings
Since they have to match what the shader is expecting, the layout must be encoded into the shader already , so defining something in code that is already existing in the compiled shader seems redundant