diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp index 718f28db..67a6d6eb 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp @@ -259,16 +259,20 @@ namespace SHADE currentCmdBuffer->BindIndexBuffer(buffer, 0); } - std::array texDynamicOffset {0}; // Bind textures - currentCmdBuffer->BindDescriptorSet - ( - texLibrary.GetTextureDescriptorSetGroup(), + auto textureDescSet = texLibrary.GetTextureDescriptorSetGroup(); + if (textureDescSet) + { + std::array texDynamicOffset {0}; + currentCmdBuffer->BindDescriptorSet + ( + textureDescSet, vk::PipelineBindPoint::eGraphics, 0, std::span{texDynamicOffset.data(), texDynamicOffset.size()} - ); + ); + } // bind camera data renderers[renIndex]->UpdateDataAndBind(currentCmdBuffer, frameIndex); diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp index db75af6a..e1461dd3 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp @@ -168,23 +168,26 @@ namespace SHADE } addJobs.clear(); - /* Build Descriptor Set with all the Textures */ - if (!texDescriptors) + /* Build Descriptor Set with all the Textures only if there are textures */ + if (!texOrder.empty()) { - texDescriptors = descPool->Allocate({ descLayout }, { static_cast(texOrder.size()) }); + if (!texDescriptors) + { + texDescriptors = descPool->Allocate({ descLayout }, { static_cast(texOrder.size()) }); + } + const auto ALIGNED_SIZE = device->PadSSBOSize(sizeof(uint32_t)); + texDescriptors->ModifyWriteDescImage + ( + SHGraphicsConstants::DescriptorSetIndex::STATIC_GLOBALS, + SHGraphicsConstants::DescriptorSetBindings::IMAGE_AND_SAMPLERS_DATA, + combinedImageSamplers + ); + texDescriptors->UpdateDescriptorSetImages + ( + SHGraphicsConstants::DescriptorSetIndex::STATIC_GLOBALS, + SHGraphicsConstants::DescriptorSetBindings::IMAGE_AND_SAMPLERS_DATA + ); } - const auto ALIGNED_SIZE = device->PadSSBOSize(sizeof(uint32_t)); - texDescriptors->ModifyWriteDescImage - ( - SHGraphicsConstants::DescriptorSetIndex::STATIC_GLOBALS, - SHGraphicsConstants::DescriptorSetBindings::IMAGE_AND_SAMPLERS_DATA, - combinedImageSamplers - ); - texDescriptors->UpdateDescriptorSetImages - ( - SHGraphicsConstants::DescriptorSetIndex::STATIC_GLOBALS, - SHGraphicsConstants::DescriptorSetBindings::IMAGE_AND_SAMPLERS_DATA - ); isDirty = false; }