Skip to content

Commit 5e0983e

Browse files
committed
Clean-up CheckFeatureSupport.
* Renames ALLOCATOR_FEATURE to FEATURE * Adds documentation to FEATURE_RESOURCE_SUBALLOCATION_SUPPORT constant.
1 parent 62c93b4 commit 5e0983e

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,12 +1242,12 @@ namespace gpgmm::d3d12 {
12421242
return mResidencyManager != nullptr && !mIsAlwaysInBudget;
12431243
}
12441244

1245-
HRESULT ResourceAllocator::CheckFeatureSupport(ALLOCATOR_FEATURE feature,
1245+
HRESULT ResourceAllocator::CheckFeatureSupport(FEATURE feature,
12461246
void* pFeatureSupportData,
1247-
uint32_t featureSupportDataSize) {
1247+
uint32_t featureSupportDataSize) const {
12481248
switch (feature) {
1249-
case RESOURCE_ALLOCATOR_FEATURE_SUBALLOCATION_SUPPORT: {
1250-
ALLOCATOR_FEATURE_DATA_SUBALLOCATION_SUPPORT data = {};
1249+
case FEATURE_RESOURCE_SUBALLOCATION_SUPPORT: {
1250+
FEATURE_DATA_RESOURCE_SUBALLOCATION_SUPPORT data = {};
12511251
if (featureSupportDataSize != sizeof(data)) {
12521252
return E_INVALIDARG;
12531253
}

src/gpgmm/d3d12/ResourceAllocatorD3D12.h

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -354,26 +354,33 @@ namespace gpgmm::d3d12 {
354354
std::string DebugName;
355355
};
356356

357-
/** \struct ALLOCATOR_FEATURE_DATA_SUBALLOCATION_SUPPORT
357+
/** \struct FEATURE_DATA_RESOURCE_SUBALLOCATION_SUPPORT
358358
359359
Details the resource allocator limitations, including if sharing resources between command
360360
queues is coherent.
361361
*/
362-
struct ALLOCATOR_FEATURE_DATA_SUBALLOCATION_SUPPORT {
362+
struct FEATURE_DATA_RESOURCE_SUBALLOCATION_SUPPORT {
363363
/** \brief Describes multi-queue resource access behavior.
364364
365365
For example, if two allocations belong to the same resource where each allocation is
366366
referenced with a different command-queue, will accessing one stomp over the other. D3D12
367-
does not guarentee such behavior is safe but it is defined per GPU vendor.
367+
does not guarentee such behavior is safe but is it well-defined behavior based on the GPU
368+
vendor.
368369
*/
369370
bool IsResourceAccessAlwaysCoherent;
370371
};
371372

372-
/** \enum ALLOCATOR_FEATURE
373-
Additional capabilities featured by resource allocators.
373+
/** \enum FEATURE
374+
375+
Defines constants that specify a resource allocator feature to query about. When you
376+
want to query for the level to which an allocator supports a feature, pass one of these values
377+
to ResourceAllocator::CheckFeatureSupport.
374378
*/
375-
enum ALLOCATOR_FEATURE {
376-
RESOURCE_ALLOCATOR_FEATURE_SUBALLOCATION_SUPPORT,
379+
enum FEATURE {
380+
/** \brief Indicates a query for the level of support for sub-allocated resources. The
381+
corresponding data structure for this value is FEATURE_DATA_RESOURCE_SUBALLOCATION_SUPPORT
382+
*/
383+
FEATURE_RESOURCE_SUBALLOCATION_SUPPORT,
377384
};
378385

379386
using RESOURCE_ALLOCATOR_INFO = MemoryAllocatorInfo;
@@ -507,21 +514,21 @@ namespace gpgmm::d3d12 {
507514

508515
/** \brief Gets information about the features that are supported by the resource allocator.
509516
510-
@param feature A constant from the ALLOCATOR_FEATURE enumeration describing the feature(s)
517+
@param feature A constant from the FEATURE enumeration describing the feature(s)
511518
that you want to query for support.
512519
@param pFeatureSupportData A pointer to the data structure that corresponds to the value of
513520
the feature parameter. To determine the corresponding data structure for each constant, see
514-
ALLOCATOR_FEATURE.
521+
FEATURE.
515522
@param featureSupportDataSize The sie of the structure pointed by the pFeatureSupportData
516523
parameter.
517524
518525
\return Returns S_OK if successful. Returns E_INVALIDARG if unsupported data type is passed
519526
to pFeatureSupportData or if a size mismatch is detected for the featureSupportDataSize
520527
parameter.
521528
*/
522-
HRESULT CheckFeatureSupport(ALLOCATOR_FEATURE feature,
529+
HRESULT CheckFeatureSupport(FEATURE feature,
523530
void* pFeatureSupportData,
524-
uint32_t featureSupportDataSize);
531+
uint32_t featureSupportDataSize) const;
525532

526533
private:
527534
friend BufferAllocator;

src/tests/end2end/D3D12ResourceAllocatorTests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,20 +1387,20 @@ TEST_F(D3D12ResourceAllocatorTests, CheckFeatureSupport) {
13871387
uint64_t bigItem;
13881388
} WrongData = {};
13891389

1390-
ASSERT_FAILED(resourceAllocator->CheckFeatureSupport(
1391-
RESOURCE_ALLOCATOR_FEATURE_SUBALLOCATION_SUPPORT, &WrongData, sizeof(WrongData)));
1390+
ASSERT_FAILED(resourceAllocator->CheckFeatureSupport(FEATURE_RESOURCE_SUBALLOCATION_SUPPORT,
1391+
&WrongData, sizeof(WrongData)));
13921392
}
13931393

13941394
// Request information with no data.
13951395
{
1396-
ASSERT_FAILED(resourceAllocator->CheckFeatureSupport(
1397-
RESOURCE_ALLOCATOR_FEATURE_SUBALLOCATION_SUPPORT, nullptr, 0));
1396+
ASSERT_FAILED(resourceAllocator->CheckFeatureSupport(FEATURE_RESOURCE_SUBALLOCATION_SUPPORT,
1397+
nullptr, 0));
13981398
}
13991399

14001400
// Request information with valid data size.
14011401
{
1402-
ALLOCATOR_FEATURE_DATA_SUBALLOCATION_SUPPORT data = {};
1402+
FEATURE_DATA_RESOURCE_SUBALLOCATION_SUPPORT data = {};
14031403
ASSERT_SUCCEEDED(resourceAllocator->CheckFeatureSupport(
1404-
RESOURCE_ALLOCATOR_FEATURE_SUBALLOCATION_SUPPORT, &data, sizeof(data)));
1404+
FEATURE_RESOURCE_SUBALLOCATION_SUPPORT, &data, sizeof(data)));
14051405
}
14061406
}

0 commit comments

Comments
 (0)