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
2 changes: 1 addition & 1 deletion .github/workflows/.patches/dawn.diff
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ index 214fa67f8..909e7d810 100644
+ "D3D12 create residency manager"));
+ }
+
+ DAWN_TRY(CheckHRESULT(gpgmm::d3d12::ResourceAllocator::CreateAllocator(
+ DAWN_TRY(CheckHRESULT(gpgmm::d3d12::ResourceAllocator::CreateResourceAllocator(
+ allocatorDesc, mResidencyManager.Get(), &mResourceAllocator),
+ "D3D12 create resource allocator"));

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ allocatorDesc.ResourceHeapTier = D3D12_RESOURCE_HEAP_TIER_1;

ComPtr<gpgmm::d3d12::ResidencyManager> residency; // Optional
ComPtr<gpgmm::d3d12::ResourceAllocator> allocator;
gpgmm::d3d12::ResourceAllocator::CreateAllocator(desc, &allocator, &residency);
gpgmm::d3d12::ResourceAllocator::CreateResourceAllocator(desc, &allocator, &residency);
```

```cpp
Expand Down
2 changes: 1 addition & 1 deletion src/fuzzers/D3D12Fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ uint64_t UInt8ToUInt64(const uint8_t* src) {
return dst;
}

HRESULT CreateAllocatorDesc(gpgmm::d3d12::ALLOCATOR_DESC* allocatorDesc) {
HRESULT CreateResourceAllocatorDesc(gpgmm::d3d12::ALLOCATOR_DESC* allocatorDesc) {
gpgmm::d3d12::ALLOCATOR_DESC allocatorDescOut = {};

// Populate the device
Expand Down
2 changes: 1 addition & 1 deletion src/fuzzers/D3D12Fuzzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

uint64_t UInt8ToUInt64(const uint8_t* src);

HRESULT CreateAllocatorDesc(gpgmm::d3d12::ALLOCATOR_DESC* allocatorDesc);
HRESULT CreateResourceAllocatorDesc(gpgmm::d3d12::ALLOCATOR_DESC* allocatorDesc);

D3D12_RESOURCE_DESC CreateBufferDesc(uint64_t width, uint64_t alignment = 0);

Expand Down
4 changes: 2 additions & 2 deletions src/fuzzers/D3D12ResidencyManagerFuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace {

extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) {
gpgmm::d3d12::ALLOCATOR_DESC allocatorDesc = {};
if (FAILED(CreateAllocatorDesc(&allocatorDesc))) {
if (FAILED(CreateResourceAllocatorDesc(&allocatorDesc))) {
return 0;
}

Expand Down Expand Up @@ -72,7 +72,7 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) {
return 0;
}

if (FAILED(gpgmm::d3d12::ResourceAllocator::CreateAllocator(
if (FAILED(gpgmm::d3d12::ResourceAllocator::CreateResourceAllocator(
allocatorDesc, gResidencyManager.Get(), &gResourceAllocator))) {
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/fuzzers/D3D12ResourceAllocatorFuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ namespace {

extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) {
gpgmm::d3d12::ALLOCATOR_DESC allocatorDesc = {};
if (FAILED(CreateAllocatorDesc(&allocatorDesc))) {
if (FAILED(CreateResourceAllocatorDesc(&allocatorDesc))) {
return 0;
}

if (FAILED(
gpgmm::d3d12::ResourceAllocator::CreateAllocator(allocatorDesc, &gResourceAllocator))) {
if (FAILED(gpgmm::d3d12::ResourceAllocator::CreateResourceAllocator(allocatorDesc,
&gResourceAllocator))) {
return 0;
}

Expand Down
16 changes: 8 additions & 8 deletions src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ namespace gpgmm::d3d12 {
} // namespace

// static
HRESULT ResourceAllocator::CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResourceAllocator** ppResourceAllocatorOut,
ResidencyManager** ppResidencyManagerOut) {
HRESULT ResourceAllocator::CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResourceAllocator** ppResourceAllocatorOut,
ResidencyManager** ppResidencyManagerOut) {
if (allocatorDescriptor.Device == nullptr || allocatorDescriptor.Adapter == nullptr) {
return E_INVALIDARG;
}
Expand All @@ -391,8 +391,8 @@ namespace gpgmm::d3d12 {
}

ComPtr<ResourceAllocator> resourceAllocator;
ReturnIfFailed(
CreateAllocator(allocatorDescriptor, residencyManager.Get(), &resourceAllocator));
ReturnIfFailed(CreateResourceAllocator(allocatorDescriptor, residencyManager.Get(),
&resourceAllocator));

if (ppResourceAllocatorOut != nullptr) {
*ppResourceAllocatorOut = resourceAllocator.Detach();
Expand All @@ -406,9 +406,9 @@ namespace gpgmm::d3d12 {
}

// static
HRESULT ResourceAllocator::CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResidencyManager* pResidencyManager,
ResourceAllocator** ppResourceAllocatorOut) {
HRESULT ResourceAllocator::CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResidencyManager* pResidencyManager,
ResourceAllocator** ppResourceAllocatorOut) {
if (allocatorDescriptor.Adapter == nullptr || allocatorDescriptor.Device == nullptr) {
return E_INVALIDARG;
}
Expand Down
16 changes: 8 additions & 8 deletions src/gpgmm/d3d12/ResourceAllocatorD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ namespace gpgmm::d3d12 {
**/
class GPGMM_EXPORT ResourceAllocator final : public MemoryAllocator, public IUnknownImpl {
public:
/** \brief Create allocator with residency.
/** \brief Create a resource allocator with residency.

Residency requires at-least DXGI version 1.4.

Expand All @@ -496,11 +496,11 @@ namespace gpgmm::d3d12 {
residency manager. If NULL is passed, the allocator will be created without using
residency.
*/
static HRESULT CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResourceAllocator** ppResourceAllocatorOut,
ResidencyManager** ppResidencyManagerOut = nullptr);
static HRESULT CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResourceAllocator** ppResourceAllocatorOut,
ResidencyManager** ppResidencyManagerOut = nullptr);

/** \brief Create allocator using a specified residency manager.
/** \brief Create a resource allocator using a specified residency manager.

@param allocatorDescriptor A reference to ALLOCATOR_DESC structure that describes the
allocator.
Expand All @@ -510,9 +510,9 @@ namespace gpgmm::d3d12 {
resource allocator. Pass NULL to test if allocator creation would succeed, but not actually
create the allocator.
*/
static HRESULT CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResidencyManager* pResidencyManager,
ResourceAllocator** ppResourceAllocatorOut);
static HRESULT CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResidencyManager* pResidencyManager,
ResourceAllocator** ppResourceAllocatorOut);

~ResourceAllocator() override;

Expand Down
6 changes: 3 additions & 3 deletions src/gpgmm/vk/ResourceAllocatorVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace gpgmm::vk {

VkResult gpCreateResourceAllocator(const GpAllocatorCreateInfo& info,
GpResourceAllocator* allocatorOut) {
return GpResourceAllocator_T::CreateAllocator(info, allocatorOut);
return GpResourceAllocator_T::CreateResourceAllocator(info, allocatorOut);
}

void gpDestroyResourceAllocator(GpResourceAllocator allocator) {
Expand Down Expand Up @@ -186,8 +186,8 @@ namespace gpgmm::vk {
// GpResourceAllocator_T

// static
VkResult GpResourceAllocator_T::CreateAllocator(const GpAllocatorCreateInfo& info,
GpResourceAllocator* allocatorOut) {
VkResult GpResourceAllocator_T::CreateResourceAllocator(const GpAllocatorCreateInfo& info,
GpResourceAllocator* allocatorOut) {
VulkanFunctions vkFunctions = {};
{
VulkanExtensions vkExtensionsRequired = {};
Expand Down
4 changes: 2 additions & 2 deletions src/gpgmm/vk/ResourceAllocatorVk.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ namespace gpgmm::vk {
class Caps;
struct GpResourceAllocator_T {
public:
static VkResult CreateAllocator(const GpAllocatorCreateInfo& info,
GpResourceAllocator* allocatorOut);
static VkResult CreateResourceAllocator(const GpAllocatorCreateInfo& info,
GpResourceAllocator* allocatorOut);

VkResult TryAllocateMemory(const VkMemoryRequirements& requirements,
const GpResourceAllocationCreateInfo& allocationInfo,
Expand Down
16 changes: 8 additions & 8 deletions src/include/min/gpgmm_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ namespace gpgmm::d3d12 {
// ResourceAllocator

// static
HRESULT ResourceAllocator::CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResourceAllocator** ppResourceAllocatorOut,
ResidencyManager** ppResidencyManagerOut) {
HRESULT ResourceAllocator::CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResourceAllocator** ppResourceAllocatorOut,
ResidencyManager** ppResidencyManagerOut) {
if (allocatorDescriptor.Device == nullptr || allocatorDescriptor.Adapter == nullptr) {
return E_INVALIDARG;
}
Expand All @@ -235,8 +235,8 @@ namespace gpgmm::d3d12 {
}

Microsoft::WRL::ComPtr<ResourceAllocator> resourceAllocator;
ReturnIfFailed(
CreateAllocator(allocatorDescriptor, residencyManager.Get(), &resourceAllocator));
ReturnIfFailed(CreateResourceAllocator(allocatorDescriptor, residencyManager.Get(),
&resourceAllocator));

if (ppResourceAllocatorOut != nullptr) {
*ppResourceAllocatorOut = resourceAllocator.Detach();
Expand All @@ -250,9 +250,9 @@ namespace gpgmm::d3d12 {
}

// static
HRESULT ResourceAllocator::CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResidencyManager* pResidencyManager,
ResourceAllocator** ppResourceAllocatorOut) {
HRESULT ResourceAllocator::CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResidencyManager* pResidencyManager,
ResourceAllocator** ppResourceAllocatorOut) {
if (ppResourceAllocatorOut != nullptr) {
*ppResourceAllocatorOut = new ResourceAllocator(allocatorDescriptor, pResidencyManager);
}
Expand Down
12 changes: 6 additions & 6 deletions src/include/min/gpgmm_d3d12.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,13 @@ namespace gpgmm::d3d12 {

class ResourceAllocator final : public MemoryAllocator, public IUnknownImpl {
public:
static HRESULT CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResourceAllocator** ppResourceAllocatorOut,
ResidencyManager** ppResidencyManagerOut = nullptr);
static HRESULT CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResourceAllocator** ppResourceAllocatorOut,
ResidencyManager** ppResidencyManagerOut = nullptr);

static HRESULT CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResidencyManager* pResidencyManager,
ResourceAllocator** ppResourceAllocatorOut);
static HRESULT CreateResourceAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResidencyManager* pResidencyManager,
ResourceAllocator** ppResourceAllocatorOut);

HRESULT CreateResource(const ALLOCATION_DESC& allocationDescriptor,
const D3D12_RESOURCE_DESC& resourceDescriptor,
Expand Down
2 changes: 1 addition & 1 deletion src/samples/D3D12Sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ HRESULT Init() {
desc.ResourceHeapTier = options.ResourceHeapTier;

Microsoft::WRL::ComPtr<gpgmm::d3d12::ResourceAllocator> resourceAllocator;
hr = gpgmm::d3d12::ResourceAllocator::CreateAllocator(desc, &resourceAllocator);
hr = gpgmm::d3d12::ResourceAllocator::CreateResourceAllocator(desc, &resourceAllocator);
if (FAILED(hr)) {
return hr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ class D3D12EventTraceReplay : public D3D12TestBase, public CaptureReplayTestWith
}

ComPtr<ResourceAllocator> resourceAllocator;
ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(
ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(
allocatorDescOfProfile, residencyManager.Get(), &resourceAllocator));

ASSERT_TRUE(playbackContext.CreatedAllocatorsToID
Expand Down
28 changes: 14 additions & 14 deletions src/tests/end2end/D3D12ResidencyManagerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ TEST_F(D3D12ResidencyManagerTests, CreateDescriptorHeap) {

TEST_F(D3D12ResidencyManagerTests, CreateResidencyList) {
ComPtr<ResourceAllocator> resourceAllocator;
ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(),
&resourceAllocator, nullptr));
ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(),
&resourceAllocator, nullptr));

ALLOCATION_DESC allocationDesc = {};
allocationDesc.HeapType = D3D12_HEAP_TYPE_DEFAULT;
Expand Down Expand Up @@ -328,8 +328,8 @@ TEST_F(D3D12ResidencyManagerTests, CreateResidencyManager) {
{
ComPtr<ResidencyManager> residencyManager;
ComPtr<ResourceAllocator> resourceAllocator;
ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(),
&resourceAllocator, &residencyManager));
ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(
CreateBasicAllocatorDesc(), &resourceAllocator, &residencyManager));
EXPECT_NE(resourceAllocator, nullptr);
EXPECT_NE(residencyManager, nullptr);
}
Expand All @@ -341,7 +341,7 @@ TEST_F(D3D12ResidencyManagerTests, CreateResidencyManager) {
CreateBasicResidencyDesc(kDefaultBudget), &residencyManager));

ComPtr<ResourceAllocator> resourceAllocator;
ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(
ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(
CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator));
EXPECT_NE(resourceAllocator, nullptr);
EXPECT_NE(residencyManager, nullptr);
Expand All @@ -355,8 +355,8 @@ TEST_F(D3D12ResidencyManagerTests, CreateResidencyManagerNoLeak) {
{
ComPtr<ResidencyManager> residencyManager;
ComPtr<ResourceAllocator> resourceAllocator;
ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), &resourceAllocator,
&residencyManager);
ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(), &resourceAllocator,
&residencyManager);
}

// Create allocator with residency, seperately.
Expand All @@ -366,8 +366,8 @@ TEST_F(D3D12ResidencyManagerTests, CreateResidencyManagerNoLeak) {
&residencyManager);

ComPtr<ResourceAllocator> resourceAllocator;
ResourceAllocator::CreateAllocator(CreateBasicAllocatorDesc(), residencyManager.Get(),
&resourceAllocator);
ResourceAllocator::CreateResourceAllocator(CreateBasicAllocatorDesc(),
residencyManager.Get(), &resourceAllocator);
}

GPGMM_TEST_MEMORY_LEAK_END();
Expand All @@ -382,7 +382,7 @@ TEST_F(D3D12ResidencyManagerTests, OverBudget) {
ASSERT_SUCCEEDED(ResidencyManager::CreateResidencyManager(residencyDesc, &residencyManager));

ComPtr<ResourceAllocator> resourceAllocator;
ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(
ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(
CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator));

constexpr uint64_t kBufferMemorySize = GPGMM_MB_TO_BYTES(1);
Expand Down Expand Up @@ -440,7 +440,7 @@ TEST_F(D3D12ResidencyManagerTests, OverBudgetAsync) {
ASSERT_SUCCEEDED(ResidencyManager::CreateResidencyManager(residencyDesc, &residencyManager));

ComPtr<ResourceAllocator> resourceAllocator;
ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(
ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(
CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator));

constexpr uint64_t kBufferMemorySize = GPGMM_MB_TO_BYTES(1);
Expand Down Expand Up @@ -487,7 +487,7 @@ TEST_F(D3D12ResidencyManagerTests, OverBudgetDisablesGrowth) {
allocatorDesc.MemoryGrowthFactor = 2;

ComPtr<ResourceAllocator> resourceAllocator;
ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(
ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(
CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator));

std::vector<ComPtr<ResourceAllocation>> allocations = {};
Expand Down Expand Up @@ -528,7 +528,7 @@ TEST_F(D3D12ResidencyManagerTests, OverBudgetWithLockedHeaps) {
ASSERT_SUCCEEDED(ResidencyManager::CreateResidencyManager(residencyDesc, &residencyManager));

ComPtr<ResourceAllocator> resourceAllocator;
ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(
ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(
CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator));

constexpr uint64_t kBufferMemorySize = GPGMM_MB_TO_BYTES(1);
Expand Down Expand Up @@ -577,7 +577,7 @@ TEST_F(D3D12ResidencyManagerTests, ExecuteCommandListOverBudget) {
CreateBasicResidencyDesc(kDefaultBudget), &residencyManager));

ComPtr<ResourceAllocator> resourceAllocator;
ASSERT_SUCCEEDED(ResourceAllocator::CreateAllocator(
ASSERT_SUCCEEDED(ResourceAllocator::CreateResourceAllocator(
CreateBasicAllocatorDesc(), residencyManager.Get(), &resourceAllocator));

constexpr uint64_t kBufferMemorySize = GPGMM_MB_TO_BYTES(1);
Expand Down
Loading