|
1 |
| -//// Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O. |
| 1 | +//// Copyright (C) 2023-2024 - DevSH Graphics Programming Sp. z O.O. |
2 | 2 | //// This file is part of the "Nabla Engine".
|
3 | 3 | //// For conditions of distribution and use, see copyright notice in nabla.h
|
| 4 | +#include "app_resources/common.hlsl" |
4 | 5 |
|
5 |
| -#define STATIC_ASSERT(...) { nbl::hlsl::conditional<__VA_ARGS__, int, void>::type a = 0; } |
6 |
| - |
7 |
| -#define IS_SAME(L,R) nbl::hlsl::is_same<L,R>::value |
8 | 6 | #define SHADER_CRASHING_ASSERT(expr) \
|
9 | 7 | { \
|
10 | 8 | bool con = (expr); \
|
|
14 | 12 | } while(!con); \
|
15 | 13 | }
|
16 | 14 |
|
17 |
| -// tcpp dies, we need to fix first! |
18 |
| -//#include <boost/preprocessor.hpp> |
19 |
| - |
20 |
| - |
21 |
| -#include <nbl/builtin/hlsl/cpp_compat.hlsl> |
22 |
| -#include <nbl/builtin/hlsl/type_traits.hlsl> |
23 |
| - |
24 |
| -#include <nbl/builtin/hlsl/cpp_compat/matrix.hlsl> |
25 |
| -#include <nbl/builtin/hlsl/cpp_compat/vector.hlsl> |
26 |
| - |
27 |
| -#include <nbl/builtin/hlsl/colorspace/encodeCIEXYZ.hlsl> |
28 |
| -#include <nbl/builtin/hlsl/colorspace/decodeCIEXYZ.hlsl> |
29 |
| -#include <nbl/builtin/hlsl/colorspace/EOTF.hlsl> |
30 |
| -#include <nbl/builtin/hlsl/colorspace/OETF.hlsl> |
31 |
| - |
32 |
| -#include <nbl/builtin/hlsl/random/xoroshiro.hlsl> |
33 |
| - |
34 |
| -#include <nbl/builtin/hlsl/mpl.hlsl> |
35 |
| -#include <nbl/builtin/hlsl/bit.hlsl> |
36 |
| - |
37 |
| -#include <nbl/builtin/hlsl/limits.hlsl> |
| 15 | +template<typename L, typename R> |
| 16 | +const static bool is_same_v = nbl::hlsl::is_same_v<L,R>; |
38 | 17 |
|
39 |
| -#include <nbl/builtin/hlsl/member_test_macros.hlsl> |
40 |
| -#include <nbl/builtin/hlsl/device_capabilities_traits.hlsl> |
41 | 18 |
|
42 | 19 | struct PushConstants
|
43 | 20 | {
|
@@ -241,32 +218,32 @@ void main(uint3 invocationID : SV_DispatchThreadID)
|
241 | 218 | float4 v;
|
242 | 219 | const volatile float4 u;
|
243 | 220 |
|
244 |
| - STATIC_ASSERT(IS_SAME(decltype(v.x), nbl::hlsl::impl::add_lvalue_reference<decltype(v.x)>::type)); |
| 221 | + STATIC_ASSERT(is_same_v<decltype(v.x), nbl::hlsl::impl::add_lvalue_reference<decltype(v.x)>::type>); |
245 | 222 | STATIC_ASSERT(nbl::hlsl::impl::is_reference<decltype(v.x)>::value);
|
246 |
| - STATIC_ASSERT(IS_SAME(float,nbl::hlsl::impl::remove_reference<decltype(v.x)>::type)); |
247 |
| - STATIC_ASSERT(IS_SAME(decltype(v.x),nbl::hlsl::impl::add_lvalue_reference<float>::type)); |
248 |
| - STATIC_ASSERT(IS_SAME(decltype(v.x),nbl::hlsl::impl::add_lvalue_reference<nbl::hlsl::impl::remove_reference<decltype(v.x)>::type>::type)); |
| 223 | + STATIC_ASSERT(is_same_v<float,nbl::hlsl::impl::remove_reference<decltype(v.x)>::type>); |
| 224 | + STATIC_ASSERT(is_same_v<decltype(v.x),nbl::hlsl::impl::add_lvalue_reference<float>::type>); |
| 225 | + STATIC_ASSERT(is_same_v<decltype(v.x),nbl::hlsl::impl::add_lvalue_reference<nbl::hlsl::impl::remove_reference<decltype(v.x)>::type>::type>); |
249 | 226 |
|
250 |
| - STATIC_ASSERT(IS_SAME(float,nbl::hlsl::remove_cvref<decltype(v.x)>::type)); |
251 |
| - STATIC_ASSERT(IS_SAME(nbl::hlsl::remove_cv<decltype(v.x)>::type,nbl::hlsl::impl::add_lvalue_reference<float>::type)); |
252 |
| - STATIC_ASSERT(IS_SAME(nbl::hlsl::remove_cv<decltype(v.x)>::type,nbl::hlsl::impl::add_lvalue_reference<nbl::hlsl::remove_cvref<decltype(v.x)>::type>::type)); |
| 227 | + STATIC_ASSERT(is_same_v<float,nbl::hlsl::remove_cvref<decltype(v.x)>::type>); |
| 228 | + STATIC_ASSERT(is_same_v<nbl::hlsl::remove_cv<decltype(v.x)>::type,nbl::hlsl::impl::add_lvalue_reference<float>::type>); |
| 229 | + STATIC_ASSERT(is_same_v<nbl::hlsl::remove_cv<decltype(v.x)>::type,nbl::hlsl::impl::add_lvalue_reference<nbl::hlsl::remove_cvref<decltype(v.x)>::type>::type>); |
253 | 230 | }
|
254 | 231 | fill(invocationID, 7);
|
255 | 232 | {
|
256 | 233 | float x[4][4];
|
257 |
| - STATIC_ASSERT(IS_SAME(nbl::hlsl::remove_extent<decltype(x)>::type, float[4])); |
258 |
| - STATIC_ASSERT(IS_SAME(nbl::hlsl::remove_all_extents<decltype(x)>::type, float)); |
| 234 | + STATIC_ASSERT(is_same_v<nbl::hlsl::remove_extent<decltype(x)>::type, float[4]>); |
| 235 | + STATIC_ASSERT(is_same_v<nbl::hlsl::remove_all_extents<decltype(x)>::type, float>); |
259 | 236 | }
|
260 | 237 | fill(invocationID, 8);
|
261 | 238 | {
|
262 |
| - STATIC_ASSERT(IS_SAME(nbl::hlsl::make_signed<int16_t>::type, nbl::hlsl::make_signed<uint16_t>::type)); |
263 |
| - STATIC_ASSERT(IS_SAME(nbl::hlsl::make_unsigned<int16_t>::type, nbl::hlsl::make_unsigned<uint16_t>::type)); |
| 239 | + STATIC_ASSERT(is_same_v<nbl::hlsl::make_signed<int16_t>::type, nbl::hlsl::make_signed<uint16_t>::type>); |
| 240 | + STATIC_ASSERT(is_same_v<nbl::hlsl::make_unsigned<int16_t>::type, nbl::hlsl::make_unsigned<uint16_t>::type>); |
264 | 241 |
|
265 |
| - STATIC_ASSERT(IS_SAME(nbl::hlsl::make_signed<int32_t>::type, nbl::hlsl::make_signed<uint32_t>::type)); |
266 |
| - STATIC_ASSERT(IS_SAME(nbl::hlsl::make_unsigned<int32_t>::type, nbl::hlsl::make_unsigned<uint32_t>::type)); |
| 242 | + STATIC_ASSERT(is_same_v<nbl::hlsl::make_signed<int32_t>::type, nbl::hlsl::make_signed<uint32_t>::type>); |
| 243 | + STATIC_ASSERT(is_same_v<nbl::hlsl::make_unsigned<int32_t>::type, nbl::hlsl::make_unsigned<uint32_t>::type>); |
267 | 244 |
|
268 |
| - STATIC_ASSERT(IS_SAME(nbl::hlsl::make_signed<int64_t>::type, nbl::hlsl::make_signed<uint64_t>::type)); |
269 |
| - STATIC_ASSERT(IS_SAME(nbl::hlsl::make_unsigned<int64_t>::type, nbl::hlsl::make_unsigned<uint64_t>::type)); |
| 245 | + STATIC_ASSERT(is_same_v<nbl::hlsl::make_signed<int64_t>::type, nbl::hlsl::make_signed<uint64_t>::type>); |
| 246 | + STATIC_ASSERT(is_same_v<nbl::hlsl::make_unsigned<int64_t>::type, nbl::hlsl::make_unsigned<uint64_t>::type>); |
270 | 247 | }
|
271 | 248 |
|
272 | 249 | {
|
@@ -301,17 +278,14 @@ void main(uint3 invocationID : SV_DispatchThreadID)
|
301 | 278 |
|
302 | 279 | {
|
303 | 280 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities0>::shaderFloat64 == device_capabilities0::shaderFloat64);
|
304 |
| - STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities0>::shaderDrawParameters == device_capabilities0::shaderDrawParameters); |
305 | 281 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities0>::subgroupArithmetic == device_capabilities0::subgroupArithmetic);
|
306 | 282 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities0>::fragmentShaderPixelInterlock == device_capabilities0::fragmentShaderPixelInterlock);
|
307 | 283 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities0>::maxOptimallyResidentWorkgroupInvocations == device_capabilities0::maxOptimallyResidentWorkgroupInvocations);
|
308 | 284 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities1>::shaderFloat64 == device_capabilities1::shaderFloat64);
|
309 |
| - STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities1>::shaderDrawParameters == false); |
310 | 285 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities1>::subgroupArithmetic == false);
|
311 | 286 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities1>::fragmentShaderPixelInterlock == device_capabilities1::fragmentShaderPixelInterlock);
|
312 | 287 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities1>::maxOptimallyResidentWorkgroupInvocations == device_capabilities1::maxOptimallyResidentWorkgroupInvocations);
|
313 | 288 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities2>::shaderFloat64 == false);
|
314 |
| - STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities2>::shaderDrawParameters == false); |
315 | 289 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities2>::subgroupArithmetic == device_capabilities2::subgroupArithmetic);
|
316 | 290 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities2>::fragmentShaderPixelInterlock == device_capabilities2::fragmentShaderPixelInterlock);
|
317 | 291 | STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities2>::maxOptimallyResidentWorkgroupInvocations == device_capabilities2::maxOptimallyResidentWorkgroupInvocations);
|
|
0 commit comments