diff --git a/test/bug/bug_ms_vec_static.cpp b/test/bug/bug_ms_vec_static.cpp index aed6e51c..e6ce7d34 100644 --- a/test/bug/bug_ms_vec_static.cpp +++ b/test/bug/bug_ms_vec_static.cpp @@ -17,117 +17,41 @@ enum precision defaultp = highp }; -template -struct is_aligned -{ - static const bool value = false; -}; - -template<> -struct is_aligned -{ - static const bool value = true; -}; - -template<> -struct is_aligned -{ - static const bool value = true; -}; - -template<> -struct is_aligned -{ - static const bool value = true; -}; - template struct vec2; template struct _swizzle_base0 { -protected: - T& elem(size_t i){ return (reinterpret_cast(_buffer))[i]; } - T const& elem(size_t i) const{ return (reinterpret_cast(_buffer))[i]; } - char _buffer[1]; }; -template +template struct _swizzle_base1 : public _swizzle_base0 { }; -template -struct _swizzle_base1 : public _swizzle_base0 +template +struct _swizzle_base1 : public _swizzle_base0 { - vec2 operator ()() const { return vec2(this->elem(E0), this->elem(E1)); } + }; template -struct _swizzle_base2 : public _swizzle_base1::value> +struct _swizzle_base2 : public _swizzle_base1 { - _swizzle_base2& operator= (const T& t) - { - for (int i = 0; i < 2; ++i) - (*this)[i] = t; - return *this; - } - _swizzle_base2& operator= (vec2 const& that) - { - struct op { - void operator() (T& e, T& t) { e = t; } - }; - _apply_op(that, op()); - return *this; - } - - T& operator[](size_t i) - { - const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } - T operator[](size_t i) const - { - const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } - -protected: - template - void _apply_op(vec2 const& that, U op) - { - T t[N]; - for (int i = 0; i < N; ++i) - t[i] = that[i]; - for (int i = 0; i < N; ++i) - op( (*this)[i], t[i] ); - } }; template -struct _swizzle_base2 : public _swizzle_base1::value> +struct _swizzle_base2 : public _swizzle_base1 { - struct Stub {}; - _swizzle_base2& operator= (Stub const &) { return *this; } - - T operator[] (size_t i) const - { - const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } }; template struct _swizzle : public _swizzle_base2 { - typedef _swizzle_base2 base_type; - using base_type::operator=; - - operator vec2 () const { return (*this)(); } }; template @@ -139,21 +63,8 @@ struct vec2 union { - struct{ T x, y; }; - struct{ T r, g; }; - struct{ T s, t; }; + struct { T x, y; }; struct { _swizzle xx; }; - struct { _swizzle xy; }; - struct { _swizzle yy; }; - struct { _swizzle yx; }; - struct { _swizzle rr; }; - struct { _swizzle rg; }; - struct { _swizzle gr; }; - struct { _swizzle gg; }; - struct { _swizzle ss; }; - struct { _swizzle st; }; - struct { _swizzle ts; }; - struct { _swizzle tt; }; }; };