Skip to content

Commit f2a3648

Browse files
author
devsh
committed
merge working ex22 and turn off cmath/tgmath tests
1 parent 56aebe0 commit f2a3648

File tree

4 files changed

+145
-153
lines changed

4 files changed

+145
-153
lines changed

22_CppCompat/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ nbl_create_executable_project("" "" "" "" "${NBL_EXECUTABLE_PROJECT_CREATION_PCH
77

88
if(NBL_EMBED_BUILTIN_RESOURCES)
99
set(_BR_TARGET_ ${EXECUTABLE_NAME}_builtinResourceData)
10-
set(RESOURCE_DIR "app_resources")
10+
set(RESOURCE_DIR "app_resources")
1111

1212
get_filename_component(_SEARCH_DIRECTORIES_ "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
1313
get_filename_component(_OUTPUT_DIRECTORY_SOURCE_ "${CMAKE_CURRENT_BINARY_DIR}/src" ABSOLUTE)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//// Copyright (C) 2023-2024 - DevSH Graphics Programming Sp. z O.O.
2+
//// This file is part of the "Nabla Engine".
3+
//// For conditions of distribution and use, see copyright notice in nabla.h
4+
5+
// because DXC doesn't properly support `_Static_assert`
6+
#define STATIC_ASSERT(...) { nbl::hlsl::conditional<__VA_ARGS__, int, void>::type a = 0; }
7+
8+
#include <boost/preprocessor.hpp>
9+
10+
#include <nbl/builtin/hlsl/cpp_compat.hlsl>
11+
#include <nbl/builtin/hlsl/type_traits.hlsl>
12+
13+
#include <nbl/builtin/hlsl/cpp_compat/matrix.hlsl>
14+
#include <nbl/builtin/hlsl/cpp_compat/vector.hlsl>
15+
16+
#include <nbl/builtin/hlsl/colorspace/encodeCIEXYZ.hlsl>
17+
#include <nbl/builtin/hlsl/colorspace/decodeCIEXYZ.hlsl>
18+
#include <nbl/builtin/hlsl/colorspace/EOTF.hlsl>
19+
#include <nbl/builtin/hlsl/colorspace/OETF.hlsl>
20+
21+
#include <nbl/builtin/hlsl/random/xoroshiro.hlsl>
22+
23+
#include <nbl/builtin/hlsl/mpl.hlsl>
24+
#include <nbl/builtin/hlsl/bit.hlsl>
25+
26+
#include <nbl/builtin/hlsl/limits.hlsl>
27+
28+
#define DISABLE_TGMATH_TESTS
29+
#ifndef DISABLE_TGMATH_TESTS
30+
#include <nbl/builtin/hlsl/cmath.hlsl>
31+
#endif
32+
33+
#include <nbl/builtin/hlsl/barycentric/utils.hlsl>
34+
#include <nbl/builtin/hlsl/member_test_macros.hlsl>
35+
#include <nbl/builtin/hlsl/device_capabilities_traits.hlsl>

22_CppCompat/app_resources/test.comp.hlsl

Lines changed: 19 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
//// Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O.
1+
//// Copyright (C) 2023-2024 - DevSH Graphics Programming Sp. z O.O.
22
//// This file is part of the "Nabla Engine".
33
//// For conditions of distribution and use, see copyright notice in nabla.h
4+
#include "app_resources/common.hlsl"
45

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
86
#define SHADER_CRASHING_ASSERT(expr) \
97
{ \
108
bool con = (expr); \
@@ -14,30 +12,9 @@
1412
} while(!con); \
1513
}
1614

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>;
3817

39-
#include <nbl/builtin/hlsl/member_test_macros.hlsl>
40-
#include <nbl/builtin/hlsl/device_capabilities_traits.hlsl>
4118

4219
struct PushConstants
4320
{
@@ -241,32 +218,32 @@ void main(uint3 invocationID : SV_DispatchThreadID)
241218
float4 v;
242219
const volatile float4 u;
243220

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>);
245222
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>);
249226

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>);
253230
}
254231
fill(invocationID, 7);
255232
{
256233
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>);
259236
}
260237
fill(invocationID, 8);
261238
{
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>);
264241

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>);
267244

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>);
270247
}
271248

272249
{
@@ -301,17 +278,14 @@ void main(uint3 invocationID : SV_DispatchThreadID)
301278

302279
{
303280
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);
305281
STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities0>::subgroupArithmetic == device_capabilities0::subgroupArithmetic);
306282
STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities0>::fragmentShaderPixelInterlock == device_capabilities0::fragmentShaderPixelInterlock);
307283
STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities0>::maxOptimallyResidentWorkgroupInvocations == device_capabilities0::maxOptimallyResidentWorkgroupInvocations);
308284
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);
310285
STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities1>::subgroupArithmetic == false);
311286
STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities1>::fragmentShaderPixelInterlock == device_capabilities1::fragmentShaderPixelInterlock);
312287
STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities1>::maxOptimallyResidentWorkgroupInvocations == device_capabilities1::maxOptimallyResidentWorkgroupInvocations);
313288
STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities2>::shaderFloat64 == false);
314-
STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities2>::shaderDrawParameters == false);
315289
STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities2>::subgroupArithmetic == device_capabilities2::subgroupArithmetic);
316290
STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities2>::fragmentShaderPixelInterlock == device_capabilities2::fragmentShaderPixelInterlock);
317291
STATIC_ASSERT(nbl::hlsl::device_capabilities_traits<device_capabilities2>::maxOptimallyResidentWorkgroupInvocations == device_capabilities2::maxOptimallyResidentWorkgroupInvocations);

0 commit comments

Comments
 (0)