Skip to content

Commit e193903

Browse files
committed
Merge branch 'master' into maths_for_bxdfs_hlsl
2 parents 37a8b7b + 62b4be3 commit e193903

File tree

22 files changed

+219
-133
lines changed

22 files changed

+219
-133
lines changed

3rdparty/dxc/dxc

Submodule dxc updated 162 files

include/nbl/asset/IRenderpass.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ class NBL_API2 IRenderpass
165165
{
166166
enum RESOLVE_MODE : uint8_t
167167
{
168-
NONE = nbl::hlsl::ResolveModeFlags::NONE,
169-
SAMPLE_ZERO_BIT = nbl::hlsl::ResolveModeFlags::SAMPLE_ZERO_BIT,
170-
AVERAGE_BIT = nbl::hlsl::ResolveModeFlags::AVERAGE_BIT,
171-
MIN_BIT = nbl::hlsl::ResolveModeFlags::MIN_BIT,
172-
MAX_BIT = nbl::hlsl::ResolveModeFlags::MAX_BIT
168+
NONE = hlsl::ResolveModeFlags::NONE,
169+
SAMPLE_ZERO_BIT = hlsl::ResolveModeFlags::SAMPLE_ZERO_BIT,
170+
AVERAGE_BIT = hlsl::ResolveModeFlags::AVERAGE_BIT,
171+
MIN_BIT = hlsl::ResolveModeFlags::MIN_BIT,
172+
MAX_BIT = hlsl::ResolveModeFlags::MAX_BIT
173173
};
174174
struct ResolveMode
175175
{

include/nbl/asset/utils/CHLSLCompiler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ class NBL_API2 CHLSLCompiler final : public IShaderCompiler
146146
L"-Wno-c++1z-extensions",
147147
L"-Wno-c++14-extensions",
148148
L"-Wno-gnu-static-float-init",
149-
L"-fspv-target-env=vulkan1.3",
150149
L"-HV", L"202x"
151150
});
152151
};

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/bda/__ref.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace hlsl
1313
namespace bda
1414
{
1515
template<typename T>
16-
using __spv_ptr_t = spirv::pointer_t<spv::StorageClassPhysicalStorageBuffer,T>;
16+
using __spv_ptr_t __NBL_CAPABILITY_PhysicalStorageBufferAddresses = spirv::pointer_t<spv::StorageClassPhysicalStorageBuffer,T>;
1717

1818
template<typename T>
1919
struct __ptr;

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/enums.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ enum SwapchainMode : uint16_t {
9393
NBL_ENUM_ADD_BITWISE_OPERATORS(ShaderStage)
9494
NBL_ENUM_ADD_BITWISE_OPERATORS(SampleCountFlags)
9595
NBL_ENUM_ADD_BITWISE_OPERATORS(ResolveModeFlags)
96-
NBL_ENUM_ADD_BITWISE_OPERATORS(SpirvVersion)
96+
NBL_ENUM_ADD_BITWISE_OPERATORS(SpirvVersion) // erm do we want this?
9797
NBL_ENUM_ADD_BITWISE_OPERATORS(PointClippingBehavior)
9898
NBL_ENUM_ADD_BITWISE_OPERATORS(SwapchainMode)
9999
#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

0 commit comments

Comments
 (0)