I would like to achieve the following but I can't get it right:
struct SamplerState
{
int i;
};
#define SAMPLER_TYPE Point
#define SAMPLER_MODE_U ClampU
#define SAMPLER_MODE_V ClampV
#define SAMPLER_NAME( a, b, c ) ( ##a ##_ ##b ##_ ##c)
#define SAMPLER SamplerState SAMPLER_NAME(SAMPLER_TYPE, SAMPLER_MODE_U, SAMPLER_MODE_V)
int main()
{
SAMPLER = {};
}
I expect the name of SAMPLER
to be Point_ClampU_ClampV
but it isn't when debugging, it is SAMPLER_TYPE_SAMPLER_MODE_U_SAMPLER_MODE_V
instead:
Question:
How can I achieve that, if possible at all?
(
with a
in (##a
. No need to tho.a
, b
and c
expand.struct SamplerState
{
int i;
};
#define SAMPLER_TYPE Point
#define SAMPLER_MODE_U ClampU
#define SAMPLER_MODE_V ClampV
#define SAMPLER_NAME_IN(a, b, c) ( a##_ ##b##_##c )
#define SAMPLER_NAME(a, b, c) SAMPLER_NAME_IN(a, b, c)
#define SAMPLER SamplerState SAMPLER_NAME(SAMPLER_TYPE, SAMPLER_MODE_U, SAMPLER_MODE_V)
int main()
{
SAMPLER = {};
}