Add more debugging to desc layout
This commit is contained in:
parent
01e01b333f
commit
7b5b54d149
1 changed files with 53 additions and 0 deletions
|
@ -70,6 +70,12 @@ impl DescriptorSetLayoutBuilder {
|
|||
*/
|
||||
}
|
||||
|
||||
let bindings = self
|
||||
.layout_bindings
|
||||
.iter()
|
||||
.map(|b| DescriptorLayoutBinding::from(b.clone()))
|
||||
.collect();
|
||||
|
||||
let descriptor_set_layout = device.create_descriptor_set_layout(&descriptor_set_ci)?;
|
||||
|
||||
let pool_sizes = self
|
||||
|
@ -85,6 +91,8 @@ impl DescriptorSetLayoutBuilder {
|
|||
device,
|
||||
descriptor_set_layout,
|
||||
pool_sizes,
|
||||
|
||||
bindings,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +102,8 @@ pub struct DescriptorSetLayout {
|
|||
device: Arc<Device>,
|
||||
descriptor_set_layout: VkDescriptorSetLayout,
|
||||
pool_sizes: Vec<VkDescriptorPoolSize>,
|
||||
|
||||
bindings: Vec<DescriptorLayoutBinding>,
|
||||
}
|
||||
|
||||
impl DescriptorSetLayout {
|
||||
|
@ -108,6 +118,10 @@ impl DescriptorSetLayout {
|
|||
pub(crate) fn pool_sizes(&self) -> &[VkDescriptorPoolSize] {
|
||||
self.pool_sizes.as_slice()
|
||||
}
|
||||
|
||||
pub fn bindings(&self) -> &[DescriptorLayoutBinding] {
|
||||
&self.bindings
|
||||
}
|
||||
}
|
||||
|
||||
impl VulkanDevice for DescriptorSetLayout {
|
||||
|
@ -128,3 +142,42 @@ impl Drop for DescriptorSetLayout {
|
|||
.destroy_descriptor_set_layout(self.descriptor_set_layout);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct DescriptorLayoutBinding {
|
||||
pub binding: u32,
|
||||
pub desc_type: VkDescriptorType,
|
||||
pub stage_flags: Vec<VkShaderStageFlags>,
|
||||
}
|
||||
|
||||
impl From<VkDescriptorSetLayoutBinding> for DescriptorLayoutBinding {
|
||||
fn from(value: VkDescriptorSetLayoutBinding) -> Self {
|
||||
let flag_enum_list = [
|
||||
VK_SHADER_STAGE_VERTEX_BIT,
|
||||
VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT,
|
||||
VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT,
|
||||
VK_SHADER_STAGE_GEOMETRY_BIT,
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT,
|
||||
VK_SHADER_STAGE_COMPUTE_BIT,
|
||||
VK_SHADER_STAGE_ALL_GRAPHICS,
|
||||
VK_SHADER_STAGE_ALL,
|
||||
VK_SHADER_STAGE_RAYGEN_BIT_KHR,
|
||||
VK_SHADER_STAGE_ANY_HIT_BIT_KHR,
|
||||
VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR,
|
||||
VK_SHADER_STAGE_MISS_BIT_KHR,
|
||||
VK_SHADER_STAGE_INTERSECTION_BIT_KHR,
|
||||
VK_SHADER_STAGE_CALLABLE_BIT_KHR,
|
||||
VK_SHADER_STAGE_TASK_BIT_NV,
|
||||
VK_SHADER_STAGE_MESH_BIT_NV,
|
||||
];
|
||||
|
||||
Self {
|
||||
binding: value.binding,
|
||||
desc_type: value.descriptorType,
|
||||
stage_flags: flag_enum_list
|
||||
.into_iter()
|
||||
.filter(|&flag| (flag & value.stageFlagBits) != 0)
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue