Skip to content

Commit 6984f80

Browse files
committed
IUtilities Fix Layout Transition Bug
1 parent 45552f8 commit 6984f80

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

include/nbl/video/utilities/IUtilities.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,16 @@ class NBL_API IUtilities : public core::IReferenceCounted
172172

173173
if (finalLayout != asset::EIL_TRANSFER_DST_OPTIMAL)
174174
{
175-
barrier.barrier.srcAccessMask = asset::EAF_TRANSFER_WRITE_BIT;
176-
barrier.barrier.dstAccessMask = asset::EAF_TRANSFER_READ_BIT;
177-
barrier.oldLayout = asset::EIL_TRANSFER_DST_OPTIMAL;
178-
barrier.newLayout = finalLayout;
179-
cmdbuf->pipelineBarrier(asset::EPSF_TRANSFER_BIT, asset::EPSF_TRANSFER_BIT, asset::EDF_NONE, 0u, nullptr, 0u, nullptr, 1u, &barrier);
175+
// Cannot transition to UNDEFINED and PREINITIALIZED
176+
// TODO: Take an extra parameter that let's the user choose the newLayout or an output parameter that tells the user the final layout
177+
if(finalLayout != asset::EIL_UNDEFINED && finalLayout != asset::EIL_PREINITIALIZED)
178+
{
179+
barrier.barrier.srcAccessMask = asset::EAF_TRANSFER_WRITE_BIT;
180+
barrier.barrier.dstAccessMask = asset::EAF_TRANSFER_READ_BIT;
181+
barrier.oldLayout = asset::EIL_TRANSFER_DST_OPTIMAL;
182+
barrier.newLayout = finalLayout;
183+
cmdbuf->pipelineBarrier(asset::EPSF_TRANSFER_BIT, asset::EPSF_TRANSFER_BIT, asset::EDF_NONE, 0u, nullptr, 0u, nullptr, 1u, &barrier);
184+
}
180185
}
181186

182187
return retImg;

0 commit comments

Comments
 (0)