I have a vertex and a fragment shader, written in HLSL, which I compile into a SPIR-V binary using the DirectX Shader Compiler.
They both use a common cbuffer
(which I want to treat as a uniform
buffer) ubo
. In order to construct a suitable VkDescriptorSetLayout
, I want to use SPIRV-Reflect to obtain the necessary information about ubo
.
While, I can create separate spv_reflect::ShaderModule
's vertex_shader
and fragment_shader
from the binary of my SPIR-V binaries of my shaders, I can only retrieve the information about existing descriptor bindings by calling EnumerateDescriptorBindings()
on both spv_reflect::ShaderModule
's individidually.
They both yield the existence of ubo
. But what I would want to do is tell the API that both shaders use the same uniform buffer ubo
, i.e. create a VkDescriptorSetLayoutBinding
for ubo
and specify VK_SHADER_STAGE_VERTEX_BIT
and VK_SHADER_STAGE_FRAGMENT_BIT
for the stageFlags
field.
But in order to do this I need to detect that both descriptor bindings yielded by the individual calls to EnumerateDescriptorBindings
are referring to the same buffer. How can I do that?