Skip to content

Commit

Permalink
Modify fallback macros to make them more intellisense friendly
Browse files Browse the repository at this point in the history
The macros are uglier but it's all hidden away and it's for the better
  • Loading branch information
redorav committed Apr 21, 2021
1 parent c6a645f commit 0f76921
Show file tree
Hide file tree
Showing 33 changed files with 6,764 additions and 6,770 deletions.
14 changes: 4 additions & 10 deletions include/hlsl++.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,12 @@

#endif

#define hlslpp_unpack(...) __VA_ARGS__

#if defined(_MSC_VER) && _MSC_VER < 1900
#define hlslpp_declare_swizzle1(S, X, name) struct { S<X> name; }
#define hlslpp_declare_swizzle2(S, X, Y, name) struct { S<X, Y> name; }
#define hlslpp_declare_swizzle3(S, X, Y, Z, name) struct { S<X, Y, Z> name; }
#define hlslpp_declare_swizzle4(S, X, Y, Z, W, name) struct { S<X, Y, Z, W> name; }
#define hlslpp_swizzle_start struct {
#define hlslpp_swizzle_end };
#else
#define hlslpp_declare_swizzle1(S, X, name) S<X> name
#define hlslpp_declare_swizzle2(S, X, Y, name) S<X, Y> name
#define hlslpp_declare_swizzle3(S, X, Y, Z, name) S<X, Y, Z> name
#define hlslpp_declare_swizzle4(S, X, Y, Z, W, name) S<X, Y, Z, W> name
#define hlslpp_swizzle_start
#define hlslpp_swizzle_end
#endif

#define HLSLPP_SHUFFLE_MASK(X, Y, Z, W) (((W) << 6) | ((Z) << 4) | ((Y) << 2) | (X))
Expand Down
16 changes: 8 additions & 8 deletions include/swizzle/hlsl++_matrix_row0_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
// _mNM
// -------------------------------

hlslpp_declare_swizzle1(swizzle1, 0, _m00);
hlslpp_declare_swizzle2(swizzle2, 0, 0, _m00_m00);
hlslpp_declare_swizzle3(swizzle3, 0, 0, 0, _m00_m00_m00);
hlslpp_declare_swizzle4(swizzle4, 0, 0, 0, 0, _m00_m00_m00_m00);
hlslpp_swizzle_start swizzle1<0> _m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle2<0, 0> _m00_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<0, 0, 0> _m00_m00_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<0, 0, 0, 0> _m00_m00_m00_m00; hlslpp_swizzle_end

// -------------------------------
// _NM
// -------------------------------

hlslpp_declare_swizzle1(swizzle1, 0, _11);
hlslpp_declare_swizzle2(swizzle2, 0, 0, _11_11);
hlslpp_declare_swizzle3(swizzle3, 0, 0, 0, _11_11_11);
hlslpp_declare_swizzle4(swizzle4, 0, 0, 0, 0, _11_11_11_11);
hlslpp_swizzle_start swizzle1<0> _11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle2<0, 0> _11_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<0, 0, 0> _11_11_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<0, 0, 0, 0> _11_11_11_11; hlslpp_swizzle_end
104 changes: 52 additions & 52 deletions include/swizzle/hlsl++_matrix_row0_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,82 +2,82 @@
// _mNM
// -------------------------------

hlslpp_declare_swizzle1(swizzle1, 1, _m01);
hlslpp_swizzle_start swizzle1<1> _m01; hlslpp_swizzle_end

hlslpp_declare_swizzle2(swizzle2, 0, 1, _m00_m01);
hlslpp_declare_swizzle2(swizzle2, 1, 0, _m01_m00);
hlslpp_declare_swizzle2(swizzle2, 1, 1, _m01_m01);
hlslpp_swizzle_start swizzle2<0, 1> _m00_m01; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle2<1, 0> _m01_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle2<1, 1> _m01_m01; hlslpp_swizzle_end

hlslpp_declare_swizzle3(swizzle3, 0, 0, 1, _m00_m00_m01);
hlslpp_declare_swizzle3(swizzle3, 0, 1, 0, _m00_m01_m00);
hlslpp_declare_swizzle3(swizzle3, 0, 1, 1, _m00_m01_m01);
hlslpp_swizzle_start swizzle3<0, 0, 1> _m00_m00_m01; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<0, 1, 0> _m00_m01_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<0, 1, 1> _m00_m01_m01; hlslpp_swizzle_end

hlslpp_declare_swizzle3(swizzle3, 1, 0, 0, _m01_m00_m00);
hlslpp_declare_swizzle3(swizzle3, 1, 0, 1, _m01_m00_m01);
hlslpp_declare_swizzle3(swizzle3, 1, 1, 0, _m01_m01_m00);
hlslpp_declare_swizzle3(swizzle3, 1, 1, 1, _m01_m01_m01);
hlslpp_swizzle_start swizzle3<1, 0, 0> _m01_m00_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<1, 0, 1> _m01_m00_m01; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<1, 1, 0> _m01_m01_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<1, 1, 1> _m01_m01_m01; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 0, 0, 0, 1, _m00_m00_m00_m01);
hlslpp_swizzle_start swizzle4<0, 0, 0, 1> _m00_m00_m00_m01; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 0, 0, 1, 0, _m00_m00_m01_m00);
hlslpp_declare_swizzle4(swizzle4, 0, 0, 1, 1, _m00_m00_m01_m01);
hlslpp_swizzle_start swizzle4<0, 0, 1, 0> _m00_m00_m01_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<0, 0, 1, 1> _m00_m00_m01_m01; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 0, 1, 0, 0, _m00_m01_m00_m00);
hlslpp_declare_swizzle4(swizzle4, 0, 1, 0, 1, _m00_m01_m00_m01);
hlslpp_swizzle_start swizzle4<0, 1, 0, 0> _m00_m01_m00_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<0, 1, 0, 1> _m00_m01_m00_m01; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 0, 1, 1, 0, _m00_m01_m01_m00);
hlslpp_declare_swizzle4(swizzle4, 0, 1, 1, 1, _m00_m01_m01_m01);
hlslpp_swizzle_start swizzle4<0, 1, 1, 0> _m00_m01_m01_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<0, 1, 1, 1> _m00_m01_m01_m01; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 1, 0, 0, 0, _m01_m00_m00_m00);
hlslpp_declare_swizzle4(swizzle4, 1, 0, 0, 1, _m01_m00_m00_m01);
hlslpp_swizzle_start swizzle4<1, 0, 0, 0> _m01_m00_m00_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<1, 0, 0, 1> _m01_m00_m00_m01; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 1, 0, 1, 0, _m01_m00_m01_m00);
hlslpp_declare_swizzle4(swizzle4, 1, 0, 1, 1, _m01_m00_m01_m01);
hlslpp_swizzle_start swizzle4<1, 0, 1, 0> _m01_m00_m01_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<1, 0, 1, 1> _m01_m00_m01_m01; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 1, 1, 0, 0, _m01_m01_m00_m00);
hlslpp_declare_swizzle4(swizzle4, 1, 1, 0, 1, _m01_m01_m00_m01);
hlslpp_swizzle_start swizzle4<1, 1, 0, 0> _m01_m01_m00_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<1, 1, 0, 1> _m01_m01_m00_m01; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 1, 1, 1, 0, _m01_m01_m01_m00);
hlslpp_declare_swizzle4(swizzle4, 1, 1, 1, 1, _m01_m01_m01_m01);
hlslpp_swizzle_start swizzle4<1, 1, 1, 0> _m01_m01_m01_m00; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<1, 1, 1, 1> _m01_m01_m01_m01; hlslpp_swizzle_end

// -------------------------------
// _NM
// -------------------------------

hlslpp_declare_swizzle1(swizzle1, 1, _12);
hlslpp_swizzle_start swizzle1<1> _12; hlslpp_swizzle_end

hlslpp_declare_swizzle2(swizzle2, 0, 1, _11_12);
hlslpp_declare_swizzle2(swizzle2, 1, 0, _12_11);
hlslpp_declare_swizzle2(swizzle2, 1, 1, _12_12);
hlslpp_swizzle_start swizzle2<0, 1> _11_12; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle2<1, 0> _12_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle2<1, 1> _12_12; hlslpp_swizzle_end

hlslpp_declare_swizzle3(swizzle3, 0, 0, 1, _11_11_12);
hlslpp_declare_swizzle3(swizzle3, 0, 1, 0, _11_12_11);
hlslpp_declare_swizzle3(swizzle3, 0, 1, 1, _11_12_12);
hlslpp_swizzle_start swizzle3<0, 0, 1> _11_11_12; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<0, 1, 0> _11_12_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<0, 1, 1> _11_12_12; hlslpp_swizzle_end

hlslpp_declare_swizzle3(swizzle3, 1, 0, 0, _12_11_11);
hlslpp_declare_swizzle3(swizzle3, 1, 0, 1, _12_11_12);
hlslpp_declare_swizzle3(swizzle3, 1, 1, 0, _12_12_11);
hlslpp_declare_swizzle3(swizzle3, 1, 1, 1, _12_12_12);
hlslpp_swizzle_start swizzle3<1, 0, 0> _12_11_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<1, 0, 1> _12_11_12; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<1, 1, 0> _12_12_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle3<1, 1, 1> _12_12_12; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 0, 0, 0, 1, _11_11_11_12);
hlslpp_swizzle_start swizzle4<0, 0, 0, 1> _11_11_11_12; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 0, 0, 1, 0, _11_11_12_11);
hlslpp_declare_swizzle4(swizzle4, 0, 0, 1, 1, _11_11_12_12);
hlslpp_swizzle_start swizzle4<0, 0, 1, 0> _11_11_12_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<0, 0, 1, 1> _11_11_12_12; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 0, 1, 0, 0, _11_12_11_11);
hlslpp_declare_swizzle4(swizzle4, 0, 1, 0, 1, _11_12_11_12);
hlslpp_swizzle_start swizzle4<0, 1, 0, 0> _11_12_11_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<0, 1, 0, 1> _11_12_11_12; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 0, 1, 1, 0, _11_12_12_11);
hlslpp_declare_swizzle4(swizzle4, 0, 1, 1, 1, _11_12_12_12);
hlslpp_swizzle_start swizzle4<0, 1, 1, 0> _11_12_12_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<0, 1, 1, 1> _11_12_12_12; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 1, 0, 0, 0, _12_11_11_11);
hlslpp_declare_swizzle4(swizzle4, 1, 0, 0, 1, _12_11_11_12);
hlslpp_swizzle_start swizzle4<1, 0, 0, 0> _12_11_11_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<1, 0, 0, 1> _12_11_11_12; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 1, 0, 1, 0, _12_11_12_11);
hlslpp_declare_swizzle4(swizzle4, 1, 0, 1, 1, _12_11_12_12);
hlslpp_swizzle_start swizzle4<1, 0, 1, 0> _12_11_12_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<1, 0, 1, 1> _12_11_12_12; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 1, 1, 0, 0, _12_12_11_11);
hlslpp_declare_swizzle4(swizzle4, 1, 1, 0, 1, _12_12_11_12);
hlslpp_swizzle_start swizzle4<1, 1, 0, 0> _12_12_11_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<1, 1, 0, 1> _12_12_11_12; hlslpp_swizzle_end

hlslpp_declare_swizzle4(swizzle4, 1, 1, 1, 0, _12_12_12_11);
hlslpp_declare_swizzle4(swizzle4, 1, 1, 1, 1, _12_12_12_12);
hlslpp_swizzle_start swizzle4<1, 1, 1, 0> _12_12_12_11; hlslpp_swizzle_end
hlslpp_swizzle_start swizzle4<1, 1, 1, 1> _12_12_12_12; hlslpp_swizzle_end
Loading

0 comments on commit 0f76921

Please sign in to comment.