Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: include/gpu/GrTypes.h

Issue 304743004: Move ETC1 and LATC enums value to GrPixelConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add LATC checks Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 */ 274 */
275 kRGBA_4444_GrPixelConfig, 275 kRGBA_4444_GrPixelConfig,
276 /** 276 /**
277 * Premultiplied. Byte order is r,g,b,a. 277 * Premultiplied. Byte order is r,g,b,a.
278 */ 278 */
279 kRGBA_8888_GrPixelConfig, 279 kRGBA_8888_GrPixelConfig,
280 /** 280 /**
281 * Premultiplied. Byte order is b,g,r,a. 281 * Premultiplied. Byte order is b,g,r,a.
282 */ 282 */
283 kBGRA_8888_GrPixelConfig, 283 kBGRA_8888_GrPixelConfig,
284 284
robertphillips 2014/05/29 12:53:18 I think these comments should only have one * or b
krajcevski 2014/05/29 14:28:22 Done.
285 kLast_GrPixelConfig = kBGRA_8888_GrPixelConfig 285 kETC1_GrPixelConfig, /** ETC1 Compressed Data **/
286 kLATC_GrPixelConfig, /** LATC/RGTC/3Dc/BC4 Compressed Data **/
287 kLast_GrPixelConfig = kLATC_GrPixelConfig
286 }; 288 };
287 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; 289 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
288 290
289 // Aliases for pixel configs that match skia's byte order. 291 // Aliases for pixel configs that match skia's byte order.
290 #ifndef SK_CPU_LENDIAN 292 #ifndef SK_CPU_LENDIAN
291 #error "Skia gpu currently assumes little endian" 293 #error "Skia gpu currently assumes little endian"
292 #endif 294 #endif
293 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) 295 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
294 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi g; 296 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi g;
295 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) 297 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
296 static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfi g; 298 static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfi g;
297 #else 299 #else
298 #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format." 300 #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format."
299 #endif 301 #endif
300 302
303 // Returns true if the pixel config is a GPU-specific compressed format
304 // representation.
305 static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) {
306 switch (config) {
307 case kETC1_GrPixelConfig:
308 case kLATC_GrPixelConfig:
309 return true;
310 default:
311 return false;
312 }
313 }
314
301 // Returns true if the pixel config is 32 bits per pixel 315 // Returns true if the pixel config is 32 bits per pixel
302 static inline bool GrPixelConfigIs8888(GrPixelConfig config) { 316 static inline bool GrPixelConfigIs8888(GrPixelConfig config) {
303 switch (config) { 317 switch (config) {
304 case kRGBA_8888_GrPixelConfig: 318 case kRGBA_8888_GrPixelConfig:
305 case kBGRA_8888_GrPixelConfig: 319 case kBGRA_8888_GrPixelConfig:
306 return true; 320 return true;
307 default: 321 default:
308 return false; 322 return false;
309 } 323 }
310 } 324 }
(...skipping 22 matching lines...) Expand all
333 case kRGBA_8888_GrPixelConfig: 347 case kRGBA_8888_GrPixelConfig:
334 case kBGRA_8888_GrPixelConfig: 348 case kBGRA_8888_GrPixelConfig:
335 return 4; 349 return 4;
336 default: 350 default:
337 return 0; 351 return 0;
338 } 352 }
339 } 353 }
340 354
341 static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) { 355 static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
342 switch (config) { 356 switch (config) {
357 case kETC1_GrPixelConfig:
343 case kRGB_565_GrPixelConfig: 358 case kRGB_565_GrPixelConfig:
344 return true; 359 return true;
345 default: 360 default:
346 return false; 361 return false;
347 } 362 }
348 } 363 }
349 364
350 static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) { 365 static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) {
351 switch (config) { 366 switch (config) {
352 case kAlpha_8_GrPixelConfig: 367 case kAlpha_8_GrPixelConfig:
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 kStencil_GrGLBackendState = 1 << 6, 628 kStencil_GrGLBackendState = 1 << 6,
614 kPixelStore_GrGLBackendState = 1 << 7, 629 kPixelStore_GrGLBackendState = 1 << 7,
615 kProgram_GrGLBackendState = 1 << 8, 630 kProgram_GrGLBackendState = 1 << 8,
616 kFixedFunction_GrGLBackendState = 1 << 9, 631 kFixedFunction_GrGLBackendState = 1 << 9,
617 kMisc_GrGLBackendState = 1 << 10, 632 kMisc_GrGLBackendState = 1 << 10,
618 kPathRendering_GrGLBackendState = 1 << 11, 633 kPathRendering_GrGLBackendState = 1 << 11,
619 kALL_GrGLBackendState = 0xffff 634 kALL_GrGLBackendState = 0xffff
620 }; 635 };
621 636
622 /** 637 /**
623 * The compressed texture formats that may be supported by the renderer.
624 * Make sure to check for the required capabilities using
625 * GrDrawTargetCaps::compressedTextureSupport
626 */
627 enum GrCompressedFormat {
628 kETC1_GrCompressedFormat,
629 kETC2_GrCompressedFormat,
630 kDXT1_GrCompressedFormat,
631
632 kLast_GrCompressedFormat = kDXT1_GrCompressedFormat
633 };
634 static const int kGrCompressedFormatCount = kLast_GrCompressedFormat + 1;
635
636 /**
637 * This value translates to reseting all the context state for any backend. 638 * This value translates to reseting all the context state for any backend.
638 */ 639 */
639 static const uint32_t kAll_GrBackendState = 0xffffffff; 640 static const uint32_t kAll_GrBackendState = 0xffffffff;
640 641
641 /////////////////////////////////////////////////////////////////////////////// 642 ///////////////////////////////////////////////////////////////////////////////
642 643
643 #endif 644 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698