Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/gpgmm_d3d12.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ namespace gpgmm::d3d12 {
Internally, the ResidencyManager keeps the application in-budget by calling ID3D12Device::Evict
and ID3D12Device::MakeResident to page-out or page-in heaps, respectively.
**/
GPGMM_INTERFACE IResidencyManager : public IUnknown {
GPGMM_INTERFACE IResidencyManager : public IDebugObject {
public:
/** \brief Locks the specified heap.

Expand Down Expand Up @@ -1095,7 +1095,7 @@ namespace gpgmm::d3d12 {
budget. And similarly, a smaller Heap allows for finer grained residency but could increase
overall memory usage for allocation.
**/
GPGMM_INTERFACE IResourceAllocator : public IUnknown {
GPGMM_INTERFACE IResourceAllocator : public IDebugObject {
public:
/** \brief Allocates memory and creates a D3D12 resource using it.

Expand Down
5 changes: 5 additions & 0 deletions src/gpgmm/d3d12/DebugObjectD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@ namespace gpgmm::d3d12 {
return SetDebugNameImpl(Name);
}

HRESULT DebugObject::SetDebugNameImpl(LPCWSTR name) {
mDebugName = name;
return S_OK;
}

} // namespace gpgmm::d3d12
4 changes: 3 additions & 1 deletion src/gpgmm/d3d12/DebugObjectD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ namespace gpgmm::d3d12 {
LPCWSTR GetDebugName() const;
HRESULT SetDebugName(LPCWSTR Name);

DEFINE_UNKNOWN_OVERRIDES()

protected:
// Derived classes should override to associate the name with the containing ID3D12Object.
virtual HRESULT SetDebugNameImpl(LPCWSTR name) = 0;
virtual HRESULT SetDebugNameImpl(LPCWSTR name);

private:
std::wstring mDebugName;
Expand Down
1 change: 0 additions & 1 deletion src/gpgmm/d3d12/HeapD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include "gpgmm/common/Memory.h"
#include "gpgmm/d3d12/DebugObjectD3D12.h"
#include "gpgmm/d3d12/UnknownD3D12.h"
#include "gpgmm/utils/Limits.h"
#include "gpgmm/utils/LinkedList.h"

Expand Down
8 changes: 8 additions & 0 deletions src/gpgmm/d3d12/ResidencyManagerD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,4 +1033,12 @@ namespace gpgmm::d3d12 {
return S_OK;
}

LPCWSTR ResidencyManager::GetDebugName() const {
return DebugObject::GetDebugName();
}

HRESULT ResidencyManager::SetDebugName(LPCWSTR Name) {
return DebugObject::SetDebugNameImpl(Name);
}

} // namespace gpgmm::d3d12
9 changes: 7 additions & 2 deletions src/gpgmm/d3d12/ResidencyManagerD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define GPGMM_D3D12_RESIDENCYMANAGERD3D12_H_

#include "gpgmm/common/Object.h"
#include "gpgmm/d3d12/UnknownD3D12.h"
#include "gpgmm/d3d12/DebugObjectD3D12.h"
#include "gpgmm/utils/EnumFlags.h"
#include "gpgmm/utils/LinkedList.h"

Expand All @@ -40,7 +40,7 @@ namespace gpgmm::d3d12 {
class ResourceAllocator;
class ResourceHeapAllocator;

class ResidencyManager final : public Unknown, public IResidencyManager, ObjectBase {
class ResidencyManager final : public DebugObject, public IResidencyManager, public ObjectBase {
public:
static HRESULT CreateResidencyManager(const RESIDENCY_DESC& descriptor,
IResidencyManager** ppResidencyManagerOut);
Expand Down Expand Up @@ -92,8 +92,13 @@ namespace gpgmm::d3d12 {

bool IsUMA() const;

// ObjectBase interface
const char* GetTypename() const override;

// IDebugObject interface
LPCWSTR GetDebugName() const override;
HRESULT SetDebugName(LPCWSTR Name) override;

using LRUCache = LinkedList<Heap>;

struct VideoMemorySegment {
Expand Down
2 changes: 0 additions & 2 deletions src/gpgmm/d3d12/ResourceAllocationD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#include "gpgmm/common/MemoryAllocation.h"
#include "gpgmm/d3d12/DebugObjectD3D12.h"
#include "gpgmm/d3d12/UnknownD3D12.h"
#include "gpgmm/d3d12/d3d12_platform.h"

#include <gpgmm_d3d12.h>

Expand Down
8 changes: 8 additions & 0 deletions src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1638,6 +1638,14 @@ namespace gpgmm::d3d12 {
return E_INVALIDARG;
}

LPCWSTR ResourceAllocator::GetDebugName() const {
return DebugObject::GetDebugName();
}

HRESULT ResourceAllocator::SetDebugName(LPCWSTR Name) {
return DebugObject::SetDebugNameImpl(Name);
}

ImportResourceCallbackContext::ImportResourceCallbackContext(ID3D12Resource* resource)
: mResource(resource) {
}
Expand Down
8 changes: 6 additions & 2 deletions src/gpgmm/d3d12/ResourceAllocatorD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define GPGMM_D3D12_RESOURCEALLOCATORD3D12_H_

#include "gpgmm/common/MemoryAllocator.h"
#include "gpgmm/d3d12/UnknownD3D12.h"
#include "gpgmm/d3d12/DebugObjectD3D12.h"
#include "gpgmm/utils/EnumFlags.h"

#include <gpgmm_d3d12.h>
Expand All @@ -35,7 +35,7 @@ namespace gpgmm::d3d12 {
class ResidencyManager;
class ResourceAllocation;

class ResourceAllocator final : public Unknown,
class ResourceAllocator final : public DebugObject,
public IResourceAllocator,
public MemoryAllocator {
public:
Expand Down Expand Up @@ -73,6 +73,10 @@ namespace gpgmm::d3d12 {
// ObjectBase interface
const char* GetTypename() const override;

// IDebugObject interface
LPCWSTR GetDebugName() const override;
HRESULT SetDebugName(LPCWSTR Name) override;

HRESULT CreateResourceInternal(const ALLOCATION_DESC& allocationDescriptor,
const D3D12_RESOURCE_DESC& resourceDescriptor,
D3D12_RESOURCE_STATES initialResourceState,
Expand Down
16 changes: 16 additions & 0 deletions src/mvi/gpgmm_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ namespace gpgmm::d3d12 {
return Unknown::Release();
}

LPCWSTR ResidencyManager::GetDebugName() const {
return L"";
}

HRESULT ResidencyManager::SetDebugName(LPCWSTR Name) {
return S_OK;
}

// ResourceAllocation

void ResourceAllocation::DeleteThis() {
Expand Down Expand Up @@ -419,6 +427,14 @@ namespace gpgmm::d3d12 {
return Unknown::Release();
}

LPCWSTR ResourceAllocator::GetDebugName() const {
return L"";
}

HRESULT ResourceAllocator::SetDebugName(LPCWSTR Name) {
return S_OK;
}

CreateCommittedResourceCallbackContext::CreateCommittedResourceCallbackContext(
ID3D12Device* device,
ALLOCATION_DESC allocationDescriptor,
Expand Down
8 changes: 8 additions & 0 deletions src/mvi/gpgmm_d3d12.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ namespace gpgmm::d3d12 {
ULONG STDMETHODCALLTYPE AddRef() override;
ULONG STDMETHODCALLTYPE Release() override;

// IDebugObject interface
LPCWSTR GetDebugName() const override;
HRESULT SetDebugName(LPCWSTR Name) override;

private:
ResidencyManager(const RESIDENCY_DESC& descriptor);

Expand Down Expand Up @@ -228,6 +232,10 @@ namespace gpgmm::d3d12 {
ULONG STDMETHODCALLTYPE AddRef() override;
ULONG STDMETHODCALLTYPE Release() override;

// IDebugObject interface
LPCWSTR GetDebugName() const override;
HRESULT SetDebugName(LPCWSTR Name) override;

private:
ResourceAllocator(const ALLOCATOR_DESC& descriptor, ResidencyManager* pResidencyManager);

Expand Down