Skip to content

Commit 798939a

Browse files
fix header bugs and update submodule
1 parent 89099f7 commit 798939a

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

include/nbl/builtin/hlsl/limits.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ struct num_traits : num_base<T>
194194
{
195195
// have to be weird like that to avoid a warning
196196
NBL_CONSTEXPR_STATIC_INLINE T min = T(num_base<T>::is_signed)<<(num_base<T>::is_signed ? num_base<T>::digits:0);
197-
NBL_CONSTEXPR_STATIC_INLINE T max = ~(T(num_base<T>::is_signed)<<num_base<T>::digits);
197+
NBL_CONSTEXPR_STATIC_INLINE T max = ~min;
198198
NBL_CONSTEXPR_STATIC_INLINE T denorm_min = T(0);
199199
NBL_CONSTEXPR_STATIC_INLINE T quiet_NaN = T(0);
200200
NBL_CONSTEXPR_STATIC_INLINE T signaling_NaN = T(0);

include/nbl/builtin/hlsl/workgroup/ballot.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ uint16_t BallotDWORDCount(const uint16_t itemCount)
5050
template<class Accessor>
5151
void ballot(const bool value, NBL_REF_ARG(Accessor) accessor)
5252
{
53-
const uint32_t index = SubgroupContiguousIndex();
54-
const bool initialize = index<BallotDWORDCount(Volume());
53+
const uint16_t index = SubgroupContiguousIndex();
54+
const bool initialize = index<impl::BallotDWORDCount(Volume());
5555
if (initialize)
5656
accessor.set(index,0u);
5757

@@ -64,7 +64,7 @@ void ballot(const bool value, NBL_REF_ARG(Accessor) accessor)
6464
}
6565

6666
template<class Accessor>
67-
bool ballotBitExtract(const uint32_t index, NBL_REF_ARG(Accessor) accessor)
67+
bool ballotBitExtract(const uint16_t index, NBL_REF_ARG(Accessor) accessor)
6868
{
6969
return bool(accessor.get(impl::getDWORD(index))&(1u<<(index&31u)));
7070
}

include/nbl/builtin/hlsl/workgroup/basic.hlsl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ namespace workgroup
1717
static const uint32_t MaxWorkgroupSizeLog2 = 11;
1818
static const uint32_t MaxWorkgroupSize = 0x1u<<MaxWorkgroupSizeLog2;
1919

20-
uint32_t Volume()
20+
uint16_t Volume()
2121
{
22-
const uint32_t3 dims = glsl::gl_WorkGroupSize();
22+
const uint16_t3 dims = uint16_t3(glsl::gl_WorkGroupSize());
2323
return dims.x*dims.y*dims.z;
2424
}
2525

26-
uint32_t SubgroupContiguousIndex()
26+
uint16_t SubgroupContiguousIndex()
2727
{
28-
return glsl::gl_SubgroupID()*glsl::gl_SubgroupSize()+glsl::gl_SubgroupInvocationID();
28+
return uint16_t(glsl::gl_SubgroupID()*glsl::gl_SubgroupSize()+glsl::gl_SubgroupInvocationID());
2929
}
3030

3131
bool Elect()
3232
{
3333
return glsl::gl_SubgroupID()==0 && glsl::gl_SubgroupInvocationID()==0;
3434
}
3535

36-
uint32_t ElectedSubgroupContiguousIndex()
36+
uint16_t ElectedSubgroupContiguousIndex()
3737
{
38-
return glsl::subgroupBroadcastFirst<uint32_t>(SubgroupContiguousIndex());
38+
return glsl::subgroupBroadcastFirst<uint16_t>(SubgroupContiguousIndex());
3939
}
4040

4141
}

include/nbl/builtin/hlsl/workgroup/scratch_size.hlsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77

88
#include "nbl/builtin/hlsl/type_traits.hlsl"
9+
#include "nbl/builtin/hlsl/subgroup/basic.hlsl"
910

1011

1112
namespace nbl
@@ -37,7 +38,7 @@ struct scratch_size_ballot
3738
};
3839

3940
// you're only writing one element
40-
NBL_CONSTEXPR_STATIC scratch_size_broadcast = 1u;
41+
NBL_CONSTEXPR uint32_t scratch_size_broadcast = 1u;
4142

4243
// if you know better you can use the actual subgroup size
4344
template<uint16_t ContiguousItemCount, uint16_t SubgroupSize=subgroup::MinSubgroupSize>

0 commit comments

Comments
 (0)