Skip to content

Commit 5527e94

Browse files
committed
pr feedback - move comments to appropriate locations
1 parent 9ec0375 commit 5527e94

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

lib/API/DX/Device.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ class DXTexture : public offloadtest::Texture {
299299
public:
300300
ComPtr<ID3D12Resource> Resource;
301301
// TODO:
302-
// RTV/DSV views own a dedicated single-descriptor heap and are created at
303-
// texture creation time. Ideally SRV/UAV views would also live here, but
302+
// RTV/DSV own a dedicated single-descriptor heap and are created at
303+
// texture creation time. Ideally SRVs/UAVs would also live here, but
304304
// they currently require a shared CBV_SRV_UAV heap whose indices are
305305
// determined at pipeline bind time. Moving them here would require a
306306
// descriptor heap allocator, which is not yet implemented.
@@ -482,9 +482,6 @@ class DXDevice : public offloadtest::Device {
482482
size_t SizeInBytes) override {
483483
const D3D12_HEAP_TYPE HeapType = getDXHeapType(Desc.Location);
484484

485-
// As per the readback heap docs
486-
// > Resources in this heap must be created with
487-
// > D3D12_RESOURCE_STATE_COPY_DEST, and cannot be changed away from this.
488485
const D3D12_RESOURCE_FLAGS Flags =
489486
HeapType == D3D12_HEAP_TYPE_READBACK
490487
? D3D12_RESOURCE_FLAG_NONE
@@ -498,6 +495,9 @@ class DXDevice : public offloadtest::Device {
498495
if (HeapType == D3D12_HEAP_TYPE_UPLOAD)
499496
InitialState = D3D12_RESOURCE_STATE_GENERIC_READ;
500497
else if (HeapType == D3D12_HEAP_TYPE_READBACK)
498+
// As per the readback heap docs
499+
// > Resources in this heap must be created with
500+
// > D3D12_RESOURCE_STATE_COPY_DEST, and cannot be changed away from this.
501501
InitialState = D3D12_RESOURCE_STATE_COPY_DEST;
502502

503503
ComPtr<ID3D12Resource> DeviceBuffer;

lib/API/MTL/MTLResources.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ namespace offloadtest {
2121
// Metal requires different storage modes for textures and buffers.
2222
// Textures use Managed for GpuToCpu because Shared textures are not available
2323
// on discrete GPUs and lack hardware compression/tiling optimizations.
24-
// Buffers use Shared for GpuToCpu because they are linear memory with no
25-
// layout concerns, and Shared avoids the explicit synchronizeResource step
26-
// that Managed requires.
2724
inline MTL::StorageMode getMetalTextureStorageMode(MemoryLocation Location) {
2825
switch (Location) {
2926
case MemoryLocation::GpuOnly:
@@ -35,6 +32,10 @@ inline MTL::StorageMode getMetalTextureStorageMode(MemoryLocation Location) {
3532
llvm_unreachable("All MemoryLocation cases handled");
3633
}
3734

35+
// Metal requires different storage modes for textures and buffers.
36+
// Buffers use Shared for GpuToCpu because they are linear memory with no
37+
// layout concerns, and Shared avoids the explicit synchronizeResource step
38+
// that Managed requires.
3839
inline MTL::ResourceOptions
3940
getMetalBufferResourceOptions(MemoryLocation Location) {
4041
switch (Location) {

0 commit comments

Comments
 (0)