Skip to content

Commit

Permalink
Added VkShaderStageFlags argument to getDSLBinding()
Browse files Browse the repository at this point in the history
  • Loading branch information
corporateshark committed Sep 8, 2024
1 parent 7227231 commit 5f648de
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
12 changes: 8 additions & 4 deletions lvk/vulkan/VulkanClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5361,11 +5361,15 @@ lvk::Result lvk::VulkanContext::growDescriptorPool(uint32_t maxTextures, uint32_
}

// create default descriptor set layout which is going to be shared by graphics pipelines
const VkShaderStageFlags stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT |
VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT | VK_SHADER_STAGE_FRAGMENT_BIT |
VK_SHADER_STAGE_COMPUTE_BIT;
const VkDescriptorSetLayoutBinding bindings[kBinding_NumBindings] = {
lvk::getDSLBinding(kBinding_Textures, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, maxTextures),
lvk::getDSLBinding(kBinding_Samplers, VK_DESCRIPTOR_TYPE_SAMPLER, maxSamplers),
lvk::getDSLBinding(kBinding_StorageImages, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, maxTextures),
lvk::getDSLBinding(kBinding_YUVImages, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, immutableSamplers.size(), immutableSamplersData),
lvk::getDSLBinding(kBinding_Textures, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, maxTextures, stageFlags),
lvk::getDSLBinding(kBinding_Samplers, VK_DESCRIPTOR_TYPE_SAMPLER, maxSamplers, stageFlags),
lvk::getDSLBinding(kBinding_StorageImages, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, maxTextures, stageFlags),
lvk::getDSLBinding(
kBinding_YUVImages, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, immutableSamplers.size(), stageFlags, immutableSamplersData),
};
const uint32_t flags = VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT |
VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT;
Expand Down
8 changes: 5 additions & 3 deletions lvk/vulkan/VulkanClasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,11 @@ class VulkanContext final : public IContext {
&vkPhysicalDeviceDriverProperties_,
};
// provided by Vulkan 1.1
VkPhysicalDeviceProperties2 vkPhysicalDeviceProperties2_ = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
&vkPhysicalDeviceVulkan12Properties_,
VkPhysicalDeviceProperties{}};
VkPhysicalDeviceProperties2 vkPhysicalDeviceProperties2_ = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
&vkPhysicalDeviceVulkan12Properties_,
VkPhysicalDeviceProperties{},
};

std::vector<VkFormat> deviceDepthFormats_;
std::vector<VkSurfaceFormatKHR> deviceSurfaceFormats_;
Expand Down
4 changes: 2 additions & 2 deletions lvk/vulkan/VulkanUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,13 +813,13 @@ VkResult lvk::allocateMemory2(VkPhysicalDevice physDev,
VkDescriptorSetLayoutBinding lvk::getDSLBinding(uint32_t binding,
VkDescriptorType descriptorType,
uint32_t descriptorCount,
VkShaderStageFlags stageFlags,
const VkSampler* immutableSamplers) {
return VkDescriptorSetLayoutBinding{
.binding = binding,
.descriptorType = descriptorType,
.descriptorCount = descriptorCount,
.stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT | VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT |
VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_COMPUTE_BIT,
.stageFlags = stageFlags,
.pImmutableSamplers = immutableSamplers,
};
}
Expand Down
1 change: 1 addition & 0 deletions lvk/vulkan/VulkanUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ VkSamplerCreateInfo samplerStateDescToVkSamplerCreateInfo(const lvk::SamplerStat
VkDescriptorSetLayoutBinding getDSLBinding(uint32_t binding,
VkDescriptorType descriptorType,
uint32_t descriptorCount,
VkShaderStageFlags stageFlags,
const VkSampler* immutableSamplers = nullptr);
VkSpecializationInfo getPipelineShaderStageSpecializationInfo(lvk::SpecializationConstantDesc desc, VkSpecializationMapEntry* outEntries);
VkPipelineShaderStageCreateInfo getPipelineShaderStageCreateInfo(VkShaderStageFlagBits stage,
Expand Down

0 comments on commit 5f648de

Please sign in to comment.