Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
9be65a0
changed quaternion struct name, brought in quaternion stuff from prze…
keptsecret Dec 1, 2025
3e03467
_static_create quaternion to matrix, create quaternion from axis-angle
keptsecret Dec 2, 2025
34d1385
added more quaternion funcs: transformVec, inverse, normalize + stati…
keptsecret Dec 2, 2025
61540d6
Modified `LoadableImage` and `ResolveAccessorBase` concepts
Przemog1 Dec 11, 2025
6953879
Small RWMC fixes
Przemog1 Dec 22, 2025
3d0c454
changes to linear, bilinear, box muller for pdf and backward pdf
keptsecret Jan 20, 2026
bea01f9
get polarized fresnel values by component
keptsecret Jan 20, 2026
5a36766
precompute some phase shift constants
keptsecret Jan 21, 2026
d079f5b
removed morton struct superseded by new one
keptsecret Jan 21, 2026
3f8fd48
changes to solid angle method name, simplified a lot of code in spher…
keptsecret Jan 21, 2026
c06f199
simplify call to iridescent helper through base struct
keptsecret Jan 21, 2026
407d0fd
removed redundant/unused variables from spherical triangle sample
keptsecret Jan 22, 2026
795b9fa
spherical rectangle stores origin, extent, basis and takes observer i…
keptsecret Jan 22, 2026
f9b949e
added compressed spherical rectangle, comments for info of implementa…
keptsecret Jan 22, 2026
140c5c6
removed unused code
keptsecret Jan 22, 2026
2ce08d9
path tracer (unidirectional) and concepts moved from example
keptsecret Jan 23, 2026
1a7b185
use correct quantized sequence decode
keptsecret Jan 23, 2026
3350351
moved raygen out as basic ray gen with gaussian filter
keptsecret Jan 23, 2026
29910cf
merge master, fix conflicts
keptsecret Feb 2, 2026
a4a5a12
merge master, fix conflicts
keptsecret Feb 6, 2026
ea38df1
Merge branch 'master' into path_tracer_leftover_cleanup
keptsecret Feb 12, 2026
c630f62
Merge branch 'master' into path_tracer_leftover_cleanup
devshgraphicsprogramming Feb 12, 2026
5ed90fa
moved nan check from ndotl to ldoth
keptsecret Feb 13, 2026
b8f0c9f
minor fixes because this is ref in hlsl and pointer in c++
keptsecret Feb 13, 2026
78dcf93
revert linear back to old version because rcpDiff can be negative
keptsecret Feb 13, 2026
cf936ed
fix conditionalAbsOrMax for vectors
keptsecret Feb 13, 2026
5e52a6f
refactor changes to various sampling functions so it runs
keptsecret Feb 13, 2026
86e3146
some fixes to pt concept type names
keptsecret Feb 13, 2026
addde12
RWMC fixes
Przemog1 Feb 16, 2026
94a5bfb
type alias for id of material and light, also reduced arguments to ma…
keptsecret Feb 16, 2026
1227991
change nee to return a struct because of multiple return values
keptsecret Feb 16, 2026
676831e
scene does the mapping from object id to light/mat id
keptsecret Feb 16, 2026
3a90b0c
Finalize RWMC review fixes
AnastaZIuk Feb 16, 2026
187ced6
Restrict Resolver template parameters to review scope
AnastaZIuk Feb 16, 2026
a604064
renamed constants in camelcase
keptsecret Feb 17, 2026
87c7fb1
intersector returns a struct with intersection point, interaction, hi…
keptsecret Feb 17, 2026
9d98071
randGen should return a unorm float, everything that rand3d() does wi…
keptsecret Feb 17, 2026
acd91aa
refactor ray struct to be polymorphic on polygon method, new methods
keptsecret Feb 17, 2026
70b90d6
Finalize RWMC review fixes
AnastaZIuk Feb 17, 2026
ea2e525
Fix accessor concepts for out-param get
AnastaZIuk Feb 17, 2026
9399ad3
Address latest RWMC accessor and splatting review comments
AnastaZIuk Feb 17, 2026
1125f48
Improve packed splatting parameter naming
AnastaZIuk Feb 17, 2026
6897443
Merge branch 'master' into path_tracer_leftover_cleanup
keptsecret Feb 18, 2026
31011e8
fix depth increment, nee should return env radiance
keptsecret Feb 18, 2026
0ee6534
minor bug fix to depth, throughputCIE
keptsecret Feb 18, 2026
b7ec514
material system handles emissive material of lights, nee does only de…
keptsecret Feb 18, 2026
e20adf0
Merge branch 'master' into path_tracer_leftover_cleanup
keptsecret Feb 19, 2026
e02ae41
made some vars members to assign, gaussian takes vec2
keptsecret Feb 19, 2026
b27ec2d
nee chooses the light so takes material system with emissive instead
keptsecret Feb 19, 2026
e648649
merge rwmc_fix2, fix conflicts
keptsecret Feb 19, 2026
233f9b8
fixes to mis usage, moved albedo into material
keptsecret Feb 19, 2026
2e19c85
nee shouldn't copy scene again
keptsecret Feb 19, 2026
f9cd190
intersector does traceShadowRay as well
keptsecret Feb 19, 2026
2b52594
merge master, fix conflicts
keptsecret Feb 20, 2026
740ff00
use ray methods instead of calling members
keptsecret Feb 20, 2026
d96e337
minor fixes to check ldoth only when transmit
keptsecret Feb 20, 2026
8a614c3
more getters and setters for ray, result structs
keptsecret Feb 20, 2026
76ed253
made tolerance method a type alias in nee with new static method
keptsecret Feb 20, 2026
f165d87
merge master, fix conflicts
keptsecret Feb 23, 2026
da544f8
add more concepts for additional structs in pt
keptsecret Feb 23, 2026
15003cb
added concept for ray type
keptsecret Feb 23, 2026
0a85285
added a create param struct for resolve params
keptsecret Feb 23, 2026
60728b7
renamed intersector traceRay to traceClosestHit
keptsecret Feb 23, 2026
8a29fa2
concept for material light id
keptsecret Feb 24, 2026
9a227eb
removed redundant param for randgen operator
keptsecret Feb 24, 2026
a506180
added a create method to pack all the required splatting params
keptsecret Feb 24, 2026
4ceb3f2
scene returns an interaction, instead of just normal
keptsecret Feb 25, 2026
917acc5
minor fixes to spherical rectangle stuff
keptsecret Feb 25, 2026
4ea58c8
remove unused variable in packed splatting params
keptsecret Feb 25, 2026
885e58f
minor changes to concept for intersector, nee; document concept symbols
keptsecret Feb 25, 2026
9aeb80c
changes to ray methods to separate interaction from init, nee takes a…
keptsecret Feb 25, 2026
575f15b
fix normalize throughputCIE, minor changes to method names
keptsecret Feb 25, 2026
b5a4feb
use nbl this macro for fresnel iridescent that uses this
keptsecret Feb 26, 2026
120e179
added some asserts, material system should take aniso types and decid…
keptsecret Feb 26, 2026
5e243d9
correct pdf method for mat system, added shouldDoMIS for ray payload
keptsecret Feb 26, 2026
40d585c
added some comments regarding future use of MIS, scene takes and inte…
keptsecret Feb 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples_tests
14 changes: 12 additions & 2 deletions include/nbl/builtin/hlsl/bxdf/base/cook_torrance_base.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,10 @@ struct SCookTorrance
// fail if samples have invalid paths
const scalar_type NdotL = hlsl::mix(scalar_type(2.0) * VdotH * localH.z - NdotV,
localH.z * (VdotH * rcpEta.value[0] + LdotH) - NdotV * rcpEta.value[0], transmitted);
assert(!hlsl::isnan(NdotL));
// VNDF sampling guarantees that `VdotH` has same sign as `NdotV`
// and `transmitted` controls the sign of `LdotH` relative to `VdotH` by construction (reflect -> same sign, or refract -> opposite sign)
if (hlsl::isnan(NdotL) || ComputeMicrofacetNormal<scalar_type>::isTransmissionPath(NdotV, NdotL) != transmitted)
if (ComputeMicrofacetNormal<scalar_type>::isTransmissionPath(NdotV, NdotL) != transmitted)
{
valid = false;
return sample_type::createInvalid(); // should check if sample direction is invalid
Expand Down Expand Up @@ -307,7 +308,16 @@ struct SCookTorrance
partitionRandVariable.leftProb = reflectance;
bool transmitted = partitionRandVariable(z, rcpChoiceProb);

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);
scalar_type LdotH;
if (transmitted)
{
scalar_type det = rcpEta.value2[0]*VdotH*VdotH + scalar_type(1.0) - rcpEta.value2[0];
if (det < scalar_type(0.0))
return sample_type::createInvalid();
LdotH = ieee754::copySign(hlsl::sqrt(det), -VdotH);
}
else
LdotH = VdotH;
bool valid;
sample_type s = __generate_common(interaction, localH, NdotV, VdotH, LdotH, transmitted, rcpEta, valid);
if (valid)
Expand Down
92 changes: 64 additions & 28 deletions include/nbl/builtin/hlsl/bxdf/fresnel.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,8 @@ struct iridescent_helper
using vector_type = T;

// returns phi, the phase shift for each plane of polarization (p,s)
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)
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)
{
const vector_type cosTheta2 = cosTheta * cosTheta;
const vector_type sinTheta2 = hlsl::promote<vector_type>(1.0) - cosTheta2;
const vector_type ior1_2 = ior1*ior1;
const vector_type ior2_2 = ior2*ior2;
const vector_type iork2_2 = iork2*iork2;
Expand All @@ -523,6 +521,7 @@ struct iridescent_helper
const vector_type a = hlsl::sqrt(a2);
const vector_type b = hlsl::sqrt(b2);

// TODO: very optimizable, especially atan2 usage
phiS = hlsl::atan2(scalar_type(2.0) * ior1 * b * cosTheta, a2 + b2 - ior1_2*cosTheta2);
const vector_type k2_plus_one = hlsl::promote<vector_type>(1.0) + iork2_2;
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),
Expand All @@ -549,37 +548,50 @@ struct iridescent_helper
{
const scalar_type cosTheta_1 = clampedCosTheta;
vector_type R12p, R23p, R12s, R23s;
vector_type cosTheta_2;
vector_type cosTheta_2, cosTheta2_2;
vector<bool,vector_traits<vector_type>::Dimension> notTIR;
{
const vector_type scale = scalar_type(1.0)/eta12;
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;
cosTheta2_2 = hlsl::promote<vector_type>(1.0) - hlsl::promote<vector_type>(scalar_type(1.0)-cosTheta_1*cosTheta_1) * scale * scale;
notTIR = cosTheta2_2 > hlsl::promote<vector_type>(0.0);
cosTheta_2 = hlsl::sqrt(hlsl::max(cosTheta2_2, hlsl::promote<vector_type>(0.0)));
cosTheta_2 = hlsl::mix(hlsl::promote<vector_type>(0.0), hlsl::sqrt(cosTheta2_2), notTIR);
}

if (hlsl::any(notTIR))
NBL_UNROLL for (uint32_t i = 0; i < vector_traits<vector_type>::Dimension; i++)
{
Dielectric<vector_type>::__polarized(eta12 * eta12, hlsl::promote<vector_type>(cosTheta_1), R12p, R12s);

// Reflected part by the base
// if kappa==0, base material is dielectric
NBL_IF_CONSTEXPR(SupportsTransmission)
Dielectric<vector_type>::__polarized(eta23 * eta23, cosTheta_2, R23p, R23s);
// Check for total internal reflection
if (notTIR[i])
{
using monochrome_type = vector<scalar_type, 1>;
monochrome_type p12, s12, p23, s23;
Dielectric<monochrome_type>::__polarized(hlsl::promote<monochrome_type>(eta12[i] * eta12[i]), hlsl::promote<monochrome_type>(cosTheta_1), p12, s12);

const monochrome_type eta23_2 = hlsl::promote<monochrome_type>(eta23[i] * eta23[i]);

// Reflected part by the base
// if kappa==0, base material is dielectric
NBL_IF_CONSTEXPR(SupportsTransmission)
Dielectric<monochrome_type>::__polarized(eta23_2, hlsl::promote<monochrome_type>(cosTheta_2[i]), p23, s23);
else
{
const monochrome_type etaLen2 = eta23_2 + hlsl::promote<monochrome_type>(etak23[i] * etak23[i]);
Conductor<monochrome_type>::__polarized(hlsl::promote<monochrome_type>(eta23[i]), etaLen2, hlsl::promote<monochrome_type>(cosTheta_2[i]), p23, s23);
}

R12p[i] = p12[0];
R12s[i] = s12[0];
R23p[i] = p23[0];
R23s[i] = s23[0];
}
else
{
vector_type etaLen2 = eta23 * eta23 + etak23 * etak23;
Conductor<vector_type>::__polarized(eta23, etaLen2, cosTheta_2, R23p, R23s);
R12s[i] = scalar_type(0.0);
R12p[i] = scalar_type(0.0);
R23s[i] = scalar_type(0.0);
R23p[i] = scalar_type(0.0);
}
}

// Check for total internal reflection
const vector_type notTIRFactor = vector_type(notTIR); // 0 when TIR, 1 otherwise
R12s = R12s * notTIRFactor;
R12p = R12p * notTIRFactor;
R23s = R23s * notTIRFactor;
R23p = R23p * notTIRFactor;

// Compute the transmission coefficients
vector_type T121p = hlsl::promote<vector_type>(1.0) - R12p;
vector_type T121s = hlsl::promote<vector_type>(1.0) - R12s;
Expand All @@ -591,8 +603,18 @@ struct iridescent_helper
vector_type I = hlsl::promote<vector_type>(0.0);

// Evaluate the phase shift
phase_shift(ior1, ior2, hlsl::promote<vector_type>(0.0), hlsl::promote<vector_type>(cosTheta_1), phi21s, phi21p);
phase_shift(ior2, ior3, iork3, cosTheta_2, phi23s, phi23p);
{
const vector_type ct = hlsl::promote<vector_type>(cosTheta_1);
const vector_type ct2 = ct * ct;
const vector_type st2 = hlsl::promote<vector_type>(1.0) - ct2;
phase_shift(ior1, ior2, hlsl::promote<vector_type>(0.0), ct, ct2, st2, phi21s, phi21p);
}
{
const vector_type ct = hlsl::promote<vector_type>(cosTheta_2);
const vector_type ct2 = cosTheta2_2;
const vector_type st2 = hlsl::promote<vector_type>(1.0) - ct2;
phase_shift(ior2, ior3, iork3, ct, ct2, st2, phi23s, phi23p);
}
phi21p = hlsl::promote<vector_type>(numbers::pi<scalar_type>) - phi21p;
phi21s = hlsl::promote<vector_type>(numbers::pi<scalar_type>) - phi21s;

Expand All @@ -613,6 +635,7 @@ struct iridescent_helper
NBL_UNROLL for (int m=1; m<=2; ++m)
{
Cm *= r123p;
// TODO: common subexpression, maybe we can hoist it out somehow?
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));
I += Cm*Sm;
}
Expand Down Expand Up @@ -641,6 +664,13 @@ struct iridescent_base
using scalar_type = typename vector_traits<T>::scalar_type;
using vector_type = T;

template<bool SupportsTransmission, typename Colorspace>
T __call(const vector_type iork3, const vector_type etak23, const scalar_type clampedCosTheta) NBL_CONST_MEMBER_FUNC
{
return impl::iridescent_helper<T,false>::template __call<Colorspace>(D, ior1, ior2, ior3, iork3,
eta12, eta23, etak23, clampedCosTheta);
}

vector_type D;
vector_type ior1;
vector_type ior2;
Expand All @@ -650,6 +680,14 @@ struct iridescent_base
vector_type eta23; // thin-film -> base material IOR
vector_type eta13;
};


// workaround due to DXC bug: github.com/microsoft/DirectXShaderCompiler/issues/5966
template<typename T, bool SupportsTransmission, typename Colorspace>
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)
{
return _this.template __call<SupportsTransmission, Colorspace>(iork3, etak23, clampedCosTheta);
}
}

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

T operator()(const scalar_type clampedCosTheta) NBL_CONST_MEMBER_FUNC
{
return impl::iridescent_helper<T,false>::template __call<Colorspace>(base_type::D, base_type::ior1, base_type::ior2, base_type::ior3, base_type::iork3,
base_type::eta12, base_type::eta23, getEtak23(), clampedCosTheta);
return impl::__iridescent_base__call_const<T, false, Colorspace>(NBL_DEREF_THIS, base_type::iork3, getEtak23(), clampedCosTheta);
}

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

T operator()(const scalar_type clampedCosTheta) NBL_CONST_MEMBER_FUNC
{
return impl::iridescent_helper<T,true>::template __call<Colorspace>(base_type::D, base_type::ior1, base_type::ior2, base_type::ior3, getEtak23(),
base_type::eta12, base_type::eta23, getEtak23(), clampedCosTheta);
return impl::__iridescent_base__call_const<T, true, Colorspace>(NBL_DEREF_THIS, getEtak23(), getEtak23(), clampedCosTheta);
}

scalar_type getRefractionOrientedEta() NBL_CONST_MEMBER_FUNC { return base_type::eta13[0]; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,28 @@ namespace accessors
{
// declare concept
#define NBL_CONCEPT_NAME AnisotropicallySampled
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(int32_t)
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(Dims)
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(int32_t)(int32_t)
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(Dims)(Components)
// not the greatest syntax but works
#define NBL_CONCEPT_PARAM_0 (a,U)
#define NBL_CONCEPT_PARAM_1 (uv,vector<float32_t,Dims>)
#define NBL_CONCEPT_PARAM_2 (layer,uint16_t)
#define NBL_CONCEPT_PARAM_3 (dU,vector<float32_t,Dims>)
#define NBL_CONCEPT_PARAM_4 (dV,vector<float32_t,Dims>)
#define NBL_CONCEPT_PARAM_5 (outVal,vector<float32_t,Components>)
// start concept
NBL_CONCEPT_BEGIN(5)
NBL_CONCEPT_BEGIN(6)
// need to be defined AFTER the cocnept begins
#define a NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0
#define uv NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1
#define layer NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_2
#define dU NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_3
#define dV NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_4
#define outVal NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_5
NBL_CONCEPT_END(
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<Dims>(uv,layer,dU,dV)) , ::nbl::hlsl::is_same_v, float32_t4>))
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<Dims>(outVal,uv,layer,dU,dV)) , ::nbl::hlsl::is_same_v, void))
);
#undef outVal
#undef dV
#undef dU
#undef layer
Expand All @@ -47,4 +50,4 @@ NBL_CONCEPT_END(
}
}
}
#endif
#endif
30 changes: 18 additions & 12 deletions include/nbl/builtin/hlsl/concepts/accessors/loadable_image.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,52 +18,58 @@ namespace accessors
{

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

// declare concept
#define NBL_CONCEPT_NAME LoadableImage
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)(int32_t)
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)(Components)
// not the greatest syntax but works
#define NBL_CONCEPT_PARAM_0 (a,U)
#define NBL_CONCEPT_PARAM_1 (uv,vector<uint16_t,Dims>)
#define NBL_CONCEPT_PARAM_2 (layer,uint16_t)
#define NBL_CONCEPT_PARAM_3 (outVal,vector<T,Components>)
// start concept
NBL_CONCEPT_BEGIN(3)
NBL_CONCEPT_BEGIN(4)
// need to be defined AFTER the concept begins
#define a NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0
#define uv NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1
#define layer NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_2
#define outVal NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_3
NBL_CONCEPT_END(
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<T,Dims>(uv,layer)), ::nbl::hlsl::is_same_v, vector<T,4>))
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<T,Dims>(outVal,uv,layer)), ::nbl::hlsl::is_same_v, void))
);
#undef outVal
#undef layer
#undef uv
#undef a
#include <nbl/builtin/hlsl/concepts/__end.hlsl>

// declare concept
#define NBL_CONCEPT_NAME MipmappedLoadableImage
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)(int32_t)
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)(Components)
// not the greatest syntax but works
#define NBL_CONCEPT_PARAM_0 (a,U)
#define NBL_CONCEPT_PARAM_1 (uv,vector<uint16_t,Dims>)
#define NBL_CONCEPT_PARAM_2 (layer,uint16_t)
#define NBL_CONCEPT_PARAM_3 (level,uint16_t)
#define NBL_CONCEPT_PARAM_4 (outVal,vector<T,Components>)
// start concept
NBL_CONCEPT_BEGIN(4)
NBL_CONCEPT_BEGIN(5)
// need to be defined AFTER the cocnept begins
#define a NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0
#define uv NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1
#define layer NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_2
#define level NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_3
#define outVal NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_4
NBL_CONCEPT_END(
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<T,Dims>(uv,layer,level)) , ::nbl::hlsl::is_same_v, vector<T,4>))
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<T,Dims>(outVal,uv,layer,level)) , ::nbl::hlsl::is_same_v, void))
);
#undef outVal
#undef level
#undef layer
#undef uv
Expand All @@ -73,4 +79,4 @@ NBL_CONCEPT_END(
}
}
}
#endif
#endif
9 changes: 6 additions & 3 deletions include/nbl/builtin/hlsl/concepts/accessors/mip_mapped.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ namespace accessors
#define NBL_CONCEPT_PARAM_1 (uv,vector<float32_t,Dims>)
#define NBL_CONCEPT_PARAM_2 (layer,uint16_t)
#define NBL_CONCEPT_PARAM_3 (level,float)
#define NBL_CONCEPT_PARAM_4 (outVal,float32_t4)
// start concept
NBL_CONCEPT_BEGIN(4)
NBL_CONCEPT_BEGIN(5)
// need to be defined AFTER the cocnept begins
#define a NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0
#define uv NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1
#define layer NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_2
#define level NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_3
#define outVal NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_4
NBL_CONCEPT_END(
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<Dims>(uv,layer,level)) , ::nbl::hlsl::is_same_v, float32_t4>))
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((a.template get<Dims>(outVal,uv,layer,level)) , ::nbl::hlsl::is_same_v, void))
);
#undef outVal
#undef level
#undef layer
#undef uv
Expand All @@ -44,4 +47,4 @@ NBL_CONCEPT_END(
}
}
}
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ namespace accessors
{
// declare concept
#define NBL_CONCEPT_NAME StorableImage
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)(typename)(int32_t)(int32_t)
#define NBL_CONCEPT_TPLT_PRM_NAMES (U)(T)(Dims)(Components)
// not the greatest syntax but works
#define NBL_CONCEPT_PARAM_0 (a,U)
#define NBL_CONCEPT_PARAM_1 (uv,vector<uint16_t,Dims>)
#define NBL_CONCEPT_PARAM_2 (layer,uint16_t)
#define NBL_CONCEPT_PARAM_3 (data,vector<T,4>)
#define NBL_CONCEPT_PARAM_3 (data,vector<T,Components>)
// start concept
NBL_CONCEPT_BEGIN(4)
// need to be defined AFTER the cocnept begins
Expand Down
2 changes: 1 addition & 1 deletion include/nbl/builtin/hlsl/math/functions.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct conditionalAbsOrMax_helper<T NBL_PARTIAL_REQ_BOT(concepts::FloatingPointL

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

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

Expand Down
Loading
Loading