Skip to content

Commit cbda773

Browse files
committed
fmt + const removal
1 parent 3123f3d commit cbda773

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

include/API/FormatConversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- FormatConversion.h - Bridge between DataFormat and Format -----------===//
1+
//===- FormatConversion.h - Refactoring helpers ---------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

lib/API/DX/Device.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,11 @@ class DXDevice : public offloadtest::Device {
423423
InitialState = D3D12_RESOURCE_STATE_COPY_DEST;
424424

425425
ComPtr<ID3D12Resource> DeviceBuffer;
426-
if (auto Err = HR::toError(Device->CreateCommittedResource(
427-
&HeapProps, D3D12_HEAP_FLAG_NONE,
428-
&BufferDesc, InitialState, nullptr,
429-
IID_PPV_ARGS(&DeviceBuffer)),
430-
"Failed to create buffer."))
426+
if (auto Err =
427+
HR::toError(Device->CreateCommittedResource(
428+
&HeapProps, D3D12_HEAP_FLAG_NONE, &BufferDesc,
429+
InitialState, nullptr, IID_PPV_ARGS(&DeviceBuffer)),
430+
"Failed to create buffer."))
431431
return Err;
432432

433433
return std::make_shared<DXBuffer>(DeviceBuffer, Name, Desc, SizeInBytes);

lib/API/MTL/MTLDevice.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ class MTLDevice : public offloadtest::Device {
371371
if (TableSize > 0) {
372372
IS.ArgBuffer =
373373
Device->newBuffer(TableSize, MTL::ResourceStorageModeManaged);
374-
const uint32_t HeapIndex = 0;
374+
uint32_t HeapIndex = 0;
375375
for (auto &D : P.Sets) {
376376
for (auto &R : D.Resources) {
377377
if (auto Err = createDescriptor(R, IS, HeapIndex++))
@@ -506,8 +506,8 @@ class MTLDevice : public offloadtest::Device {
506506
MTL::RenderPassDescriptor *Desc =
507507
MTL::RenderPassDescriptor::alloc()->init();
508508

509-
const uint64_t Width = P.Bindings.RTargetBufferPtr->OutputProps.Width;
510-
const uint64_t Height = P.Bindings.RTargetBufferPtr->OutputProps.Height;
509+
const uint64_t Width = IS.FrameBufferTexture->Desc.Width;
510+
const uint64_t Height = IS.FrameBufferTexture->Desc.Height;
511511

512512
// Color attachment.
513513
auto *CADesc = MTL::RenderPassColorAttachmentDescriptor::alloc()->init();
@@ -576,7 +576,7 @@ class MTLDevice : public offloadtest::Device {
576576

577577
// Blit the render target into the readback buffer for CPU access.
578578
MTL::BlitCommandEncoder *Blit = IS.CmdBuffer->blitCommandEncoder();
579-
const size_t ElemSize = RTarget->getElementSize();
579+
const size_t ElemSize = getFormatSize(IS.FrameBufferTexture->Desc.Format);
580580
const size_t RowBytes = Width * ElemSize;
581581
Blit->copyFromTexture(IS.FrameBufferTexture->Tex, 0, 0,
582582
MTL::Origin(0, 0, 0), MTL::Size(Width, Height, 1),
@@ -599,8 +599,8 @@ class MTLDevice : public offloadtest::Device {
599599
}
600600

601601
llvm::Error copyBack(Pipeline &P, InvocationState &IS) {
602-
const uint32_t TextureIndex = 0;
603-
const uint32_t BufferIndex = 0;
602+
uint32_t TextureIndex = 0;
603+
uint32_t BufferIndex = 0;
604604
for (auto &D : P.Sets) {
605605
for (auto &R : D.Resources) {
606606
assert(R.BufferPtr->ArraySize == 1 &&

0 commit comments

Comments
 (0)