Skip to content

Commit 23383f2

Browse files
author
devsh
committed
make the host compilers stop moaning about dxc pragma they can't understand
1 parent 37fcd32 commit 23383f2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/nbl/builtin/hlsl/tgmath/impl.hlsl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,14 @@ struct l2gamma_helper<T NBL_PARTIAL_REQ_BOT(concepts::FloatingPointScalar<T>) >
539539
// implementation derived from Numerical Recipes in C, transformed for log2
540540
static T __call(T x)
541541
{
542+
#ifdef __HLSL_VERSION // make the host compilers shut up
542543
#pragma dxc diagnostic push
543544
#pragma dxc diagnostic ignored "-Wliteral-range"
545+
#endif
544546
const T thresholds[4] = { 0, 5e4, 1e36, 1e305 }; // threshold values gotten from testing when the function returns nan/inf
547+
#ifdef __HLSL_VERSION // make the host compilers shut up
545548
#pragma dxc diagnostic pop
549+
#endif
546550
if (x > thresholds[mpl::find_lsb_v<sizeof(T)>])
547551
return bit_cast<T>(numeric_limits<T>::infinity);
548552

@@ -584,10 +588,14 @@ struct beta_helper<T NBL_PARTIAL_REQ_BOT(concepts::FloatingPointScalar<T>) >
584588
// implementation from Numerical Recipes in C, 2nd ed.
585589
static T __call(T v1, T v2)
586590
{
591+
#ifdef __HLSL_VERSION // make the host compilers shut up
587592
#pragma dxc diagnostic push
588593
#pragma dxc diagnostic ignored "-Wliteral-range"
594+
#endif
589595
const T thresholds[4] = { 0, 2e4, 1e6, 1e15 }; // threshold values gotten from testing when the function returns nan/inf/1
596+
#ifdef __HLSL_VERSION // make the host compilers shut up
590597
#pragma dxc diagnostic pop
598+
#endif
591599
if (v1+v2 > thresholds[mpl::find_lsb_v<sizeof(T)>])
592600
return T(0.0);
593601

0 commit comments

Comments
 (0)