Skip to content

Commit 33d9388

Browse files
committed
Refactored accessor usage
1 parent 28f3ea5 commit 33d9388

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

10_CountingSort/app_resources/prefix_sum_shader.comp.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ groupshared uint32_t sdata[BucketCount];
1111

1212
struct SharedAccessor
1313
{
14-
uint32_t get(const uint32_t index)
14+
void get(const uint32_t index, NBL_REF_ARG(uint32_t) value)
1515
{
16-
return sdata[index];
16+
value = sdata[index];
1717
}
1818

1919
void set(const uint32_t index, const uint32_t value)
@@ -46,7 +46,7 @@ void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
4646
params.minimum = pushData.minimum;
4747
params.maximum = pushData.maximum;
4848

49-
using Counter = nbl::hlsl::sort::counting < WorkgroupSize, BucketCount, PtrAccessor, PtrAccessor, PtrAccessor, SharedAccessor>;
49+
using Counter = nbl::hlsl::sort::counting < WorkgroupSize, BucketCount, PtrAccessor, PtrAccessor, PtrAccessor, SharedAccessor, PtrAccessor::type_t>;
5050
Counter counter = Counter::create(nbl::hlsl::glsl::gl_WorkGroupID().x);
5151

5252
const Ptr input_ptr = Ptr::create(pushData.inputKeyAddress);

10_CountingSort/app_resources/scatter_shader.comp.hlsl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ groupshared uint32_t sdata[BucketCount];
1111

1212
struct SharedAccessor
1313
{
14-
uint32_t get(const uint32_t index)
14+
void get(const uint32_t index, NBL_REF_ARG(uint32_t) value)
1515
{
16-
return sdata[index];
16+
value = sdata[index];
1717
}
1818

1919
void set(const uint32_t index, const uint32_t value)
@@ -34,6 +34,7 @@ struct SharedAccessor
3434

3535
struct DoublePtrAccessor
3636
{
37+
using type_t = uint32_t;
3738
static DoublePtrAccessor create(const PtrAccessor input, const PtrAccessor output)
3839
{
3940
DoublePtrAccessor accessor;
@@ -42,9 +43,9 @@ struct DoublePtrAccessor
4243
return accessor;
4344
}
4445

45-
uint32_t get(const uint64_t index)
46+
void get(const uint64_t index, NBL_REF_ARG(uint32_t) value)
4647
{
47-
return input.get(index);
48+
input.get(index, value);
4849
}
4950

5051
void set(const uint64_t index, const uint32_t value)
@@ -69,7 +70,7 @@ void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
6970
params.minimum = pushData.minimum;
7071
params.maximum = pushData.maximum;
7172

72-
using Counter = nbl::hlsl::sort::counting < WorkgroupSize, BucketCount, DoublePtrAccessor, DoublePtrAccessor, PtrAccessor, SharedAccessor>;
73+
using Counter = nbl::hlsl::sort::counting < WorkgroupSize, BucketCount, DoublePtrAccessor, DoublePtrAccessor, PtrAccessor, SharedAccessor, DoublePtrAccessor::type_t>;
7374
Counter counter = Counter::create(nbl::hlsl::glsl::gl_WorkGroupID().x);
7475

7576
const Ptr input_key_ptr = Ptr::create(pushData.inputKeyAddress);

23_ArithmeticUnitTest/app_resources/testWorkgroup.comp.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ groupshared uint32_t scratch[ScratchSz];
1717
template<uint16_t offset>
1818
struct ScratchProxy
1919
{
20-
uint32_t get(const uint32_t ix)
20+
void get(const uint32_t ix, NBL_REF_ARG(uint32_t) value)
2121
{
22-
return scratch[ix+offset];
22+
value = scratch[ix+offset];
2323
}
2424
void set(const uint32_t ix, const uint32_t value)
2525
{

0 commit comments

Comments
 (0)