Skip to content

Commit 9a50c4d

Browse files
author
devsh
committed
update DXC to our "fixed" version, also make sure everyone is using NBL_REF_ARG religiously
1 parent 105a553 commit 9a50c4d

File tree

7 files changed

+20
-21
lines changed

7 files changed

+20
-21
lines changed

3rdparty/dxc/dxc

Submodule dxc updated 104 files

include/nbl/builtin/hlsl/algorithm.hlsl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct bound_t
113113
}
114114

115115

116-
uint operator()(inout Accessor accessor)
116+
uint operator()(NBL_REF_ARG(Accessor) accessor)
117117
{
118118
if (isNPoT(len))
119119
{
@@ -132,19 +132,19 @@ struct bound_t
132132
return it;
133133
}
134134

135-
void iteration(inout Accessor accessor)
135+
void iteration(NBL_REF_ARG(Accessor) accessor)
136136
{
137137
len >>= 1;
138138
const uint mid = it+len;
139139
comp_step(accessor,mid);
140140
}
141141

142-
void comp_step(inout Accessor accessor, const uint testPoint, const uint rightBegin)
142+
void comp_step(NBL_REF_ARG(Accessor) accessor, const uint testPoint, const uint rightBegin)
143143
{
144144
if (comp(accessor[testPoint],value))
145145
it = rightBegin;
146146
}
147-
void comp_step(inout Accessor accessor, const uint testPoint)
147+
void comp_step(NBL_REF_ARG(Accessor) accessor, const uint testPoint)
148148
{
149149
comp_step(accessor,testPoint,testPoint);
150150
}
@@ -170,14 +170,14 @@ struct lower_to_upper_comparator_transform_t
170170

171171

172172
template<class Accessor, class Comparator>
173-
uint lower_bound(inout Accessor accessor, const uint begin, const uint end, const typename Accessor::value_type value, const Comparator comp)
173+
uint lower_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const typename Accessor::value_type value, const Comparator comp)
174174
{
175175
impl::bound_t<Accessor,Comparator> implementation = impl::bound_t<Accessor,Comparator>::setup(begin,end,value,comp);
176176
return implementation(accessor);
177177
}
178178

179179
template<class Accessor, class Comparator>
180-
uint upper_bound(inout Accessor accessor, const uint begin, const uint end, const typename Accessor::value_type value, const Comparator comp)
180+
uint upper_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const typename Accessor::value_type value, const Comparator comp)
181181
{
182182
//using TransformedComparator = impl::lower_to_upper_comparator_transform_t<Accessor,Comparator>;
183183
//TransformedComparator transformedComparator;
@@ -193,7 +193,7 @@ namespace impl
193193

194194
// extra indirection due to https://github.com/microsoft/DirectXShaderCompiler/issues/4771
195195
template<class Accessor, typename T>
196-
uint lower_bound(inout Accessor accessor, const uint begin, const uint end, const T value)
196+
uint lower_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const T value)
197197
{
198198
//using Comparator = nbl::hlsl::less<T>;
199199
//Comparator comp;
@@ -202,7 +202,7 @@ uint lower_bound(inout Accessor accessor, const uint begin, const uint end, cons
202202
return nbl::hlsl::lower_bound<Accessor, nbl::hlsl::less<T> >(accessor,begin,end,value,comp);
203203
}
204204
template<class Accessor, typename T>
205-
uint upper_bound(inout Accessor accessor, const uint begin, const uint end, const T value)
205+
uint upper_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const T value)
206206
{
207207
//using Comparator = nbl::hlsl::less<T>;
208208
//Comparator comp;
@@ -214,12 +214,12 @@ uint upper_bound(inout Accessor accessor, const uint begin, const uint end, cons
214214
}
215215

216216
template<class Accessor>
217-
uint lower_bound(inout Accessor accessor, const uint begin, const uint end, const typename Accessor::value_type value)
217+
uint lower_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const typename Accessor::value_type value)
218218
{
219219
return impl::lower_bound<Accessor,typename Accessor::value_type>(accessor,begin,end,value);
220220
}
221221
template<class Accessor>
222-
uint upper_bound(inout Accessor accessor, const uint begin, const uint end, const typename Accessor::value_type value)
222+
uint upper_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint end, const typename Accessor::value_type value)
223223
{
224224
return impl::upper_bound<Accessor,typename Accessor::value_type>(accessor,begin,end,value);
225225
}

include/nbl/builtin/hlsl/bit.hlsl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ enable_if_t<sizeof(T)==sizeof(U)&&(is_scalar_v<T>||is_vector_v<T>)==(is_scalar_v
3737
{
3838
return spirv::bitcast<T,U>(val);
3939
}
40-
// unfortunately its impossible to deduce Storage Class right now,
41-
// also this function will only work as long as `inout` behaves as `__restrict &` in DXC
40+
// unfortunately its impossible to deduce Storage Class right now
4241
template<class T, class U, uint32_t StorageClass>
43-
enable_if_t<sizeof(T)==sizeof(U),T> bit_cast(inout U val)
42+
enable_if_t<sizeof(T)==sizeof(U),T> bit_cast(NBL_REF_ARG(U) val)
4443
{
4544
using ptr_u_t = spirv::pointer_t<U,StorageClass>;
4645
// get the address of U

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace workgroup
1313
namespace fft
1414
{
1515
// The SharedMemoryAccessor MUST provide the following methods:
16-
// * void get(uint32_t index, inout uint32_t value);
16+
// * void get(uint32_t index, NBL_REF_ARG(uint32_t) value);
1717
// * void set(uint32_t index, in uint32_t value);
1818
// * void workgroupExecutionAndMemoryBarrier();
1919

@@ -39,7 +39,7 @@ NBL_CONCEPT_END(
3939

4040

4141
// The Accessor (for a small FFT) MUST provide the following methods:
42-
// * void get(uint32_t index, inout complex_t<Scalar> value);
42+
// * void get(uint32_t index, NBL_REF_ARG(complex_t<Scalar>) value);
4343
// * void set(uint32_t index, in complex_t<Scalar> value);
4444

4545
#define NBL_CONCEPT_NAME FFTAccessor

include/nbl/builtin/hlsl/cpp_compat/basic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ struct add_pointer
9595
}
9696
}
9797

98-
#define NBL_REF_ARG(...) inout __VA_ARGS__
98+
#define NBL_REF_ARG(...) [[vk::ext_reference]] inout __VA_ARGS__
9999
#define NBL_CONST_REF_ARG(...) const in __VA_ARGS__
100100

101101
#endif

include/nbl/builtin/hlsl/scanning_append.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct result_t
2828
// Elements with value 0 do not get appended
2929
// Note: If NBL_GLSL_EXT_shader_atomic_int64 is not present, then the call to these functions needs to be subgroup uniform
3030
template<class AtomicCounterAccessor>
31-
result_t non_negative(inout AtomicCounterAccessor accessor, in uint value)
31+
result_t non_negative(NBL_REF_ARG(AtomicCounterAccessor) accessor, in uint value)
3232
{
3333
const bool willAppend = bool(value);
3434

@@ -70,7 +70,7 @@ result_t non_negative(inout AtomicCounterAccessor accessor, in uint value)
7070

7171
// optimized version which tries to omit the atomicAdd and locks if it can, in return it may return garbage/invalid value when invocation's `value==0`
7272
template<class AtomicCounterAccessor>
73-
result_t positive(inout AtomicCounterAccessor accessor, in uint value)
73+
result_t positive(NBL_REF_ARG(AtomicCounterAccessor) accessor, in uint value)
7474
{
7575
const bool willAppend = bool(value);
7676
#ifdef NBL_GLSL_EXT_shader_atomic_int64

include/nbl/builtin/hlsl/workgroup/fft.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ struct FFT;
295295
// If `ConstevalParameters::ElementsPerInvocationLog2 == 1`, the arrays it accesses with `get` and `set` can optionally be different,
296296
// if you don't want the FFT to be done in-place. Otherwise, you MUST make it in-place.
297297
// The Accessor MUST provide the following methods:
298-
// * void get(uint32_t index, inout complex_t<Scalar> value);
298+
// * void get(uint32_t index, NBL_REF_ARG(complex_t<Scalar>) value);
299299
// * void set(uint32_t index, in complex_t<Scalar> value);
300300
// * void memoryBarrier();
301301
// For it to work correctly, this memory barrier must use `AcquireRelease` semantics, with the proper flags set for the memory type.
@@ -304,7 +304,7 @@ struct FFT;
304304

305305
// - SharedMemoryAccessor accesses a workgroup-shared memory array of size `WorkgroupSize` elements of type complex_t<Scalar>.
306306
// The SharedMemoryAccessor MUST provide the following methods:
307-
// * void get(uint32_t index, inout uint32_t value);
307+
// * void get(uint32_t index, NBL_REF_ARG(uint32_t) value);
308308
// * void set(uint32_t index, in uint32_t value);
309309
// * void workgroupExecutionAndMemoryBarrier();
310310

0 commit comments

Comments
 (0)