Path: blob/main_old/src/image_util/imageformats.h
1693 views
//1// Copyright 2013 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56// imageformats.h: Defines image format types with functions for mip generation7// and copying.89#ifndef IMAGEUTIL_IMAGEFORMATS_H_10#define IMAGEUTIL_IMAGEFORMATS_H_1112#include "common/Color.h"1314#include <cstdint>1516namespace angle17{1819// Several structures share functionality for reading, writing or mipmapping but the layout20// must match the texture format which the structure represents. If collapsing or typedefing21// structs in this header, make sure the functionality and memory layout is exactly the same.2223struct L824{25uint8_t L;2627static void readColor(gl::ColorF *dst, const L8 *src);28static void writeColor(L8 *dst, const gl::ColorF *src);29static void average(L8 *dst, const L8 *src1, const L8 *src2);30};3132struct R833{34uint8_t R;3536static void readColor(gl::ColorF *dst, const R8 *src);37static void readColor(gl::ColorUI *dst, const R8 *src);38static void writeColor(R8 *dst, const gl::ColorF *src);39static void writeColor(R8 *dst, const gl::ColorUI *src);40static void average(R8 *dst, const R8 *src1, const R8 *src2);41};4243struct A844{45uint8_t A;4647static void readColor(gl::ColorF *dst, const A8 *src);48static void writeColor(A8 *dst, const gl::ColorF *src);49static void average(A8 *dst, const A8 *src1, const A8 *src2);50};5152struct L8A853{54uint8_t L;55uint8_t A;5657static void readColor(gl::ColorF *dst, const L8A8 *src);58static void writeColor(L8A8 *dst, const gl::ColorF *src);59static void average(L8A8 *dst, const L8A8 *src1, const L8A8 *src2);60};6162struct A8L863{64uint8_t A;65uint8_t L;6667static void readColor(gl::ColorF *dst, const A8L8 *src);68static void writeColor(A8L8 *dst, const gl::ColorF *src);69static void average(A8L8 *dst, const A8L8 *src1, const A8L8 *src2);70};7172struct R8G873{74uint8_t R;75uint8_t G;7677static void readColor(gl::ColorF *dst, const R8G8 *src);78static void readColor(gl::ColorUI *dst, const R8G8 *src);79static void writeColor(R8G8 *dst, const gl::ColorF *src);80static void writeColor(R8G8 *dst, const gl::ColorUI *src);81static void average(R8G8 *dst, const R8G8 *src1, const R8G8 *src2);82};8384struct R8G8B885{86uint8_t R;87uint8_t G;88uint8_t B;8990static void readColor(gl::ColorF *dst, const R8G8B8 *src);91static void readColor(gl::ColorUI *dst, const R8G8B8 *src);92static void writeColor(R8G8B8 *dst, const gl::ColorF *src);93static void writeColor(R8G8B8 *dst, const gl::ColorUI *src);94static void average(R8G8B8 *dst, const R8G8B8 *src1, const R8G8B8 *src2);95};9697struct B8G8R898{99uint8_t B;100uint8_t G;101uint8_t R;102103static void readColor(gl::ColorF *dst, const B8G8R8 *src);104static void readColor(gl::ColorUI *dst, const B8G8R8 *src);105static void writeColor(B8G8R8 *dst, const gl::ColorF *src);106static void writeColor(B8G8R8 *dst, const gl::ColorUI *src);107static void average(B8G8R8 *dst, const B8G8R8 *src1, const B8G8R8 *src2);108};109110struct R5G6B5111{112// OpenGL ES 2.0.25 spec Section 3.6.2: "Components are packed with the first component in the113// most significant bits of the bitfield, and successive component occupying progressively less114// significant locations"115uint16_t RGB;116117static void readColor(gl::ColorF *dst, const R5G6B5 *src);118static void writeColor(R5G6B5 *dst, const gl::ColorF *src);119static void average(R5G6B5 *dst, const R5G6B5 *src1, const R5G6B5 *src2);120};121122struct B5G6R5123{124uint16_t BGR;125126static void readColor(gl::ColorF *dst, const B5G6R5 *src);127static void writeColor(B5G6R5 *dst, const gl::ColorF *src);128static void average(B5G6R5 *dst, const B5G6R5 *src1, const B5G6R5 *src2);129};130131struct A8R8G8B8132{133uint8_t A;134uint8_t R;135uint8_t G;136uint8_t B;137138static void readColor(gl::ColorF *dst, const A8R8G8B8 *src);139static void readColor(gl::ColorUI *dst, const A8R8G8B8 *src);140static void writeColor(A8R8G8B8 *dst, const gl::ColorF *src);141static void writeColor(A8R8G8B8 *dst, const gl::ColorUI *src);142static void average(A8R8G8B8 *dst, const A8R8G8B8 *src1, const A8R8G8B8 *src2);143};144145struct R8G8B8A8146{147uint8_t R;148uint8_t G;149uint8_t B;150uint8_t A;151152static void readColor(gl::ColorF *dst, const R8G8B8A8 *src);153static void readColor(gl::ColorUI *dst, const R8G8B8A8 *src);154static void writeColor(R8G8B8A8 *dst, const gl::ColorF *src);155static void writeColor(R8G8B8A8 *dst, const gl::ColorUI *src);156static void average(R8G8B8A8 *dst, const R8G8B8A8 *src1, const R8G8B8A8 *src2);157};158159struct R8G8B8A8SRGB160{161uint8_t R;162uint8_t G;163uint8_t B;164uint8_t A;165166static void readColor(gl::ColorF *dst, const R8G8B8A8SRGB *src);167static void writeColor(R8G8B8A8SRGB *dst, const gl::ColorF *src);168static void average(R8G8B8A8SRGB *dst, const R8G8B8A8SRGB *src1, const R8G8B8A8SRGB *src2);169};170171struct B8G8R8A8172{173uint8_t B;174uint8_t G;175uint8_t R;176uint8_t A;177178static void readColor(gl::ColorF *dst, const B8G8R8A8 *src);179static void readColor(gl::ColorUI *dst, const B8G8R8A8 *src);180static void writeColor(B8G8R8A8 *dst, const gl::ColorF *src);181static void writeColor(B8G8R8A8 *dst, const gl::ColorUI *src);182static void average(B8G8R8A8 *dst, const B8G8R8A8 *src1, const B8G8R8A8 *src2);183};184185struct B8G8R8X8186{187uint8_t B;188uint8_t G;189uint8_t R;190uint8_t X;191192static void readColor(gl::ColorF *dst, const B8G8R8X8 *src);193static void readColor(gl::ColorUI *dst, const B8G8R8X8 *src);194static void writeColor(B8G8R8X8 *dst, const gl::ColorF *src);195static void writeColor(B8G8R8X8 *dst, const gl::ColorUI *src);196static void average(B8G8R8X8 *dst, const B8G8R8X8 *src1, const B8G8R8X8 *src2);197};198199struct A1R5G5B5200{201uint16_t ARGB;202203static void readColor(gl::ColorF *dst, const A1R5G5B5 *src);204static void writeColor(A1R5G5B5 *dst, const gl::ColorF *src);205static void average(A1R5G5B5 *dst, const A1R5G5B5 *src1, const A1R5G5B5 *src2);206};207208struct R5G5B5A1209{210// OpenGL ES 2.0.25 spec Section 3.6.2: "Components are packed with the first component in the211// most significant212// bits of the bitfield, and successive component occupying progressively less significant213// locations"214uint16_t RGBA;215216static void readColor(gl::ColorF *dst, const R5G5B5A1 *src);217static void writeColor(R5G5B5A1 *dst, const gl::ColorF *src);218static void average(R5G5B5A1 *dst, const R5G5B5A1 *src1, const R5G5B5A1 *src2);219};220221struct R4G4B4A4222{223// OpenGL ES 2.0.25 spec Section 3.6.2: "Components are packed with the first component in the224// most significant225// bits of the bitfield, and successive component occupying progressively less significant226// locations"227uint16_t RGBA;228229static void readColor(gl::ColorF *dst, const R4G4B4A4 *src);230static void writeColor(R4G4B4A4 *dst, const gl::ColorF *src);231static void average(R4G4B4A4 *dst, const R4G4B4A4 *src1, const R4G4B4A4 *src2);232};233234struct A4R4G4B4235{236uint16_t ARGB;237238static void readColor(gl::ColorF *dst, const A4R4G4B4 *src);239static void writeColor(A4R4G4B4 *dst, const gl::ColorF *src);240static void average(A4R4G4B4 *dst, const A4R4G4B4 *src1, const A4R4G4B4 *src2);241};242243struct R16244{245uint16_t R;246247static void readColor(gl::ColorF *dst, const R16 *src);248static void readColor(gl::ColorUI *dst, const R16 *src);249static void writeColor(R16 *dst, const gl::ColorF *src);250static void writeColor(R16 *dst, const gl::ColorUI *src);251static void average(R16 *dst, const R16 *src1, const R16 *src2);252};253254struct R16G16255{256uint16_t R;257uint16_t G;258259static void readColor(gl::ColorF *dst, const R16G16 *src);260static void readColor(gl::ColorUI *dst, const R16G16 *src);261static void writeColor(R16G16 *dst, const gl::ColorF *src);262static void writeColor(R16G16 *dst, const gl::ColorUI *src);263static void average(R16G16 *dst, const R16G16 *src1, const R16G16 *src2);264};265266struct R16G16B16267{268uint16_t R;269uint16_t G;270uint16_t B;271272static void readColor(gl::ColorF *dst, const R16G16B16 *src);273static void readColor(gl::ColorUI *dst, const R16G16B16 *src);274static void writeColor(R16G16B16 *dst, const gl::ColorF *src);275static void writeColor(R16G16B16 *dst, const gl::ColorUI *src);276static void average(R16G16B16 *dst, const R16G16B16 *src1, const R16G16B16 *src2);277};278279struct R16G16B16A16280{281uint16_t R;282uint16_t G;283uint16_t B;284uint16_t A;285286static void readColor(gl::ColorF *dst, const R16G16B16A16 *src);287static void readColor(gl::ColorUI *dst, const R16G16B16A16 *src);288static void writeColor(R16G16B16A16 *dst, const gl::ColorF *src);289static void writeColor(R16G16B16A16 *dst, const gl::ColorUI *src);290static void average(R16G16B16A16 *dst, const R16G16B16A16 *src1, const R16G16B16A16 *src2);291};292293struct R32294{295uint32_t R;296297static void readColor(gl::ColorF *dst, const R32 *src);298static void readColor(gl::ColorUI *dst, const R32 *src);299static void writeColor(R32 *dst, const gl::ColorF *src);300static void writeColor(R32 *dst, const gl::ColorUI *src);301static void average(R32 *dst, const R32 *src1, const R32 *src2);302};303304struct R32G32305{306uint32_t R;307uint32_t G;308309static void readColor(gl::ColorF *dst, const R32G32 *src);310static void readColor(gl::ColorUI *dst, const R32G32 *src);311static void writeColor(R32G32 *dst, const gl::ColorF *src);312static void writeColor(R32G32 *dst, const gl::ColorUI *src);313static void average(R32G32 *dst, const R32G32 *src1, const R32G32 *src2);314};315316struct R32G32B32317{318uint32_t R;319uint32_t G;320uint32_t B;321322static void readColor(gl::ColorF *dst, const R32G32B32 *src);323static void readColor(gl::ColorUI *dst, const R32G32B32 *src);324static void writeColor(R32G32B32 *dst, const gl::ColorF *src);325static void writeColor(R32G32B32 *dst, const gl::ColorUI *src);326static void average(R32G32B32 *dst, const R32G32B32 *src1, const R32G32B32 *src2);327};328329struct R32G32B32A32330{331uint32_t R;332uint32_t G;333uint32_t B;334uint32_t A;335336static void readColor(gl::ColorF *dst, const R32G32B32A32 *src);337static void readColor(gl::ColorUI *dst, const R32G32B32A32 *src);338static void writeColor(R32G32B32A32 *dst, const gl::ColorF *src);339static void writeColor(R32G32B32A32 *dst, const gl::ColorUI *src);340static void average(R32G32B32A32 *dst, const R32G32B32A32 *src1, const R32G32B32A32 *src2);341};342343struct R8S344{345int8_t R;346347static void readColor(gl::ColorF *dst, const R8S *src);348static void readColor(gl::ColorI *dst, const R8S *src);349static void writeColor(R8S *dst, const gl::ColorF *src);350static void writeColor(R8S *dst, const gl::ColorI *src);351static void average(R8S *dst, const R8S *src1, const R8S *src2);352};353354struct R8G8S355{356int8_t R;357int8_t G;358359static void readColor(gl::ColorF *dst, const R8G8S *src);360static void readColor(gl::ColorI *dst, const R8G8S *src);361static void writeColor(R8G8S *dst, const gl::ColorF *src);362static void writeColor(R8G8S *dst, const gl::ColorI *src);363static void average(R8G8S *dst, const R8G8S *src1, const R8G8S *src2);364};365366struct R8G8B8S367{368int8_t R;369int8_t G;370int8_t B;371372static void readColor(gl::ColorF *dst, const R8G8B8S *src);373static void readColor(gl::ColorI *dst, const R8G8B8S *src);374static void writeColor(R8G8B8S *dst, const gl::ColorF *src);375static void writeColor(R8G8B8S *dst, const gl::ColorI *src);376static void average(R8G8B8S *dst, const R8G8B8S *src1, const R8G8B8S *src2);377};378379struct R8G8B8A8S380{381int8_t R;382int8_t G;383int8_t B;384int8_t A;385386static void readColor(gl::ColorF *dst, const R8G8B8A8S *src);387static void readColor(gl::ColorI *dst, const R8G8B8A8S *src);388static void writeColor(R8G8B8A8S *dst, const gl::ColorF *src);389static void writeColor(R8G8B8A8S *dst, const gl::ColorI *src);390static void average(R8G8B8A8S *dst, const R8G8B8A8S *src1, const R8G8B8A8S *src2);391};392393struct R16S394{395int16_t R;396397static void readColor(gl::ColorF *dst, const R16S *src);398static void readColor(gl::ColorI *dst, const R16S *src);399static void writeColor(R16S *dst, const gl::ColorF *src);400static void writeColor(R16S *dst, const gl::ColorI *src);401static void average(R16S *dst, const R16S *src1, const R16S *src2);402};403404struct R16G16S405{406int16_t R;407int16_t G;408409static void readColor(gl::ColorF *dst, const R16G16S *src);410static void readColor(gl::ColorI *dst, const R16G16S *src);411static void writeColor(R16G16S *dst, const gl::ColorF *src);412static void writeColor(R16G16S *dst, const gl::ColorI *src);413static void average(R16G16S *dst, const R16G16S *src1, const R16G16S *src2);414};415416struct R16G16B16S417{418int16_t R;419int16_t G;420int16_t B;421422static void readColor(gl::ColorF *dst, const R16G16B16S *src);423static void readColor(gl::ColorI *dst, const R16G16B16S *src);424static void writeColor(R16G16B16S *dst, const gl::ColorF *src);425static void writeColor(R16G16B16S *dst, const gl::ColorI *src);426static void average(R16G16B16S *dst, const R16G16B16S *src1, const R16G16B16S *src2);427};428429struct R16G16B16A16S430{431int16_t R;432int16_t G;433int16_t B;434int16_t A;435436static void readColor(gl::ColorF *dst, const R16G16B16A16S *src);437static void readColor(gl::ColorI *dst, const R16G16B16A16S *src);438static void writeColor(R16G16B16A16S *dst, const gl::ColorF *src);439static void writeColor(R16G16B16A16S *dst, const gl::ColorI *src);440static void average(R16G16B16A16S *dst, const R16G16B16A16S *src1, const R16G16B16A16S *src2);441};442443struct R32S444{445int32_t R;446447static void readColor(gl::ColorF *dst, const R32S *src);448static void readColor(gl::ColorI *dst, const R32S *src);449static void writeColor(R32S *dst, const gl::ColorF *src);450static void writeColor(R32S *dst, const gl::ColorI *src);451static void average(R32S *dst, const R32S *src1, const R32S *src2);452};453454struct R32G32S455{456int32_t R;457int32_t G;458459static void readColor(gl::ColorF *dst, const R32G32S *src);460static void readColor(gl::ColorI *dst, const R32G32S *src);461static void writeColor(R32G32S *dst, const gl::ColorF *src);462static void writeColor(R32G32S *dst, const gl::ColorI *src);463static void average(R32G32S *dst, const R32G32S *src1, const R32G32S *src2);464};465466struct R32G32B32S467{468int32_t R;469int32_t G;470int32_t B;471472static void readColor(gl::ColorF *dst, const R32G32B32S *src);473static void readColor(gl::ColorI *dst, const R32G32B32S *src);474static void writeColor(R32G32B32S *dst, const gl::ColorF *src);475static void writeColor(R32G32B32S *dst, const gl::ColorI *src);476static void average(R32G32B32S *dst, const R32G32B32S *src1, const R32G32B32S *src2);477};478479struct R32G32B32A32S480{481int32_t R;482int32_t G;483int32_t B;484int32_t A;485486static void readColor(gl::ColorF *dst, const R32G32B32A32S *src);487static void readColor(gl::ColorI *dst, const R32G32B32A32S *src);488static void writeColor(R32G32B32A32S *dst, const gl::ColorF *src);489static void writeColor(R32G32B32A32S *dst, const gl::ColorI *src);490static void average(R32G32B32A32S *dst, const R32G32B32A32S *src1, const R32G32B32A32S *src2);491};492493struct A16B16G16R16F494{495uint16_t A;496uint16_t R;497uint16_t G;498uint16_t B;499500static void readColor(gl::ColorF *dst, const A16B16G16R16F *src);501static void writeColor(A16B16G16R16F *dst, const gl::ColorF *src);502static void average(A16B16G16R16F *dst, const A16B16G16R16F *src1, const A16B16G16R16F *src2);503};504505struct R16G16B16A16F506{507uint16_t R;508uint16_t G;509uint16_t B;510uint16_t A;511512static void readColor(gl::ColorF *dst, const R16G16B16A16F *src);513static void writeColor(R16G16B16A16F *dst, const gl::ColorF *src);514static void average(R16G16B16A16F *dst, const R16G16B16A16F *src1, const R16G16B16A16F *src2);515};516517struct R16F518{519uint16_t R;520521static void readColor(gl::ColorF *dst, const R16F *src);522static void writeColor(R16F *dst, const gl::ColorF *src);523static void average(R16F *dst, const R16F *src1, const R16F *src2);524};525526struct A16F527{528uint16_t A;529530static void readColor(gl::ColorF *dst, const A16F *src);531static void writeColor(A16F *dst, const gl::ColorF *src);532static void average(A16F *dst, const A16F *src1, const A16F *src2);533};534535struct L16F536{537uint16_t L;538539static void readColor(gl::ColorF *dst, const L16F *src);540static void writeColor(L16F *dst, const gl::ColorF *src);541static void average(L16F *dst, const L16F *src1, const L16F *src2);542};543544struct L16A16F545{546uint16_t L;547uint16_t A;548549static void readColor(gl::ColorF *dst, const L16A16F *src);550static void writeColor(L16A16F *dst, const gl::ColorF *src);551static void average(L16A16F *dst, const L16A16F *src1, const L16A16F *src2);552};553554struct R16G16F555{556uint16_t R;557uint16_t G;558559static void readColor(gl::ColorF *dst, const R16G16F *src);560static void writeColor(R16G16F *dst, const gl::ColorF *src);561static void average(R16G16F *dst, const R16G16F *src1, const R16G16F *src2);562};563564struct R16G16B16F565{566uint16_t R;567uint16_t G;568uint16_t B;569570static void readColor(gl::ColorF *dst, const R16G16B16F *src);571static void writeColor(R16G16B16F *dst, const gl::ColorF *src);572static void average(R16G16B16F *dst, const R16G16B16F *src1, const R16G16B16F *src2);573};574575struct A32B32G32R32F576{577float A;578float R;579float G;580float B;581582static void readColor(gl::ColorF *dst, const A32B32G32R32F *src);583static void writeColor(A32B32G32R32F *dst, const gl::ColorF *src);584static void average(A32B32G32R32F *dst, const A32B32G32R32F *src1, const A32B32G32R32F *src2);585};586587struct R32G32B32A32F588{589float R;590float G;591float B;592float A;593594static void readColor(gl::ColorF *dst, const R32G32B32A32F *src);595static void writeColor(R32G32B32A32F *dst, const gl::ColorF *src);596static void average(R32G32B32A32F *dst, const R32G32B32A32F *src1, const R32G32B32A32F *src2);597};598599struct R32F600{601float R;602603static void readColor(gl::ColorF *dst, const R32F *src);604static void writeColor(R32F *dst, const gl::ColorF *src);605static void average(R32F *dst, const R32F *src1, const R32F *src2);606};607608struct A32F609{610float A;611612static void readColor(gl::ColorF *dst, const A32F *src);613static void writeColor(A32F *dst, const gl::ColorF *src);614static void average(A32F *dst, const A32F *src1, const A32F *src2);615};616617struct L32F618{619float L;620621static void readColor(gl::ColorF *dst, const L32F *src);622static void writeColor(L32F *dst, const gl::ColorF *src);623static void average(L32F *dst, const L32F *src1, const L32F *src2);624};625626struct L32A32F627{628float L;629float A;630631static void readColor(gl::ColorF *dst, const L32A32F *src);632static void writeColor(L32A32F *dst, const gl::ColorF *src);633static void average(L32A32F *dst, const L32A32F *src1, const L32A32F *src2);634};635636struct R32G32F637{638float R;639float G;640641static void readColor(gl::ColorF *dst, const R32G32F *src);642static void writeColor(R32G32F *dst, const gl::ColorF *src);643static void average(R32G32F *dst, const R32G32F *src1, const R32G32F *src2);644};645646struct R32G32B32F647{648float R;649float G;650float B;651652static void readColor(gl::ColorF *dst, const R32G32B32F *src);653static void writeColor(R32G32B32F *dst, const gl::ColorF *src);654static void average(R32G32B32F *dst, const R32G32B32F *src1, const R32G32B32F *src2);655};656657struct R10G10B10A2658{659uint32_t R : 10;660uint32_t G : 10;661uint32_t B : 10;662uint32_t A : 2;663664static void readColor(gl::ColorF *dst, const R10G10B10A2 *src);665static void readColor(gl::ColorUI *dst, const R10G10B10A2 *src);666static void writeColor(R10G10B10A2 *dst, const gl::ColorF *src);667static void writeColor(R10G10B10A2 *dst, const gl::ColorUI *src);668static void average(R10G10B10A2 *dst, const R10G10B10A2 *src1, const R10G10B10A2 *src2);669};670static_assert(sizeof(R10G10B10A2) == 4, "R10G10B10A2 struct not 32-bits.");671672struct R10G10B10A2S673{674int32_t R : 10;675int32_t G : 10;676int32_t B : 10;677int32_t A : 2;678679static void readColor(gl::ColorF *dst, const R10G10B10A2S *src);680static void readColor(gl::ColorI *dst, const R10G10B10A2S *src);681static void writeColor(R10G10B10A2S *dst, const gl::ColorF *src);682static void writeColor(R10G10B10A2S *dst, const gl::ColorI *src);683static void average(R10G10B10A2S *dst, const R10G10B10A2S *src1, const R10G10B10A2S *src2);684};685static_assert(sizeof(R10G10B10A2S) == 4, "R10G10B10A2S struct not 32-bits.");686687struct R10G10B10X2688{689uint32_t R : 10;690uint32_t G : 10;691uint32_t B : 10;692693static void readColor(gl::ColorF *dst, const R10G10B10X2 *src);694static void readColor(gl::ColorUI *dst, const R10G10B10X2 *src);695static void writeColor(R10G10B10X2 *dst, const gl::ColorF *src);696static void writeColor(R10G10B10X2 *dst, const gl::ColorUI *src);697static void average(R10G10B10X2 *dst, const R10G10B10X2 *src1, const R10G10B10X2 *src2);698};699static_assert(sizeof(R10G10B10X2) == 4, "R10G10B10X2 struct not 32-bits.");700701struct B10G10R10A2702{703uint32_t B : 10;704uint32_t G : 10;705uint32_t R : 10;706uint32_t A : 2;707708static void readColor(gl::ColorF *dst, const B10G10R10A2 *src);709static void readColor(gl::ColorUI *dst, const B10G10R10A2 *src);710static void writeColor(B10G10R10A2 *dst, const gl::ColorF *src);711static void writeColor(B10G10R10A2 *dst, const gl::ColorUI *src);712static void average(B10G10R10A2 *dst, const B10G10R10A2 *src1, const B10G10R10A2 *src2);713};714static_assert(sizeof(B10G10R10A2) == 4, "B10G10R10A2 struct not 32-bits.");715716struct R9G9B9E5717{718uint32_t R : 9;719uint32_t G : 9;720uint32_t B : 9;721uint32_t E : 5;722723static void readColor(gl::ColorF *dst, const R9G9B9E5 *src);724static void writeColor(R9G9B9E5 *dst, const gl::ColorF *src);725static void average(R9G9B9E5 *dst, const R9G9B9E5 *src1, const R9G9B9E5 *src2);726};727static_assert(sizeof(R9G9B9E5) == 4, "R9G9B9E5 struct not 32-bits.");728729struct R11G11B10F730{731uint32_t R : 11;732uint32_t G : 11;733uint32_t B : 10;734735static void readColor(gl::ColorF *dst, const R11G11B10F *src);736static void writeColor(R11G11B10F *dst, const gl::ColorF *src);737static void average(R11G11B10F *dst, const R11G11B10F *src1, const R11G11B10F *src2);738};739static_assert(sizeof(R11G11B10F) == 4, "R11G11B10F struct not 32-bits.");740741struct D24S8742{743uint32_t S : 8;744uint32_t D : 24;745746static void ReadDepthStencil(DepthStencil *dst, const D24S8 *src);747static void WriteDepthStencil(D24S8 *dst, const DepthStencil *src);748};749750struct S8751{752uint8_t S;753754static void ReadDepthStencil(DepthStencil *dst, const S8 *src);755static void WriteDepthStencil(S8 *dst, const DepthStencil *src);756};757758struct D16759{760uint16_t D;761762static void ReadDepthStencil(DepthStencil *dst, const D16 *src);763static void WriteDepthStencil(D16 *dst, const DepthStencil *src);764};765766struct D24X8767{768uint32_t D : 24;769uint32_t X : 8;770771static void ReadDepthStencil(DepthStencil *dst, const D24X8 *src);772static void WriteDepthStencil(D24X8 *dst, const DepthStencil *src);773};774775struct D32F776{777float D;778779static void ReadDepthStencil(DepthStencil *dst, const D32F *src);780static void WriteDepthStencil(D32F *dst, const DepthStencil *src);781};782783struct D32784{785uint32_t D;786787static void ReadDepthStencil(DepthStencil *dst, const D32 *src);788static void WriteDepthStencil(D32 *dst, const DepthStencil *src);789};790791struct D32FS8X24792{793float D;794uint32_t S;795796static void ReadDepthStencil(DepthStencil *dst, const D32FS8X24 *src);797static void WriteDepthStencil(D32FS8X24 *dst, const DepthStencil *src);798};799} // namespace angle800801#endif // IMAGEUTIL_IMAGEFORMATS_H_802803804