Skip to content

Commit 90dfc4e

Browse files
Merge pull request #991 from Devsh-Graphics-Programming/path_tracer_leftover_cleanup
Address path tracer merge leftover comments
2 parents 65f0f5b + 8a9070e commit 90dfc4e

27 files changed

Lines changed: 1345 additions & 517 deletions

examples_tests

Submodule examples_tests updated 29 files

include/nbl/builtin/hlsl/bxdf/base/cook_torrance_base.hlsl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,10 @@ struct SCookTorrance
202202
// fail if samples have invalid paths
203203
const scalar_type NdotL = hlsl::mix(scalar_type(2.0) * VdotH * localH.z - NdotV,
204204
localH.z * (VdotH * rcpEta.value[0] + LdotH) - NdotV * rcpEta.value[0], transmitted);
205+
assert(!hlsl::isnan(NdotL));
205206
// VNDF sampling guarantees that `VdotH` has same sign as `NdotV`
206207
// and `transmitted` controls the sign of `LdotH` relative to `VdotH` by construction (reflect -> same sign, or refract -> opposite sign)
207-
if (hlsl::isnan(NdotL) || ComputeMicrofacetNormal<scalar_type>::isTransmissionPath(NdotV, NdotL) != transmitted)
208+
if (ComputeMicrofacetNormal<scalar_type>::isTransmissionPath(NdotV, NdotL) != transmitted)
208209
{
209210
valid = false;
210211
return sample_type::createInvalid(); // should check if sample direction is invalid
@@ -307,7 +308,16 @@ struct SCookTorrance
307308
partitionRandVariable.leftProb = reflectance;
308309
bool transmitted = partitionRandVariable(z, rcpChoiceProb);
309310

310-
const scalar_type LdotH = hlsl::mix(VdotH, ieee754::copySign(hlsl::sqrt(rcpEta.value2[0]*VdotH*VdotH + scalar_type(1.0) - rcpEta.value2[0]), -VdotH), transmitted);
311+
scalar_type LdotH;
312+
if (transmitted)
313+
{
314+
scalar_type det = rcpEta.value2[0]*VdotH*VdotH + scalar_type(1.0) - rcpEta.value2[0];
315+
if (det < scalar_type(0.0))
316+
return sample_type::createInvalid();
317+
LdotH = ieee754::copySign(hlsl::sqrt(det), -VdotH);
318+
}
319+
else
320+
LdotH = VdotH;
311321
bool valid;
312322
sample_type s = __generate_common(interaction, localH, NdotV, VdotH, LdotH, transmitted, rcpEta, valid);
313323
if (valid)

include/nbl/builtin/hlsl/bxdf/fresnel.hlsl

Lines changed: 64 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,8 @@ struct iridescent_helper
508508
using vector_type = T;
509509

510510
// returns phi, the phase shift for each plane of polarization (p,s)
511-
static void phase_shift(const vector_type ior1, const vector_type ior2, const vector_type iork2, const vector_type cosTheta, NBL_REF_ARG(vector_type) phiS, NBL_REF_ARG(vector_type) phiP)
511+
static void phase_shift(const vector_type ior1, const vector_type ior2, const vector_type iork2, const vector_type cosTheta, const vector_type cosTheta2, const vector_type sinTheta2, NBL_REF_ARG(vector_type) phiS, NBL_REF_ARG(vector_type) phiP)
512512
{
513-
const vector_type cosTheta2 = cosTheta * cosTheta;
514-
const vector_type sinTheta2 = hlsl::promote<vector_type>(1.0) - cosTheta2;
515513
const vector_type ior1_2 = ior1*ior1;
516514
const vector_type ior2_2 = ior2*ior2;
517515
const vector_type iork2_2 = iork2*iork2;
@@ -523,6 +521,7 @@ struct iridescent_helper
523521
const vector_type a = hlsl::sqrt(a2);
524522
const vector_type b = hlsl::sqrt(b2);
525523

524+
// TODO: very optimizable, especially atan2 usage
526525
phiS = hlsl::atan2(scalar_type(2.0) * ior1 * b * cosTheta, a2 + b2 - ior1_2*cosTheta2);
527526
const vector_type k2_plus_one = hlsl::promote<vector_type>(1.0) + iork2_2;
528527
phiP = hlsl::atan2(scalar_type(2.0) * ior1 * ior2_2 * cosTheta * (scalar_type(2.0) * iork2 * a - (hlsl::promote<vector_type>(1.0) - iork2_2) * b),
@@ -549,37 +548,50 @@ struct iridescent_helper
549548
{
550549
const scalar_type cosTheta_1 = clampedCosTheta;
551550
vector_type R12p, R23p, R12s, R23s;
552-
vector_type cosTheta_2;
551+
vector_type cosTheta_2, cosTheta2_2;
553552
vector<bool,vector_traits<vector_type>::Dimension> notTIR;
554553
{
555554
const vector_type scale = scalar_type(1.0)/eta12;
556-
const vector_type cosTheta2_2 = hlsl::promote<vector_type>(1.0) - hlsl::promote<vector_type>(scalar_type(1.0)-cosTheta_1*cosTheta_1) * scale * scale;
555+
cosTheta2_2 = hlsl::promote<vector_type>(1.0) - hlsl::promote<vector_type>(scalar_type(1.0)-cosTheta_1*cosTheta_1) * scale * scale;
557556
notTIR = cosTheta2_2 > hlsl::promote<vector_type>(0.0);
558-
cosTheta_2 = hlsl::sqrt(hlsl::max(cosTheta2_2, hlsl::promote<vector_type>(0.0)));
557+
cosTheta_2 = hlsl::mix(hlsl::promote<vector_type>(0.0), hlsl::sqrt(cosTheta2_2), notTIR);
559558
}
560559

561-
if (hlsl::any(notTIR))
560+
NBL_UNROLL for (uint32_t i = 0; i < vector_traits<vector_type>::Dimension; i++)
562561
{
563-
Dielectric<vector_type>::__polarized(eta12 * eta12, hlsl::promote<vector_type>(cosTheta_1), R12p, R12s);
564-
565-
// Reflected part by the base
566-
// if kappa==0, base material is dielectric
567-
NBL_IF_CONSTEXPR(SupportsTransmission)
568-
Dielectric<vector_type>::__polarized(eta23 * eta23, cosTheta_2, R23p, R23s);
562+
// Check for total internal reflection
563+
if (notTIR[i])
564+
{
565+
using monochrome_type = vector<scalar_type, 1>;
566+
monochrome_type p12, s12, p23, s23;
567+
Dielectric<monochrome_type>::__polarized(hlsl::promote<monochrome_type>(eta12[i] * eta12[i]), hlsl::promote<monochrome_type>(cosTheta_1), p12, s12);
568+
569+
const monochrome_type eta23_2 = hlsl::promote<monochrome_type>(eta23[i] * eta23[i]);
570+
571+
// Reflected part by the base
572+
// if kappa==0, base material is dielectric
573+
NBL_IF_CONSTEXPR(SupportsTransmission)
574+
Dielectric<monochrome_type>::__polarized(eta23_2, hlsl::promote<monochrome_type>(cosTheta_2[i]), p23, s23);
575+
else
576+
{
577+
const monochrome_type etaLen2 = eta23_2 + hlsl::promote<monochrome_type>(etak23[i] * etak23[i]);
578+
Conductor<monochrome_type>::__polarized(hlsl::promote<monochrome_type>(eta23[i]), etaLen2, hlsl::promote<monochrome_type>(cosTheta_2[i]), p23, s23);
579+
}
580+
581+
R12p[i] = p12[0];
582+
R12s[i] = s12[0];
583+
R23p[i] = p23[0];
584+
R23s[i] = s23[0];
585+
}
569586
else
570587
{
571-
vector_type etaLen2 = eta23 * eta23 + etak23 * etak23;
572-
Conductor<vector_type>::__polarized(eta23, etaLen2, cosTheta_2, R23p, R23s);
588+
R12s[i] = scalar_type(0.0);
589+
R12p[i] = scalar_type(0.0);
590+
R23s[i] = scalar_type(0.0);
591+
R23p[i] = scalar_type(0.0);
573592
}
574593
}
575594

576-
// Check for total internal reflection
577-
const vector_type notTIRFactor = vector_type(notTIR); // 0 when TIR, 1 otherwise
578-
R12s = R12s * notTIRFactor;
579-
R12p = R12p * notTIRFactor;
580-
R23s = R23s * notTIRFactor;
581-
R23p = R23p * notTIRFactor;
582-
583595
// Compute the transmission coefficients
584596
vector_type T121p = hlsl::promote<vector_type>(1.0) - R12p;
585597
vector_type T121s = hlsl::promote<vector_type>(1.0) - R12s;
@@ -591,8 +603,18 @@ struct iridescent_helper
591603
vector_type I = hlsl::promote<vector_type>(0.0);
592604

593605
// Evaluate the phase shift
594-
phase_shift(ior1, ior2, hlsl::promote<vector_type>(0.0), hlsl::promote<vector_type>(cosTheta_1), phi21s, phi21p);
595-
phase_shift(ior2, ior3, iork3, cosTheta_2, phi23s, phi23p);
606+
{
607+
const vector_type ct = hlsl::promote<vector_type>(cosTheta_1);
608+
const vector_type ct2 = ct * ct;
609+
const vector_type st2 = hlsl::promote<vector_type>(1.0) - ct2;
610+
phase_shift(ior1, ior2, hlsl::promote<vector_type>(0.0), ct, ct2, st2, phi21s, phi21p);
611+
}
612+
{
613+
const vector_type ct = hlsl::promote<vector_type>(cosTheta_2);
614+
const vector_type ct2 = cosTheta2_2;
615+
const vector_type st2 = hlsl::promote<vector_type>(1.0) - ct2;
616+
phase_shift(ior2, ior3, iork3, ct, ct2, st2, phi23s, phi23p);
617+
}
596618
phi21p = hlsl::promote<vector_type>(numbers::pi<scalar_type>) - phi21p;
597619
phi21s = hlsl::promote<vector_type>(numbers::pi<scalar_type>) - phi21s;
598620

@@ -613,6 +635,7 @@ struct iridescent_helper
613635
NBL_UNROLL for (int m=1; m<=2; ++m)
614636
{
615637
Cm *= r123p;
638+
// TODO: common subexpression, maybe we can hoist it out somehow?
616639
Sm = hlsl::promote<vector_type>(2.0) * evalSensitivity(hlsl::promote<vector_type>(scalar_type(m))*D, hlsl::promote<vector_type>(scalar_type(m))*(phi23p+phi21p));
617640
I += Cm*Sm;
618641
}
@@ -641,6 +664,13 @@ struct iridescent_base
641664
using scalar_type = typename vector_traits<T>::scalar_type;
642665
using vector_type = T;
643666

667+
template<bool SupportsTransmission, typename Colorspace>
668+
T __call(const vector_type iork3, const vector_type etak23, const scalar_type clampedCosTheta) NBL_CONST_MEMBER_FUNC
669+
{
670+
return impl::iridescent_helper<T,false>::template __call<Colorspace>(D, ior1, ior2, ior3, iork3,
671+
eta12, eta23, etak23, clampedCosTheta);
672+
}
673+
644674
vector_type D;
645675
vector_type ior1;
646676
vector_type ior2;
@@ -650,6 +680,14 @@ struct iridescent_base
650680
vector_type eta23; // thin-film -> base material IOR
651681
vector_type eta13;
652682
};
683+
684+
685+
// workaround due to DXC bug: github.com/microsoft/DirectXShaderCompiler/issues/5966
686+
template<typename T, bool SupportsTransmission, typename Colorspace>
687+
T __iridescent_base__call_const(NBL_CONST_REF_ARG(iridescent_base<T>) _this, const T iork3, const T etak23, const typename vector_traits<T>::scalar_type clampedCosTheta)
688+
{
689+
return _this.template __call<SupportsTransmission, Colorspace>(iork3, etak23, clampedCosTheta);
690+
}
653691
}
654692

655693
template<typename T, typename Colorspace>
@@ -691,8 +729,7 @@ struct Iridescent<T, false, Colorspace NBL_PARTIAL_REQ_BOT(concepts::FloatingPoi
691729

692730
T operator()(const scalar_type clampedCosTheta) NBL_CONST_MEMBER_FUNC
693731
{
694-
return impl::iridescent_helper<T,false>::template __call<Colorspace>(base_type::D, base_type::ior1, base_type::ior2, base_type::ior3, base_type::iork3,
695-
base_type::eta12, base_type::eta23, getEtak23(), clampedCosTheta);
732+
return impl::__iridescent_base__call_const<T, false, Colorspace>(NBL_DEREF_THIS, base_type::iork3, getEtak23(), clampedCosTheta);
696733
}
697734

698735
vector_type getEtak23() NBL_CONST_MEMBER_FUNC
@@ -739,8 +776,7 @@ struct Iridescent<T, true, Colorspace NBL_PARTIAL_REQ_BOT(concepts::FloatingPoin
739776

740777
T operator()(const scalar_type clampedCosTheta) NBL_CONST_MEMBER_FUNC
741778
{
742-
return impl::iridescent_helper<T,true>::template __call<Colorspace>(base_type::D, base_type::ior1, base_type::ior2, base_type::ior3, getEtak23(),
743-
base_type::eta12, base_type::eta23, getEtak23(), clampedCosTheta);
779+
return impl::__iridescent_base__call_const<T, true, Colorspace>(NBL_DEREF_THIS, getEtak23(), getEtak23(), clampedCosTheta);
744780
}
745781

746782
scalar_type getRefractionOrientedEta() NBL_CONST_MEMBER_FUNC { return base_type::eta13[0]; }

include/nbl/builtin/hlsl/concepts/accessors/anisotropically_sampled.hlsl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,28 @@ namespace accessors
1818
{
1919
// declare concept
2020
#define NBL_CONCEPT_NAME AnisotropicallySampled
21-
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(int32_t)
22-
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(Dims)
21+
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(int32_t)(int32_t)
22+
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(Dims)(Components)
2323
// not the greatest syntax but works
2424
#define NBL_CONCEPT_PARAM_0 (a,U)
2525
#define NBL_CONCEPT_PARAM_1 (uv,vector<float32_t,Dims>)
2626
#define NBL_CONCEPT_PARAM_2 (layer,uint16_t)
2727
#define NBL_CONCEPT_PARAM_3 (dU,vector<float32_t,Dims>)
2828
#define NBL_CONCEPT_PARAM_4 (dV,vector<float32_t,Dims>)
29+
#define NBL_CONCEPT_PARAM_5 (outVal,vector<float32_t,Components>)
2930
// start concept
30-
NBL_CONCEPT_BEGIN(5)
31+
NBL_CONCEPT_BEGIN(6)
3132
// need to be defined AFTER the cocnept begins
3233
#define a NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0
3334
#define uv NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1
3435
#define layer NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_2
3536
#define dU NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_3
3637
#define dV NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_4
38+
#define outVal NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_5
3739
NBL_CONCEPT_END(
38-
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<Dims>(uv,layer,dU,dV)) , ::nbl::hlsl::is_same_v, float32_t4>))
40+
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<Dims>(outVal,uv,layer,dU,dV)) , ::nbl::hlsl::is_same_v, void))
3941
);
42+
#undef outVal
4043
#undef dV
4144
#undef dU
4245
#undef layer
@@ -47,4 +50,4 @@ NBL_CONCEPT_END(
4750
}
4851
}
4952
}
50-
#endif
53+
#endif

include/nbl/builtin/hlsl/concepts/accessors/loadable_image.hlsl

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,52 +18,58 @@ namespace accessors
1818
{
1919

2020
// concept `LoadableImage` translates to smth like this:
21-
//template<typename U, typename T, int32_t Dims>
22-
//concept LoadableImage = requires(U a, vector<uint16_t, Dims> uv, uint16_t layer) {
23-
// ::nbl::hlsl::is_same_v<decltype(declval<U>().template get<T,Dims>(uv,layer)), vector<T,4>>;
21+
//template<typename U, typename T, int32_t Dims, int32_t Components>
22+
//concept LoadableImage = requires(U a, vector<uint16_t, Dims> uv, uint16_t layer, vector<T, Components> outVal) {
23+
// ::nbl::hlsl::is_same_v<decltype(declval<U>().template get<T,Dims>(outVal,uv,layer)), void>;
2424
//};
2525

2626
// declare concept
2727
#define NBL_CONCEPT_NAME LoadableImage
28-
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)
29-
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)
28+
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)(int32_t)
29+
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)(Components)
3030
// not the greatest syntax but works
3131
#define NBL_CONCEPT_PARAM_0 (a,U)
3232
#define NBL_CONCEPT_PARAM_1 (uv,vector<uint16_t,Dims>)
3333
#define NBL_CONCEPT_PARAM_2 (layer,uint16_t)
34+
#define NBL_CONCEPT_PARAM_3 (outVal,vector<T,Components>)
3435
// start concept
35-
NBL_CONCEPT_BEGIN(3)
36+
NBL_CONCEPT_BEGIN(4)
3637
// need to be defined AFTER the concept begins
3738
#define a NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0
3839
#define uv NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1
3940
#define layer NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_2
41+
#define outVal NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_3
4042
NBL_CONCEPT_END(
41-
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<T,Dims>(uv,layer)), ::nbl::hlsl::is_same_v, vector<T,4>))
43+
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<T,Dims>(outVal,uv,layer)), ::nbl::hlsl::is_same_v, void))
4244
);
45+
#undef outVal
4346
#undef layer
4447
#undef uv
4548
#undef a
4649
#include <nbl/builtin/hlsl/concepts/__end.hlsl>
4750

4851
// declare concept
4952
#define NBL_CONCEPT_NAME MipmappedLoadableImage
50-
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)
51-
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)
53+
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)(int32_t)
54+
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)(Components)
5255
// not the greatest syntax but works
5356
#define NBL_CONCEPT_PARAM_0 (a,U)
5457
#define NBL_CONCEPT_PARAM_1 (uv,vector<uint16_t,Dims>)
5558
#define NBL_CONCEPT_PARAM_2 (layer,uint16_t)
5659
#define NBL_CONCEPT_PARAM_3 (level,uint16_t)
60+
#define NBL_CONCEPT_PARAM_4 (outVal,vector<T,Components>)
5761
// start concept
58-
NBL_CONCEPT_BEGIN(4)
62+
NBL_CONCEPT_BEGIN(5)
5963
// need to be defined AFTER the cocnept begins
6064
#define a NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0
6165
#define uv NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1
6266
#define layer NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_2
6367
#define level NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_3
68+
#define outVal NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_4
6469
NBL_CONCEPT_END(
65-
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<T,Dims>(uv,layer,level)) , ::nbl::hlsl::is_same_v, vector<T,4>))
70+
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<T,Dims>(outVal,uv,layer,level)) , ::nbl::hlsl::is_same_v, void))
6671
);
72+
#undef outVal
6773
#undef level
6874
#undef layer
6975
#undef uv
@@ -73,4 +79,4 @@ NBL_CONCEPT_END(
7379
}
7480
}
7581
}
76-
#endif
82+
#endif

include/nbl/builtin/hlsl/concepts/accessors/mip_mapped.hlsl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,19 @@ namespace accessors
2525
#define NBL_CONCEPT_PARAM_1 (uv,vector<float32_t,Dims>)
2626
#define NBL_CONCEPT_PARAM_2 (layer,uint16_t)
2727
#define NBL_CONCEPT_PARAM_3 (level,float)
28+
#define NBL_CONCEPT_PARAM_4 (outVal,float32_t4)
2829
// start concept
29-
NBL_CONCEPT_BEGIN(4)
30+
NBL_CONCEPT_BEGIN(5)
3031
// need to be defined AFTER the cocnept begins
3132
#define a NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0
3233
#define uv NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1
3334
#define layer NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_2
3435
#define level NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_3
36+
#define outVal NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_4
3537
NBL_CONCEPT_END(
36-
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<Dims>(uv,layer,level)) , ::nbl::hlsl::is_same_v, float32_t4>))
38+
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<Dims>(outVal,uv,layer,level)) , ::nbl::hlsl::is_same_v, void))
3739
);
40+
#undef outVal
3841
#undef level
3942
#undef layer
4043
#undef uv
@@ -44,4 +47,4 @@ NBL_CONCEPT_END(
4447
}
4548
}
4649
}
47-
#endif
50+
#endif

include/nbl/builtin/hlsl/concepts/accessors/storable_image.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ namespace accessors
1818
{
1919
// declare concept
2020
#define NBL_CONCEPT_NAME StorableImage
21-
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)
22-
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)
21+
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)(int32_t)
22+
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)(Components)
2323
// not the greatest syntax but works
2424
#define NBL_CONCEPT_PARAM_0 (a,U)
2525
#define NBL_CONCEPT_PARAM_1 (uv,vector<uint16_t,Dims>)
2626
#define NBL_CONCEPT_PARAM_2 (layer,uint16_t)
27-
#define NBL_CONCEPT_PARAM_3 (data,vector<T,4>)
27+
#define NBL_CONCEPT_PARAM_3 (data,vector<T,Components>)
2828
// start concept
2929
NBL_CONCEPT_BEGIN(4)
3030
// need to be defined AFTER the cocnept begins

include/nbl/builtin/hlsl/math/functions.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ struct conditionalAbsOrMax_helper<T NBL_PARTIAL_REQ_BOT(concepts::FloatingPointL
152152

153153
Uint32VectorWithDimensionOfT xAsUintVec = bit_cast<Uint32VectorWithDimensionOfT, T>(x);
154154

155-
const Uint32VectorWithDimensionOfT mask = cond ? _static_cast<Uint32VectorWithDimensionOfT>(numeric_limits<UintOfTSize>::max >> 1) : _static_cast<Uint32VectorWithDimensionOfT>(numeric_limits<UintOfTSize>::max);
155+
const Uint32VectorWithDimensionOfT mask = cond ? promote<Uint32VectorWithDimensionOfT>(numeric_limits<UintOfTSize>::max >> 1) : promote<Uint32VectorWithDimensionOfT>(numeric_limits<UintOfTSize>::max);
156156
const Uint32VectorWithDimensionOfT condAbsAsUint = xAsUintVec & mask;
157157
T condAbs = bit_cast<T, Uint32VectorWithDimensionOfT>(condAbsAsUint);
158158

0 commit comments

Comments
 (0)