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

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

Issue 359803003: 32 bpp floating point textures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback incorporated Created 6 years, 5 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/GrDrawTarget.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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 */ 267 */
268 kRGBA_4444_GrPixelConfig, 268 kRGBA_4444_GrPixelConfig,
269 /** 269 /**
270 * Premultiplied. Byte order is r,g,b,a. 270 * Premultiplied. Byte order is r,g,b,a.
271 */ 271 */
272 kRGBA_8888_GrPixelConfig, 272 kRGBA_8888_GrPixelConfig,
273 /** 273 /**
274 * Premultiplied. Byte order is b,g,r,a. 274 * Premultiplied. Byte order is b,g,r,a.
275 */ 275 */
276 kBGRA_8888_GrPixelConfig, 276 kBGRA_8888_GrPixelConfig,
277 /** 277 /**
278 * ETC1 Compressed Data 278 * ETC1 Compressed Data
279 */ 279 */
280 kETC1_GrPixelConfig, 280 kETC1_GrPixelConfig,
281 /** 281 /**
282 * LATC/RGTC/3Dc/BC4 Compressed Data 282 * LATC/RGTC/3Dc/BC4 Compressed Data
283 */ 283 */
284 kLATC_GrPixelConfig, 284 kLATC_GrPixelConfig,
285
286 /** 285 /**
287 * R11 EAC Compressed Data 286 * R11 EAC Compressed Data
288 * (Corresponds to section C.3.5 of the OpenGL 4.4 core profile spec) 287 * (Corresponds to section C.3.5 of the OpenGL 4.4 core profile spec)
289 */ 288 */
290 kR11_EAC_GrPixelConfig, 289 kR11_EAC_GrPixelConfig,
291 290 /**
292 kLast_GrPixelConfig = kR11_EAC_GrPixelConfig 291 * Byte order is r, g, b, a. This color format is 32 bits per channel
292 */
293 kRGBA_float_GrPixelConfig,
294 kLast_GrPixelConfig = kRGBA_float_GrPixelConfig
293 }; 295 };
294 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; 296 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
295 297
296 // Aliases for pixel configs that match skia's byte order. 298 // Aliases for pixel configs that match skia's byte order.
297 #ifndef SK_CPU_LENDIAN 299 #ifndef SK_CPU_LENDIAN
298 #error "Skia gpu currently assumes little endian" 300 #error "Skia gpu currently assumes little endian"
299 #endif 301 #endif
300 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) 302 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
301 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi g; 303 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi g;
302 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) 304 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 switch (config) { 348 switch (config) {
347 case kAlpha_8_GrPixelConfig: 349 case kAlpha_8_GrPixelConfig:
348 case kIndex_8_GrPixelConfig: 350 case kIndex_8_GrPixelConfig:
349 return 1; 351 return 1;
350 case kRGB_565_GrPixelConfig: 352 case kRGB_565_GrPixelConfig:
351 case kRGBA_4444_GrPixelConfig: 353 case kRGBA_4444_GrPixelConfig:
352 return 2; 354 return 2;
353 case kRGBA_8888_GrPixelConfig: 355 case kRGBA_8888_GrPixelConfig:
354 case kBGRA_8888_GrPixelConfig: 356 case kBGRA_8888_GrPixelConfig:
355 return 4; 357 return 4;
358 case kRGBA_float_GrPixelConfig:
359 return 16;
360 default:
361 return 0;
362 }
363 }
364
365 static inline size_t GrUnpackAlignment(GrPixelConfig config) {
366 switch (config) {
367 case kAlpha_8_GrPixelConfig:
368 case kIndex_8_GrPixelConfig:
369 return 1;
370 case kRGB_565_GrPixelConfig:
371 case kRGBA_4444_GrPixelConfig:
372 return 2;
373 case kRGBA_8888_GrPixelConfig:
374 case kBGRA_8888_GrPixelConfig:
375 case kRGBA_float_GrPixelConfig:
376 return 4;
356 default: 377 default:
357 return 0; 378 return 0;
358 } 379 }
359 } 380 }
360 381
361 static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) { 382 static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
362 switch (config) { 383 switch (config) {
363 case kETC1_GrPixelConfig: 384 case kETC1_GrPixelConfig:
364 case kRGB_565_GrPixelConfig: 385 case kRGB_565_GrPixelConfig:
365 return true; 386 return true;
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 kPixelStore_GrGLBackendState = 1 << 7, 658 kPixelStore_GrGLBackendState = 1 << 7,
638 kProgram_GrGLBackendState = 1 << 8, 659 kProgram_GrGLBackendState = 1 << 8,
639 kFixedFunction_GrGLBackendState = 1 << 9, 660 kFixedFunction_GrGLBackendState = 1 << 9,
640 kMisc_GrGLBackendState = 1 << 10, 661 kMisc_GrGLBackendState = 1 << 10,
641 kPathRendering_GrGLBackendState = 1 << 11, 662 kPathRendering_GrGLBackendState = 1 << 11,
642 kALL_GrGLBackendState = 0xffff 663 kALL_GrGLBackendState = 0xffff
643 }; 664 };
644 665
645 /** 666 /**
646 * Returns the data size for the given compressed pixel config 667 * Returns the data size for the given compressed pixel config
647 */ 668 */
648 static inline size_t GrCompressedFormatDataSize(GrPixelConfig config, 669 static inline size_t GrCompressedFormatDataSize(GrPixelConfig config,
649 int width, int height) { 670 int width, int height) {
650 SkASSERT(GrPixelConfigIsCompressed(config)); 671 SkASSERT(GrPixelConfigIsCompressed(config));
651 672
652 switch (config) { 673 switch (config) {
653 case kR11_EAC_GrPixelConfig: 674 case kR11_EAC_GrPixelConfig:
654 case kLATC_GrPixelConfig: 675 case kLATC_GrPixelConfig:
655 case kETC1_GrPixelConfig: 676 case kETC1_GrPixelConfig:
656 SkASSERT((width & 3) == 0); 677 SkASSERT((width & 3) == 0);
657 SkASSERT((height & 3) == 0); 678 SkASSERT((height & 3) == 0);
658 return (width >> 2) * (height >> 2) * 8; 679 return (width >> 2) * (height >> 2) * 8;
659 680
660 default: 681 default:
661 SkFAIL("Unknown compressed pixel config"); 682 SkFAIL("Unknown compressed pixel config");
662 return 4 * width * height; 683 return 4 * width * height;
663 } 684 }
664 } 685 }
665 686
666 /** 687 /**
667 * This value translates to reseting all the context state for any backend. 688 * This value translates to reseting all the context state for any backend.
668 */ 689 */
669 static const uint32_t kAll_GrBackendState = 0xffffffff; 690 static const uint32_t kAll_GrBackendState = 0xffffffff;
670 691
671 /////////////////////////////////////////////////////////////////////////////// 692 ///////////////////////////////////////////////////////////////////////////////
672 693
673 #endif 694 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrColor.h ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698