Skip to content

Commit f93772e

Browse files
committed
change ndf type alias macro usage
1 parent 6a0e28d commit f93772e

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "nbl/builtin/hlsl/concepts.hlsl"
88
#include "nbl/builtin/hlsl/bxdf/common.hlsl"
9+
#include <boost/preprocessor/punctuation/remove_parens.hpp>
910

1011
namespace nbl
1112
{
@@ -73,18 +74,15 @@ NBL_CONSTEXPR_STATIC_INLINE bool SupportsTransmission = REFLECT_REFRACT != MTT_R
7374
NBL_CONSTEXPR_STATIC_INLINE BxDFClampMode _clamp = SupportsTransmission ? BxDFClampMode::BCM_ABS : BxDFClampMode::BCM_NONE;\
7475
NBL_HLSL_BXDF_ANISOTROPIC_COND_DECLS(IsAnisotropic);\
7576

76-
// help avoid preprocessor splitting template declarations by comma
77-
#define NBL_HLSL_NDF_SINGLE_ARG(...) __VA_ARGS__
78-
79-
#define NBL_HLSL_NDF_TYPE_ALIASES(N,BASE,DG1_QUERY,G2_QUERY,QUANT_QUERY) using this_t = N;\
77+
#define NBL_HLSL_NDF_TYPE_ALIASES(...) using this_t = BOOST_PP_REMOVE_PARENS(BOOST_PP_SEQ_ELEM(0, __VA_ARGS__));\
8078
using scalar_type = T;\
81-
using base_type = BASE;\
79+
using base_type = BOOST_PP_REMOVE_PARENS(BOOST_PP_SEQ_ELEM(1, __VA_ARGS__));\
8280
using quant_type = SDualMeasureQuant<scalar_type>;\
8381
using vector2_type = vector<T, 2>;\
8482
using vector3_type = vector<T, 3>;\
85-
using dg1_query_type = DG1_QUERY;\
86-
using g2g1_query_type = G2_QUERY;\
87-
using quant_query_type = QUANT_QUERY;\
83+
using dg1_query_type = BOOST_PP_REMOVE_PARENS(BOOST_PP_SEQ_ELEM(2, __VA_ARGS__));\
84+
using g2g1_query_type = BOOST_PP_REMOVE_PARENS(BOOST_PP_SEQ_ELEM(3, __VA_ARGS__));\
85+
using quant_query_type = BOOST_PP_REMOVE_PARENS(BOOST_PP_SEQ_ELEM(4, __VA_ARGS__));\
8886

8987
}
9088
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ template<typename T, bool _IsAnisotropic, MicrofacetTransformTypes reflect_refra
231231
struct Beckmann
232232
{
233233
NBL_HLSL_NDF_CONSTEXPR_DECLS(_IsAnisotropic,reflect_refract);
234-
NBL_HLSL_NDF_TYPE_ALIASES(NBL_HLSL_NDF_SINGLE_ARG(Beckmann<T,IsAnisotropic,SupportedPaths>), NBL_HLSL_NDF_SINGLE_ARG(impl::BeckmannCommon<T,IsAnisotropic>), impl::SBeckmannDG1Query<scalar_type>, impl::SBeckmannG2overG1Query<scalar_type>, DualMeasureQuantQuery<scalar_type>);
234+
NBL_HLSL_NDF_TYPE_ALIASES(((Beckmann<T,IsAnisotropic,SupportedPaths>))((impl::BeckmannCommon<T,IsAnisotropic>))((impl::SBeckmannDG1Query<scalar_type>))((impl::SBeckmannG2overG1Query<scalar_type>))((DualMeasureQuantQuery<scalar_type>)));
235235

236236
template<typename C=bool_constant<!IsAnisotropic> >
237237
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
@@ -175,7 +175,7 @@ template<typename T, bool _IsAnisotropic, MicrofacetTransformTypes reflect_refra
175175
struct GGX
176176
{
177177
NBL_HLSL_NDF_CONSTEXPR_DECLS(_IsAnisotropic,reflect_refract);
178-
NBL_HLSL_NDF_TYPE_ALIASES(NBL_HLSL_NDF_SINGLE_ARG(GGX<T,IsAnisotropic,SupportedPaths>), NBL_HLSL_NDF_SINGLE_ARG(impl::GGXCommon<T,SupportsTransmission,IsAnisotropic>), impl::SGGXDG1Query<scalar_type>, impl::SGGXG2XQuery<scalar_type>, DualMeasureQuantQuery<scalar_type>);
178+
NBL_HLSL_NDF_TYPE_ALIASES(((GGX<T,IsAnisotropic,SupportedPaths>))((impl::GGXCommon<T,SupportsTransmission,IsAnisotropic>))((impl::SGGXDG1Query<scalar_type>))((impl::SGGXG2XQuery<scalar_type>))((DualMeasureQuantQuery<scalar_type>)));
179179

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

0 commit comments

Comments
 (0)