#include "QuadRasterizer.hpp"
#include "Surface.hpp"
#include "Primitive.hpp"
-#include "CPUID.hpp"
#include "SamplerCore.hpp"
#include "Constants.hpp"
#include "Debug.hpp"
buffer += q * *Pointer<Int>(data + OFFSET(DrawData,stencilSliceB));
}
- Byte8 value = As<Byte8>(Long1(*Pointer<UInt>(buffer)));
+ Byte8 value = *Pointer<Byte8>(buffer);
Byte8 valueCCW = value;
if(!state.noStencilMask)
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);
buffer += q * *Pointer<Int>(data + OFFSET(DrawData,stencilSliceB));
}
- Byte8 bufferValue = As<Byte8>(Long1(*Pointer<UInt>(buffer)));
+ Byte8 bufferValue = *Pointer<Byte8>(buffer);
Byte8 newValue;
stencilOperation(newValue, bufferValue, state.stencilPassOperation, state.stencilZFailOperation, state.stencilFailOperation, false, zMask, sMask);
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);
}
}
- void PixelRoutine::blendFactor(const Vector4s &blendFactor, const Vector4s ¤t, const Vector4s &pixel, BlendFactor blendFactorActive)
+ void PixelRoutine::blendFactor(Vector4s &blendFactor, const Vector4s ¤t, const Vector4s &pixel, BlendFactor blendFactorActive)
{
switch(blendFactorActive)
{
}
}
- void PixelRoutine::blendFactorAlpha(const Vector4s &blendFactor, const Vector4s ¤t, const Vector4s &pixel, BlendFactor blendFactorAlphaActive)
+ void PixelRoutine::blendFactorAlpha(Vector4s &blendFactor, const Vector4s ¤t, const Vector4s &pixel, BlendFactor blendFactorAlphaActive)
{
switch(blendFactorAlphaActive)
{
{
Int masked = value;
c01 &= *Pointer<Int>(constants + OFFSET(Constants,mask565Q[bgraWriteMask & 0x7][0]));
- masked &= *Pointer<Int>(constants + OFFSET(Constants,invMask565Q[bgraWriteMask & 0x7][0]));
+ masked &= *Pointer<Int>(constants + OFFSET(Constants,mask565Q[~bgraWriteMask & 0x7][0]));
c01 |= masked;
}
{
Int masked = value;
c23 &= *Pointer<Int>(constants + OFFSET(Constants,mask565Q[bgraWriteMask & 0x7][0]));
- masked &= *Pointer<Int>(constants + OFFSET(Constants,invMask565Q[bgraWriteMask & 0x7][0]));
+ masked &= *Pointer<Int>(constants + OFFSET(Constants,mask565Q[~bgraWriteMask & 0x7][0]));
c23 |= masked;
}
{
Short4 masked = value;
current.x &= *Pointer<Short4>(constants + OFFSET(Constants,maskW01Q[rgbaWriteMask & 0x3][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskW01Q[rgbaWriteMask & 0x3][0]));
+ masked &= *Pointer<Short4>(constants + OFFSET(Constants,maskW01Q[~rgbaWriteMask & 0x3][0]));
current.x |= masked;
}
{
Short4 masked = value;
current.y &= *Pointer<Short4>(constants + OFFSET(Constants,maskW01Q[rgbaWriteMask & 0x3][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskW01Q[rgbaWriteMask & 0x3][0]));
+ masked &= *Pointer<Short4>(constants + OFFSET(Constants,maskW01Q[~rgbaWriteMask & 0x3][0]));
current.y |= masked;
}
}
}
- void PixelRoutine::blendFactor(const Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, BlendFactor blendFactorActive)
+ void PixelRoutine::blendFactor(Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, BlendFactor blendFactorActive)
{
switch(blendFactorActive)
{
}
}
- void PixelRoutine::blendFactorAlpha(const Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, BlendFactor blendFactorAlphaActive)
+ void PixelRoutine::blendFactorAlpha(Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, BlendFactor blendFactorAlphaActive)
{
switch(blendFactorAlphaActive)
{
{
Float4 masked = value;
oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants,maskD01X[rgbaWriteMask & 0x3][0])));
- masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskD01X[rgbaWriteMask & 0x3][0])));
+ masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants,maskD01X[~rgbaWriteMask & 0x3][0])));
oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(masked));
}
masked = value;
oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants,maskD01X[rgbaWriteMask & 0x3][0])));
- masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskD01X[rgbaWriteMask & 0x3][0])));
+ masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants,maskD01X[~rgbaWriteMask & 0x3][0])));
oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(masked));
}
}
{
- value = (state.targetFormat[index] == FORMAT_X32B32G32R32F) ? Float4(1.0f) : *Pointer<Float4>(buffer + 16, 16);
+ value = *Pointer<Float4>(buffer + 16, 16);
if(rgbaWriteMask != 0x0000000F)
{