Fixed crash if no textures were loaded
This commit is contained in:
parent
e9496bead6
commit
65c67c14b7
|
@ -259,16 +259,20 @@ namespace SHADE
|
|||
currentCmdBuffer->BindIndexBuffer(buffer, 0);
|
||||
}
|
||||
|
||||
std::array<uint32_t, 1> texDynamicOffset {0};
|
||||
|
||||
// Bind textures
|
||||
currentCmdBuffer->BindDescriptorSet
|
||||
(
|
||||
texLibrary.GetTextureDescriptorSetGroup(),
|
||||
auto textureDescSet = texLibrary.GetTextureDescriptorSetGroup();
|
||||
if (textureDescSet)
|
||||
{
|
||||
std::array<uint32_t, 1> texDynamicOffset {0};
|
||||
currentCmdBuffer->BindDescriptorSet
|
||||
(
|
||||
textureDescSet,
|
||||
vk::PipelineBindPoint::eGraphics,
|
||||
0,
|
||||
std::span<uint32_t, 1>{texDynamicOffset.data(), texDynamicOffset.size()}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
// bind camera data
|
||||
renderers[renIndex]->UpdateDataAndBind(currentCmdBuffer, frameIndex);
|
||||
|
|
|
@ -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<uint32_t>(texOrder.size()) });
|
||||
if (!texDescriptors)
|
||||
{
|
||||
texDescriptors = descPool->Allocate({ descLayout }, { static_cast<uint32_t>(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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue