Skip to content

Commit

Permalink
Clean-up Backend related struct names.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbernhar committed Jan 3, 2024
1 parent 0a5ae1b commit fb312e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions src/gpgmm/common/Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ namespace gpgmm {
// Forward declare common types.
class MemoryAllocationBase;

template <typename CommonType, typename BackendTrait>
struct CommonTrait;
template <typename CommonType, typename BackendTraits>
struct CommonTraits;

// Define common types.
template <typename BackendTrait>
struct CommonTrait<MemoryAllocationBase, BackendTrait> {
using CommonType = typename BackendTrait::AllocationType;
template <typename BackendTraits>
struct CommonTraits<MemoryAllocationBase, BackendTraits> {
using CommonType = typename BackendTraits::AllocationType;
};

// Convert common to backend type.

template <typename BackendTrait, typename CommonT>
typename CommonTrait<CommonT, BackendTrait>::CommonType* ToBackend(CommonT* common) {
return reinterpret_cast<typename CommonTrait<CommonT, BackendTrait>::CommonType*>(common);
template <typename BackendTraits, typename CommonT>
typename CommonTraits<CommonT, BackendTraits>::CommonType* ToBackend(CommonT* common) {
return reinterpret_cast<typename CommonTraits<CommonT, BackendTraits>::CommonType*>(common);
}

template <typename BackendTrait, typename CommonT>
const typename CommonTrait<CommonT, BackendTrait>::CommonType* ToBackend(
template <typename BackendTraits, typename CommonT>
const typename CommonTraits<CommonT, BackendTraits>::CommonType* ToBackend(
const CommonT* common) {
return reinterpret_cast<const typename CommonTrait<CommonT, BackendTrait>::CommonType*>(
return reinterpret_cast<const typename CommonTraits<CommonT, BackendTraits>::CommonType*>(
common);
}

Expand Down
6 changes: 3 additions & 3 deletions src/gpgmm/d3d12/BackendD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ namespace gpgmm::d3d12 {

class ResourceAllocation;

struct BackendTrait {
struct BackendTraits {
using AllocationType = ResourceAllocation;
};

template <typename T>
auto ToBackend(T&& common) -> decltype(gpgmm::ToBackend<BackendTrait>(common)) {
return gpgmm::ToBackend<BackendTrait>(common);
auto ToBackend(T&& common) -> decltype(gpgmm::ToBackend<BackendTraits>(common)) {
return gpgmm::ToBackend<BackendTraits>(common);
}

} // namespace gpgmm::d3d12
Expand Down

0 comments on commit fb312e6

Please sign in to comment.