Skip to content

Commit 493b01e

Browse files
Remove invariant code from the loop.
Signed-off-by: Michal Mrozek <[email protected]>
1 parent 35d9d9e commit 493b01e

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

shared/source/helpers/blit_commands_helper_base.inl

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const Bl
183183

184184
const auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
185185
dispatchPreBlitCommand(linearStream, hwInfo);
186+
auto bltCmd = GfxFamily::cmdInitXyCopyBlt;
187+
appendColorDepth(blitProperties, bltCmd);
186188

187189
for (uint64_t slice = 0; slice < blitProperties.copySize.z; slice++) {
188190
for (uint64_t row = 0; row < blitProperties.copySize.y; row++) {
@@ -199,29 +201,24 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const Bl
199201
height = 1;
200202
}
201203

202-
{
203-
auto bltCmd = GfxFamily::cmdInitXyCopyBlt;
204-
205-
bltCmd.setDestinationX2CoordinateRight(static_cast<uint32_t>(width));
206-
bltCmd.setDestinationY2CoordinateBottom(static_cast<uint32_t>(height));
207-
bltCmd.setDestinationPitch(static_cast<uint32_t>(width));
208-
bltCmd.setSourcePitch(static_cast<uint32_t>(width));
204+
bltCmd.setDestinationX2CoordinateRight(static_cast<uint32_t>(width));
205+
bltCmd.setDestinationY2CoordinateBottom(static_cast<uint32_t>(height));
206+
bltCmd.setDestinationPitch(static_cast<uint32_t>(width));
207+
bltCmd.setSourcePitch(static_cast<uint32_t>(width));
209208

210-
auto dstAddr = calculateBlitCommandDestinationBaseAddress(blitProperties, offset, row, slice);
211-
auto srcAddr = calculateBlitCommandSourceBaseAddress(blitProperties, offset, row, slice);
209+
auto dstAddr = calculateBlitCommandDestinationBaseAddress(blitProperties, offset, row, slice);
210+
auto srcAddr = calculateBlitCommandSourceBaseAddress(blitProperties, offset, row, slice);
212211

213-
PRINT_DEBUG_STRING(DebugManager.flags.PrintBlitDispatchDetails.get(), stdout,
214-
"\nBlit command. width: %u, height: %u, srcAddr: %#llx, dstAddr: %#llx ", width, height, srcAddr, dstAddr);
212+
PRINT_DEBUG_STRING(DebugManager.flags.PrintBlitDispatchDetails.get(), stdout,
213+
"\nBlit command. width: %u, height: %u, srcAddr: %#llx, dstAddr: %#llx ", width, height, srcAddr, dstAddr);
215214

216-
bltCmd.setDestinationBaseAddress(dstAddr);
217-
bltCmd.setSourceBaseAddress(srcAddr);
215+
bltCmd.setDestinationBaseAddress(dstAddr);
216+
bltCmd.setSourceBaseAddress(srcAddr);
218217

219-
appendBlitCommandsForBuffer(blitProperties, bltCmd, rootDeviceEnvironment);
220-
appendColorDepth(blitProperties, bltCmd);
218+
appendBlitCommandsForBuffer(blitProperties, bltCmd, rootDeviceEnvironment);
221219

222-
auto bltStream = linearStream.getSpaceForCmd<typename GfxFamily::XY_COPY_BLT>();
223-
*bltStream = bltCmd;
224-
}
220+
auto bltStream = linearStream.getSpaceForCmd<typename GfxFamily::XY_COPY_BLT>();
221+
*bltStream = bltCmd;
225222

226223
dispatchPostBlitCommand(linearStream, hwInfo);
227224

@@ -382,6 +379,11 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferRegion(const Bl
382379
const auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
383380
dispatchPreBlitCommand(linearStream, hwInfo);
384381

382+
auto bltCmd = GfxFamily::cmdInitXyCopyBlt;
383+
bltCmd.setSourcePitch(static_cast<uint32_t>(blitProperties.srcRowPitch));
384+
bltCmd.setDestinationPitch(static_cast<uint32_t>(blitProperties.dstRowPitch));
385+
appendColorDepth(blitProperties, bltCmd);
386+
385387
for (size_t slice = 0u; slice < blitProperties.copySize.z; ++slice) {
386388
auto srcAddress = calculateBlitCommandSourceBaseAddressCopyRegion(blitProperties, slice);
387389
auto dstAddress = calculateBlitCommandDestinationBaseAddressCopyRegion(blitProperties, slice);
@@ -393,17 +395,13 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferRegion(const Bl
393395

394396
while (widthToCopy > 0) {
395397
auto width = static_cast<uint32_t>(std::min(widthToCopy, static_cast<size_t>(maxWidthToCopy)));
396-
auto bltCmd = GfxFamily::cmdInitXyCopyBlt;
397398

398399
bltCmd.setSourceBaseAddress(srcAddress);
399400
bltCmd.setDestinationBaseAddress(dstAddress);
400401
bltCmd.setDestinationX2CoordinateRight(width);
401402
bltCmd.setDestinationY2CoordinateBottom(height);
402-
bltCmd.setSourcePitch(static_cast<uint32_t>(blitProperties.srcRowPitch));
403-
bltCmd.setDestinationPitch(static_cast<uint32_t>(blitProperties.dstRowPitch));
404403

405404
appendBlitCommandsForBuffer(blitProperties, bltCmd, rootDeviceEnvironment);
406-
appendColorDepth(blitProperties, bltCmd);
407405

408406
auto cmd = linearStream.getSpaceForCmd<typename GfxFamily::XY_COPY_BLT>();
409407
*cmd = bltCmd;

0 commit comments

Comments
 (0)