| OLD | NEW |
| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 285 |
| 286 kLast_GrPixelConfig = kLATC_GrPixelConfig | 286 /** |
| 287 * R11 EAC Compressed Data |
| 288 * (Corresponds to section C.3.5 of the OpenGL 4.4 core profile spec) |
| 289 */ |
| 290 kR11_EAC_GrPixelConfig, |
| 291 |
| 292 kLast_GrPixelConfig = kR11_EAC_GrPixelConfig |
| 287 }; | 293 }; |
| 288 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; | 294 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; |
| 289 | 295 |
| 290 // Aliases for pixel configs that match skia's byte order. | 296 // Aliases for pixel configs that match skia's byte order. |
| 291 #ifndef SK_CPU_LENDIAN | 297 #ifndef SK_CPU_LENDIAN |
| 292 #error "Skia gpu currently assumes little endian" | 298 #error "Skia gpu currently assumes little endian" |
| 293 #endif | 299 #endif |
| 294 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) | 300 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) |
| 295 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi
g; | 301 static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfi
g; |
| 296 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) | 302 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) |
| 297 static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfi
g; | 303 static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfi
g; |
| 298 #else | 304 #else |
| 299 #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format." | 305 #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format." |
| 300 #endif | 306 #endif |
| 301 | 307 |
| 302 // Returns true if the pixel config is a GPU-specific compressed format | 308 // Returns true if the pixel config is a GPU-specific compressed format |
| 303 // representation. | 309 // representation. |
| 304 static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) { | 310 static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) { |
| 305 switch (config) { | 311 switch (config) { |
| 306 case kETC1_GrPixelConfig: | 312 case kETC1_GrPixelConfig: |
| 307 case kLATC_GrPixelConfig: | 313 case kLATC_GrPixelConfig: |
| 314 case kR11_EAC_GrPixelConfig: |
| 308 return true; | 315 return true; |
| 309 default: | 316 default: |
| 310 return false; | 317 return false; |
| 311 } | 318 } |
| 312 } | 319 } |
| 313 | 320 |
| 314 // Returns true if the pixel config is 32 bits per pixel | 321 // Returns true if the pixel config is 32 bits per pixel |
| 315 static inline bool GrPixelConfigIs8888(GrPixelConfig config) { | 322 static inline bool GrPixelConfigIs8888(GrPixelConfig config) { |
| 316 switch (config) { | 323 switch (config) { |
| 317 case kRGBA_8888_GrPixelConfig: | 324 case kRGBA_8888_GrPixelConfig: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 case kETC1_GrPixelConfig: | 363 case kETC1_GrPixelConfig: |
| 357 case kRGB_565_GrPixelConfig: | 364 case kRGB_565_GrPixelConfig: |
| 358 return true; | 365 return true; |
| 359 default: | 366 default: |
| 360 return false; | 367 return false; |
| 361 } | 368 } |
| 362 } | 369 } |
| 363 | 370 |
| 364 static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) { | 371 static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) { |
| 365 switch (config) { | 372 switch (config) { |
| 373 case kR11_EAC_GrPixelConfig: |
| 366 case kLATC_GrPixelConfig: | 374 case kLATC_GrPixelConfig: |
| 367 case kAlpha_8_GrPixelConfig: | 375 case kAlpha_8_GrPixelConfig: |
| 368 return true; | 376 return true; |
| 369 default: | 377 default: |
| 370 return false; | 378 return false; |
| 371 } | 379 } |
| 372 } | 380 } |
| 373 | 381 |
| 374 /** | 382 /** |
| 375 * Optional bitfield flags that can be passed to createTexture. | 383 * Optional bitfield flags that can be passed to createTexture. |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 }; | 643 }; |
| 636 | 644 |
| 637 /** | 645 /** |
| 638 * Returns the data size for the given compressed pixel config | 646 * Returns the data size for the given compressed pixel config |
| 639 */ | 647 */ |
| 640 static inline size_t GrCompressedFormatDataSize(GrPixelConfig config, | 648 static inline size_t GrCompressedFormatDataSize(GrPixelConfig config, |
| 641 int width, int height) { | 649 int width, int height) { |
| 642 SkASSERT(GrPixelConfigIsCompressed(config)); | 650 SkASSERT(GrPixelConfigIsCompressed(config)); |
| 643 | 651 |
| 644 switch (config) { | 652 switch (config) { |
| 653 case kR11_EAC_GrPixelConfig: |
| 645 case kLATC_GrPixelConfig: | 654 case kLATC_GrPixelConfig: |
| 646 case kETC1_GrPixelConfig: | 655 case kETC1_GrPixelConfig: |
| 647 SkASSERT((width & 3) == 0); | 656 SkASSERT((width & 3) == 0); |
| 648 SkASSERT((height & 3) == 0); | 657 SkASSERT((height & 3) == 0); |
| 649 return (width >> 2) * (height >> 2) * 8; | 658 return (width >> 2) * (height >> 2) * 8; |
| 650 | 659 |
| 651 default: | 660 default: |
| 652 SkFAIL("Unknown compressed pixel config"); | 661 SkFAIL("Unknown compressed pixel config"); |
| 653 return 4 * width * height; | 662 return 4 * width * height; |
| 654 } | 663 } |
| 655 } | 664 } |
| 656 | 665 |
| 657 /** | 666 /** |
| 658 * This value translates to reseting all the context state for any backend. | 667 * This value translates to reseting all the context state for any backend. |
| 659 */ | 668 */ |
| 660 static const uint32_t kAll_GrBackendState = 0xffffffff; | 669 static const uint32_t kAll_GrBackendState = 0xffffffff; |
| 661 | 670 |
| 662 /////////////////////////////////////////////////////////////////////////////// | 671 /////////////////////////////////////////////////////////////////////////////// |
| 663 | 672 |
| 664 #endif | 673 #endif |
| OLD | NEW |