{
case FORMAT_X8R8G8B8:
case FORMAT_A8R8G8B8:
- *Pointer<UInt>(d) = UInt(As<Long>(Pack(As<UShort4>(c1), As<UShort4>(c1))));
+ *Pointer<Byte4>(d) = Byte4(Pack(As<UShort4>(c1), As<UShort4>(c1)));
break;
case FORMAT_X8B8G8R8:
case FORMAT_A8B8G8R8:
{
c1 = Swizzle(c1, 0xC6);
- *Pointer<UInt>(d) = UInt(As<Long>(Pack(As<UShort4>(c1), As<UShort4>(c1))));
+ *Pointer<Byte4>(d) = Byte4(Pack(As<UShort4>(c1), As<UShort4>(c1)));
}
break;
case FORMAT_R8G8B8:
return T(llvm::Type::getInt16Ty(*::context));
}
+ Byte4::Byte4(RValue<Byte8> cast)
+ {
+ // xyzw.parent = this;
+
+ storeValue(Nucleus::createTrunc(Nucleus::createBitCast(cast.value, Long::getType()), Int::getType()));
+ }
+
+ Byte4::Byte4(const Reference<Byte4> &rhs)
+ {
+ // xyzw.parent = this;
+
+ Value *value = rhs.loadValue();
+ storeValue(value);
+ }
+
Type *Byte4::getType()
{
#if 0
storeValue(Nucleus::createBitCast(vector, getType()));
}
- Byte8::Byte8(int64_t x)
- {
- // xyzw.parent = this;
-
- Constant *constantVector[8];
- constantVector[0] = Nucleus::createConstantByte((unsigned char)(x >> 0));
- constantVector[1] = Nucleus::createConstantByte((unsigned char)(x >> 8));
- constantVector[2] = Nucleus::createConstantByte((unsigned char)(x >> 16));
- constantVector[3] = Nucleus::createConstantByte((unsigned char)(x >> 24));
- constantVector[4] = Nucleus::createConstantByte((unsigned char)(x >> 32));
- constantVector[5] = Nucleus::createConstantByte((unsigned char)(x >> 40));
- constantVector[6] = Nucleus::createConstantByte((unsigned char)(x >> 48));
- constantVector[7] = Nucleus::createConstantByte((unsigned char)(x >> 56));
- Value *vector = V(Nucleus::createConstantVector(constantVector, 8));
-
- storeValue(Nucleus::createBitCast(vector, getType()));
- }
-
Byte8::Byte8(RValue<Byte8> rhs)
{
// xyzw.parent = this;
{
if(CPUID::supportsMMX2())
{
- return val ^ Byte8(0xFFFFFFFFFFFFFFFF);
+ return val ^ Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
}
else
{
storeValue(Nucleus::createBitCast(vector, getType()));
}
- SByte8::SByte8(int64_t x)
- {
- // xyzw.parent = this;
-
- Constant *constantVector[8];
- constantVector[0] = Nucleus::createConstantByte((unsigned char)(x >> 0));
- constantVector[1] = Nucleus::createConstantByte((unsigned char)(x >> 8));
- constantVector[2] = Nucleus::createConstantByte((unsigned char)(x >> 16));
- constantVector[3] = Nucleus::createConstantByte((unsigned char)(x >> 24));
- constantVector[4] = Nucleus::createConstantByte((unsigned char)(x >> 32));
- constantVector[5] = Nucleus::createConstantByte((unsigned char)(x >> 40));
- constantVector[6] = Nucleus::createConstantByte((unsigned char)(x >> 48));
- constantVector[7] = Nucleus::createConstantByte((unsigned char)(x >> 56));
- Value *vector = V(Nucleus::createConstantVector(constantVector, 8));
-
- storeValue(Nucleus::createBitCast(vector, getType()));
- }
-
SByte8::SByte8(RValue<SByte8> rhs)
{
// xyzw.parent = this;
{
if(CPUID::supportsMMX2())
{
- return val ^ SByte8(0xFFFFFFFFFFFFFFFF);
+ return val ^ SByte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
}
else
{
return T( VectorType::get(SByte::getType(), 16));
}
+ Short2::Short2(RValue<Short4> cast)
+ {
+ storeValue(Nucleus::createTrunc(Nucleus::createBitCast(cast.value, Long::getType()), UInt::getType()));
+ }
+
+ Type *Short2::getType()
+ {
+ #if 0
+ return T(VectorType::get(Short::getType(), 2));
+ #else
+ return UInt::getType(); // FIXME: LLVM doesn't manipulate it as one 32-bit block
+ #endif
+ }
+
+ UShort2::UShort2(RValue<UShort4> cast)
+ {
+ storeValue(Nucleus::createTrunc(Nucleus::createBitCast(cast.value, Long::getType()), UInt::getType()));
+ }
+
+ Type *UShort2::getType()
+ {
+ #if 0
+ return T(VectorType::get(UShort::getType(), 2));
+ #else
+ return UInt::getType(); // FIXME: LLVM doesn't manipulate it as one 32-bit block
+ #endif
+ }
+
Short4::Short4(RValue<Int> cast)
{
Value *extend = Nucleus::createZExt(cast.value, Long::getType());
}
}
+ RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ if(CPUID::supportsMMX2())
+ {
+ return As<UShort4>(x86::pand(As<Short4>(lhs), As<Short4>(rhs)));
+ }
+ else
+ {
+ return RValue<UShort4>(Nucleus::createAnd(lhs.value, rhs.value));
+ }
+ }
+
+ RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ if(CPUID::supportsMMX2())
+ {
+ return As<UShort4>(x86::por(As<Short4>(lhs), As<Short4>(rhs)));
+ }
+ else
+ {
+ return RValue<UShort4>(Nucleus::createOr(lhs.value, rhs.value));
+ }
+ }
+
+ RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ if(CPUID::supportsMMX2())
+ {
+ return As<UShort4>(x86::pxor(As<Short4>(lhs), As<Short4>(rhs)));
+ }
+ else
+ {
+ return RValue<UShort4>(Nucleus::createXor(lhs.value, rhs.value));
+ }
+ }
+
RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs)
{
// return RValue<Short4>(Nucleus::createShl(lhs.value, rhs.value));
class SByte16;
class Short;
class UShort;
+ class Short2;
+ class UShort2;
class Short4;
class UShort4;
class Short8;
class Byte4 : public Variable<Byte4>
{
public:
+ explicit Byte4(RValue<Byte8> cast);
+
// Byte4();
// Byte4(int x, int y, int z, int w);
// Byte4(RValue<Byte4> rhs);
// Byte4(const Byte4 &rhs);
- // Byte4(const Reference<Byte4> &rhs);
+ Byte4(const Reference<Byte4> &rhs);
// RValue<Byte4> operator=(RValue<Byte4> rhs) const;
// RValue<Byte4> operator=(const Byte4 &rhs) const;
public:
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(int64_t x);
Byte8(RValue<Byte8> rhs);
Byte8(const Byte8 &rhs);
Byte8(const Reference<Byte8> &rhs);
public:
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(int64_t x);
SByte8(RValue<SByte8> rhs);
SByte8(const SByte8 &rhs);
SByte8(const Reference<SByte8> &rhs);
// RValue<SByte16> operator--(const SByte16 &val, int); // Post-decrement
// const SByte16 &operator--(const SByte16 &val); // Pre-decrement
+ class Short2 : public Variable<Short2>
+ {
+ public:
+ explicit Short2(RValue<Short4> cast);
+
+ static Type *getType();
+ };
+
+ class UShort2 : public Variable<UShort2>
+ {
+ public:
+ explicit UShort2(RValue<UShort4> cast);
+
+ static Type *getType();
+ };
+
class Short4 : public Variable<Short4>
{
public:
RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs);
// RValue<UShort4> operator/(RValue<UShort4> lhs, RValue<UShort4> rhs);
// RValue<UShort4> operator%(RValue<UShort4> lhs, RValue<UShort4> rhs);
-// RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs);
-// RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs);
-// RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs);
+ RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs);
+ RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs);
+ RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs);
RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs);
RValue<UShort4> operator>>(RValue<UShort4> lhs, unsigned char rhs);
RValue<UShort4> operator<<(RValue<UShort4> lhs, RValue<Long1> rhs);
assert(false && "UNIMPLEMENTED"); return nullptr;
}
+ Byte4::Byte4(RValue<Byte8> cast)
+ {
+ // xyzw.parent = this;
+
+ storeValue(Nucleus::createBitCast(cast.value, getType()));
+ }
+
+ Byte4::Byte4(const Reference<Byte4> &rhs)
+ {
+ // xyzw.parent = this;
+
+ assert(false && "UNIMPLEMENTED");
+ }
+
Type *Byte4::getType()
{
- #if 0
- return VectorType::get(Byte::getType(), 4);
- #else
- return UInt::getType(); // FIXME
- #endif
+ assert(false && "UNIMPLEMENTED"); return nullptr;
}
Type *SByte4::getType()
{
- #if 0
- return VectorType::get(SByte::getType(), 4);
- #else
- return Int::getType(); // FIXME
- #endif
+ assert(false && "UNIMPLEMENTED"); return nullptr;
}
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)
{
// xyzw.parent = this;
- }
- Byte8::Byte8(int64_t x)
- {
- // xyzw.parent = this;
+ assert(false && "UNIMPLEMENTED");
}
Byte8::Byte8(RValue<Byte8> rhs)
assert(false && "UNIMPLEMENTED");
}
- SByte8::SByte8(int64_t x)
- {
- // xyzw.parent = this;
-
- assert(false && "UNIMPLEMENTED");
- }
-
SByte8::SByte8(RValue<SByte8> rhs)
{
// xyzw.parent = this;
assert(false && "UNIMPLEMENTED"); return nullptr;
}
+ Short2::Short2(RValue<Short4> cast)
+ {
+ assert(false && "UNIMPLEMENTED");
+ }
+
+ Type *Short2::getType()
+ {
+ assert(false && "UNIMPLEMENTED"); return nullptr;
+ }
+
+ UShort2::UShort2(RValue<UShort4> cast)
+ {
+ assert(false && "UNIMPLEMENTED");
+ }
+
+ Type *UShort2::getType()
+ {
+ assert(false && "UNIMPLEMENTED"); return nullptr;
+ }
+
Short4::Short4(RValue<Int> cast)
{
Value *extend = Nucleus::createZExt(cast.value, Long::getType());
assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
}
+ RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
+ }
+
+ RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
+ }
+
+ RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs)
+ {
+ assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
+ }
+
RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs)
{
assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
if(writeRGBA)
{
UShort4 c0 = As<UShort4>(RoundShort4(c.zyxw));
- Byte8 c1 = Pack(c0, c0);
- *Pointer<UInt>(element) = UInt(As<Long>(c1));
+ *Pointer<Byte4>(element) = Byte4(Pack(c0, c0));
}
else
{
if(writeRGBA)
{
UShort4 c0 = As<UShort4>(RoundShort4(c));
- Byte8 c1 = Pack(c0, c0);
- *Pointer<UInt>(element) = UInt(As<Long>(c1));
+ *Pointer<Byte4>(element) = Byte4(Pack(c0, c0));
}
else
{
case FORMAT_X8R8G8B8:
if(writeRGBA)
{
- UShort4 c0 = As<UShort4>(RoundShort4(c.zyxw));
- Byte8 c1 = Pack(c0, c0);
- *Pointer<UInt>(element) = UInt(As<Long>(c1)) | 0xFF000000;
+ UShort4 c0 = As<UShort4>(RoundShort4(c.zyxw)) | UShort4(0x0000, 0x0000, 0x0000, 0xFFFFu);
+ *Pointer<Byte4>(element) = Byte4(Pack(c0, c0));
}
else
{
case FORMAT_SRGB8_X8:
if(writeRGBA)
{
- UShort4 c0 = As<UShort4>(RoundShort4(c));
- Byte8 c1 = Pack(c0, c0);
- *Pointer<UInt>(element) = UInt(As<Long>(c1)) | 0xFF000000;
+ UShort4 c0 = As<UShort4>(RoundShort4(c)) | UShort4(0x0000, 0x0000, 0x0000, 0xFFFFu);
+ *Pointer<Byte4>(element) = Byte4(Pack(c0, c0));
}
else
{
case FORMAT_G16R16I:
if(writeR && writeG)
{
- *Pointer<UInt>(element) = UInt(As<Long>(Short4(RoundInt(c))));
+ *Pointer<Short2>(element) = Short2(Short4(RoundInt(c)));
}
else
{
case FORMAT_G16R16:
if(writeR && writeG)
{
- *Pointer<UInt>(element) = UInt(As<Long>(UShort4(RoundInt(c))));
+ *Pointer<UShort2>(element) = UShort2(UShort4(RoundInt(c)));
}
else
{
switch(stencilCompareMode)
{
case STENCIL_ALWAYS:
- value = Byte8(0xFFFFFFFFFFFFFFFF);
+ value = Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
break;
case STENCIL_NEVER:
- value = Byte8(0x0000000000000000);
+ value = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
break;
case STENCIL_LESS: // a < b ~ b > a
value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
break;
case STENCIL_NOTEQUAL: // a != b ~ !(a == b)
value = CmpEQ(value, *Pointer<Byte8>(data + OFFSET(DrawData,stencil[CCW].referenceMaskedQ)));
- value ^= Byte8(0xFFFFFFFFFFFFFFFF);
+ value ^= Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
break;
case STENCIL_LESSEQUAL: // a <= b ~ (b > a) || (a == b)
equal = value;
case STENCIL_GREATEREQUAL: // a >= b ~ !(a < b) ~ !(b > a)
value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(data + OFFSET(DrawData,stencil[CCW].referenceMaskedSignedQ)));
- value ^= Byte8(0xFFFFFFFFFFFFFFFF);
+ value ^= Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
break;
default:
ASSERT(false);
bufferValue &= *Pointer<Byte8>(constants + OFFSET(Constants,invMaskB4Q) + 8 * cMask);
newValue |= bufferValue;
- *Pointer<UInt>(buffer) = UInt(As<Long>(newValue));
+ *Pointer<Byte4>(buffer) = Byte4(newValue);
}
void PixelRoutine::stencilOperation(Byte8 &newValue, Byte8 &bufferValue, StencilOperation stencilPassOperation, StencilOperation stencilZFailOperation, StencilOperation stencilFailOperation, bool CCW, Int &zMask, Int &sMask)
output = bufferValue;
break;
case OPERATION_ZERO:
- output = Byte8(0x0000000000000000);
+ output = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
break;
case OPERATION_REPLACE:
output = *Pointer<Byte8>(data + OFFSET(DrawData,stencil[CCW].referenceQ));
output = SubSat(bufferValue, Byte8(1, 1, 1, 1, 1, 1, 1, 1));
break;
case OPERATION_INVERT:
- output = bufferValue ^ Byte8(0xFFFFFFFFFFFFFFFF);
+ output = bufferValue ^ Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
break;
case OPERATION_INCR:
output = bufferValue + Byte8(1, 1, 1, 1, 1, 1, 1, 1);
{
If(A > 0.0f)
{
- *Pointer<Byte8>(primitive + OFFSET(Primitive,clockwiseMask)) = Byte8(0xFFFFFFFFFFFFFFFF);
- *Pointer<Byte8>(primitive + OFFSET(Primitive,invClockwiseMask)) = Byte8(0x0000000000000000);
+ *Pointer<Byte8>(primitive + OFFSET(Primitive,clockwiseMask)) = Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
+ *Pointer<Byte8>(primitive + OFFSET(Primitive,invClockwiseMask)) = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
}
Else
{
- *Pointer<Byte8>(primitive + OFFSET(Primitive,clockwiseMask)) = Byte8(0x0000000000000000);
- *Pointer<Byte8>(primitive + OFFSET(Primitive,invClockwiseMask)) = Byte8(0xFFFFFFFFFFFFFFFF);
+ *Pointer<Byte8>(primitive + OFFSET(Primitive,clockwiseMask)) = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
+ *Pointer<Byte8>(primitive + OFFSET(Primitive,invClockwiseMask)) = Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
}
}
{
if(state.twoSidedStencil)
{
- *Pointer<Byte8>(primitive + OFFSET(Primitive,clockwiseMask)) = Byte8(0xFFFFFFFFFFFFFFFF);
- *Pointer<Byte8>(primitive + OFFSET(Primitive,invClockwiseMask)) = Byte8(0x0000000000000000);
+ *Pointer<Byte8>(primitive + OFFSET(Primitive,clockwiseMask)) = Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
+ *Pointer<Byte8>(primitive + OFFSET(Primitive,invClockwiseMask)) = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
}
}