77#define STATIC_ASSERT(C) { nbl::hlsl::conditional<C, int, void>::type a = 0; }
88
99#define IS_SAME(L,R) nbl::hlsl::is_same<L,R>::value
10- #define SHADER_CRASHING_ASSERT(expr) \
11- { \
12- bool con = (expr); \
13- do { \
14- [branch] if (!con) \
15- vk::RawBufferStore<uint32_t>(0xdeadbeefBADC0FFbull,0x45u,4u); \
16- } while(!con); \
17- }
1810
1911#include <nbl/builtin/hlsl/cmath.hlsl>
2012
@@ -145,10 +137,10 @@ void main(uint3 invocationID : SV_DispatchThreadID)
145137 // uint32_t rotrResult0 = nbl::hlsl::mpl::rotr<uint32_t, 2u, 1>::value;
146138 // uint32_t rotrResult1 = nbl::hlsl::mpl::rotr<uint32_t, 2u, -1>::value;
147139
148- // SHADER_CRASHING_ASSERT (rotlResult0 == mplRotlResult0);
149- // SHADER_CRASHING_ASSERT (rotlResult1 == mplRotlResult1);
150- // SHADER_CRASHING_ASSERT (rotrResult0 == mplRotrResult0);
151- // SHADER_CRASHING_ASSERT (rotrResult1 == mplRotrResult1);
140+ // assert (rotlResult0 == mplRotlResult0);
141+ // assert (rotlResult1 == mplRotlResult1);
142+ // assert (rotrResult0 == mplRotrResult0);
143+ // assert (rotrResult1 == mplRotrResult1);
152144
153145 // TODO: more tests and compare with cpp version as well
154146 fill(invocationID, 5);
@@ -165,27 +157,27 @@ void main(uint3 invocationID : SV_DispatchThreadID)
165157 uint16_t compileTimeCountLZero = nbl::hlsl::mpl::countl_zero<uint16_t, TEST_VALUE_0>::value;
166158 uint16_t runTimeCountLZero = nbl::hlsl::countl_zero(TEST_VALUE_0);
167159 fill(invocationID, float4(5.1, compileTimeCountLZero, runTimeCountLZero, 0));
168- SHADER_CRASHING_ASSERT (compileTimeCountLZero == runTimeCountLZero);
160+ assert (compileTimeCountLZero == runTimeCountLZero);
169161
170162 compileTimeCountLZero = nbl::hlsl::mpl::countl_zero<uint32_t, TEST_VALUE_1>::value;
171163 runTimeCountLZero = nbl::hlsl::countl_zero(TEST_VALUE_1);
172164 fill(invocationID, float4(5.2, compileTimeCountLZero, runTimeCountLZero, 0));
173- SHADER_CRASHING_ASSERT (compileTimeCountLZero == runTimeCountLZero);
165+ assert (compileTimeCountLZero == runTimeCountLZero);
174166
175167 compileTimeCountLZero = nbl::hlsl::mpl::countl_zero<uint32_t, TEST_VALUE_2>::value;
176168 runTimeCountLZero = nbl::hlsl::countl_zero(TEST_VALUE_2);
177169 fill(invocationID, float4(5.3, compileTimeCountLZero, runTimeCountLZero, 0));
178- SHADER_CRASHING_ASSERT (compileTimeCountLZero == runTimeCountLZero);
170+ assert (compileTimeCountLZero == runTimeCountLZero);
179171
180172 compileTimeCountLZero = nbl::hlsl::mpl::countl_zero<uint32_t, TEST_VALUE_3>::value;
181173 runTimeCountLZero = nbl::hlsl::countl_zero(TEST_VALUE_3);
182174 fill(invocationID, float4(5.4, compileTimeCountLZero, runTimeCountLZero, 0));
183- SHADER_CRASHING_ASSERT (compileTimeCountLZero == runTimeCountLZero);
175+ assert (compileTimeCountLZero == runTimeCountLZero);
184176
185177 compileTimeCountLZero = nbl::hlsl::mpl::countl_zero<uint32_t, TEST_VALUE_4>::value;
186178 runTimeCountLZero = nbl::hlsl::countl_zero(TEST_VALUE_4);
187179 fill(invocationID, float4(5.5, compileTimeCountLZero, runTimeCountLZero, 0));
188- SHADER_CRASHING_ASSERT (compileTimeCountLZero == runTimeCountLZero);
180+ assert (compileTimeCountLZero == runTimeCountLZero);
189181 }
190182
191183 {
@@ -201,7 +193,7 @@ void main(uint3 invocationID : SV_DispatchThreadID)
201193 {
202194 float4 v;
203195 fill(invocationID, float4(alignof(v.x), alignof(v), 0, 0));
204- SHADER_CRASHING_ASSERT (alignof(v.x) == alignof(v));
196+ assert (alignof(v.x) == alignof(v));
205197 }
206198
207199 {
@@ -266,7 +258,7 @@ void main(uint3 invocationID : SV_DispatchThreadID)
266258 decltype(fn(__VA_ARGS__)) lhs = nbl::hlsl::fn(__VA_ARGS__); \
267259 decltype(lhs) rhs = fn(__VA_ARGS__); \
268260 fill(invocationID, float4(idx, lhs, rhs)); \
269- SHADER_CRASHING_ASSERT (abs(lhs - rhs) < nbl::hlsl::numeric_limits<decltype(lhs)>::epsilon) \
261+ assert (abs(lhs - rhs) < nbl::hlsl::numeric_limits<decltype(lhs)>::epsilon) \
270262 }
271263 TEST_FN(float2(10, 1), cos, 1.44f)
272264 TEST_FN(float2(10, 2), sin, 1.44f)
0 commit comments