Commit a25311ad by Nicolas Capens

Refactor Reactor type constructors.

Provide default constructors for each type, and initialize the swizzle parent in a less bug prone manner. Change-Id: Ia7f406a66274c7b1737cbe82db733e2e3ab65175 Reviewed-on: https://swiftshader-review.googlesource.com/8453Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 0133d0f5
...@@ -814,10 +814,6 @@ namespace sw ...@@ -814,10 +814,6 @@ namespace sw
storeValue(argument.value); storeValue(argument.value);
} }
Bool::Bool()
{
}
Bool::Bool(bool x) Bool::Bool(bool x)
{ {
storeValue(Nucleus::createConstantBool(x)); storeValue(Nucleus::createConstantBool(x));
...@@ -909,10 +905,6 @@ namespace sw ...@@ -909,10 +905,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
Byte::Byte()
{
}
Byte::Byte(int x) Byte::Byte(int x)
{ {
storeValue(Nucleus::createConstantByte((unsigned char)x)); storeValue(Nucleus::createConstantByte((unsigned char)x));
...@@ -1168,10 +1160,6 @@ namespace sw ...@@ -1168,10 +1160,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
SByte::SByte()
{
}
SByte::SByte(signed char x) SByte::SByte(signed char x)
{ {
storeValue(Nucleus::createConstantByte(x)); storeValue(Nucleus::createConstantByte(x));
...@@ -1415,10 +1403,6 @@ namespace sw ...@@ -1415,10 +1403,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
Short::Short()
{
}
Short::Short(short x) Short::Short(short x)
{ {
storeValue(Nucleus::createConstantShort(x)); storeValue(Nucleus::createConstantShort(x));
...@@ -1669,10 +1653,6 @@ namespace sw ...@@ -1669,10 +1653,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
UShort::UShort()
{
}
UShort::UShort(unsigned short x) UShort::UShort(unsigned short x)
{ {
storeValue(Nucleus::createConstantShort(x)); storeValue(Nucleus::createConstantShort(x));
...@@ -1906,15 +1886,11 @@ namespace sw ...@@ -1906,15 +1886,11 @@ namespace sw
Byte4::Byte4(RValue<Byte8> cast) Byte4::Byte4(RValue<Byte8> cast)
{ {
// xyzw.parent = this;
storeValue(Nucleus::createTrunc(Nucleus::createBitCast(cast.value, Long::getType()), Int::getType())); storeValue(Nucleus::createTrunc(Nucleus::createBitCast(cast.value, Long::getType()), Int::getType()));
} }
Byte4::Byte4(const Reference<Byte4> &rhs) Byte4::Byte4(const Reference<Byte4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -1937,15 +1913,8 @@ namespace sw ...@@ -1937,15 +1913,8 @@ namespace sw
#endif #endif
} }
Byte8::Byte8()
{
// xyzw.parent = this;
}
Byte8::Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7) Byte8::Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
{ {
// xyzw.parent = this;
int64_t constantVector[8] = {x0, x1, x2, x3, x4, x5, x6, x7}; int64_t constantVector[8] = {x0, x1, x2, x3, x4, x5, x6, x7};
Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(Byte::getType(), 8)))); Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(Byte::getType(), 8))));
...@@ -1954,23 +1923,17 @@ namespace sw ...@@ -1954,23 +1923,17 @@ namespace sw
Byte8::Byte8(RValue<Byte8> rhs) Byte8::Byte8(RValue<Byte8> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Byte8::Byte8(const Byte8 &rhs) Byte8::Byte8(const Byte8 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Byte8::Byte8(const Reference<Byte8> &rhs) Byte8::Byte8(const Reference<Byte8> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -2230,15 +2193,8 @@ namespace sw ...@@ -2230,15 +2193,8 @@ namespace sw
} }
} }
SByte8::SByte8()
{
// xyzw.parent = this;
}
SByte8::SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7) SByte8::SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
{ {
// xyzw.parent = this;
int64_t constantVector[8] = {x0, x1, x2, x3, x4, x5, x6, x7}; int64_t constantVector[8] = {x0, x1, x2, x3, x4, x5, x6, x7};
Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(SByte::getType(), 8)))); Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(SByte::getType(), 8))));
...@@ -2247,23 +2203,17 @@ namespace sw ...@@ -2247,23 +2203,17 @@ namespace sw
SByte8::SByte8(RValue<SByte8> rhs) SByte8::SByte8(RValue<SByte8> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
SByte8::SByte8(const SByte8 &rhs) SByte8::SByte8(const SByte8 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
SByte8::SByte8(const Reference<SByte8> &rhs) SByte8::SByte8(const Reference<SByte8> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -2496,23 +2446,17 @@ namespace sw ...@@ -2496,23 +2446,17 @@ namespace sw
Byte16::Byte16(RValue<Byte16> rhs) Byte16::Byte16(RValue<Byte16> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Byte16::Byte16(const Byte16 &rhs) Byte16::Byte16(const Byte16 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Byte16::Byte16(const Reference<Byte16> &rhs) Byte16::Byte16(const Reference<Byte16> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -2644,15 +2588,8 @@ namespace sw ...@@ -2644,15 +2588,8 @@ namespace sw
storeValue(As<Short4>(Int2(v4i32)).value); storeValue(As<Short4>(Int2(v4i32)).value);
} }
Short4::Short4()
{
// xyzw.parent = this;
}
Short4::Short4(short xyzw) Short4::Short4(short xyzw)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw}; int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw};
Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(Short::getType(), 4)))); Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(Short::getType(), 4))));
...@@ -2661,8 +2598,6 @@ namespace sw ...@@ -2661,8 +2598,6 @@ namespace sw
Short4::Short4(short x, short y, short z, short w) Short4::Short4(short x, short y, short z, short w)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {x, y, z, w}; int64_t constantVector[4] = {x, y, z, w};
Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(Short::getType(), 4)))); Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(Short::getType(), 4))));
...@@ -2671,45 +2606,33 @@ namespace sw ...@@ -2671,45 +2606,33 @@ namespace sw
Short4::Short4(RValue<Short4> rhs) Short4::Short4(RValue<Short4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Short4::Short4(const Short4 &rhs) Short4::Short4(const Short4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Short4::Short4(const Reference<Short4> &rhs) Short4::Short4(const Reference<Short4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Short4::Short4(RValue<UShort4> rhs) Short4::Short4(RValue<UShort4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Short4::Short4(const UShort4 &rhs) Short4::Short4(const UShort4 &rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.loadValue()); storeValue(rhs.loadValue());
} }
Short4::Short4(const Reference<UShort4> &rhs) Short4::Short4(const Reference<UShort4> &rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.loadValue()); storeValue(rhs.loadValue());
} }
...@@ -3102,15 +3025,8 @@ namespace sw ...@@ -3102,15 +3025,8 @@ namespace sw
} }
} }
UShort4::UShort4()
{
// xyzw.parent = this;
}
UShort4::UShort4(unsigned short xyzw) UShort4::UShort4(unsigned short xyzw)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw}; int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw};
Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(UShort::getType(), 4)))); Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(UShort::getType(), 4))));
...@@ -3119,8 +3035,6 @@ namespace sw ...@@ -3119,8 +3035,6 @@ namespace sw
UShort4::UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w) UShort4::UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {x, y, z, w}; int64_t constantVector[4] = {x, y, z, w};
Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(UShort::getType(), 4)))); Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(UShort::getType(), 4))));
...@@ -3129,46 +3043,34 @@ namespace sw ...@@ -3129,46 +3043,34 @@ namespace sw
UShort4::UShort4(RValue<UShort4> rhs) UShort4::UShort4(RValue<UShort4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
UShort4::UShort4(const UShort4 &rhs) UShort4::UShort4(const UShort4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UShort4::UShort4(const Reference<UShort4> &rhs) UShort4::UShort4(const Reference<UShort4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UShort4::UShort4(RValue<Short4> rhs) UShort4::UShort4(RValue<Short4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
UShort4::UShort4(const Short4 &rhs) UShort4::UShort4(const Short4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UShort4::UShort4(const Reference<Short4> &rhs) UShort4::UShort4(const Reference<Short4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -3631,10 +3533,6 @@ namespace sw ...@@ -3631,10 +3533,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
Int::Int()
{
}
Int::Int(int x) Int::Int(int x)
{ {
storeValue(Nucleus::createConstantInt(x)); storeValue(Nucleus::createConstantInt(x));
...@@ -3947,10 +3845,6 @@ namespace sw ...@@ -3947,10 +3845,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
Long::Long()
{
}
Long::Long(RValue<Long> rhs) Long::Long(RValue<Long> rhs)
{ {
storeValue(rhs.value); storeValue(rhs.value);
...@@ -4052,10 +3946,6 @@ namespace sw ...@@ -4052,10 +3946,6 @@ namespace sw
Int(cast))).value); Int(cast))).value);
} }
UInt::UInt()
{
}
UInt::UInt(int x) UInt::UInt(int x)
{ {
storeValue(Nucleus::createConstantInt(x)); storeValue(Nucleus::createConstantInt(x));
...@@ -4379,15 +4269,8 @@ namespace sw ...@@ -4379,15 +4269,8 @@ namespace sw
storeValue(int2); storeValue(int2);
} }
Int2::Int2()
{
// xy.parent = this;
}
Int2::Int2(int x, int y) Int2::Int2(int x, int y)
{ {
// xy.parent = this;
int64_t constantVector[2] = {x, y}; int64_t constantVector[2] = {x, y};
Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(Int::getType(), 2)))); Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(Int::getType(), 2))));
...@@ -4396,23 +4279,17 @@ namespace sw ...@@ -4396,23 +4279,17 @@ namespace sw
Int2::Int2(RValue<Int2> rhs) Int2::Int2(RValue<Int2> rhs)
{ {
// xy.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Int2::Int2(const Int2 &rhs) Int2::Int2(const Int2 &rhs)
{ {
// xy.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Int2::Int2(const Reference<Int2> &rhs) Int2::Int2(const Reference<Int2> &rhs)
{ {
// xy.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -4693,15 +4570,8 @@ namespace sw ...@@ -4693,15 +4570,8 @@ namespace sw
} }
} }
UInt2::UInt2()
{
// xy.parent = this;
}
UInt2::UInt2(unsigned int x, unsigned int y) UInt2::UInt2(unsigned int x, unsigned int y)
{ {
// xy.parent = this;
int64_t constantVector[2] = {x, y}; int64_t constantVector[2] = {x, y};
Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(UInt::getType(), 2)))); Value *vector = V(Nucleus::createConstantVector(constantVector, T(VectorType::get(UInt::getType(), 2))));
...@@ -4710,23 +4580,17 @@ namespace sw ...@@ -4710,23 +4580,17 @@ namespace sw
UInt2::UInt2(RValue<UInt2> rhs) UInt2::UInt2(RValue<UInt2> rhs)
{ {
// xy.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
UInt2::UInt2(const UInt2 &rhs) UInt2::UInt2(const UInt2 &rhs)
{ {
// xy.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UInt2::UInt2(const Reference<UInt2> &rhs) UInt2::UInt2(const Reference<UInt2> &rhs)
{ {
// xy.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -4984,8 +4848,6 @@ namespace sw ...@@ -4984,8 +4848,6 @@ namespace sw
Int4::Int4(RValue<Float4> cast) Int4::Int4(RValue<Float4> cast)
{ {
// xyzw.parent = this;
Value *xyzw = Nucleus::createFPToSI(cast.value, Int4::getType()); Value *xyzw = Nucleus::createFPToSI(cast.value, Int4::getType());
storeValue(xyzw); storeValue(xyzw);
...@@ -5041,11 +4903,6 @@ namespace sw ...@@ -5041,11 +4903,6 @@ namespace sw
} }
} }
Int4::Int4()
{
// xyzw.parent = this;
}
Int4::Int4(int xyzw) Int4::Int4(int xyzw)
{ {
constant(xyzw, xyzw, xyzw, xyzw); constant(xyzw, xyzw, xyzw, xyzw);
...@@ -5068,62 +4925,46 @@ namespace sw ...@@ -5068,62 +4925,46 @@ namespace sw
void Int4::constant(int x, int y, int z, int w) void Int4::constant(int x, int y, int z, int w)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {x, y, z, w}; int64_t constantVector[4] = {x, y, z, w};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
Int4::Int4(RValue<Int4> rhs) Int4::Int4(RValue<Int4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Int4::Int4(const Int4 &rhs) Int4::Int4(const Int4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Int4::Int4(const Reference<Int4> &rhs) Int4::Int4(const Reference<Int4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Int4::Int4(RValue<UInt4> rhs) Int4::Int4(RValue<UInt4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Int4::Int4(const UInt4 &rhs) Int4::Int4(const UInt4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Int4::Int4(const Reference<UInt4> &rhs) Int4::Int4(const Reference<UInt4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Int4::Int4(RValue<Int2> lo, RValue<Int2> hi) Int4::Int4(RValue<Int2> lo, RValue<Int2> hi)
{ {
// xyzw.parent = this;
Value *loLong = Nucleus::createBitCast(lo.value, Long::getType()); Value *loLong = Nucleus::createBitCast(lo.value, Long::getType());
Value *hiLong = Nucleus::createBitCast(hi.value, Long::getType()); Value *hiLong = Nucleus::createBitCast(hi.value, Long::getType());
...@@ -5137,8 +4978,6 @@ namespace sw ...@@ -5137,8 +4978,6 @@ namespace sw
Int4::Int4(RValue<Int> rhs) Int4::Int4(RValue<Int> rhs)
{ {
// xyzw.parent = this;
Value *vector = loadValue(); Value *vector = loadValue();
Value *insert = Nucleus::createInsertElement(vector, rhs.value, 0); Value *insert = Nucleus::createInsertElement(vector, rhs.value, 0);
...@@ -5150,15 +4989,11 @@ namespace sw ...@@ -5150,15 +4989,11 @@ namespace sw
Int4::Int4(const Int &rhs) Int4::Int4(const Int &rhs)
{ {
// xyzw.parent = this;
*this = RValue<Int>(rhs.loadValue()); *this = RValue<Int>(rhs.loadValue());
} }
Int4::Int4(const Reference<Int> &rhs) Int4::Int4(const Reference<Int> &rhs)
{ {
// xyzw.parent = this;
*this = RValue<Int>(rhs.loadValue()); *this = RValue<Int>(rhs.loadValue());
} }
...@@ -5412,8 +5247,6 @@ namespace sw ...@@ -5412,8 +5247,6 @@ namespace sw
UInt4::UInt4(RValue<Float4> cast) UInt4::UInt4(RValue<Float4> cast)
{ {
// xyzw.parent = this;
// Note: createFPToUI is broken, must perform conversion using createFPtoSI // Note: createFPToUI is broken, must perform conversion using createFPtoSI
// Value *xyzw = Nucleus::createFPToUI(cast.value, UInt4::getType()); // Value *xyzw = Nucleus::createFPToUI(cast.value, UInt4::getType());
...@@ -5431,11 +5264,6 @@ namespace sw ...@@ -5431,11 +5264,6 @@ namespace sw
storeValue((~(As<Int4>(cast) >> 31) & uiValue).value); storeValue((~(As<Int4>(cast) >> 31) & uiValue).value);
} }
UInt4::UInt4()
{
// xyzw.parent = this;
}
UInt4::UInt4(int xyzw) UInt4::UInt4(int xyzw)
{ {
constant(xyzw, xyzw, xyzw, xyzw); constant(xyzw, xyzw, xyzw, xyzw);
...@@ -5458,54 +5286,40 @@ namespace sw ...@@ -5458,54 +5286,40 @@ namespace sw
void UInt4::constant(int x, int y, int z, int w) void UInt4::constant(int x, int y, int z, int w)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {x, y, z, w}; int64_t constantVector[4] = {x, y, z, w};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
UInt4::UInt4(RValue<UInt4> rhs) UInt4::UInt4(RValue<UInt4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
UInt4::UInt4(const UInt4 &rhs) UInt4::UInt4(const UInt4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UInt4::UInt4(const Reference<UInt4> &rhs) UInt4::UInt4(const Reference<UInt4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UInt4::UInt4(RValue<Int4> rhs) UInt4::UInt4(RValue<Int4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
UInt4::UInt4(const Int4 &rhs) UInt4::UInt4(const Int4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UInt4::UInt4(const Reference<Int4> &rhs) UInt4::UInt4(const Reference<Int4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -5753,11 +5567,6 @@ namespace sw ...@@ -5753,11 +5567,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
Float::Float()
{
}
Float::Float(float x) Float::Float(float x)
{ {
storeValue(Nucleus::createConstantFloat(x)); storeValue(Nucleus::createConstantFloat(x));
...@@ -5989,8 +5798,6 @@ namespace sw ...@@ -5989,8 +5798,6 @@ namespace sw
Float2::Float2(RValue<Float4> cast) Float2::Float2(RValue<Float4> cast)
{ {
// xyzw.parent = this;
Value *int64x2 = Nucleus::createBitCast(cast.value, T(VectorType::get(Long::getType(), 2))); Value *int64x2 = Nucleus::createBitCast(cast.value, T(VectorType::get(Long::getType(), 2)));
Value *int64 = Nucleus::createExtractElement(int64x2, Long::getType(), 0); Value *int64 = Nucleus::createExtractElement(int64x2, Long::getType(), 0);
Value *float2 = Nucleus::createBitCast(int64, Float2::getType()); Value *float2 = Nucleus::createBitCast(int64, Float2::getType());
...@@ -6003,10 +5810,8 @@ namespace sw ...@@ -6003,10 +5810,8 @@ namespace sw
return T(VectorType::get(Float::getType(), 2)); return T(VectorType::get(Float::getType(), 2));
} }
Float4::Float4(RValue<Byte4> cast) Float4::Float4(RValue<Byte4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
#if 0 #if 0
Value *xyzw = Nucleus::createUIToFP(cast.value, Float4::getType()); // FIXME: Crashes Value *xyzw = Nucleus::createUIToFP(cast.value, Float4::getType()); // FIXME: Crashes
#elif 0 #elif 0
...@@ -6035,10 +5840,8 @@ namespace sw ...@@ -6035,10 +5840,8 @@ namespace sw
storeValue(xyzw); storeValue(xyzw);
} }
Float4::Float4(RValue<SByte4> cast) Float4::Float4(RValue<SByte4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
#if 0 #if 0
Value *xyzw = Nucleus::createSIToFP(cast.value, Float4::getType()); // FIXME: Crashes Value *xyzw = Nucleus::createSIToFP(cast.value, Float4::getType()); // FIXME: Crashes
#elif 0 #elif 0
...@@ -6067,101 +5870,82 @@ namespace sw ...@@ -6067,101 +5870,82 @@ namespace sw
storeValue(xyzw); storeValue(xyzw);
} }
Float4::Float4(RValue<Short4> cast) Float4::Float4(RValue<Short4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
Int4 c(cast); Int4 c(cast);
storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType())); storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
} }
Float4::Float4(RValue<UShort4> cast) Float4::Float4(RValue<UShort4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
Int4 c(cast); Int4 c(cast);
storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType())); storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
} }
Float4::Float4(RValue<Int4> cast) Float4::Float4(RValue<Int4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
Value *xyzw = Nucleus::createSIToFP(cast.value, Float4::getType()); Value *xyzw = Nucleus::createSIToFP(cast.value, Float4::getType());
storeValue(xyzw); storeValue(xyzw);
} }
Float4::Float4(RValue<UInt4> cast) Float4::Float4(RValue<UInt4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
RValue<Float4> result = Float4(Int4(cast & UInt4(0x7FFFFFFF))) + RValue<Float4> result = Float4(Int4(cast & UInt4(0x7FFFFFFF))) +
As<Float4>((As<Int4>(cast) >> 31) & As<Int4>(Float4(0x80000000u))); As<Float4>((As<Int4>(cast) >> 31) & As<Int4>(Float4(0x80000000u)));
storeValue(result.value); storeValue(result.value);
} }
Float4::Float4() Float4::Float4() : FloatXYZW(this)
{ {
xyzw.parent = this;
} }
Float4::Float4(float xyzw) Float4::Float4(float xyzw) : FloatXYZW(this)
{ {
constant(xyzw, xyzw, xyzw, xyzw); constant(xyzw, xyzw, xyzw, xyzw);
} }
Float4::Float4(float x, float yzw) Float4::Float4(float x, float yzw) : FloatXYZW(this)
{ {
constant(x, yzw, yzw, yzw); constant(x, yzw, yzw, yzw);
} }
Float4::Float4(float x, float y, float zw) Float4::Float4(float x, float y, float zw) : FloatXYZW(this)
{ {
constant(x, y, zw, zw); constant(x, y, zw, zw);
} }
Float4::Float4(float x, float y, float z, float w) Float4::Float4(float x, float y, float z, float w) : FloatXYZW(this)
{ {
constant(x, y, z, w); constant(x, y, z, w);
} }
void Float4::constant(float x, float y, float z, float w) void Float4::constant(float x, float y, float z, float w)
{ {
xyzw.parent = this;
double constantVector[4] = {x, y, z, w}; double constantVector[4] = {x, y, z, w};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
Float4::Float4(RValue<Float4> rhs) Float4::Float4(RValue<Float4> rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Float4::Float4(const Float4 &rhs) Float4::Float4(const Float4 &rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Float4::Float4(const Reference<Float4> &rhs) Float4::Float4(const Reference<Float4> &rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Float4::Float4(RValue<Float> rhs) Float4::Float4(RValue<Float> rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
Value *vector = loadValue(); Value *vector = loadValue();
Value *insert = Nucleus::createInsertElement(vector, rhs.value, 0); Value *insert = Nucleus::createInsertElement(vector, rhs.value, 0);
...@@ -6171,17 +5955,13 @@ namespace sw ...@@ -6171,17 +5955,13 @@ namespace sw
storeValue(replicate); storeValue(replicate);
} }
Float4::Float4(const Float &rhs) Float4::Float4(const Float &rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
*this = RValue<Float>(rhs.loadValue()); *this = RValue<Float>(rhs.loadValue());
} }
Float4::Float4(const Reference<Float> &rhs) Float4::Float4(const Reference<Float> &rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
*this = RValue<Float>(rhs.loadValue()); *this = RValue<Float>(rhs.loadValue());
} }
......
...@@ -184,7 +184,7 @@ namespace sw ...@@ -184,7 +184,7 @@ namespace sw
public: public:
Bool(Argument<Bool> argument); Bool(Argument<Bool> argument);
Bool(); Bool() = default;
Bool(bool x); Bool(bool x);
Bool(RValue<Bool> rhs); Bool(RValue<Bool> rhs);
Bool(const Bool &rhs); Bool(const Bool &rhs);
...@@ -211,7 +211,7 @@ namespace sw ...@@ -211,7 +211,7 @@ namespace sw
explicit Byte(RValue<UInt> cast); explicit Byte(RValue<UInt> cast);
explicit Byte(RValue<UShort> cast); explicit Byte(RValue<UShort> cast);
Byte(); Byte() = default;
Byte(int x); Byte(int x);
Byte(unsigned char x); Byte(unsigned char x);
Byte(RValue<Byte> rhs); Byte(RValue<Byte> rhs);
...@@ -268,7 +268,7 @@ namespace sw ...@@ -268,7 +268,7 @@ namespace sw
explicit SByte(RValue<Int> cast); explicit SByte(RValue<Int> cast);
explicit SByte(RValue<Short> cast); explicit SByte(RValue<Short> cast);
SByte(); SByte() = default;
SByte(signed char x); SByte(signed char x);
SByte(RValue<SByte> rhs); SByte(RValue<SByte> rhs);
SByte(const SByte &rhs); SByte(const SByte &rhs);
...@@ -323,7 +323,7 @@ namespace sw ...@@ -323,7 +323,7 @@ namespace sw
explicit Short(RValue<Int> cast); explicit Short(RValue<Int> cast);
Short(); Short() = default;
Short(short x); Short(short x);
Short(RValue<Short> rhs); Short(RValue<Short> rhs);
Short(const Short &rhs); Short(const Short &rhs);
...@@ -379,7 +379,7 @@ namespace sw ...@@ -379,7 +379,7 @@ namespace sw
explicit UShort(RValue<UInt> cast); explicit UShort(RValue<UInt> cast);
explicit UShort(RValue<Int> cast); explicit UShort(RValue<Int> cast);
UShort(); UShort() = default;
UShort(unsigned short x); UShort(unsigned short x);
UShort(RValue<UShort> rhs); UShort(RValue<UShort> rhs);
UShort(const UShort &rhs); UShort(const UShort &rhs);
...@@ -432,7 +432,7 @@ namespace sw ...@@ -432,7 +432,7 @@ namespace sw
public: public:
explicit Byte4(RValue<Byte8> cast); explicit Byte4(RValue<Byte8> cast);
// Byte4(); Byte4() = default;
// Byte4(int x, int y, int z, int w); // Byte4(int x, int y, int z, int w);
// Byte4(RValue<Byte4> rhs); // Byte4(RValue<Byte4> rhs);
// Byte4(const Byte4 &rhs); // Byte4(const Byte4 &rhs);
...@@ -476,7 +476,7 @@ namespace sw ...@@ -476,7 +476,7 @@ namespace sw
class SByte4 : public LValue<SByte4> class SByte4 : public LValue<SByte4>
{ {
public: public:
// SByte4(); SByte4() = default;
// SByte4(int x, int y, int z, int w); // SByte4(int x, int y, int z, int w);
// SByte4(RValue<SByte4> rhs); // SByte4(RValue<SByte4> rhs);
// SByte4(const SByte4 &rhs); // SByte4(const SByte4 &rhs);
...@@ -520,7 +520,7 @@ namespace sw ...@@ -520,7 +520,7 @@ namespace sw
class Byte8 : public LValue<Byte8> class Byte8 : public LValue<Byte8>
{ {
public: public:
Byte8(); Byte8() = default;
Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7); Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7);
Byte8(RValue<Byte8> rhs); Byte8(RValue<Byte8> rhs);
Byte8(const Byte8 &rhs); Byte8(const Byte8 &rhs);
...@@ -573,7 +573,7 @@ namespace sw ...@@ -573,7 +573,7 @@ namespace sw
class SByte8 : public LValue<SByte8> class SByte8 : public LValue<SByte8>
{ {
public: public:
SByte8(); SByte8() = default;
SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7); SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7);
SByte8(RValue<SByte8> rhs); SByte8(RValue<SByte8> rhs);
SByte8(const SByte8 &rhs); SByte8(const SByte8 &rhs);
...@@ -625,7 +625,7 @@ namespace sw ...@@ -625,7 +625,7 @@ namespace sw
class Byte16 : public LValue<Byte16> class Byte16 : public LValue<Byte16>
{ {
public: public:
// Byte16(); Byte16() = default;
// Byte16(int x, int y, int z, int w); // Byte16(int x, int y, int z, int w);
Byte16(RValue<Byte16> rhs); Byte16(RValue<Byte16> rhs);
Byte16(const Byte16 &rhs); Byte16(const Byte16 &rhs);
...@@ -669,7 +669,7 @@ namespace sw ...@@ -669,7 +669,7 @@ namespace sw
class SByte16 : public LValue<SByte16> class SByte16 : public LValue<SByte16>
{ {
public: public:
// SByte16(); SByte16() = default;
// SByte16(int x, int y, int z, int w); // SByte16(int x, int y, int z, int w);
// SByte16(RValue<SByte16> rhs); // SByte16(RValue<SByte16> rhs);
// SByte16(const SByte16 &rhs); // SByte16(const SByte16 &rhs);
...@@ -734,7 +734,7 @@ namespace sw ...@@ -734,7 +734,7 @@ namespace sw
// explicit Short4(RValue<Float> cast); // explicit Short4(RValue<Float> cast);
explicit Short4(RValue<Float4> cast); explicit Short4(RValue<Float4> cast);
Short4(); Short4() = default;
Short4(short xyzw); Short4(short xyzw);
Short4(short x, short y, short z, short w); Short4(short x, short y, short z, short w);
Short4(RValue<Short4> rhs); Short4(RValue<Short4> rhs);
...@@ -810,7 +810,7 @@ namespace sw ...@@ -810,7 +810,7 @@ namespace sw
explicit UShort4(RValue<Int4> cast); explicit UShort4(RValue<Int4> cast);
explicit UShort4(RValue<Float4> cast, bool saturate = false); explicit UShort4(RValue<Float4> cast, bool saturate = false);
UShort4(); UShort4() = default;
UShort4(unsigned short xyzw); UShort4(unsigned short xyzw);
UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w); UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w);
UShort4(RValue<UShort4> rhs); UShort4(RValue<UShort4> rhs);
...@@ -869,7 +869,7 @@ namespace sw ...@@ -869,7 +869,7 @@ namespace sw
class Short8 : public LValue<Short8> class Short8 : public LValue<Short8>
{ {
public: public:
// Short8(); Short8() = default;
Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7); Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7);
Short8(RValue<Short8> rhs); Short8(RValue<Short8> rhs);
// Short8(const Short8 &rhs); // Short8(const Short8 &rhs);
...@@ -926,7 +926,7 @@ namespace sw ...@@ -926,7 +926,7 @@ namespace sw
class UShort8 : public LValue<UShort8> class UShort8 : public LValue<UShort8>
{ {
public: public:
// UShort8(); UShort8() = default;
UShort8(unsigned short c0, unsigned short c1, unsigned short c2, unsigned short c3, unsigned short c4, unsigned short c5, unsigned short c6, unsigned short c7); UShort8(unsigned short c0, unsigned short c1, unsigned short c2, unsigned short c3, unsigned short c4, unsigned short c5, unsigned short c6, unsigned short c7);
UShort8(RValue<UShort8> rhs); UShort8(RValue<UShort8> rhs);
// UShort8(const UShort8 &rhs); // UShort8(const UShort8 &rhs);
...@@ -992,7 +992,7 @@ namespace sw ...@@ -992,7 +992,7 @@ namespace sw
explicit Int(RValue<Long> cast); explicit Int(RValue<Long> cast);
explicit Int(RValue<Float> cast); explicit Int(RValue<Float> cast);
Int(); Int() = default;
Int(int x); Int(int x);
Int(RValue<Int> rhs); Int(RValue<Int> rhs);
Int(RValue<UInt> rhs); Int(RValue<UInt> rhs);
...@@ -1062,7 +1062,7 @@ namespace sw ...@@ -1062,7 +1062,7 @@ namespace sw
explicit Long(RValue<UInt> cast); explicit Long(RValue<UInt> cast);
// explicit Long(RValue<Float> cast); // explicit Long(RValue<Float> cast);
Long(); Long() = default;
// Long(qword x); // Long(qword x);
Long(RValue<Long> rhs); Long(RValue<Long> rhs);
// Long(RValue<ULong> rhs); // Long(RValue<ULong> rhs);
...@@ -1128,7 +1128,7 @@ namespace sw ...@@ -1128,7 +1128,7 @@ namespace sw
explicit UInt(RValue<Long> cast); explicit UInt(RValue<Long> cast);
explicit UInt(RValue<Float> cast); explicit UInt(RValue<Float> cast);
UInt(); UInt() = default;
UInt(int x); UInt(int x);
UInt(unsigned int x); UInt(unsigned int x);
UInt(RValue<UInt> rhs); UInt(RValue<UInt> rhs);
...@@ -1194,7 +1194,7 @@ namespace sw ...@@ -1194,7 +1194,7 @@ namespace sw
// explicit Int2(RValue<Int> cast); // explicit Int2(RValue<Int> cast);
explicit Int2(RValue<Int4> cast); explicit Int2(RValue<Int4> cast);
Int2(); Int2() = default;
Int2(int x, int y); Int2(int x, int y);
Int2(RValue<Int2> rhs); Int2(RValue<Int2> rhs);
Int2(const Int2 &rhs); Int2(const Int2 &rhs);
...@@ -1251,7 +1251,7 @@ namespace sw ...@@ -1251,7 +1251,7 @@ namespace sw
class UInt2 : public LValue<UInt2> class UInt2 : public LValue<UInt2>
{ {
public: public:
UInt2(); UInt2() = default;
UInt2(unsigned int x, unsigned int y); UInt2(unsigned int x, unsigned int y);
UInt2(RValue<UInt2> rhs); UInt2(RValue<UInt2> rhs);
UInt2(const UInt2 &rhs); UInt2(const UInt2 &rhs);
...@@ -1309,7 +1309,7 @@ namespace sw ...@@ -1309,7 +1309,7 @@ namespace sw
explicit Int4(RValue<Short4> cast); explicit Int4(RValue<Short4> cast);
explicit Int4(RValue<UShort4> cast); explicit Int4(RValue<UShort4> cast);
Int4(); Int4() = default;
Int4(int xyzw); Int4(int xyzw);
Int4(int x, int yzw); Int4(int x, int yzw);
Int4(int x, int y, int zw); Int4(int x, int y, int zw);
...@@ -1391,7 +1391,7 @@ namespace sw ...@@ -1391,7 +1391,7 @@ namespace sw
public: public:
explicit UInt4(RValue<Float4> cast); explicit UInt4(RValue<Float4> cast);
UInt4(); UInt4() = default;
UInt4(int xyzw); UInt4(int xyzw);
UInt4(int x, int yzw); UInt4(int x, int yzw);
UInt4(int x, int y, int zw); UInt4(int x, int y, int zw);
...@@ -1487,7 +1487,7 @@ namespace sw ...@@ -1487,7 +1487,7 @@ namespace sw
template<int T> template<int T>
class SwizzleMaskFloat4 class SwizzleMaskFloat4
{ {
friend class Float4; friend struct FloatXYZW;
public: public:
operator RValue<Float4>() const; operator RValue<Float4>() const;
...@@ -1533,7 +1533,7 @@ namespace sw ...@@ -1533,7 +1533,7 @@ namespace sw
public: public:
explicit Float(RValue<Int> cast); explicit Float(RValue<Int> cast);
Float(); Float() = default;
Float(float x); Float(float x);
Float(RValue<Float> rhs); Float(RValue<Float> rhs);
Float(const Float &rhs); Float(const Float &rhs);
...@@ -1592,7 +1592,7 @@ namespace sw ...@@ -1592,7 +1592,7 @@ namespace sw
// explicit Float2(RValue<UInt2> cast); // explicit Float2(RValue<UInt2> cast);
explicit Float2(RValue<Float4> cast); explicit Float2(RValue<Float4> cast);
// Float2(); Float2() = default;
// Float2(float x, float y); // Float2(float x, float y);
// Float2(RValue<Float2> rhs); // Float2(RValue<Float2> rhs);
// Float2(const Float2 &rhs); // Float2(const Float2 &rhs);
...@@ -1637,56 +1637,17 @@ namespace sw ...@@ -1637,56 +1637,17 @@ namespace sw
// RValue<Float2> Swizzle(RValue<Float2> x, unsigned char select); // RValue<Float2> Swizzle(RValue<Float2> x, unsigned char select);
// RValue<Float2> Mask(Float2 &lhs, RValue<Float2> rhs, unsigned char select); // RValue<Float2> Mask(Float2 &lhs, RValue<Float2> rhs, unsigned char select);
class Float4 : public LValue<Float4> struct FloatXYZW
{ {
public: friend class Float4;
explicit Float4(RValue<Byte4> cast);
explicit Float4(RValue<SByte4> cast);
explicit Float4(RValue<Short4> cast);
explicit Float4(RValue<UShort4> cast);
explicit Float4(RValue<Int4> cast);
explicit Float4(RValue<UInt4> cast);
Float4();
Float4(float xyzw);
Float4(float x, float yzw);
Float4(float x, float y, float zw);
Float4(float x, float y, float z, float w);
Float4(RValue<Float4> rhs);
Float4(const Float4 &rhs);
Float4(const Reference<Float4> &rhs);
Float4(RValue<Float> rhs);
Float4(const Float &rhs);
Float4(const Reference<Float> &rhs);
template<int T>
Float4(const SwizzleMask1Float4<T> &rhs);
template<int T>
Float4(const SwizzleFloat4<T> &rhs);
template<int X, int Y>
Float4(const Swizzle2Float4<X> &x, const Swizzle2Float4<Y> &y);
template<int X, int Y>
Float4(const SwizzleMask2Float4<X> &x, const Swizzle2Float4<Y> &y);
template<int X, int Y>
Float4(const Swizzle2Float4<X> &x, const SwizzleMask2Float4<Y> &y);
template<int X, int Y>
Float4(const SwizzleMask2Float4<X> &x, const SwizzleMask2Float4<Y> &y);
RValue<Float4> operator=(float replicate);
RValue<Float4> operator=(RValue<Float4> rhs);
RValue<Float4> operator=(const Float4 &rhs);
RValue<Float4> operator=(const Reference<Float4> &rhs);
RValue<Float4> operator=(RValue<Float> rhs);
RValue<Float4> operator=(const Float &rhs);
RValue<Float4> operator=(const Reference<Float> &rhs);
template<int T>
RValue<Float4> operator=(const SwizzleMask1Float4<T> &rhs);
template<int T>
RValue<Float4> operator=(const SwizzleFloat4<T> &rhs);
static Type *getType(); private:
FloatXYZW(Float4 *parent)
{
xyzw.parent = parent;
}
public:
union union
{ {
SwizzleMask1Float4<0x00> x; SwizzleMask1Float4<0x00> x;
...@@ -2030,6 +1991,57 @@ namespace sw ...@@ -2030,6 +1991,57 @@ namespace sw
SwizzleFloat4<0xFE> zwww; SwizzleFloat4<0xFE> zwww;
SwizzleFloat4<0xFF> wwww; SwizzleFloat4<0xFF> wwww;
}; };
};
class Float4 : public LValue<Float4>, public FloatXYZW
{
public:
explicit Float4(RValue<Byte4> cast);
explicit Float4(RValue<SByte4> cast);
explicit Float4(RValue<Short4> cast);
explicit Float4(RValue<UShort4> cast);
explicit Float4(RValue<Int4> cast);
explicit Float4(RValue<UInt4> cast);
Float4();
Float4(float xyzw);
Float4(float x, float yzw);
Float4(float x, float y, float zw);
Float4(float x, float y, float z, float w);
Float4(RValue<Float4> rhs);
Float4(const Float4 &rhs);
Float4(const Reference<Float4> &rhs);
Float4(RValue<Float> rhs);
Float4(const Float &rhs);
Float4(const Reference<Float> &rhs);
template<int T>
Float4(const SwizzleMask1Float4<T> &rhs);
template<int T>
Float4(const SwizzleFloat4<T> &rhs);
template<int X, int Y>
Float4(const Swizzle2Float4<X> &x, const Swizzle2Float4<Y> &y);
template<int X, int Y>
Float4(const SwizzleMask2Float4<X> &x, const Swizzle2Float4<Y> &y);
template<int X, int Y>
Float4(const Swizzle2Float4<X> &x, const SwizzleMask2Float4<Y> &y);
template<int X, int Y>
Float4(const SwizzleMask2Float4<X> &x, const SwizzleMask2Float4<Y> &y);
RValue<Float4> operator=(float replicate);
RValue<Float4> operator=(RValue<Float4> rhs);
RValue<Float4> operator=(const Float4 &rhs);
RValue<Float4> operator=(const Reference<Float4> &rhs);
RValue<Float4> operator=(RValue<Float> rhs);
RValue<Float4> operator=(const Float &rhs);
RValue<Float4> operator=(const Reference<Float> &rhs);
template<int T>
RValue<Float4> operator=(const SwizzleMask1Float4<T> &rhs);
template<int T>
RValue<Float4> operator=(const SwizzleFloat4<T> &rhs);
static Type *getType();
private: private:
void constant(float x, float y, float z, float w); void constant(float x, float y, float z, float w);
...@@ -2408,50 +2420,38 @@ namespace sw ...@@ -2408,50 +2420,38 @@ namespace sw
} }
template<int T> template<int T>
Float4::Float4(const SwizzleMask1Float4<T> &rhs) Float4::Float4(const SwizzleMask1Float4<T> &rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
*this = rhs.operator RValue<Float4>(); *this = rhs.operator RValue<Float4>();
} }
template<int T> template<int T>
Float4::Float4(const SwizzleFloat4<T> &rhs) Float4::Float4(const SwizzleFloat4<T> &rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
*this = rhs.operator RValue<Float4>(); *this = rhs.operator RValue<Float4>();
} }
template<int X, int Y> template<int X, int Y>
Float4::Float4(const Swizzle2Float4<X> &x, const Swizzle2Float4<Y> &y) Float4::Float4(const Swizzle2Float4<X> &x, const Swizzle2Float4<Y> &y) : FloatXYZW(this)
{ {
xyzw.parent = this;
*this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4); *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
} }
template<int X, int Y> template<int X, int Y>
Float4::Float4(const SwizzleMask2Float4<X> &x, const Swizzle2Float4<Y> &y) Float4::Float4(const SwizzleMask2Float4<X> &x, const Swizzle2Float4<Y> &y) : FloatXYZW(this)
{ {
xyzw.parent = this;
*this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4); *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
} }
template<int X, int Y> template<int X, int Y>
Float4::Float4(const Swizzle2Float4<X> &x, const SwizzleMask2Float4<Y> &y) Float4::Float4(const Swizzle2Float4<X> &x, const SwizzleMask2Float4<Y> &y) : FloatXYZW(this)
{ {
xyzw.parent = this;
*this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4); *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
} }
template<int X, int Y> template<int X, int Y>
Float4::Float4(const SwizzleMask2Float4<X> &x, const SwizzleMask2Float4<Y> &y) Float4::Float4(const SwizzleMask2Float4<X> &x, const SwizzleMask2Float4<Y> &y) : FloatXYZW(this)
{ {
xyzw.parent = this;
*this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4); *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
} }
......
...@@ -1302,10 +1302,6 @@ namespace sw ...@@ -1302,10 +1302,6 @@ namespace sw
storeValue(argument.value); storeValue(argument.value);
} }
Bool::Bool()
{
}
Bool::Bool(bool x) Bool::Bool(bool x)
{ {
storeValue(Nucleus::createConstantBool(x)); storeValue(Nucleus::createConstantBool(x));
...@@ -1397,10 +1393,6 @@ namespace sw ...@@ -1397,10 +1393,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
Byte::Byte()
{
}
Byte::Byte(int x) Byte::Byte(int x)
{ {
storeValue(Nucleus::createConstantByte((unsigned char)x)); storeValue(Nucleus::createConstantByte((unsigned char)x));
...@@ -1646,10 +1638,6 @@ namespace sw ...@@ -1646,10 +1638,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
SByte::SByte()
{
}
SByte::SByte(signed char x) SByte::SByte(signed char x)
{ {
storeValue(Nucleus::createConstantByte(x)); storeValue(Nucleus::createConstantByte(x));
...@@ -1883,10 +1871,6 @@ namespace sw ...@@ -1883,10 +1871,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
Short::Short()
{
}
Short::Short(short x) Short::Short(short x)
{ {
storeValue(Nucleus::createConstantShort(x)); storeValue(Nucleus::createConstantShort(x));
...@@ -2127,10 +2111,6 @@ namespace sw ...@@ -2127,10 +2111,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
UShort::UShort()
{
}
UShort::UShort(unsigned short x) UShort::UShort(unsigned short x)
{ {
storeValue(Nucleus::createConstantShort(x)); storeValue(Nucleus::createConstantShort(x));
...@@ -2354,15 +2334,11 @@ namespace sw ...@@ -2354,15 +2334,11 @@ namespace sw
Byte4::Byte4(RValue<Byte8> cast) Byte4::Byte4(RValue<Byte8> cast)
{ {
// xyzw.parent = this;
storeValue(Nucleus::createBitCast(cast.value, getType())); storeValue(Nucleus::createBitCast(cast.value, getType()));
} }
Byte4::Byte4(const Reference<Byte4> &rhs) Byte4::Byte4(const Reference<Byte4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -2377,10 +2353,6 @@ namespace sw ...@@ -2377,10 +2353,6 @@ namespace sw
return T(Type_v4i8); return T(Type_v4i8);
} }
Byte8::Byte8()
{
}
Byte8::Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7) Byte8::Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
{ {
int64_t constantVector[8] = {x0, x1, x2, x3, x4, x5, x6, x7}; int64_t constantVector[8] = {x0, x1, x2, x3, x4, x5, x6, x7};
...@@ -2614,15 +2586,8 @@ namespace sw ...@@ -2614,15 +2586,8 @@ namespace sw
return T(Type_v8i8); return T(Type_v8i8);
} }
SByte8::SByte8()
{
// xyzw.parent = this;
}
SByte8::SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7) SByte8::SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
{ {
// xyzw.parent = this;
int64_t constantVector[8] = { x0, x1, x2, x3, x4, x5, x6, x7 }; int64_t constantVector[8] = { x0, x1, x2, x3, x4, x5, x6, x7 };
Value *vector = V(Nucleus::createConstantVector(constantVector, getType())); Value *vector = V(Nucleus::createConstantVector(constantVector, getType()));
...@@ -2631,23 +2596,17 @@ namespace sw ...@@ -2631,23 +2596,17 @@ namespace sw
SByte8::SByte8(RValue<SByte8> rhs) SByte8::SByte8(RValue<SByte8> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
SByte8::SByte8(const SByte8 &rhs) SByte8::SByte8(const SByte8 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
SByte8::SByte8(const Reference<SByte8> &rhs) SByte8::SByte8(const Reference<SByte8> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -2858,23 +2817,17 @@ namespace sw ...@@ -2858,23 +2817,17 @@ namespace sw
Byte16::Byte16(RValue<Byte16> rhs) Byte16::Byte16(RValue<Byte16> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Byte16::Byte16(const Byte16 &rhs) Byte16::Byte16(const Byte16 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Byte16::Byte16(const Reference<Byte16> &rhs) Byte16::Byte16(const Reference<Byte16> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -2963,68 +2916,47 @@ namespace sw ...@@ -2963,68 +2916,47 @@ namespace sw
assert(false && "UNIMPLEMENTED"); assert(false && "UNIMPLEMENTED");
} }
Short4::Short4()
{
// xyzw.parent = this;
}
Short4::Short4(short xyzw) Short4::Short4(short xyzw)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw}; int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
Short4::Short4(short x, short y, short z, short w) Short4::Short4(short x, short y, short z, short w)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {x, y, z, w}; int64_t constantVector[4] = {x, y, z, w};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
Short4::Short4(RValue<Short4> rhs) Short4::Short4(RValue<Short4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Short4::Short4(const Short4 &rhs) Short4::Short4(const Short4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Short4::Short4(const Reference<Short4> &rhs) Short4::Short4(const Reference<Short4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Short4::Short4(RValue<UShort4> rhs) Short4::Short4(RValue<UShort4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Short4::Short4(const UShort4 &rhs) Short4::Short4(const UShort4 &rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.loadValue()); storeValue(rhs.loadValue());
} }
Short4::Short4(const Reference<UShort4> &rhs) Short4::Short4(const Reference<UShort4> &rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.loadValue()); storeValue(rhs.loadValue());
} }
...@@ -3367,69 +3299,48 @@ namespace sw ...@@ -3367,69 +3299,48 @@ namespace sw
} }
} }
UShort4::UShort4()
{
// xyzw.parent = this;
}
UShort4::UShort4(unsigned short xyzw) UShort4::UShort4(unsigned short xyzw)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw}; int64_t constantVector[4] = {xyzw, xyzw, xyzw, xyzw};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
UShort4::UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w) UShort4::UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {x, y, z, w}; int64_t constantVector[4] = {x, y, z, w};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
UShort4::UShort4(RValue<UShort4> rhs) UShort4::UShort4(RValue<UShort4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
UShort4::UShort4(const UShort4 &rhs) UShort4::UShort4(const UShort4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UShort4::UShort4(const Reference<UShort4> &rhs) UShort4::UShort4(const Reference<UShort4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UShort4::UShort4(RValue<Short4> rhs) UShort4::UShort4(RValue<Short4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
UShort4::UShort4(const Short4 &rhs) UShort4::UShort4(const Short4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UShort4::UShort4(const Reference<Short4> &rhs) UShort4::UShort4(const Reference<Short4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -3625,23 +3536,17 @@ namespace sw ...@@ -3625,23 +3536,17 @@ namespace sw
Short8::Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7) Short8::Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7)
{ {
// xyzw.parent = this;
int64_t constantVector[8] = {c0, c1, c2, c3, c4, c5, c6, c7}; int64_t constantVector[8] = {c0, c1, c2, c3, c4, c5, c6, c7};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
Short8::Short8(RValue<Short8> rhs) Short8::Short8(RValue<Short8> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Short8::Short8(const Reference<Short8> &rhs) Short8::Short8(const Reference<Short8> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -3851,10 +3756,6 @@ namespace sw ...@@ -3851,10 +3756,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
Int::Int()
{
}
Int::Int(int x) Int::Int(int x)
{ {
storeValue(Nucleus::createConstantInt(x)); storeValue(Nucleus::createConstantInt(x));
...@@ -4161,10 +4062,6 @@ namespace sw ...@@ -4161,10 +4062,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
Long::Long()
{
}
Long::Long(RValue<Long> rhs) Long::Long(RValue<Long> rhs)
{ {
storeValue(rhs.value); storeValue(rhs.value);
...@@ -4263,10 +4160,6 @@ namespace sw ...@@ -4263,10 +4160,6 @@ namespace sw
Int(cast))).value); Int(cast))).value);
} }
UInt::UInt()
{
}
UInt::UInt(int x) UInt::UInt(int x)
{ {
storeValue(Nucleus::createConstantInt(x)); storeValue(Nucleus::createConstantInt(x));
...@@ -4577,38 +4470,25 @@ namespace sw ...@@ -4577,38 +4470,25 @@ namespace sw
storeValue(Nucleus::createBitCast(cast.value, getType())); storeValue(Nucleus::createBitCast(cast.value, getType()));
} }
Int2::Int2()
{
// xy.parent = this;
}
Int2::Int2(int x, int y) Int2::Int2(int x, int y)
{ {
// xy.parent = this;
int64_t constantVector[2] = {x, y}; int64_t constantVector[2] = {x, y};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
Int2::Int2(RValue<Int2> rhs) Int2::Int2(RValue<Int2> rhs)
{ {
// xy.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Int2::Int2(const Int2 &rhs) Int2::Int2(const Int2 &rhs)
{ {
// xy.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Int2::Int2(const Reference<Int2> &rhs) Int2::Int2(const Reference<Int2> &rhs)
{ {
// xy.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -4787,38 +4667,25 @@ namespace sw ...@@ -4787,38 +4667,25 @@ namespace sw
return T(Type_v2i32); return T(Type_v2i32);
} }
UInt2::UInt2()
{
// xy.parent = this;
}
UInt2::UInt2(unsigned int x, unsigned int y) UInt2::UInt2(unsigned int x, unsigned int y)
{ {
// xy.parent = this;
int64_t constantVector[2] = {x, y}; int64_t constantVector[2] = {x, y};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
UInt2::UInt2(RValue<UInt2> rhs) UInt2::UInt2(RValue<UInt2> rhs)
{ {
// xy.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
UInt2::UInt2(const UInt2 &rhs) UInt2::UInt2(const UInt2 &rhs)
{ {
// xy.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UInt2::UInt2(const Reference<UInt2> &rhs) UInt2::UInt2(const Reference<UInt2> &rhs)
{ {
// xy.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -5005,8 +4872,6 @@ namespace sw ...@@ -5005,8 +4872,6 @@ namespace sw
Int4::Int4(RValue<Float4> cast) Int4::Int4(RValue<Float4> cast)
{ {
// xyzw.parent = this;
Value *xyzw = Nucleus::createFPToSI(cast.value, Int4::getType()); Value *xyzw = Nucleus::createFPToSI(cast.value, Int4::getType());
storeValue(xyzw); storeValue(xyzw);
...@@ -5029,11 +4894,6 @@ namespace sw ...@@ -5029,11 +4894,6 @@ namespace sw
storeValue(d); storeValue(d);
} }
Int4::Int4()
{
// xyzw.parent = this;
}
Int4::Int4(int xyzw) Int4::Int4(int xyzw)
{ {
constant(xyzw, xyzw, xyzw, xyzw); constant(xyzw, xyzw, xyzw, xyzw);
...@@ -5056,54 +4916,40 @@ namespace sw ...@@ -5056,54 +4916,40 @@ namespace sw
void Int4::constant(int x, int y, int z, int w) void Int4::constant(int x, int y, int z, int w)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {x, y, z, w}; int64_t constantVector[4] = {x, y, z, w};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
Int4::Int4(RValue<Int4> rhs) Int4::Int4(RValue<Int4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Int4::Int4(const Int4 &rhs) Int4::Int4(const Int4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Int4::Int4(const Reference<Int4> &rhs) Int4::Int4(const Reference<Int4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Int4::Int4(RValue<UInt4> rhs) Int4::Int4(RValue<UInt4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Int4::Int4(const UInt4 &rhs) Int4::Int4(const UInt4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Int4::Int4(const Reference<UInt4> &rhs) Int4::Int4(const Reference<UInt4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -5118,8 +4964,6 @@ namespace sw ...@@ -5118,8 +4964,6 @@ namespace sw
Int4::Int4(RValue<Int> rhs) Int4::Int4(RValue<Int> rhs)
{ {
// xyzw.parent = this;
Value *vector = loadValue(); Value *vector = loadValue();
Value *insert = Nucleus::createInsertElement(vector, rhs.value, 0); Value *insert = Nucleus::createInsertElement(vector, rhs.value, 0);
...@@ -5131,15 +4975,11 @@ namespace sw ...@@ -5131,15 +4975,11 @@ namespace sw
Int4::Int4(const Int &rhs) Int4::Int4(const Int &rhs)
{ {
// xyzw.parent = this;
*this = RValue<Int>(rhs.loadValue()); *this = RValue<Int>(rhs.loadValue());
} }
Int4::Int4(const Reference<Int> &rhs) Int4::Int4(const Reference<Int> &rhs)
{ {
// xyzw.parent = this;
*this = RValue<Int>(rhs.loadValue()); *this = RValue<Int>(rhs.loadValue());
} }
...@@ -5405,8 +5245,6 @@ namespace sw ...@@ -5405,8 +5245,6 @@ namespace sw
UInt4::UInt4(RValue<Float4> cast) UInt4::UInt4(RValue<Float4> cast)
{ {
// xyzw.parent = this;
// Smallest positive value representable in UInt, but not in Int // Smallest positive value representable in UInt, but not in Int
const unsigned int ustart = 0x80000000u; const unsigned int ustart = 0x80000000u;
const float ustartf = float(ustart); const float ustartf = float(ustart);
...@@ -5421,11 +5259,6 @@ namespace sw ...@@ -5421,11 +5259,6 @@ namespace sw
storeValue((~(As<Int4>(cast) >> 31) & uiValue).value); storeValue((~(As<Int4>(cast) >> 31) & uiValue).value);
} }
UInt4::UInt4()
{
// xyzw.parent = this;
}
UInt4::UInt4(int xyzw) UInt4::UInt4(int xyzw)
{ {
constant(xyzw, xyzw, xyzw, xyzw); constant(xyzw, xyzw, xyzw, xyzw);
...@@ -5448,54 +5281,40 @@ namespace sw ...@@ -5448,54 +5281,40 @@ namespace sw
void UInt4::constant(int x, int y, int z, int w) void UInt4::constant(int x, int y, int z, int w)
{ {
// xyzw.parent = this;
int64_t constantVector[4] = {x, y, z, w}; int64_t constantVector[4] = {x, y, z, w};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
UInt4::UInt4(RValue<UInt4> rhs) UInt4::UInt4(RValue<UInt4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
UInt4::UInt4(const UInt4 &rhs) UInt4::UInt4(const UInt4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UInt4::UInt4(const Reference<UInt4> &rhs) UInt4::UInt4(const Reference<UInt4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UInt4::UInt4(RValue<Int4> rhs) UInt4::UInt4(RValue<Int4> rhs)
{ {
// xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
UInt4::UInt4(const Int4 &rhs) UInt4::UInt4(const Int4 &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
UInt4::UInt4(const Reference<Int4> &rhs) UInt4::UInt4(const Reference<Int4> &rhs)
{ {
// xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
...@@ -5737,10 +5556,6 @@ namespace sw ...@@ -5737,10 +5556,6 @@ namespace sw
storeValue(integer); storeValue(integer);
} }
Float::Float()
{
}
Float::Float(float x) Float::Float(float x)
{ {
storeValue(Nucleus::createConstantFloat(x)); storeValue(Nucleus::createConstantFloat(x));
...@@ -5943,121 +5758,98 @@ namespace sw ...@@ -5943,121 +5758,98 @@ namespace sw
return T(Type_v2f32); return T(Type_v2f32);
} }
Float4::Float4(RValue<Byte4> cast) Float4::Float4(RValue<Byte4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
Value *a = Int4(cast).loadValue(); Value *a = Int4(cast).loadValue();
Value *xyzw = Nucleus::createSIToFP(a, Float4::getType()); Value *xyzw = Nucleus::createSIToFP(a, Float4::getType());
storeValue(xyzw); storeValue(xyzw);
} }
Float4::Float4(RValue<SByte4> cast) Float4::Float4(RValue<SByte4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
Value *a = Int4(cast).loadValue(); Value *a = Int4(cast).loadValue();
Value *xyzw = Nucleus::createSIToFP(a, Float4::getType()); Value *xyzw = Nucleus::createSIToFP(a, Float4::getType());
storeValue(xyzw); storeValue(xyzw);
} }
Float4::Float4(RValue<Short4> cast) Float4::Float4(RValue<Short4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
Int4 c(cast); Int4 c(cast);
storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType())); storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
} }
Float4::Float4(RValue<UShort4> cast) Float4::Float4(RValue<UShort4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
Int4 c(cast); Int4 c(cast);
storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType())); storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
} }
Float4::Float4(RValue<Int4> cast) Float4::Float4(RValue<Int4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
Value *xyzw = Nucleus::createSIToFP(cast.value, Float4::getType()); Value *xyzw = Nucleus::createSIToFP(cast.value, Float4::getType());
storeValue(xyzw); storeValue(xyzw);
} }
Float4::Float4(RValue<UInt4> cast) Float4::Float4(RValue<UInt4> cast) : FloatXYZW(this)
{ {
xyzw.parent = this;
RValue<Float4> result = Float4(Int4(cast & UInt4(0x7FFFFFFF))) + RValue<Float4> result = Float4(Int4(cast & UInt4(0x7FFFFFFF))) +
As<Float4>((As<Int4>(cast) >> 31) & As<Int4>(Float4(0x80000000u))); As<Float4>((As<Int4>(cast) >> 31) & As<Int4>(Float4(0x80000000u)));
storeValue(result.value); storeValue(result.value);
} }
Float4::Float4() Float4::Float4() : FloatXYZW(this)
{ {
xyzw.parent = this;
} }
Float4::Float4(float xyzw) Float4::Float4(float xyzw) : FloatXYZW(this)
{ {
constant(xyzw, xyzw, xyzw, xyzw); constant(xyzw, xyzw, xyzw, xyzw);
} }
Float4::Float4(float x, float yzw) Float4::Float4(float x, float yzw) : FloatXYZW(this)
{ {
constant(x, yzw, yzw, yzw); constant(x, yzw, yzw, yzw);
} }
Float4::Float4(float x, float y, float zw) Float4::Float4(float x, float y, float zw) : FloatXYZW(this)
{ {
constant(x, y, zw, zw); constant(x, y, zw, zw);
} }
Float4::Float4(float x, float y, float z, float w) Float4::Float4(float x, float y, float z, float w) : FloatXYZW(this)
{ {
constant(x, y, z, w); constant(x, y, z, w);
} }
void Float4::constant(float x, float y, float z, float w) void Float4::constant(float x, float y, float z, float w)
{ {
xyzw.parent = this;
double constantVector[4] = {x, y, z, w}; double constantVector[4] = {x, y, z, w};
storeValue(Nucleus::createConstantVector(constantVector, getType())); storeValue(Nucleus::createConstantVector(constantVector, getType()));
} }
Float4::Float4(RValue<Float4> rhs) Float4::Float4(RValue<Float4> rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
storeValue(rhs.value); storeValue(rhs.value);
} }
Float4::Float4(const Float4 &rhs) Float4::Float4(const Float4 &rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Float4::Float4(const Reference<Float4> &rhs) Float4::Float4(const Reference<Float4> &rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
Value *value = rhs.loadValue(); Value *value = rhs.loadValue();
storeValue(value); storeValue(value);
} }
Float4::Float4(RValue<Float> rhs) Float4::Float4(RValue<Float> rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
Value *vector = loadValue(); Value *vector = loadValue();
Value *insert = Nucleus::createInsertElement(vector, rhs.value, 0); Value *insert = Nucleus::createInsertElement(vector, rhs.value, 0);
...@@ -6067,17 +5859,13 @@ namespace sw ...@@ -6067,17 +5859,13 @@ namespace sw
storeValue(replicate); storeValue(replicate);
} }
Float4::Float4(const Float &rhs) Float4::Float4(const Float &rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
*this = RValue<Float>(rhs.loadValue()); *this = RValue<Float>(rhs.loadValue());
} }
Float4::Float4(const Reference<Float> &rhs) Float4::Float4(const Reference<Float> &rhs) : FloatXYZW(this)
{ {
xyzw.parent = this;
*this = RValue<Float>(rhs.loadValue()); *this = RValue<Float>(rhs.loadValue());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment