Commit 88816fa8 by Ben Clayton

Reactor: Add UInt4 constructors taking UInt

Odd that these don't exist already. Change-Id: I018dc4eb5144cb4c359c790aadabc35516bdd745 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31430Tested-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 90cb2606
...@@ -2964,6 +2964,18 @@ namespace rr ...@@ -2964,6 +2964,18 @@ namespace rr
storeValue((~(As<Int4>(cast) >> 31) & uiValue).value); storeValue((~(As<Int4>(cast) >> 31) & uiValue).value);
} }
UInt4::UInt4(RValue<UInt> rhs) : XYZW(this)
{
RR_DEBUG_INFO_UPDATE_LOC();
Value *vector = loadValue();
Value *insert = Nucleus::createInsertElement(vector, rhs.value, 0);
int swizzle[4] = {0, 0, 0, 0};
Value *replicate = Nucleus::createShuffleVector(insert, insert, swizzle);
storeValue(replicate);
}
RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs) RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs)
{ {
RR_DEBUG_INFO_UPDATE_LOC(); RR_DEBUG_INFO_UPDATE_LOC();
......
...@@ -3500,6 +3500,16 @@ namespace rr ...@@ -3500,6 +3500,16 @@ namespace rr
storeValue(packed); storeValue(packed);
} }
UInt4::UInt4(const UInt &rhs) : XYZW(this)
{
*this = RValue<UInt>(rhs.loadValue());
}
UInt4::UInt4(const Reference<UInt> &rhs) : XYZW(this)
{
*this = RValue<UInt>(rhs.loadValue());
}
RValue<UInt4> UInt4::operator=(RValue<UInt4> rhs) RValue<UInt4> UInt4::operator=(RValue<UInt4> rhs)
{ {
storeValue(rhs.value); storeValue(rhs.value);
......
...@@ -1966,6 +1966,9 @@ namespace rr ...@@ -1966,6 +1966,9 @@ namespace rr
UInt4(const Int4 &rhs); UInt4(const Int4 &rhs);
UInt4(const Reference<Int4> &rhs); UInt4(const Reference<Int4> &rhs);
UInt4(RValue<UInt2> lo, RValue<UInt2> hi); UInt4(RValue<UInt2> lo, RValue<UInt2> hi);
UInt4(RValue<UInt> rhs);
UInt4(const UInt &rhs);
UInt4(const Reference<UInt> &rhs);
RValue<UInt4> operator=(RValue<UInt4> rhs); RValue<UInt4> operator=(RValue<UInt4> rhs);
RValue<UInt4> operator=(const UInt4 &rhs); RValue<UInt4> operator=(const UInt4 &rhs);
......
...@@ -3007,6 +3007,16 @@ namespace rr ...@@ -3007,6 +3007,16 @@ namespace rr
storeValue((~(As<Int4>(cast) >> 31) & uiValue).value); storeValue((~(As<Int4>(cast) >> 31) & uiValue).value);
} }
UInt4::UInt4(RValue<UInt> rhs) : XYZW(this)
{
Value *vector = Nucleus::createBitCast(rhs.value, UInt4::getType());
int swizzle[4] = {0, 0, 0, 0};
Value *replicate = Nucleus::createShuffleVector(vector, vector, swizzle);
storeValue(replicate);
}
RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs) RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs)
{ {
if(emulateIntrinsics) if(emulateIntrinsics)
......
...@@ -92,7 +92,7 @@ namespace sw ...@@ -92,7 +92,7 @@ namespace sw
{ {
if(state.textureSampling) if(state.textureSampling)
{ {
vertexID = Int4(index); vertexID = Int4(Int(index));
} }
else else
{ {
......
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