Skip to content

Commit 97e5ce3

Browse files
committed
moved out quant query, adjusted ndf macro usage
1 parent 7aa071b commit 97e5ce3

File tree

4 files changed

+18
-21
lines changed

4 files changed

+18
-21
lines changed

include/nbl/builtin/hlsl/bxdf/ndf.hlsl

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,6 @@ namespace bxdf
1616
namespace ndf
1717
{
1818

19-
namespace impl
20-
{
21-
template<typename T>
22-
struct NDFQuantQuery
23-
{
24-
using scalar_type = T;
25-
26-
scalar_type getVdotHLdotH() NBL_CONST_MEMBER_FUNC { return VdotHLdotH; }
27-
scalar_type getVdotH_etaLdotH() NBL_CONST_MEMBER_FUNC { return VdotH_etaLdotH; }
28-
29-
scalar_type VdotHLdotH;
30-
scalar_type VdotH_etaLdotH;
31-
};
32-
}
33-
3419
namespace dummy_impl
3520
{
3621
using sample_t = SLightSample<ray_dir_info::SBasic<float> >;
@@ -89,15 +74,15 @@ NBL_CONSTEXPR_STATIC_INLINE bool RequiredMicrofacetCache = IsAnisotropic ? Aniso
8974
// help avoid preprocessor splitting template declarations by comma
9075
#define SINGLE_ARG(...) __VA_ARGS__
9176

92-
#define NDF_TYPE_ALIASES(N,BASE,DG1_QUERY,G2_QUERY) using this_t = N;\
77+
#define NDF_TYPE_ALIASES(N,BASE,DG1_QUERY,G2_QUERY,QUANT_QUERY) using this_t = N;\
9378
using scalar_type = T;\
9479
using base_type = BASE;\
9580
using quant_type = SDualMeasureQuant<scalar_type>;\
9681
using vector2_type = vector<T, 2>;\
9782
using vector3_type = vector<T, 3>;\
98-
using dg1_query_type = DG1_QUERY<scalar_type>;\
99-
using g2g1_query_type = G2_QUERY<scalar_type>;\
100-
using quant_query_type = impl::NDFQuantQuery<scalar_type>;\
83+
using dg1_query_type = DG1_QUERY;\
84+
using g2g1_query_type = G2_QUERY;\
85+
using quant_query_type = QUANT_QUERY;\
10186

10287
}
10388
}

include/nbl/builtin/hlsl/bxdf/ndf/beckmann.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ template<typename T, bool _IsAnisotropic, MicrofacetTransformTypes reflect_refra
299299
struct Beckmann
300300
{
301301
NDF_CONSTEXPR_DECLS(_IsAnisotropic,reflect_refract);
302-
NDF_TYPE_ALIASES(SINGLE_ARG(Beckmann<T,IsAnisotropic,SupportedPaths>), SINGLE_ARG(impl::BeckmannCommon<T,IsAnisotropic>), impl::SBeckmannDG1Query, impl::SBeckmannG2overG1Query);
302+
NDF_TYPE_ALIASES(SINGLE_ARG(Beckmann<T,IsAnisotropic,SupportedPaths>), SINGLE_ARG(impl::BeckmannCommon<T,IsAnisotropic>), impl::SBeckmannDG1Query<scalar_type>, impl::SBeckmannG2overG1Query<scalar_type>, DualMeasureQuantQuery<scalar_type>);
303303

304304
template<typename C=bool_constant<!IsAnisotropic> >
305305
static enable_if_t<C::value && !IsAnisotropic, this_t> create(scalar_type A)

include/nbl/builtin/hlsl/bxdf/ndf/ggx.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ template<typename T, bool _IsAnisotropic, MicrofacetTransformTypes reflect_refra
279279
struct GGX
280280
{
281281
NDF_CONSTEXPR_DECLS(_IsAnisotropic,reflect_refract);
282-
NDF_TYPE_ALIASES(SINGLE_ARG(GGX<T,IsAnisotropic,SupportedPaths>), SINGLE_ARG(impl::GGXCommon<T,SupportsTransmission,IsAnisotropic>), impl::SGGXDG1Query, impl::SGGXG2XQuery);
282+
NDF_TYPE_ALIASES(SINGLE_ARG(GGX<T,IsAnisotropic,SupportedPaths>), SINGLE_ARG(impl::GGXCommon<T,SupportsTransmission,IsAnisotropic>), impl::SGGXDG1Query<scalar_type>, impl::SGGXG2XQuery<scalar_type>, DualMeasureQuantQuery<scalar_type>);
283283

284284
template<typename C=bool_constant<!IsAnisotropic> >
285285
static enable_if_t<C::value && !IsAnisotropic, this_t> create(scalar_type A)

include/nbl/builtin/hlsl/bxdf/ndf/microfacet_to_light_transform.hlsl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ enum MicrofacetTransformTypes : uint16_t
2323
MTT_REFLECT_REFRACT = 0b11
2424
};
2525

26+
template<typename T>
27+
struct DualMeasureQuantQuery
28+
{
29+
using scalar_type = T;
30+
31+
scalar_type getVdotHLdotH() NBL_CONST_MEMBER_FUNC { return VdotHLdotH; }
32+
scalar_type getVdotH_etaLdotH() NBL_CONST_MEMBER_FUNC { return VdotH_etaLdotH; }
33+
34+
scalar_type VdotHLdotH;
35+
scalar_type VdotH_etaLdotH;
36+
};
37+
2638

2739
template<typename T>
2840
struct SDualMeasureQuant

0 commit comments

Comments
 (0)