Commit 76b9a6aa by Nicolas Capens

Simplify int4 and float4 types.

Change-Id: Id0d55c1364fc3db05821eb6ef666aed8c5713e31 Reviewed-on: https://swiftshader-review.googlesource.com/3503Reviewed-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 76a343af
...@@ -58,15 +58,12 @@ namespace sw ...@@ -58,15 +58,12 @@ namespace sw
ALIGN(16, struct int4 ALIGN(16, struct int4
{ {
struct int x;
{ int y;
int x; int z;
int y; int w;
int z;
int w;
};
int &operator[](int i) int &operator[](int i)
{ {
return (&x)[i]; return (&x)[i];
} }
...@@ -76,12 +73,12 @@ namespace sw ...@@ -76,12 +73,12 @@ namespace sw
return (&x)[i]; return (&x)[i];
} }
bool operator!=(int4 &rhs) bool operator!=(const int4 &rhs)
{ {
return x != rhs.x || y != rhs.y || z != rhs.z || w != rhs.w; return x != rhs.x || y != rhs.y || z != rhs.z || w != rhs.w;
} }
bool operator==(int4 &rhs) bool operator==(const int4 &rhs)
{ {
return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w; return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w;
} }
...@@ -89,26 +86,12 @@ namespace sw ...@@ -89,26 +86,12 @@ namespace sw
ALIGN(16, struct float4 ALIGN(16, struct float4
{ {
union float x;
{ float y;
struct float z;
{ float w;
float x;
float y; float &operator[](int i)
float z;
float w;
};
struct
{
float r;
float g;
float b;
float a;
};
};
float &operator[](int i)
{ {
return (&x)[i]; return (&x)[i];
} }
...@@ -118,12 +101,12 @@ namespace sw ...@@ -118,12 +101,12 @@ namespace sw
return (&x)[i]; return (&x)[i];
} }
bool operator!=(float4 &rhs) bool operator!=(const float4 &rhs)
{ {
return x != rhs.x || y != rhs.y || z != rhs.z || w != rhs.w; return x != rhs.x || y != rhs.y || z != rhs.z || w != rhs.w;
} }
bool operator==(float4 &rhs) bool operator==(const float4 &rhs)
{ {
return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w; return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w;
} }
......
...@@ -3482,10 +3482,10 @@ void Context::position(GLfloat x, GLfloat y, GLfloat z, GLfloat w) ...@@ -3482,10 +3482,10 @@ void Context::position(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
v.P.y = y; v.P.y = y;
v.P.z = z; v.P.z = z;
v.P.w = w; v.P.w = w;
v.C.r = mState.vertexAttribute[sw::Color0].mCurrentValue[0]; v.C.x = mState.vertexAttribute[sw::Color0].mCurrentValue[0];
v.C.g = mState.vertexAttribute[sw::Color0].mCurrentValue[1]; v.C.y = mState.vertexAttribute[sw::Color0].mCurrentValue[1];
v.C.b = mState.vertexAttribute[sw::Color0].mCurrentValue[2]; v.C.z = mState.vertexAttribute[sw::Color0].mCurrentValue[2];
v.C.a = mState.vertexAttribute[sw::Color0].mCurrentValue[3]; v.C.w = mState.vertexAttribute[sw::Color0].mCurrentValue[3];
v.N.x = mState.vertexAttribute[sw::Normal].mCurrentValue[0]; v.N.x = mState.vertexAttribute[sw::Normal].mCurrentValue[0];
v.N.y = mState.vertexAttribute[sw::Normal].mCurrentValue[1]; v.N.y = mState.vertexAttribute[sw::Normal].mCurrentValue[1];
v.N.z = mState.vertexAttribute[sw::Normal].mCurrentValue[2]; v.N.z = mState.vertexAttribute[sw::Normal].mCurrentValue[2];
......
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