Skip to content
Snippets Groups Projects
Verified Commit 87c3435b authored by Tobias Frisch's avatar Tobias Frisch
Browse files

[#77] Fixed crash because of unmatching amount of miplevels and descriptor-sets after resizing

parent 6db2badd
No related branches found
No related tags found
1 merge request!62Resolve "Lens Flares"
Pipeline #26050 passed
......@@ -30,7 +30,7 @@ BloomAndFlares::BloomAndFlares(
});
for(uint32_t mipLevel = 0; mipLevel < m_Blur.getMipCount(); mipLevel++)
{
m_DownsampleDescSets.push_back(
m_DownsampleDescSets.push_back(
p_Core->createDescriptorSet(dsProg.getReflectedDescriptors()[0]));
}
m_DownsamplePipe = p_Core->createComputePipeline(
......@@ -109,7 +109,7 @@ void BloomAndFlares::execDownsamplePipe(const vkcv::CommandStreamHandle &cmdStre
// downsample dispatches of blur buffer's mip maps
float mipDispatchCountX = dispatchCountX;
float mipDispatchCountY = dispatchCountY;
for(uint32_t mipLevel = 1; mipLevel < m_Blur.getMipCount(); mipLevel++)
for(uint32_t mipLevel = 1; mipLevel < m_DownsampleDescSets.size(); mipLevel++)
{
// mip descriptor writes
vkcv::DescriptorWrites mipDescriptorWrites;
......@@ -151,7 +151,10 @@ void BloomAndFlares::execUpsamplePipe(const vkcv::CommandStreamHandle &cmdStream
// upsample dispatch
p_Core->prepareImageForStorage(cmdStream, m_Blur.getHandle());
uint32_t upsampleMipLevels = std::min(m_Blur.getMipCount(), static_cast<uint32_t>(5));
const uint32_t upsampleMipLevels = std::min(
static_cast<uint32_t>(m_UpsampleDescSets.size() - 1),
static_cast<uint32_t>(5)
);
// upsample dispatch for each mip map
for(uint32_t mipLevel = upsampleMipLevels; mipLevel > 0; mipLevel--)
......
......@@ -293,7 +293,6 @@ int main(int argc, const char** argv) {
std::vector<vkcv::DrawcallInfo> drawcalls;
std::vector<vkcv::DrawcallInfo> shadowDrawcalls;
for (int i = 0; i < meshes.size(); i++) {
drawcalls.push_back(vkcv::DrawcallInfo(meshes[i], {
vkcv::DescriptorSetUsage(0, core.getDescriptorSet(forwardShadingDescriptorSet).vulkanHandle),
vkcv::DescriptorSetUsage(1, core.getDescriptorSet(perMeshDescriptorSets[i]).vulkanHandle) }));
......@@ -395,6 +394,7 @@ int main(int argc, const char** argv) {
baf.execWholePipeline(cmdStream, colorBuffer);
core.prepareImageForStorage(cmdStream, swapchainInput);
// gamma correction descriptor write
vkcv::DescriptorWrites gammaCorrectionDescriptorWrites;
gammaCorrectionDescriptorWrites.storageImageWrites = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment