1*8975f5c5SAndroid Build Coastguard Worker // 2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2013 The ANGLE Project Authors. All rights reserved. 3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file. 5*8975f5c5SAndroid Build Coastguard Worker // 6*8975f5c5SAndroid Build Coastguard Worker 7*8975f5c5SAndroid Build Coastguard Worker // imageformats.h: Defines image format types with functions for mip generation 8*8975f5c5SAndroid Build Coastguard Worker // and copying. 9*8975f5c5SAndroid Build Coastguard Worker 10*8975f5c5SAndroid Build Coastguard Worker #ifndef IMAGEUTIL_IMAGEFORMATS_H_ 11*8975f5c5SAndroid Build Coastguard Worker #define IMAGEUTIL_IMAGEFORMATS_H_ 12*8975f5c5SAndroid Build Coastguard Worker 13*8975f5c5SAndroid Build Coastguard Worker #include "common/Color.h" 14*8975f5c5SAndroid Build Coastguard Worker 15*8975f5c5SAndroid Build Coastguard Worker #include <cstdint> 16*8975f5c5SAndroid Build Coastguard Worker 17*8975f5c5SAndroid Build Coastguard Worker namespace angle 18*8975f5c5SAndroid Build Coastguard Worker { 19*8975f5c5SAndroid Build Coastguard Worker 20*8975f5c5SAndroid Build Coastguard Worker // Several structures share functionality for reading, writing or mipmapping but the layout 21*8975f5c5SAndroid Build Coastguard Worker // must match the texture format which the structure represents. If collapsing or typedefing 22*8975f5c5SAndroid Build Coastguard Worker // structs in this header, make sure the functionality and memory layout is exactly the same. 23*8975f5c5SAndroid Build Coastguard Worker 24*8975f5c5SAndroid Build Coastguard Worker struct L8 25*8975f5c5SAndroid Build Coastguard Worker { 26*8975f5c5SAndroid Build Coastguard Worker uint8_t L; 27*8975f5c5SAndroid Build Coastguard Worker 28*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const L8 *src); 29*8975f5c5SAndroid Build Coastguard Worker static void writeColor(L8 *dst, const gl::ColorF *src); 30*8975f5c5SAndroid Build Coastguard Worker static void average(L8 *dst, const L8 *src1, const L8 *src2); 31*8975f5c5SAndroid Build Coastguard Worker }; 32*8975f5c5SAndroid Build Coastguard Worker 33*8975f5c5SAndroid Build Coastguard Worker struct R8 34*8975f5c5SAndroid Build Coastguard Worker { 35*8975f5c5SAndroid Build Coastguard Worker uint8_t R; 36*8975f5c5SAndroid Build Coastguard Worker 37*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R8 *src); 38*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R8 *src); 39*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8 *dst, const gl::ColorF *src); 40*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8 *dst, const gl::ColorUI *src); 41*8975f5c5SAndroid Build Coastguard Worker static void average(R8 *dst, const R8 *src1, const R8 *src2); 42*8975f5c5SAndroid Build Coastguard Worker }; 43*8975f5c5SAndroid Build Coastguard Worker 44*8975f5c5SAndroid Build Coastguard Worker struct A8 45*8975f5c5SAndroid Build Coastguard Worker { 46*8975f5c5SAndroid Build Coastguard Worker uint8_t A; 47*8975f5c5SAndroid Build Coastguard Worker 48*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const A8 *src); 49*8975f5c5SAndroid Build Coastguard Worker static void writeColor(A8 *dst, const gl::ColorF *src); 50*8975f5c5SAndroid Build Coastguard Worker static void average(A8 *dst, const A8 *src1, const A8 *src2); 51*8975f5c5SAndroid Build Coastguard Worker }; 52*8975f5c5SAndroid Build Coastguard Worker 53*8975f5c5SAndroid Build Coastguard Worker struct L8A8 54*8975f5c5SAndroid Build Coastguard Worker { 55*8975f5c5SAndroid Build Coastguard Worker uint8_t L; 56*8975f5c5SAndroid Build Coastguard Worker uint8_t A; 57*8975f5c5SAndroid Build Coastguard Worker 58*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const L8A8 *src); 59*8975f5c5SAndroid Build Coastguard Worker static void writeColor(L8A8 *dst, const gl::ColorF *src); 60*8975f5c5SAndroid Build Coastguard Worker static void average(L8A8 *dst, const L8A8 *src1, const L8A8 *src2); 61*8975f5c5SAndroid Build Coastguard Worker }; 62*8975f5c5SAndroid Build Coastguard Worker 63*8975f5c5SAndroid Build Coastguard Worker struct A8L8 64*8975f5c5SAndroid Build Coastguard Worker { 65*8975f5c5SAndroid Build Coastguard Worker uint8_t A; 66*8975f5c5SAndroid Build Coastguard Worker uint8_t L; 67*8975f5c5SAndroid Build Coastguard Worker 68*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const A8L8 *src); 69*8975f5c5SAndroid Build Coastguard Worker static void writeColor(A8L8 *dst, const gl::ColorF *src); 70*8975f5c5SAndroid Build Coastguard Worker static void average(A8L8 *dst, const A8L8 *src1, const A8L8 *src2); 71*8975f5c5SAndroid Build Coastguard Worker }; 72*8975f5c5SAndroid Build Coastguard Worker 73*8975f5c5SAndroid Build Coastguard Worker struct L4A4 74*8975f5c5SAndroid Build Coastguard Worker { 75*8975f5c5SAndroid Build Coastguard Worker uint8_t L : 4; 76*8975f5c5SAndroid Build Coastguard Worker uint8_t A : 4; 77*8975f5c5SAndroid Build Coastguard Worker 78*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const L4A4 *src); 79*8975f5c5SAndroid Build Coastguard Worker static void writeColor(L4A4 *dst, const gl::ColorF *src); 80*8975f5c5SAndroid Build Coastguard Worker static void average(L4A4 *dst, const L4A4 *src1, const L4A4 *src2); 81*8975f5c5SAndroid Build Coastguard Worker }; 82*8975f5c5SAndroid Build Coastguard Worker 83*8975f5c5SAndroid Build Coastguard Worker struct R8G8 84*8975f5c5SAndroid Build Coastguard Worker { 85*8975f5c5SAndroid Build Coastguard Worker uint8_t R; 86*8975f5c5SAndroid Build Coastguard Worker uint8_t G; 87*8975f5c5SAndroid Build Coastguard Worker 88*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R8G8 *src); 89*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R8G8 *src); 90*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8 *dst, const gl::ColorF *src); 91*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8 *dst, const gl::ColorUI *src); 92*8975f5c5SAndroid Build Coastguard Worker static void average(R8G8 *dst, const R8G8 *src1, const R8G8 *src2); 93*8975f5c5SAndroid Build Coastguard Worker }; 94*8975f5c5SAndroid Build Coastguard Worker 95*8975f5c5SAndroid Build Coastguard Worker struct R8G8B8 96*8975f5c5SAndroid Build Coastguard Worker { 97*8975f5c5SAndroid Build Coastguard Worker uint8_t R; 98*8975f5c5SAndroid Build Coastguard Worker uint8_t G; 99*8975f5c5SAndroid Build Coastguard Worker uint8_t B; 100*8975f5c5SAndroid Build Coastguard Worker 101*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R8G8B8 *src); 102*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R8G8B8 *src); 103*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8B8 *dst, const gl::ColorF *src); 104*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8B8 *dst, const gl::ColorUI *src); 105*8975f5c5SAndroid Build Coastguard Worker static void average(R8G8B8 *dst, const R8G8B8 *src1, const R8G8B8 *src2); 106*8975f5c5SAndroid Build Coastguard Worker }; 107*8975f5c5SAndroid Build Coastguard Worker 108*8975f5c5SAndroid Build Coastguard Worker struct B8G8R8 109*8975f5c5SAndroid Build Coastguard Worker { 110*8975f5c5SAndroid Build Coastguard Worker uint8_t B; 111*8975f5c5SAndroid Build Coastguard Worker uint8_t G; 112*8975f5c5SAndroid Build Coastguard Worker uint8_t R; 113*8975f5c5SAndroid Build Coastguard Worker 114*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const B8G8R8 *src); 115*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const B8G8R8 *src); 116*8975f5c5SAndroid Build Coastguard Worker static void writeColor(B8G8R8 *dst, const gl::ColorF *src); 117*8975f5c5SAndroid Build Coastguard Worker static void writeColor(B8G8R8 *dst, const gl::ColorUI *src); 118*8975f5c5SAndroid Build Coastguard Worker static void average(B8G8R8 *dst, const B8G8R8 *src1, const B8G8R8 *src2); 119*8975f5c5SAndroid Build Coastguard Worker }; 120*8975f5c5SAndroid Build Coastguard Worker 121*8975f5c5SAndroid Build Coastguard Worker struct R5G6B5 122*8975f5c5SAndroid Build Coastguard Worker { 123*8975f5c5SAndroid Build Coastguard Worker // OpenGL ES 2.0.25 spec Section 3.6.2: "Components are packed with the first component in the 124*8975f5c5SAndroid Build Coastguard Worker // most significant bits of the bitfield, and successive component occupying progressively less 125*8975f5c5SAndroid Build Coastguard Worker // significant locations" 126*8975f5c5SAndroid Build Coastguard Worker uint16_t RGB; 127*8975f5c5SAndroid Build Coastguard Worker 128*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R5G6B5 *src); 129*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R5G6B5 *dst, const gl::ColorF *src); 130*8975f5c5SAndroid Build Coastguard Worker static void average(R5G6B5 *dst, const R5G6B5 *src1, const R5G6B5 *src2); 131*8975f5c5SAndroid Build Coastguard Worker }; 132*8975f5c5SAndroid Build Coastguard Worker 133*8975f5c5SAndroid Build Coastguard Worker struct B5G6R5 134*8975f5c5SAndroid Build Coastguard Worker { 135*8975f5c5SAndroid Build Coastguard Worker uint16_t BGR; 136*8975f5c5SAndroid Build Coastguard Worker 137*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const B5G6R5 *src); 138*8975f5c5SAndroid Build Coastguard Worker static void writeColor(B5G6R5 *dst, const gl::ColorF *src); 139*8975f5c5SAndroid Build Coastguard Worker static void average(B5G6R5 *dst, const B5G6R5 *src1, const B5G6R5 *src2); 140*8975f5c5SAndroid Build Coastguard Worker }; 141*8975f5c5SAndroid Build Coastguard Worker 142*8975f5c5SAndroid Build Coastguard Worker struct A8R8G8B8 143*8975f5c5SAndroid Build Coastguard Worker { 144*8975f5c5SAndroid Build Coastguard Worker uint8_t A; 145*8975f5c5SAndroid Build Coastguard Worker uint8_t R; 146*8975f5c5SAndroid Build Coastguard Worker uint8_t G; 147*8975f5c5SAndroid Build Coastguard Worker uint8_t B; 148*8975f5c5SAndroid Build Coastguard Worker 149*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const A8R8G8B8 *src); 150*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const A8R8G8B8 *src); 151*8975f5c5SAndroid Build Coastguard Worker static void writeColor(A8R8G8B8 *dst, const gl::ColorF *src); 152*8975f5c5SAndroid Build Coastguard Worker static void writeColor(A8R8G8B8 *dst, const gl::ColorUI *src); 153*8975f5c5SAndroid Build Coastguard Worker static void average(A8R8G8B8 *dst, const A8R8G8B8 *src1, const A8R8G8B8 *src2); 154*8975f5c5SAndroid Build Coastguard Worker }; 155*8975f5c5SAndroid Build Coastguard Worker 156*8975f5c5SAndroid Build Coastguard Worker struct R8G8B8A8 157*8975f5c5SAndroid Build Coastguard Worker { 158*8975f5c5SAndroid Build Coastguard Worker uint8_t R; 159*8975f5c5SAndroid Build Coastguard Worker uint8_t G; 160*8975f5c5SAndroid Build Coastguard Worker uint8_t B; 161*8975f5c5SAndroid Build Coastguard Worker uint8_t A; 162*8975f5c5SAndroid Build Coastguard Worker 163*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R8G8B8A8 *src); 164*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R8G8B8A8 *src); 165*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8B8A8 *dst, const gl::ColorF *src); 166*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8B8A8 *dst, const gl::ColorUI *src); 167*8975f5c5SAndroid Build Coastguard Worker static void average(R8G8B8A8 *dst, const R8G8B8A8 *src1, const R8G8B8A8 *src2); 168*8975f5c5SAndroid Build Coastguard Worker }; 169*8975f5c5SAndroid Build Coastguard Worker 170*8975f5c5SAndroid Build Coastguard Worker struct R8G8B8A8SRGB 171*8975f5c5SAndroid Build Coastguard Worker { 172*8975f5c5SAndroid Build Coastguard Worker uint8_t R; 173*8975f5c5SAndroid Build Coastguard Worker uint8_t G; 174*8975f5c5SAndroid Build Coastguard Worker uint8_t B; 175*8975f5c5SAndroid Build Coastguard Worker uint8_t A; 176*8975f5c5SAndroid Build Coastguard Worker 177*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R8G8B8A8SRGB *src); 178*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8B8A8SRGB *dst, const gl::ColorF *src); 179*8975f5c5SAndroid Build Coastguard Worker static void average(R8G8B8A8SRGB *dst, const R8G8B8A8SRGB *src1, const R8G8B8A8SRGB *src2); 180*8975f5c5SAndroid Build Coastguard Worker }; 181*8975f5c5SAndroid Build Coastguard Worker 182*8975f5c5SAndroid Build Coastguard Worker struct B8G8R8A8 183*8975f5c5SAndroid Build Coastguard Worker { 184*8975f5c5SAndroid Build Coastguard Worker uint8_t B; 185*8975f5c5SAndroid Build Coastguard Worker uint8_t G; 186*8975f5c5SAndroid Build Coastguard Worker uint8_t R; 187*8975f5c5SAndroid Build Coastguard Worker uint8_t A; 188*8975f5c5SAndroid Build Coastguard Worker 189*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const B8G8R8A8 *src); 190*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const B8G8R8A8 *src); 191*8975f5c5SAndroid Build Coastguard Worker static void writeColor(B8G8R8A8 *dst, const gl::ColorF *src); 192*8975f5c5SAndroid Build Coastguard Worker static void writeColor(B8G8R8A8 *dst, const gl::ColorUI *src); 193*8975f5c5SAndroid Build Coastguard Worker static void average(B8G8R8A8 *dst, const B8G8R8A8 *src1, const B8G8R8A8 *src2); 194*8975f5c5SAndroid Build Coastguard Worker }; 195*8975f5c5SAndroid Build Coastguard Worker 196*8975f5c5SAndroid Build Coastguard Worker struct B8G8R8X8 197*8975f5c5SAndroid Build Coastguard Worker { 198*8975f5c5SAndroid Build Coastguard Worker uint8_t B; 199*8975f5c5SAndroid Build Coastguard Worker uint8_t G; 200*8975f5c5SAndroid Build Coastguard Worker uint8_t R; 201*8975f5c5SAndroid Build Coastguard Worker uint8_t X; 202*8975f5c5SAndroid Build Coastguard Worker 203*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const B8G8R8X8 *src); 204*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const B8G8R8X8 *src); 205*8975f5c5SAndroid Build Coastguard Worker static void writeColor(B8G8R8X8 *dst, const gl::ColorF *src); 206*8975f5c5SAndroid Build Coastguard Worker static void writeColor(B8G8R8X8 *dst, const gl::ColorUI *src); 207*8975f5c5SAndroid Build Coastguard Worker static void average(B8G8R8X8 *dst, const B8G8R8X8 *src1, const B8G8R8X8 *src2); 208*8975f5c5SAndroid Build Coastguard Worker }; 209*8975f5c5SAndroid Build Coastguard Worker 210*8975f5c5SAndroid Build Coastguard Worker struct R8G8B8X8 211*8975f5c5SAndroid Build Coastguard Worker { 212*8975f5c5SAndroid Build Coastguard Worker uint8_t R; 213*8975f5c5SAndroid Build Coastguard Worker uint8_t G; 214*8975f5c5SAndroid Build Coastguard Worker uint8_t B; 215*8975f5c5SAndroid Build Coastguard Worker uint8_t X; 216*8975f5c5SAndroid Build Coastguard Worker 217*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R8G8B8X8 *src); 218*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R8G8B8X8 *src); 219*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8B8X8 *dst, const gl::ColorF *src); 220*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8B8X8 *dst, const gl::ColorUI *src); 221*8975f5c5SAndroid Build Coastguard Worker static void average(R8G8B8X8 *dst, const R8G8B8X8 *src1, const R8G8B8X8 *src2); 222*8975f5c5SAndroid Build Coastguard Worker }; 223*8975f5c5SAndroid Build Coastguard Worker 224*8975f5c5SAndroid Build Coastguard Worker struct A1R5G5B5 225*8975f5c5SAndroid Build Coastguard Worker { 226*8975f5c5SAndroid Build Coastguard Worker uint16_t ARGB; 227*8975f5c5SAndroid Build Coastguard Worker 228*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const A1R5G5B5 *src); 229*8975f5c5SAndroid Build Coastguard Worker static void writeColor(A1R5G5B5 *dst, const gl::ColorF *src); 230*8975f5c5SAndroid Build Coastguard Worker static void average(A1R5G5B5 *dst, const A1R5G5B5 *src1, const A1R5G5B5 *src2); 231*8975f5c5SAndroid Build Coastguard Worker }; 232*8975f5c5SAndroid Build Coastguard Worker 233*8975f5c5SAndroid Build Coastguard Worker struct R5G5B5A1 234*8975f5c5SAndroid Build Coastguard Worker { 235*8975f5c5SAndroid Build Coastguard Worker // OpenGL ES 2.0.25 spec Section 3.6.2: "Components are packed with the first component in the 236*8975f5c5SAndroid Build Coastguard Worker // most significant 237*8975f5c5SAndroid Build Coastguard Worker // bits of the bitfield, and successive component occupying progressively less significant 238*8975f5c5SAndroid Build Coastguard Worker // locations" 239*8975f5c5SAndroid Build Coastguard Worker uint16_t RGBA; 240*8975f5c5SAndroid Build Coastguard Worker 241*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R5G5B5A1 *src); 242*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R5G5B5A1 *dst, const gl::ColorF *src); 243*8975f5c5SAndroid Build Coastguard Worker static void average(R5G5B5A1 *dst, const R5G5B5A1 *src1, const R5G5B5A1 *src2); 244*8975f5c5SAndroid Build Coastguard Worker }; 245*8975f5c5SAndroid Build Coastguard Worker 246*8975f5c5SAndroid Build Coastguard Worker struct R4G4B4A4 247*8975f5c5SAndroid Build Coastguard Worker { 248*8975f5c5SAndroid Build Coastguard Worker // OpenGL ES 2.0.25 spec Section 3.6.2: "Components are packed with the first component in the 249*8975f5c5SAndroid Build Coastguard Worker // most significant 250*8975f5c5SAndroid Build Coastguard Worker // bits of the bitfield, and successive component occupying progressively less significant 251*8975f5c5SAndroid Build Coastguard Worker // locations" 252*8975f5c5SAndroid Build Coastguard Worker uint16_t RGBA; 253*8975f5c5SAndroid Build Coastguard Worker 254*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R4G4B4A4 *src); 255*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R4G4B4A4 *dst, const gl::ColorF *src); 256*8975f5c5SAndroid Build Coastguard Worker static void average(R4G4B4A4 *dst, const R4G4B4A4 *src1, const R4G4B4A4 *src2); 257*8975f5c5SAndroid Build Coastguard Worker }; 258*8975f5c5SAndroid Build Coastguard Worker 259*8975f5c5SAndroid Build Coastguard Worker struct A4R4G4B4 260*8975f5c5SAndroid Build Coastguard Worker { 261*8975f5c5SAndroid Build Coastguard Worker uint16_t ARGB; 262*8975f5c5SAndroid Build Coastguard Worker 263*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const A4R4G4B4 *src); 264*8975f5c5SAndroid Build Coastguard Worker static void writeColor(A4R4G4B4 *dst, const gl::ColorF *src); 265*8975f5c5SAndroid Build Coastguard Worker static void average(A4R4G4B4 *dst, const A4R4G4B4 *src1, const A4R4G4B4 *src2); 266*8975f5c5SAndroid Build Coastguard Worker }; 267*8975f5c5SAndroid Build Coastguard Worker 268*8975f5c5SAndroid Build Coastguard Worker struct R16 269*8975f5c5SAndroid Build Coastguard Worker { 270*8975f5c5SAndroid Build Coastguard Worker uint16_t R; 271*8975f5c5SAndroid Build Coastguard Worker 272*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16 *src); 273*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R16 *src); 274*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16 *dst, const gl::ColorF *src); 275*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16 *dst, const gl::ColorUI *src); 276*8975f5c5SAndroid Build Coastguard Worker static void average(R16 *dst, const R16 *src1, const R16 *src2); 277*8975f5c5SAndroid Build Coastguard Worker }; 278*8975f5c5SAndroid Build Coastguard Worker 279*8975f5c5SAndroid Build Coastguard Worker struct R16G16 280*8975f5c5SAndroid Build Coastguard Worker { 281*8975f5c5SAndroid Build Coastguard Worker uint16_t R; 282*8975f5c5SAndroid Build Coastguard Worker uint16_t G; 283*8975f5c5SAndroid Build Coastguard Worker 284*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16G16 *src); 285*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R16G16 *src); 286*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16 *dst, const gl::ColorF *src); 287*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16 *dst, const gl::ColorUI *src); 288*8975f5c5SAndroid Build Coastguard Worker static void average(R16G16 *dst, const R16G16 *src1, const R16G16 *src2); 289*8975f5c5SAndroid Build Coastguard Worker }; 290*8975f5c5SAndroid Build Coastguard Worker 291*8975f5c5SAndroid Build Coastguard Worker struct R16G16B16 292*8975f5c5SAndroid Build Coastguard Worker { 293*8975f5c5SAndroid Build Coastguard Worker uint16_t R; 294*8975f5c5SAndroid Build Coastguard Worker uint16_t G; 295*8975f5c5SAndroid Build Coastguard Worker uint16_t B; 296*8975f5c5SAndroid Build Coastguard Worker 297*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16G16B16 *src); 298*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R16G16B16 *src); 299*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16B16 *dst, const gl::ColorF *src); 300*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16B16 *dst, const gl::ColorUI *src); 301*8975f5c5SAndroid Build Coastguard Worker static void average(R16G16B16 *dst, const R16G16B16 *src1, const R16G16B16 *src2); 302*8975f5c5SAndroid Build Coastguard Worker }; 303*8975f5c5SAndroid Build Coastguard Worker 304*8975f5c5SAndroid Build Coastguard Worker struct R16G16B16A16 305*8975f5c5SAndroid Build Coastguard Worker { 306*8975f5c5SAndroid Build Coastguard Worker uint16_t R; 307*8975f5c5SAndroid Build Coastguard Worker uint16_t G; 308*8975f5c5SAndroid Build Coastguard Worker uint16_t B; 309*8975f5c5SAndroid Build Coastguard Worker uint16_t A; 310*8975f5c5SAndroid Build Coastguard Worker 311*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16G16B16A16 *src); 312*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R16G16B16A16 *src); 313*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16B16A16 *dst, const gl::ColorF *src); 314*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16B16A16 *dst, const gl::ColorUI *src); 315*8975f5c5SAndroid Build Coastguard Worker static void average(R16G16B16A16 *dst, const R16G16B16A16 *src1, const R16G16B16A16 *src2); 316*8975f5c5SAndroid Build Coastguard Worker }; 317*8975f5c5SAndroid Build Coastguard Worker 318*8975f5c5SAndroid Build Coastguard Worker struct R32 319*8975f5c5SAndroid Build Coastguard Worker { 320*8975f5c5SAndroid Build Coastguard Worker uint32_t R; 321*8975f5c5SAndroid Build Coastguard Worker 322*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32 *src); 323*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R32 *src); 324*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32 *dst, const gl::ColorF *src); 325*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32 *dst, const gl::ColorUI *src); 326*8975f5c5SAndroid Build Coastguard Worker static void average(R32 *dst, const R32 *src1, const R32 *src2); 327*8975f5c5SAndroid Build Coastguard Worker }; 328*8975f5c5SAndroid Build Coastguard Worker 329*8975f5c5SAndroid Build Coastguard Worker struct R32G32 330*8975f5c5SAndroid Build Coastguard Worker { 331*8975f5c5SAndroid Build Coastguard Worker uint32_t R; 332*8975f5c5SAndroid Build Coastguard Worker uint32_t G; 333*8975f5c5SAndroid Build Coastguard Worker 334*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32G32 *src); 335*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R32G32 *src); 336*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32 *dst, const gl::ColorF *src); 337*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32 *dst, const gl::ColorUI *src); 338*8975f5c5SAndroid Build Coastguard Worker static void average(R32G32 *dst, const R32G32 *src1, const R32G32 *src2); 339*8975f5c5SAndroid Build Coastguard Worker }; 340*8975f5c5SAndroid Build Coastguard Worker 341*8975f5c5SAndroid Build Coastguard Worker struct R32G32B32 342*8975f5c5SAndroid Build Coastguard Worker { 343*8975f5c5SAndroid Build Coastguard Worker uint32_t R; 344*8975f5c5SAndroid Build Coastguard Worker uint32_t G; 345*8975f5c5SAndroid Build Coastguard Worker uint32_t B; 346*8975f5c5SAndroid Build Coastguard Worker 347*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32G32B32 *src); 348*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R32G32B32 *src); 349*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32B32 *dst, const gl::ColorF *src); 350*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32B32 *dst, const gl::ColorUI *src); 351*8975f5c5SAndroid Build Coastguard Worker static void average(R32G32B32 *dst, const R32G32B32 *src1, const R32G32B32 *src2); 352*8975f5c5SAndroid Build Coastguard Worker }; 353*8975f5c5SAndroid Build Coastguard Worker 354*8975f5c5SAndroid Build Coastguard Worker struct R32G32B32A32 355*8975f5c5SAndroid Build Coastguard Worker { 356*8975f5c5SAndroid Build Coastguard Worker uint32_t R; 357*8975f5c5SAndroid Build Coastguard Worker uint32_t G; 358*8975f5c5SAndroid Build Coastguard Worker uint32_t B; 359*8975f5c5SAndroid Build Coastguard Worker uint32_t A; 360*8975f5c5SAndroid Build Coastguard Worker 361*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32G32B32A32 *src); 362*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R32G32B32A32 *src); 363*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32B32A32 *dst, const gl::ColorF *src); 364*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32B32A32 *dst, const gl::ColorUI *src); 365*8975f5c5SAndroid Build Coastguard Worker static void average(R32G32B32A32 *dst, const R32G32B32A32 *src1, const R32G32B32A32 *src2); 366*8975f5c5SAndroid Build Coastguard Worker }; 367*8975f5c5SAndroid Build Coastguard Worker 368*8975f5c5SAndroid Build Coastguard Worker struct R8S 369*8975f5c5SAndroid Build Coastguard Worker { 370*8975f5c5SAndroid Build Coastguard Worker int8_t R; 371*8975f5c5SAndroid Build Coastguard Worker 372*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R8S *src); 373*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R8S *src); 374*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8S *dst, const gl::ColorF *src); 375*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8S *dst, const gl::ColorI *src); 376*8975f5c5SAndroid Build Coastguard Worker static void average(R8S *dst, const R8S *src1, const R8S *src2); 377*8975f5c5SAndroid Build Coastguard Worker }; 378*8975f5c5SAndroid Build Coastguard Worker 379*8975f5c5SAndroid Build Coastguard Worker struct R8G8S 380*8975f5c5SAndroid Build Coastguard Worker { 381*8975f5c5SAndroid Build Coastguard Worker int8_t R; 382*8975f5c5SAndroid Build Coastguard Worker int8_t G; 383*8975f5c5SAndroid Build Coastguard Worker 384*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R8G8S *src); 385*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R8G8S *src); 386*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8S *dst, const gl::ColorF *src); 387*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8S *dst, const gl::ColorI *src); 388*8975f5c5SAndroid Build Coastguard Worker static void average(R8G8S *dst, const R8G8S *src1, const R8G8S *src2); 389*8975f5c5SAndroid Build Coastguard Worker }; 390*8975f5c5SAndroid Build Coastguard Worker 391*8975f5c5SAndroid Build Coastguard Worker struct R8G8B8S 392*8975f5c5SAndroid Build Coastguard Worker { 393*8975f5c5SAndroid Build Coastguard Worker int8_t R; 394*8975f5c5SAndroid Build Coastguard Worker int8_t G; 395*8975f5c5SAndroid Build Coastguard Worker int8_t B; 396*8975f5c5SAndroid Build Coastguard Worker 397*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R8G8B8S *src); 398*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R8G8B8S *src); 399*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8B8S *dst, const gl::ColorF *src); 400*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8B8S *dst, const gl::ColorI *src); 401*8975f5c5SAndroid Build Coastguard Worker static void average(R8G8B8S *dst, const R8G8B8S *src1, const R8G8B8S *src2); 402*8975f5c5SAndroid Build Coastguard Worker }; 403*8975f5c5SAndroid Build Coastguard Worker 404*8975f5c5SAndroid Build Coastguard Worker struct R8G8B8A8S 405*8975f5c5SAndroid Build Coastguard Worker { 406*8975f5c5SAndroid Build Coastguard Worker int8_t R; 407*8975f5c5SAndroid Build Coastguard Worker int8_t G; 408*8975f5c5SAndroid Build Coastguard Worker int8_t B; 409*8975f5c5SAndroid Build Coastguard Worker int8_t A; 410*8975f5c5SAndroid Build Coastguard Worker 411*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R8G8B8A8S *src); 412*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R8G8B8A8S *src); 413*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8B8A8S *dst, const gl::ColorF *src); 414*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R8G8B8A8S *dst, const gl::ColorI *src); 415*8975f5c5SAndroid Build Coastguard Worker static void average(R8G8B8A8S *dst, const R8G8B8A8S *src1, const R8G8B8A8S *src2); 416*8975f5c5SAndroid Build Coastguard Worker }; 417*8975f5c5SAndroid Build Coastguard Worker 418*8975f5c5SAndroid Build Coastguard Worker struct R16S 419*8975f5c5SAndroid Build Coastguard Worker { 420*8975f5c5SAndroid Build Coastguard Worker int16_t R; 421*8975f5c5SAndroid Build Coastguard Worker 422*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16S *src); 423*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R16S *src); 424*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16S *dst, const gl::ColorF *src); 425*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16S *dst, const gl::ColorI *src); 426*8975f5c5SAndroid Build Coastguard Worker static void average(R16S *dst, const R16S *src1, const R16S *src2); 427*8975f5c5SAndroid Build Coastguard Worker }; 428*8975f5c5SAndroid Build Coastguard Worker 429*8975f5c5SAndroid Build Coastguard Worker struct R16G16S 430*8975f5c5SAndroid Build Coastguard Worker { 431*8975f5c5SAndroid Build Coastguard Worker int16_t R; 432*8975f5c5SAndroid Build Coastguard Worker int16_t G; 433*8975f5c5SAndroid Build Coastguard Worker 434*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16G16S *src); 435*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R16G16S *src); 436*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16S *dst, const gl::ColorF *src); 437*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16S *dst, const gl::ColorI *src); 438*8975f5c5SAndroid Build Coastguard Worker static void average(R16G16S *dst, const R16G16S *src1, const R16G16S *src2); 439*8975f5c5SAndroid Build Coastguard Worker }; 440*8975f5c5SAndroid Build Coastguard Worker 441*8975f5c5SAndroid Build Coastguard Worker struct R16G16B16S 442*8975f5c5SAndroid Build Coastguard Worker { 443*8975f5c5SAndroid Build Coastguard Worker int16_t R; 444*8975f5c5SAndroid Build Coastguard Worker int16_t G; 445*8975f5c5SAndroid Build Coastguard Worker int16_t B; 446*8975f5c5SAndroid Build Coastguard Worker 447*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16G16B16S *src); 448*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R16G16B16S *src); 449*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16B16S *dst, const gl::ColorF *src); 450*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16B16S *dst, const gl::ColorI *src); 451*8975f5c5SAndroid Build Coastguard Worker static void average(R16G16B16S *dst, const R16G16B16S *src1, const R16G16B16S *src2); 452*8975f5c5SAndroid Build Coastguard Worker }; 453*8975f5c5SAndroid Build Coastguard Worker 454*8975f5c5SAndroid Build Coastguard Worker struct R16G16B16A16S 455*8975f5c5SAndroid Build Coastguard Worker { 456*8975f5c5SAndroid Build Coastguard Worker int16_t R; 457*8975f5c5SAndroid Build Coastguard Worker int16_t G; 458*8975f5c5SAndroid Build Coastguard Worker int16_t B; 459*8975f5c5SAndroid Build Coastguard Worker int16_t A; 460*8975f5c5SAndroid Build Coastguard Worker 461*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16G16B16A16S *src); 462*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R16G16B16A16S *src); 463*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16B16A16S *dst, const gl::ColorF *src); 464*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16B16A16S *dst, const gl::ColorI *src); 465*8975f5c5SAndroid Build Coastguard Worker static void average(R16G16B16A16S *dst, const R16G16B16A16S *src1, const R16G16B16A16S *src2); 466*8975f5c5SAndroid Build Coastguard Worker }; 467*8975f5c5SAndroid Build Coastguard Worker 468*8975f5c5SAndroid Build Coastguard Worker struct R32S 469*8975f5c5SAndroid Build Coastguard Worker { 470*8975f5c5SAndroid Build Coastguard Worker int32_t R; 471*8975f5c5SAndroid Build Coastguard Worker 472*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32S *src); 473*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R32S *src); 474*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32S *dst, const gl::ColorF *src); 475*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32S *dst, const gl::ColorI *src); 476*8975f5c5SAndroid Build Coastguard Worker static void average(R32S *dst, const R32S *src1, const R32S *src2); 477*8975f5c5SAndroid Build Coastguard Worker }; 478*8975f5c5SAndroid Build Coastguard Worker 479*8975f5c5SAndroid Build Coastguard Worker struct R32G32S 480*8975f5c5SAndroid Build Coastguard Worker { 481*8975f5c5SAndroid Build Coastguard Worker int32_t R; 482*8975f5c5SAndroid Build Coastguard Worker int32_t G; 483*8975f5c5SAndroid Build Coastguard Worker 484*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32G32S *src); 485*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R32G32S *src); 486*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32S *dst, const gl::ColorF *src); 487*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32S *dst, const gl::ColorI *src); 488*8975f5c5SAndroid Build Coastguard Worker static void average(R32G32S *dst, const R32G32S *src1, const R32G32S *src2); 489*8975f5c5SAndroid Build Coastguard Worker }; 490*8975f5c5SAndroid Build Coastguard Worker 491*8975f5c5SAndroid Build Coastguard Worker struct R32G32B32S 492*8975f5c5SAndroid Build Coastguard Worker { 493*8975f5c5SAndroid Build Coastguard Worker int32_t R; 494*8975f5c5SAndroid Build Coastguard Worker int32_t G; 495*8975f5c5SAndroid Build Coastguard Worker int32_t B; 496*8975f5c5SAndroid Build Coastguard Worker 497*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32G32B32S *src); 498*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R32G32B32S *src); 499*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32B32S *dst, const gl::ColorF *src); 500*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32B32S *dst, const gl::ColorI *src); 501*8975f5c5SAndroid Build Coastguard Worker static void average(R32G32B32S *dst, const R32G32B32S *src1, const R32G32B32S *src2); 502*8975f5c5SAndroid Build Coastguard Worker }; 503*8975f5c5SAndroid Build Coastguard Worker 504*8975f5c5SAndroid Build Coastguard Worker struct R32G32B32A32S 505*8975f5c5SAndroid Build Coastguard Worker { 506*8975f5c5SAndroid Build Coastguard Worker int32_t R; 507*8975f5c5SAndroid Build Coastguard Worker int32_t G; 508*8975f5c5SAndroid Build Coastguard Worker int32_t B; 509*8975f5c5SAndroid Build Coastguard Worker int32_t A; 510*8975f5c5SAndroid Build Coastguard Worker 511*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32G32B32A32S *src); 512*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R32G32B32A32S *src); 513*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32B32A32S *dst, const gl::ColorF *src); 514*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32B32A32S *dst, const gl::ColorI *src); 515*8975f5c5SAndroid Build Coastguard Worker static void average(R32G32B32A32S *dst, const R32G32B32A32S *src1, const R32G32B32A32S *src2); 516*8975f5c5SAndroid Build Coastguard Worker }; 517*8975f5c5SAndroid Build Coastguard Worker 518*8975f5c5SAndroid Build Coastguard Worker struct A16B16G16R16F 519*8975f5c5SAndroid Build Coastguard Worker { 520*8975f5c5SAndroid Build Coastguard Worker uint16_t A; 521*8975f5c5SAndroid Build Coastguard Worker uint16_t R; 522*8975f5c5SAndroid Build Coastguard Worker uint16_t G; 523*8975f5c5SAndroid Build Coastguard Worker uint16_t B; 524*8975f5c5SAndroid Build Coastguard Worker 525*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const A16B16G16R16F *src); 526*8975f5c5SAndroid Build Coastguard Worker static void writeColor(A16B16G16R16F *dst, const gl::ColorF *src); 527*8975f5c5SAndroid Build Coastguard Worker static void average(A16B16G16R16F *dst, const A16B16G16R16F *src1, const A16B16G16R16F *src2); 528*8975f5c5SAndroid Build Coastguard Worker }; 529*8975f5c5SAndroid Build Coastguard Worker 530*8975f5c5SAndroid Build Coastguard Worker struct R16G16B16A16F 531*8975f5c5SAndroid Build Coastguard Worker { 532*8975f5c5SAndroid Build Coastguard Worker uint16_t R; 533*8975f5c5SAndroid Build Coastguard Worker uint16_t G; 534*8975f5c5SAndroid Build Coastguard Worker uint16_t B; 535*8975f5c5SAndroid Build Coastguard Worker uint16_t A; 536*8975f5c5SAndroid Build Coastguard Worker 537*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16G16B16A16F *src); 538*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16B16A16F *dst, const gl::ColorF *src); 539*8975f5c5SAndroid Build Coastguard Worker static void average(R16G16B16A16F *dst, const R16G16B16A16F *src1, const R16G16B16A16F *src2); 540*8975f5c5SAndroid Build Coastguard Worker }; 541*8975f5c5SAndroid Build Coastguard Worker 542*8975f5c5SAndroid Build Coastguard Worker struct R16F 543*8975f5c5SAndroid Build Coastguard Worker { 544*8975f5c5SAndroid Build Coastguard Worker uint16_t R; 545*8975f5c5SAndroid Build Coastguard Worker 546*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16F *src); 547*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16F *dst, const gl::ColorF *src); 548*8975f5c5SAndroid Build Coastguard Worker static void average(R16F *dst, const R16F *src1, const R16F *src2); 549*8975f5c5SAndroid Build Coastguard Worker }; 550*8975f5c5SAndroid Build Coastguard Worker 551*8975f5c5SAndroid Build Coastguard Worker struct A16F 552*8975f5c5SAndroid Build Coastguard Worker { 553*8975f5c5SAndroid Build Coastguard Worker uint16_t A; 554*8975f5c5SAndroid Build Coastguard Worker 555*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const A16F *src); 556*8975f5c5SAndroid Build Coastguard Worker static void writeColor(A16F *dst, const gl::ColorF *src); 557*8975f5c5SAndroid Build Coastguard Worker static void average(A16F *dst, const A16F *src1, const A16F *src2); 558*8975f5c5SAndroid Build Coastguard Worker }; 559*8975f5c5SAndroid Build Coastguard Worker 560*8975f5c5SAndroid Build Coastguard Worker struct L16F 561*8975f5c5SAndroid Build Coastguard Worker { 562*8975f5c5SAndroid Build Coastguard Worker uint16_t L; 563*8975f5c5SAndroid Build Coastguard Worker 564*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const L16F *src); 565*8975f5c5SAndroid Build Coastguard Worker static void writeColor(L16F *dst, const gl::ColorF *src); 566*8975f5c5SAndroid Build Coastguard Worker static void average(L16F *dst, const L16F *src1, const L16F *src2); 567*8975f5c5SAndroid Build Coastguard Worker }; 568*8975f5c5SAndroid Build Coastguard Worker 569*8975f5c5SAndroid Build Coastguard Worker struct L16A16F 570*8975f5c5SAndroid Build Coastguard Worker { 571*8975f5c5SAndroid Build Coastguard Worker uint16_t L; 572*8975f5c5SAndroid Build Coastguard Worker uint16_t A; 573*8975f5c5SAndroid Build Coastguard Worker 574*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const L16A16F *src); 575*8975f5c5SAndroid Build Coastguard Worker static void writeColor(L16A16F *dst, const gl::ColorF *src); 576*8975f5c5SAndroid Build Coastguard Worker static void average(L16A16F *dst, const L16A16F *src1, const L16A16F *src2); 577*8975f5c5SAndroid Build Coastguard Worker }; 578*8975f5c5SAndroid Build Coastguard Worker 579*8975f5c5SAndroid Build Coastguard Worker struct R16G16F 580*8975f5c5SAndroid Build Coastguard Worker { 581*8975f5c5SAndroid Build Coastguard Worker uint16_t R; 582*8975f5c5SAndroid Build Coastguard Worker uint16_t G; 583*8975f5c5SAndroid Build Coastguard Worker 584*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16G16F *src); 585*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16F *dst, const gl::ColorF *src); 586*8975f5c5SAndroid Build Coastguard Worker static void average(R16G16F *dst, const R16G16F *src1, const R16G16F *src2); 587*8975f5c5SAndroid Build Coastguard Worker }; 588*8975f5c5SAndroid Build Coastguard Worker 589*8975f5c5SAndroid Build Coastguard Worker struct R16G16B16F 590*8975f5c5SAndroid Build Coastguard Worker { 591*8975f5c5SAndroid Build Coastguard Worker uint16_t R; 592*8975f5c5SAndroid Build Coastguard Worker uint16_t G; 593*8975f5c5SAndroid Build Coastguard Worker uint16_t B; 594*8975f5c5SAndroid Build Coastguard Worker 595*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R16G16B16F *src); 596*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R16G16B16F *dst, const gl::ColorF *src); 597*8975f5c5SAndroid Build Coastguard Worker static void average(R16G16B16F *dst, const R16G16B16F *src1, const R16G16B16F *src2); 598*8975f5c5SAndroid Build Coastguard Worker }; 599*8975f5c5SAndroid Build Coastguard Worker 600*8975f5c5SAndroid Build Coastguard Worker struct A32B32G32R32F 601*8975f5c5SAndroid Build Coastguard Worker { 602*8975f5c5SAndroid Build Coastguard Worker float A; 603*8975f5c5SAndroid Build Coastguard Worker float R; 604*8975f5c5SAndroid Build Coastguard Worker float G; 605*8975f5c5SAndroid Build Coastguard Worker float B; 606*8975f5c5SAndroid Build Coastguard Worker 607*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const A32B32G32R32F *src); 608*8975f5c5SAndroid Build Coastguard Worker static void writeColor(A32B32G32R32F *dst, const gl::ColorF *src); 609*8975f5c5SAndroid Build Coastguard Worker static void average(A32B32G32R32F *dst, const A32B32G32R32F *src1, const A32B32G32R32F *src2); 610*8975f5c5SAndroid Build Coastguard Worker }; 611*8975f5c5SAndroid Build Coastguard Worker 612*8975f5c5SAndroid Build Coastguard Worker struct R32G32B32A32F 613*8975f5c5SAndroid Build Coastguard Worker { 614*8975f5c5SAndroid Build Coastguard Worker float R; 615*8975f5c5SAndroid Build Coastguard Worker float G; 616*8975f5c5SAndroid Build Coastguard Worker float B; 617*8975f5c5SAndroid Build Coastguard Worker float A; 618*8975f5c5SAndroid Build Coastguard Worker 619*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32G32B32A32F *src); 620*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32B32A32F *dst, const gl::ColorF *src); 621*8975f5c5SAndroid Build Coastguard Worker static void average(R32G32B32A32F *dst, const R32G32B32A32F *src1, const R32G32B32A32F *src2); 622*8975f5c5SAndroid Build Coastguard Worker }; 623*8975f5c5SAndroid Build Coastguard Worker 624*8975f5c5SAndroid Build Coastguard Worker struct R32F 625*8975f5c5SAndroid Build Coastguard Worker { 626*8975f5c5SAndroid Build Coastguard Worker float R; 627*8975f5c5SAndroid Build Coastguard Worker 628*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32F *src); 629*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32F *dst, const gl::ColorF *src); 630*8975f5c5SAndroid Build Coastguard Worker static void average(R32F *dst, const R32F *src1, const R32F *src2); 631*8975f5c5SAndroid Build Coastguard Worker }; 632*8975f5c5SAndroid Build Coastguard Worker 633*8975f5c5SAndroid Build Coastguard Worker struct A32F 634*8975f5c5SAndroid Build Coastguard Worker { 635*8975f5c5SAndroid Build Coastguard Worker float A; 636*8975f5c5SAndroid Build Coastguard Worker 637*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const A32F *src); 638*8975f5c5SAndroid Build Coastguard Worker static void writeColor(A32F *dst, const gl::ColorF *src); 639*8975f5c5SAndroid Build Coastguard Worker static void average(A32F *dst, const A32F *src1, const A32F *src2); 640*8975f5c5SAndroid Build Coastguard Worker }; 641*8975f5c5SAndroid Build Coastguard Worker 642*8975f5c5SAndroid Build Coastguard Worker struct L32F 643*8975f5c5SAndroid Build Coastguard Worker { 644*8975f5c5SAndroid Build Coastguard Worker float L; 645*8975f5c5SAndroid Build Coastguard Worker 646*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const L32F *src); 647*8975f5c5SAndroid Build Coastguard Worker static void writeColor(L32F *dst, const gl::ColorF *src); 648*8975f5c5SAndroid Build Coastguard Worker static void average(L32F *dst, const L32F *src1, const L32F *src2); 649*8975f5c5SAndroid Build Coastguard Worker }; 650*8975f5c5SAndroid Build Coastguard Worker 651*8975f5c5SAndroid Build Coastguard Worker struct L32A32F 652*8975f5c5SAndroid Build Coastguard Worker { 653*8975f5c5SAndroid Build Coastguard Worker float L; 654*8975f5c5SAndroid Build Coastguard Worker float A; 655*8975f5c5SAndroid Build Coastguard Worker 656*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const L32A32F *src); 657*8975f5c5SAndroid Build Coastguard Worker static void writeColor(L32A32F *dst, const gl::ColorF *src); 658*8975f5c5SAndroid Build Coastguard Worker static void average(L32A32F *dst, const L32A32F *src1, const L32A32F *src2); 659*8975f5c5SAndroid Build Coastguard Worker }; 660*8975f5c5SAndroid Build Coastguard Worker 661*8975f5c5SAndroid Build Coastguard Worker struct R32G32F 662*8975f5c5SAndroid Build Coastguard Worker { 663*8975f5c5SAndroid Build Coastguard Worker float R; 664*8975f5c5SAndroid Build Coastguard Worker float G; 665*8975f5c5SAndroid Build Coastguard Worker 666*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32G32F *src); 667*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32F *dst, const gl::ColorF *src); 668*8975f5c5SAndroid Build Coastguard Worker static void average(R32G32F *dst, const R32G32F *src1, const R32G32F *src2); 669*8975f5c5SAndroid Build Coastguard Worker }; 670*8975f5c5SAndroid Build Coastguard Worker 671*8975f5c5SAndroid Build Coastguard Worker struct R32G32B32F 672*8975f5c5SAndroid Build Coastguard Worker { 673*8975f5c5SAndroid Build Coastguard Worker float R; 674*8975f5c5SAndroid Build Coastguard Worker float G; 675*8975f5c5SAndroid Build Coastguard Worker float B; 676*8975f5c5SAndroid Build Coastguard Worker 677*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R32G32B32F *src); 678*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R32G32B32F *dst, const gl::ColorF *src); 679*8975f5c5SAndroid Build Coastguard Worker static void average(R32G32B32F *dst, const R32G32B32F *src1, const R32G32B32F *src2); 680*8975f5c5SAndroid Build Coastguard Worker }; 681*8975f5c5SAndroid Build Coastguard Worker 682*8975f5c5SAndroid Build Coastguard Worker struct R10G10B10A2 683*8975f5c5SAndroid Build Coastguard Worker { 684*8975f5c5SAndroid Build Coastguard Worker uint32_t R : 10; 685*8975f5c5SAndroid Build Coastguard Worker uint32_t G : 10; 686*8975f5c5SAndroid Build Coastguard Worker uint32_t B : 10; 687*8975f5c5SAndroid Build Coastguard Worker uint32_t A : 2; 688*8975f5c5SAndroid Build Coastguard Worker 689*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R10G10B10A2 *src); 690*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R10G10B10A2 *src); 691*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R10G10B10A2 *dst, const gl::ColorF *src); 692*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R10G10B10A2 *dst, const gl::ColorUI *src); 693*8975f5c5SAndroid Build Coastguard Worker static void average(R10G10B10A2 *dst, const R10G10B10A2 *src1, const R10G10B10A2 *src2); 694*8975f5c5SAndroid Build Coastguard Worker }; 695*8975f5c5SAndroid Build Coastguard Worker static_assert(sizeof(R10G10B10A2) == 4, "R10G10B10A2 struct not 32-bits."); 696*8975f5c5SAndroid Build Coastguard Worker 697*8975f5c5SAndroid Build Coastguard Worker struct R10G10B10A2S 698*8975f5c5SAndroid Build Coastguard Worker { 699*8975f5c5SAndroid Build Coastguard Worker int32_t R : 10; 700*8975f5c5SAndroid Build Coastguard Worker int32_t G : 10; 701*8975f5c5SAndroid Build Coastguard Worker int32_t B : 10; 702*8975f5c5SAndroid Build Coastguard Worker int32_t A : 2; 703*8975f5c5SAndroid Build Coastguard Worker 704*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R10G10B10A2S *src); 705*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorI *dst, const R10G10B10A2S *src); 706*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R10G10B10A2S *dst, const gl::ColorF *src); 707*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R10G10B10A2S *dst, const gl::ColorI *src); 708*8975f5c5SAndroid Build Coastguard Worker static void average(R10G10B10A2S *dst, const R10G10B10A2S *src1, const R10G10B10A2S *src2); 709*8975f5c5SAndroid Build Coastguard Worker }; 710*8975f5c5SAndroid Build Coastguard Worker static_assert(sizeof(R10G10B10A2S) == 4, "R10G10B10A2S struct not 32-bits."); 711*8975f5c5SAndroid Build Coastguard Worker 712*8975f5c5SAndroid Build Coastguard Worker struct R10G10B10X2 713*8975f5c5SAndroid Build Coastguard Worker { 714*8975f5c5SAndroid Build Coastguard Worker uint32_t R : 10; 715*8975f5c5SAndroid Build Coastguard Worker uint32_t G : 10; 716*8975f5c5SAndroid Build Coastguard Worker uint32_t B : 10; 717*8975f5c5SAndroid Build Coastguard Worker 718*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R10G10B10X2 *src); 719*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const R10G10B10X2 *src); 720*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R10G10B10X2 *dst, const gl::ColorF *src); 721*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R10G10B10X2 *dst, const gl::ColorUI *src); 722*8975f5c5SAndroid Build Coastguard Worker static void average(R10G10B10X2 *dst, const R10G10B10X2 *src1, const R10G10B10X2 *src2); 723*8975f5c5SAndroid Build Coastguard Worker }; 724*8975f5c5SAndroid Build Coastguard Worker static_assert(sizeof(R10G10B10X2) == 4, "R10G10B10X2 struct not 32-bits."); 725*8975f5c5SAndroid Build Coastguard Worker 726*8975f5c5SAndroid Build Coastguard Worker struct B10G10R10A2 727*8975f5c5SAndroid Build Coastguard Worker { 728*8975f5c5SAndroid Build Coastguard Worker uint32_t B : 10; 729*8975f5c5SAndroid Build Coastguard Worker uint32_t G : 10; 730*8975f5c5SAndroid Build Coastguard Worker uint32_t R : 10; 731*8975f5c5SAndroid Build Coastguard Worker uint32_t A : 2; 732*8975f5c5SAndroid Build Coastguard Worker 733*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const B10G10R10A2 *src); 734*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorUI *dst, const B10G10R10A2 *src); 735*8975f5c5SAndroid Build Coastguard Worker static void writeColor(B10G10R10A2 *dst, const gl::ColorF *src); 736*8975f5c5SAndroid Build Coastguard Worker static void writeColor(B10G10R10A2 *dst, const gl::ColorUI *src); 737*8975f5c5SAndroid Build Coastguard Worker static void average(B10G10R10A2 *dst, const B10G10R10A2 *src1, const B10G10R10A2 *src2); 738*8975f5c5SAndroid Build Coastguard Worker }; 739*8975f5c5SAndroid Build Coastguard Worker static_assert(sizeof(B10G10R10A2) == 4, "B10G10R10A2 struct not 32-bits."); 740*8975f5c5SAndroid Build Coastguard Worker 741*8975f5c5SAndroid Build Coastguard Worker struct R9G9B9E5 742*8975f5c5SAndroid Build Coastguard Worker { 743*8975f5c5SAndroid Build Coastguard Worker uint32_t R : 9; 744*8975f5c5SAndroid Build Coastguard Worker uint32_t G : 9; 745*8975f5c5SAndroid Build Coastguard Worker uint32_t B : 9; 746*8975f5c5SAndroid Build Coastguard Worker uint32_t E : 5; 747*8975f5c5SAndroid Build Coastguard Worker 748*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R9G9B9E5 *src); 749*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R9G9B9E5 *dst, const gl::ColorF *src); 750*8975f5c5SAndroid Build Coastguard Worker static void average(R9G9B9E5 *dst, const R9G9B9E5 *src1, const R9G9B9E5 *src2); 751*8975f5c5SAndroid Build Coastguard Worker }; 752*8975f5c5SAndroid Build Coastguard Worker static_assert(sizeof(R9G9B9E5) == 4, "R9G9B9E5 struct not 32-bits."); 753*8975f5c5SAndroid Build Coastguard Worker 754*8975f5c5SAndroid Build Coastguard Worker struct R11G11B10F 755*8975f5c5SAndroid Build Coastguard Worker { 756*8975f5c5SAndroid Build Coastguard Worker uint32_t R : 11; 757*8975f5c5SAndroid Build Coastguard Worker uint32_t G : 11; 758*8975f5c5SAndroid Build Coastguard Worker uint32_t B : 10; 759*8975f5c5SAndroid Build Coastguard Worker 760*8975f5c5SAndroid Build Coastguard Worker static void readColor(gl::ColorF *dst, const R11G11B10F *src); 761*8975f5c5SAndroid Build Coastguard Worker static void writeColor(R11G11B10F *dst, const gl::ColorF *src); 762*8975f5c5SAndroid Build Coastguard Worker static void average(R11G11B10F *dst, const R11G11B10F *src1, const R11G11B10F *src2); 763*8975f5c5SAndroid Build Coastguard Worker }; 764*8975f5c5SAndroid Build Coastguard Worker static_assert(sizeof(R11G11B10F) == 4, "R11G11B10F struct not 32-bits."); 765*8975f5c5SAndroid Build Coastguard Worker 766*8975f5c5SAndroid Build Coastguard Worker struct D24S8 767*8975f5c5SAndroid Build Coastguard Worker { 768*8975f5c5SAndroid Build Coastguard Worker uint32_t S : 8; 769*8975f5c5SAndroid Build Coastguard Worker uint32_t D : 24; 770*8975f5c5SAndroid Build Coastguard Worker 771*8975f5c5SAndroid Build Coastguard Worker static void ReadDepthStencil(DepthStencil *dst, const D24S8 *src); 772*8975f5c5SAndroid Build Coastguard Worker static void WriteDepthStencil(D24S8 *dst, const DepthStencil *src); 773*8975f5c5SAndroid Build Coastguard Worker }; 774*8975f5c5SAndroid Build Coastguard Worker 775*8975f5c5SAndroid Build Coastguard Worker struct S8 776*8975f5c5SAndroid Build Coastguard Worker { 777*8975f5c5SAndroid Build Coastguard Worker uint8_t S; 778*8975f5c5SAndroid Build Coastguard Worker 779*8975f5c5SAndroid Build Coastguard Worker static void ReadDepthStencil(DepthStencil *dst, const S8 *src); 780*8975f5c5SAndroid Build Coastguard Worker static void WriteDepthStencil(S8 *dst, const DepthStencil *src); 781*8975f5c5SAndroid Build Coastguard Worker }; 782*8975f5c5SAndroid Build Coastguard Worker 783*8975f5c5SAndroid Build Coastguard Worker struct D16 784*8975f5c5SAndroid Build Coastguard Worker { 785*8975f5c5SAndroid Build Coastguard Worker uint16_t D; 786*8975f5c5SAndroid Build Coastguard Worker 787*8975f5c5SAndroid Build Coastguard Worker static void ReadDepthStencil(DepthStencil *dst, const D16 *src); 788*8975f5c5SAndroid Build Coastguard Worker static void WriteDepthStencil(D16 *dst, const DepthStencil *src); 789*8975f5c5SAndroid Build Coastguard Worker }; 790*8975f5c5SAndroid Build Coastguard Worker 791*8975f5c5SAndroid Build Coastguard Worker struct D24X8 792*8975f5c5SAndroid Build Coastguard Worker { 793*8975f5c5SAndroid Build Coastguard Worker uint32_t D : 24; 794*8975f5c5SAndroid Build Coastguard Worker uint32_t X : 8; 795*8975f5c5SAndroid Build Coastguard Worker 796*8975f5c5SAndroid Build Coastguard Worker static void ReadDepthStencil(DepthStencil *dst, const D24X8 *src); 797*8975f5c5SAndroid Build Coastguard Worker static void WriteDepthStencil(D24X8 *dst, const DepthStencil *src); 798*8975f5c5SAndroid Build Coastguard Worker }; 799*8975f5c5SAndroid Build Coastguard Worker 800*8975f5c5SAndroid Build Coastguard Worker struct D32F 801*8975f5c5SAndroid Build Coastguard Worker { 802*8975f5c5SAndroid Build Coastguard Worker float D; 803*8975f5c5SAndroid Build Coastguard Worker 804*8975f5c5SAndroid Build Coastguard Worker static void ReadDepthStencil(DepthStencil *dst, const D32F *src); 805*8975f5c5SAndroid Build Coastguard Worker static void WriteDepthStencil(D32F *dst, const DepthStencil *src); 806*8975f5c5SAndroid Build Coastguard Worker }; 807*8975f5c5SAndroid Build Coastguard Worker 808*8975f5c5SAndroid Build Coastguard Worker struct D32 809*8975f5c5SAndroid Build Coastguard Worker { 810*8975f5c5SAndroid Build Coastguard Worker uint32_t D; 811*8975f5c5SAndroid Build Coastguard Worker 812*8975f5c5SAndroid Build Coastguard Worker static void ReadDepthStencil(DepthStencil *dst, const D32 *src); 813*8975f5c5SAndroid Build Coastguard Worker static void WriteDepthStencil(D32 *dst, const DepthStencil *src); 814*8975f5c5SAndroid Build Coastguard Worker }; 815*8975f5c5SAndroid Build Coastguard Worker 816*8975f5c5SAndroid Build Coastguard Worker struct D32FS8X24 817*8975f5c5SAndroid Build Coastguard Worker { 818*8975f5c5SAndroid Build Coastguard Worker float D; 819*8975f5c5SAndroid Build Coastguard Worker uint32_t S; 820*8975f5c5SAndroid Build Coastguard Worker 821*8975f5c5SAndroid Build Coastguard Worker static void ReadDepthStencil(DepthStencil *dst, const D32FS8X24 *src); 822*8975f5c5SAndroid Build Coastguard Worker static void WriteDepthStencil(D32FS8X24 *dst, const DepthStencil *src); 823*8975f5c5SAndroid Build Coastguard Worker }; 824*8975f5c5SAndroid Build Coastguard Worker } // namespace angle 825*8975f5c5SAndroid Build Coastguard Worker 826*8975f5c5SAndroid Build Coastguard Worker #endif // IMAGEUTIL_IMAGEFORMATS_H_ 827