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

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

Issue 762923003: Add support for half float alpha textures. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix config setup Created 6 years 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/core/SkHalf.h » ('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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 * having RGBA values. However, there are single-channel encodings which set 295 * having RGBA values. However, there are single-channel encodings which set
296 * the alpha to opaque and all three RGB channels equal effectively making t he 296 * the alpha to opaque and all three RGB channels equal effectively making t he
297 * compression format a single channel such as R11 EAC and LATC. 297 * compression format a single channel such as R11 EAC and LATC.
298 */ 298 */
299 kASTC_12x12_GrPixelConfig, 299 kASTC_12x12_GrPixelConfig,
300 300
301 /** 301 /**
302 * Byte order is r, g, b, a. This color format is 32 bits per channel 302 * Byte order is r, g, b, a. This color format is 32 bits per channel
303 */ 303 */
304 kRGBA_float_GrPixelConfig, 304 kRGBA_float_GrPixelConfig,
305 kLast_GrPixelConfig = kRGBA_float_GrPixelConfig 305
306 /**
307 * This color format is a single 16 bit float channel
308 */
309 kAlpha_half_GrPixelConfig,
310
311 kLast_GrPixelConfig = kAlpha_half_GrPixelConfig
306 }; 312 };
307 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; 313 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
308 314
309 // Aliases for pixel configs that match skia's byte order. 315 // Aliases for pixel configs that match skia's byte order.
310 #ifndef SK_CPU_LENDIAN 316 #ifndef SK_CPU_LENDIAN
311 #error "Skia gpu currently assumes little endian" 317 #error "Skia gpu currently assumes little endian"
312 #endif 318 #endif
313 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) 319 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
314 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi g; 320 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi g;
315 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) 321 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 363 }
358 } 364 }
359 365
360 static inline size_t GrBytesPerPixel(GrPixelConfig config) { 366 static inline size_t GrBytesPerPixel(GrPixelConfig config) {
361 SkASSERT(!GrPixelConfigIsCompressed(config)); 367 SkASSERT(!GrPixelConfigIsCompressed(config));
362 switch (config) { 368 switch (config) {
363 case kAlpha_8_GrPixelConfig: 369 case kAlpha_8_GrPixelConfig:
364 return 1; 370 return 1;
365 case kRGB_565_GrPixelConfig: 371 case kRGB_565_GrPixelConfig:
366 case kRGBA_4444_GrPixelConfig: 372 case kRGBA_4444_GrPixelConfig:
373 case kAlpha_half_GrPixelConfig:
367 return 2; 374 return 2;
368 case kRGBA_8888_GrPixelConfig: 375 case kRGBA_8888_GrPixelConfig:
369 case kBGRA_8888_GrPixelConfig: 376 case kBGRA_8888_GrPixelConfig:
370 return 4; 377 return 4;
371 case kRGBA_float_GrPixelConfig: 378 case kRGBA_float_GrPixelConfig:
372 return 16; 379 return 16;
373 default: 380 default:
374 return 0; 381 return 0;
375 } 382 }
376 } 383 }
377 384
378 static inline size_t GrUnpackAlignment(GrPixelConfig config) { 385 static inline size_t GrUnpackAlignment(GrPixelConfig config) {
379 SkASSERT(!GrPixelConfigIsCompressed(config)); 386 SkASSERT(!GrPixelConfigIsCompressed(config));
380 switch (config) { 387 switch (config) {
381 case kAlpha_8_GrPixelConfig: 388 case kAlpha_8_GrPixelConfig:
382 return 1; 389 return 1;
383 case kRGB_565_GrPixelConfig: 390 case kRGB_565_GrPixelConfig:
384 case kRGBA_4444_GrPixelConfig: 391 case kRGBA_4444_GrPixelConfig:
392 case kAlpha_half_GrPixelConfig:
385 return 2; 393 return 2;
386 case kRGBA_8888_GrPixelConfig: 394 case kRGBA_8888_GrPixelConfig:
387 case kBGRA_8888_GrPixelConfig: 395 case kBGRA_8888_GrPixelConfig:
388 case kRGBA_float_GrPixelConfig: 396 case kRGBA_float_GrPixelConfig:
389 return 4; 397 return 4;
390 default: 398 default:
391 return 0; 399 return 0;
392 } 400 }
393 } 401 }
394 402
395 static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) { 403 static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
396 switch (config) { 404 switch (config) {
397 case kETC1_GrPixelConfig: 405 case kETC1_GrPixelConfig:
398 case kRGB_565_GrPixelConfig: 406 case kRGB_565_GrPixelConfig:
399 return true; 407 return true;
400 default: 408 default:
401 return false; 409 return false;
402 } 410 }
403 } 411 }
404 412
405 static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) { 413 static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) {
406 switch (config) { 414 switch (config) {
407 case kR11_EAC_GrPixelConfig: 415 case kR11_EAC_GrPixelConfig:
408 case kLATC_GrPixelConfig: 416 case kLATC_GrPixelConfig:
409 case kASTC_12x12_GrPixelConfig: 417 case kASTC_12x12_GrPixelConfig:
410 case kAlpha_8_GrPixelConfig: 418 case kAlpha_8_GrPixelConfig:
419 case kAlpha_half_GrPixelConfig:
411 return true; 420 return true;
412 default: 421 default:
413 return false; 422 return false;
414 } 423 }
415 } 424 }
416 425
417 /** 426 /**
418 * Optional bitfield flags that can be set on GrSurfaceDesc (below). 427 * Optional bitfield flags that can be set on GrSurfaceDesc (below).
419 */ 428 */
420 enum GrSurfaceFlags { 429 enum GrSurfaceFlags {
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 public: 725 public:
717 GrAutoMalloc() : INHERITED() {} 726 GrAutoMalloc() : INHERITED() {}
718 explicit GrAutoMalloc(size_t size) : INHERITED(size) {} 727 explicit GrAutoMalloc(size_t size) : INHERITED(size) {}
719 virtual ~GrAutoMalloc() {} 728 virtual ~GrAutoMalloc() {}
720 private: 729 private:
721 typedef GrAutoMallocBaseType INHERITED; 730 typedef GrAutoMallocBaseType INHERITED;
722 }; 731 };
723 732
724 #undef GrAutoMallocBaseType 733 #undef GrAutoMallocBaseType
725 #endif 734 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrColor.h ('k') | src/core/SkHalf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698