Skip to content

Commit

Permalink
Temp vars in checkAndUpdateDescriptorSets() for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
corporateshark committed Mar 11, 2024
1 parent 36a5820 commit 5f367bd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lvk/vulkan/VulkanClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5180,15 +5180,15 @@ void lvk::VulkanContext::checkAndUpdateDescriptorSets() {
VkImageView dummyImageView = texturesPool_.objects_[0].obj_.imageView_;

for (const auto& obj : texturesPool_.objects_) {
const VulkanTexture& texture = obj.obj_;
const VulkanImage* img = obj.obj_.image_.get();
const VkImageView view = obj.obj_.imageView_;
// multisampled images cannot be directly accessed from shaders
const bool isTextureAvailable = texture.image_ && ((texture.image_->vkSamples_ & VK_SAMPLE_COUNT_1_BIT) == VK_SAMPLE_COUNT_1_BIT);
const bool isSampledImage = isTextureAvailable && texture.image_->isSampledImage();
const bool isStorageImage = isTextureAvailable && texture.image_->isStorageImage();
infoSampledImages.push_back(
{VK_NULL_HANDLE, isSampledImage ? texture.imageView_ : dummyImageView, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL});
const bool isTextureAvailable = img && ((img->vkSamples_ & VK_SAMPLE_COUNT_1_BIT) == VK_SAMPLE_COUNT_1_BIT);
const bool isSampledImage = isTextureAvailable && img->isSampledImage();
const bool isStorageImage = isTextureAvailable && img->isStorageImage();
infoSampledImages.push_back({VK_NULL_HANDLE, isSampledImage ? view : dummyImageView, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL});
LVK_ASSERT(infoSampledImages.back().imageView != VK_NULL_HANDLE);
infoStorageImages.push_back({VK_NULL_HANDLE, isStorageImage ? texture.imageView_ : dummyImageView, VK_IMAGE_LAYOUT_GENERAL});
infoStorageImages.push_back({VK_NULL_HANDLE, isStorageImage ? view : dummyImageView, VK_IMAGE_LAYOUT_GENERAL});
}

// 2. Samplers
Expand Down

0 comments on commit 5f367bd

Please sign in to comment.