Optimize Int2 construction.
Change-Id: Ibab854164a45c998976e65b8bfec80a8a688461b
Reviewed-on: https://swiftshader-review.googlesource.com/4511
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/Shader/PixelRoutine.cpp b/src/Shader/PixelRoutine.cpp
index a0f876c..c313eb4 100644
--- a/src/Shader/PixelRoutine.cpp
+++ b/src/Shader/PixelRoutine.cpp
@@ -1013,14 +1013,14 @@
Short4 c01;
Short4 c23;
Pointer<Byte> buffer;
+ Pointer<Byte> buffer2;
switch(state.targetFormat[index])
{
case FORMAT_R5G6B5:
buffer = cBuffer + 2 * x;
- c01 = As<Short4>(Insert(As<Int2>(c01), *Pointer<Int>(buffer), 0));
- buffer += *Pointer<Int>(r.data + OFFSET(DrawData, colorPitchB[index]));
- c01 = As<Short4>(Insert(As<Int2>(c01), *Pointer<Int>(buffer), 1));
+ buffer2 = buffer + *Pointer<Int>(r.data + OFFSET(DrawData, colorPitchB[index]));
+ c01 = As<Short4>(Int2(*Pointer<Int>(buffer), *Pointer<Int>(buffer2)));
pixel.x = c01 & Short4(0xF800u);
pixel.y = (c01 & Short4(0x07E0u)) << 5;