OSDN Git Service

Fixed loading GL_RGB10_A2UI texture format
authorAlexis Hetu <sugoi@google.com>
Tue, 1 Aug 2017 20:49:17 +0000 (16:49 -0400)
committerAlexis Hétu <sugoi@google.com>
Tue, 1 Aug 2017 21:08:48 +0000 (21:08 +0000)
The GL_RGB10_A2UI was being unpacked as a double sized version of
GL_UNSIGNED_SHORT_5_5_5_1, which it is not. The channels are not
stored in the same order for these 2 formats.

This fixes all "rgb10_a2ui" related test in:
dEQP-GLES3.functional.texture.format.sized.*
dEQP-GLES3.functional.texture.specification.*

Change-Id: I0d398d0537a440906e9ef3aeb01fe4e782f778b6
Reviewed-on: https://swiftshader-review.googlesource.com/11168
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
src/OpenGL/common/Image.cpp

index d3fe20e..f75f92f 100644 (file)
@@ -263,10 +263,10 @@ namespace
                for(int x = 0; x < width; x++)
                {
                        unsigned int rgba = source1010102U[x];
-                       dest16U[4 * x + 0] = (rgba & 0x00000FFC) >> 2;
-                       dest16U[4 * x + 1] = (rgba & 0x003FF000) >> 12;
-                       dest16U[4 * x + 2] = (rgba & 0xFFC00000) >> 22;
-                       dest16U[4 * x + 3] = (rgba & 0x00000003);
+                       dest16U[4 * x + 0] = (rgba & 0x000003FF);
+                       dest16U[4 * x + 1] = (rgba & 0x000FFC00) >> 10;
+                       dest16U[4 * x + 2] = (rgba & 0x3FF00000) >> 20;
+                       dest16U[4 * x + 3] = (rgba & 0xC0000000) >> 30;
                }
        }