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

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: Only generate mipmaps for uncompressed textures. 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
« no previous file with comments | « include/gpu/GrColor.h ('k') | src/gpu/GrAtlas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /**
285 * ETC1 Compressed Data
286 */
287 kETC1_GrPixelConfig,
288 /**
289 * LATC/RGTC/3Dc/BC4 Compressed Data
290 */
291 kLATC_GrPixelConfig,
284 292
285 kLast_GrPixelConfig = kBGRA_8888_GrPixelConfig 293 kLast_GrPixelConfig = kLATC_GrPixelConfig
286 }; 294 };
287 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; 295 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
288 296
289 // Aliases for pixel configs that match skia's byte order. 297 // Aliases for pixel configs that match skia's byte order.
290 #ifndef SK_CPU_LENDIAN 298 #ifndef SK_CPU_LENDIAN
291 #error "Skia gpu currently assumes little endian" 299 #error "Skia gpu currently assumes little endian"
292 #endif 300 #endif
293 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) 301 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
294 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi g; 302 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi g;
295 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) 303 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
296 static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfi g; 304 static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfi g;
297 #else 305 #else
298 #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format." 306 #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format."
299 #endif 307 #endif
300 308
309 // Returns true if the pixel config is a GPU-specific compressed format
310 // representation.
311 static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) {
312 switch (config) {
313 case kETC1_GrPixelConfig:
314 case kLATC_GrPixelConfig:
315 return true;
316 default:
317 return false;
318 }
319 }
320
301 // Returns true if the pixel config is 32 bits per pixel 321 // Returns true if the pixel config is 32 bits per pixel
302 static inline bool GrPixelConfigIs8888(GrPixelConfig config) { 322 static inline bool GrPixelConfigIs8888(GrPixelConfig config) {
303 switch (config) { 323 switch (config) {
304 case kRGBA_8888_GrPixelConfig: 324 case kRGBA_8888_GrPixelConfig:
305 case kBGRA_8888_GrPixelConfig: 325 case kBGRA_8888_GrPixelConfig:
306 return true; 326 return true;
307 default: 327 default:
308 return false; 328 return false;
309 } 329 }
310 } 330 }
(...skipping 22 matching lines...) Expand all
333 case kRGBA_8888_GrPixelConfig: 353 case kRGBA_8888_GrPixelConfig:
334 case kBGRA_8888_GrPixelConfig: 354 case kBGRA_8888_GrPixelConfig:
335 return 4; 355 return 4;
336 default: 356 default:
337 return 0; 357 return 0;
338 } 358 }
339 } 359 }
340 360
341 static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) { 361 static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
342 switch (config) { 362 switch (config) {
363 case kETC1_GrPixelConfig:
343 case kRGB_565_GrPixelConfig: 364 case kRGB_565_GrPixelConfig:
344 return true; 365 return true;
345 default: 366 default:
346 return false; 367 return false;
347 } 368 }
348 } 369 }
349 370
350 static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) { 371 static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) {
351 switch (config) { 372 switch (config) {
352 case kAlpha_8_GrPixelConfig: 373 case kAlpha_8_GrPixelConfig:
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 kStencil_GrGLBackendState = 1 << 6, 634 kStencil_GrGLBackendState = 1 << 6,
614 kPixelStore_GrGLBackendState = 1 << 7, 635 kPixelStore_GrGLBackendState = 1 << 7,
615 kProgram_GrGLBackendState = 1 << 8, 636 kProgram_GrGLBackendState = 1 << 8,
616 kFixedFunction_GrGLBackendState = 1 << 9, 637 kFixedFunction_GrGLBackendState = 1 << 9,
617 kMisc_GrGLBackendState = 1 << 10, 638 kMisc_GrGLBackendState = 1 << 10,
618 kPathRendering_GrGLBackendState = 1 << 11, 639 kPathRendering_GrGLBackendState = 1 << 11,
619 kALL_GrGLBackendState = 0xffff 640 kALL_GrGLBackendState = 0xffff
620 }; 641 };
621 642
622 /** 643 /**
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. 644 * This value translates to reseting all the context state for any backend.
638 */ 645 */
639 static const uint32_t kAll_GrBackendState = 0xffffffff; 646 static const uint32_t kAll_GrBackendState = 0xffffffff;
640 647
641 /////////////////////////////////////////////////////////////////////////////// 648 ///////////////////////////////////////////////////////////////////////////////
642 649
643 #endif 650 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrColor.h ('k') | src/gpu/GrAtlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698