Commit f549e3b6 by Nicolas Capens

Vectorize R5G6B5 framebuffer present.

Change-Id: I40922c89056cacd00f9d728dfe1f3f12824c81a1 Reviewed-on: https://swiftshader-review.googlesource.com/3253Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent ae518eb0
...@@ -263,17 +263,16 @@ namespace sw ...@@ -263,17 +263,16 @@ namespace sw
} }
break; break;
case FORMAT_R5G6B5: case FORMAT_R5G6B5:
For(, x < width, x++) For(, x < width - 3, x += 4)
{ {
Int rgb = Int(*Pointer<Short>(s)); Int4 rgb = Int4(*Pointer<Short4>(s));
*Pointer<Int>(d) = 0xFF000000 | *Pointer<Int4>(d) = (((rgb & Int4(0xF800)) << 8) | ((rgb & Int4(0xE01F)) << 3)) |
((rgb & 0xF800) << 8) | ((rgb & 0xE01F) << 3) | (((rgb & Int4(0x07E0)) << 5) | ((rgb & Int4(0x0600)) >> 1)) |
((rgb & 0x07E0) << 5) | ((rgb & 0x0600) >> 1) | (((rgb & Int4(0x001C)) >> 2) | Int4(0xFF000000));
((rgb & 0x001C) >> 2);
s += sBytes; s += 4 * sBytes;
d += dBytes; d += 4 * dBytes;
} }
break; break;
default: default:
...@@ -372,17 +371,17 @@ namespace sw ...@@ -372,17 +371,17 @@ namespace sw
} }
break; break;
case FORMAT_R5G6B5: case FORMAT_R5G6B5:
For(, x < width, x++) For(, x < width - 3, x += 4)
{ {
Int rgb = Int(*Pointer<Short>(s)); Int4 rgb = Int4(*Pointer<Short4>(s));
*Pointer<Int>(d) = 0xFF000000 | *Pointer<Int4>(d) = Int4(0xFF000000) |
((rgb & 0x001F) << 19) | ((rgb & 0x001C) << 14) | (((rgb & Int4(0x001F)) << 19) | ((rgb & Int4(0x001C)) << 14)) |
((rgb & 0x07E0) << 5) | ((rgb & 0x0600) >> 1) | (((rgb & Int4(0x07E0)) << 5) | ((rgb & Int4(0x0600)) >> 1)) |
((rgb & 0xF800) >> 8) | ((rgb & 0xE000) >> 13); (((rgb & Int4(0xF800)) >> 8) | ((rgb & Int4(0xE000)) >> 13));
s += sBytes; s += 4 * sBytes;
d += dBytes; d += 4 * dBytes;
} }
break; break;
default: default:
......
...@@ -496,7 +496,7 @@ namespace es2 ...@@ -496,7 +496,7 @@ namespace es2
if(targetUniform->type == floatType[index]) if(targetUniform->type == floatType[index])
{ {
memcpy(targetUniform->data + uniformIndex[location].element * sizeof(GLfloat)* numElements, memcpy(targetUniform->data + uniformIndex[location].element * sizeof(GLfloat)* numElements,
v, numElements * sizeof(GLfloat)* count); v, numElements * sizeof(GLfloat) * count);
} }
else if(targetUniform->type == boolType[index]) else if(targetUniform->type == boolType[index])
{ {
......
...@@ -4887,7 +4887,7 @@ namespace sw ...@@ -4887,7 +4887,7 @@ namespace sw
// Each Short is packed into each Int in the (Short | Short) format. // Each Short is packed into each Int in the (Short | Short) format.
// Shifting by 16 will retrieve the original Short value. // Shifting by 16 will retrieve the original Short value.
// Shitfing an Int will propagate the sign bit, which will work // Shifting an Int will propagate the sign bit, which will work
// for both positive and negative values of a Short. // for both positive and negative values of a Short.
*this >>= 16; *this >>= 16;
} }
......
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