11 #ifndef hifi_gpu_Format_h
12 #define hifi_gpu_Format_h
49 NORMALIZED_START = NINT32,
52 static const int TYPE_SIZE[NUM_TYPES] = {
76 static const bool TYPE_IS_INTEGER[NUM_TYPES] = {
100 enum Dimension : uint8_t {
113 static const int DIMENSION_LOCATION_COUNT[NUM_DIMENSIONS] = {
125 static const int DIMENSION_SCALAR_COUNT_PER_LOCATION[NUM_DIMENSIONS] = {
137 static const int DIMENSION_SCALAR_COUNT[NUM_DIMENSIONS] = {
149 static const glm::ivec2 DIMENSION_TILE_DIM[NUM_DIMENSIONS] = {
162 enum Semantic : uint8_t {
193 COMPRESSED_BC1_SRGBA,
194 COMPRESSED_BC3_SRGBA,
198 COMPRESSED_BC7_SRGBA,
201 COMPRESSED_ETC2_SRGB,
202 COMPRESSED_ETC2_RGB_PUNCHTHROUGH_ALPHA,
203 COMPRESSED_ETC2_SRGB_PUNCHTHROUGH_ALPHA,
204 COMPRESSED_ETC2_RGBA,
205 COMPRESSED_ETC2_SRGBA,
207 COMPRESSED_EAC_RED_SIGNED,
209 COMPRESSED_EAC_XY_SIGNED,
228 static const int SEMANTIC_SIZE_FACTOR[NUM_SEMANTICS] = {
296 Element(Dimension dim, Type type, Semantic sem) :
307 Semantic getSemantic()
const {
return (Semantic)_semantic; }
309 Dimension getDimension()
const {
return (Dimension)_dimension; }
311 bool isCompressed()
const {
return uint8(getSemantic() - _FIRST_COMPRESSED) <= uint8(_LAST_COMPRESSED - _FIRST_COMPRESSED); }
313 Type getType()
const {
return (Type)_type; }
314 bool isNormalized()
const {
return (getType() >= NORMALIZED_START); }
315 bool isInteger()
const {
return TYPE_IS_INTEGER[getType()]; }
317 uint8 getScalarCount()
const {
return DIMENSION_SCALAR_COUNT[(Dimension)_dimension]; }
318 uint32 getSize()
const {
return (DIMENSION_SCALAR_COUNT[_dimension] * TYPE_SIZE[_type] * SEMANTIC_SIZE_FACTOR[_semantic]); }
319 const glm::ivec2& getTile()
const {
return (DIMENSION_TILE_DIM[_dimension]); }
321 uint8 getLocationCount()
const {
return DIMENSION_LOCATION_COUNT[(Dimension)_dimension]; }
322 uint8 getLocationScalarCount()
const {
return DIMENSION_SCALAR_COUNT_PER_LOCATION[(Dimension)_dimension]; }
323 uint32 getLocationSize()
const {
return DIMENSION_SCALAR_COUNT_PER_LOCATION[_dimension] * TYPE_SIZE[_type]; }
325 uint16 getRaw()
const {
return *((
const uint16*) (
this)); }
328 bool operator ==(
const Element& right)
const {
329 return getRaw() == right.getRaw();
331 bool operator !=(
const Element& right)
const {
332 return getRaw() != right.getRaw();
335 static const Element COLOR_R_8;
336 static const Element COLOR_SR_8;
337 static const Element COLOR_RGBA_32;
338 static const Element COLOR_SRGBA_32;
339 static const Element COLOR_BGRA_32;
340 static const Element COLOR_SBGRA_32;
341 static const Element COLOR_RGBA_2;
342 static const Element COLOR_R11G11B10;
343 static const Element COLOR_RGB9E5;
344 static const Element COLOR_COMPRESSED_BCX_RED;
345 static const Element COLOR_COMPRESSED_BCX_SRGB;
346 static const Element COLOR_COMPRESSED_BCX_SRGBA_MASK;
347 static const Element COLOR_COMPRESSED_BCX_SRGBA;
348 static const Element COLOR_COMPRESSED_BCX_XY;
349 static const Element COLOR_COMPRESSED_BCX_SRGBA_HIGH;
350 static const Element COLOR_COMPRESSED_BCX_HDR_RGB;
351 static const Element COLOR_COMPRESSED_ETC2_RGB;
352 static const Element COLOR_COMPRESSED_ETC2_SRGB;
353 static const Element COLOR_COMPRESSED_ETC2_RGB_PUNCHTHROUGH_ALPHA;
354 static const Element COLOR_COMPRESSED_ETC2_SRGB_PUNCHTHROUGH_ALPHA;
355 static const Element COLOR_COMPRESSED_ETC2_RGBA;
356 static const Element COLOR_COMPRESSED_ETC2_SRGBA;
357 static const Element COLOR_COMPRESSED_EAC_RED;
358 static const Element COLOR_COMPRESSED_EAC_RED_SIGNED;
359 static const Element COLOR_COMPRESSED_EAC_XY;
360 static const Element COLOR_COMPRESSED_EAC_XY_SIGNED;
361 static const Element DEPTH24_STENCIL8;
362 static const Element VEC2NU8_XY;
363 static const Element VEC4F_COLOR_RGBA;
364 static const Element VEC2F_UV;
365 static const Element VEC2F_XY;
366 static const Element VEC3F_XYZ;
367 static const Element VEC4F_XYZW;
368 static const Element VEC4F_NORMALIZED_XYZ10W2;
369 static const Element INDEX_UINT16;
370 static const Element INDEX_INT32;
371 static const Element PART_DRAWCALL;
374 uint16 _semantic : 7;
375 uint16 _dimension : 4;
380 enum ComparisonFunction {
390 NUM_COMPARISON_FUNCS,