Skip to content

Commit 0154eff

Browse files
author
devsh
committed
fix missing pipeline barriers in ex 22
1 parent bf2f40f commit 0154eff

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

22_CppCompat/main.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ class CompatibilityTest final : public MonoDeviceApplication, public MonoAssetMa
220220
IGPUCommandBuffer::SPipelineBarrierDependencyInfo::image_barrier_t layoutTransBarriers[2] = { {
221221
.barrier = {
222222
.dep = {
223-
.srcStageMask = PIPELINE_STAGE_FLAGS::ALL_COMMANDS_BITS,
223+
.srcStageMask = PIPELINE_STAGE_FLAGS::HOST_BIT,
224+
.srcAccessMask = ACCESS_FLAGS::HOST_WRITE_BIT,
225+
.dstStageMask = PIPELINE_STAGE_FLAGS::COMPUTE_SHADER_BIT,
224226
.dstAccessMask = ACCESS_FLAGS::SHADER_WRITE_BITS
225-
},
226-
.ownershipOp = IGPUCommandBuffer::SOwnershipTransferBarrier::OWNERSHIP_OP::RELEASE,
227-
.otherQueueFamilyIndex = ~0u
227+
}
228228
},
229229
.image = m_images[0].get(),
230230
.subresourceRange = {
@@ -235,14 +235,13 @@ class CompatibilityTest final : public MonoDeviceApplication, public MonoAssetMa
235235
.layerCount = 1u,
236236
},
237237
.oldLayout = IImage::LAYOUT::UNDEFINED,
238-
.newLayout = IImage::LAYOUT::GENERAL,
238+
.newLayout = IImage::LAYOUT::GENERAL
239239
} };
240-
241240
layoutTransBarriers[1] = layoutTransBarriers[0];
242241
layoutTransBarriers[1].image = m_images[1].get();
243242

244243
const IGPUCommandBuffer::SPipelineBarrierDependencyInfo depInfo = { .imgBarriers = layoutTransBarriers };
245-
244+
m_cmdbuf->pipelineBarrier(EDF_NONE, depInfo);
246245

247246

248247
const uint32_t pushConstants[2] = { 1920, 1080 };
@@ -252,11 +251,11 @@ class CompatibilityTest final : public MonoDeviceApplication, public MonoAssetMa
252251
m_cmdbuf->dispatch(240, 135, 1u);
253252
for (int i = 0; i < 2; ++i)
254253
{
255-
layoutTransBarriers[i].barrier.dep.srcAccessMask = layoutTransBarriers[i].barrier.dep.dstAccessMask;
256-
layoutTransBarriers[i].barrier.dep.dstAccessMask = ACCESS_FLAGS::TRANSFER_READ_BIT;
254+
layoutTransBarriers[i].barrier.dep = layoutTransBarriers[i].barrier.dep.nextBarrier(PIPELINE_STAGE_FLAGS::COPY_BIT,ACCESS_FLAGS::TRANSFER_READ_BIT);
257255
layoutTransBarriers[i].oldLayout = layoutTransBarriers[i].newLayout;
258256
layoutTransBarriers[i].newLayout = IImage::LAYOUT::TRANSFER_SRC_OPTIMAL;
259257
}
258+
m_cmdbuf->pipelineBarrier(EDF_NONE,depInfo);
260259

261260
//{
262261
// constexpr auto FinishedValue1 = 42;

0 commit comments

Comments
 (0)