Skip to content

Commit c0dfc1e

Browse files
committed
more refactor for accessor concept changes
1 parent 00787bf commit c0dfc1e

File tree

3 files changed

+59
-75
lines changed

3 files changed

+59
-75
lines changed

include/nbl/builtin/hlsl/concepts/accessors/workgroup_arithmetic.hlsl

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,11 @@ namespace hlsl
1010
namespace workgroup2
1111
{
1212

13-
template<typename T, typename V, typename I>
13+
template<typename T, typename V, typename I=uint32_t>
1414
NBL_BOOL_CONCEPT ArithmeticSharedMemoryAccessor = concepts::accessors::GenericSharedMemoryAccessor<T,V,I>;
1515

16-
#define NBL_CONCEPT_NAME ArithmeticReadOnlyDataAccessor
17-
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)
18-
#define NBL_CONCEPT_TPLT_PRM_NAMES (T)(V)
19-
#define NBL_CONCEPT_PARAM_0 (accessor, T)
20-
#define NBL_CONCEPT_PARAM_1 (index, uint32_t)
21-
#define NBL_CONCEPT_PARAM_2 (val, V)
22-
NBL_CONCEPT_BEGIN(3)
23-
#define accessor NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0
24-
#define index NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1
25-
#define val NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_2
26-
NBL_CONCEPT_END(
27-
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((accessor.template get<V>(index, val)), is_same_v, void))
28-
);
29-
#undef val
30-
#undef index
31-
#undef accessor
32-
#include <nbl/builtin/hlsl/concepts/__end.hlsl>
16+
template<typename T, typename V, typename I=uint32_t>
17+
NBL_BOOL_CONCEPT ArithmeticReadOnlyDataAccessor = concepts::accessors::GenericReadAccessor<T,V,I>;
3318

3419
template<typename T, typename V, typename I=uint32_t>
3520
NBL_BOOL_CONCEPT ArithmeticDataAccessor = concepts::accessors::GenericDataAccessor<T,V,I>;

include/nbl/builtin/hlsl/workgroup2/arithmetic_config.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ struct ArithmeticConfiguration
6666
return glsl::gl_SubgroupInvocationID()==SubgroupSize-1;
6767
}
6868

69-
static uint32_t virtualSubgroupID(const uint32_t subgroupID, const uint32_t virtualIdx)
69+
static uint32_t virtualSubgroupID(const uint32_t subgroupID, const uint32_t workgroupInVirtualIndex)
7070
{
71-
return virtualIdx * (WorkgroupSize >> SubgroupSizeLog2) + subgroupID;
71+
return workgroupInVirtualIndex * (WorkgroupSize >> SubgroupSizeLog2) + subgroupID;
7272
}
7373

74-
static uint32_t sharedCoalescedIndexNextLevel(const uint32_t subgroupID, const uint32_t itemsPerInvocation)
74+
static uint32_t sharedStoreIndex(const uint32_t subgroupID, const uint32_t itemsPerInvocation)
7575
{
7676
return (subgroupID & (itemsPerInvocation-1)) * SubgroupSize + (subgroupID/itemsPerInvocation);
7777
}
7878

79-
static uint32_t sharedCoalescedIndexByComponent(const uint32_t invocationIndex, const uint32_t component)
79+
static uint32_t sharedLoadIndex(const uint32_t invocationIndex, const uint32_t component)
8080
{
8181
return component * SubgroupSize + invocationIndex;
8282
}

0 commit comments

Comments
 (0)