OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrVkUtil.h" | 8 #include "GrVkUtil.h" |
9 | 9 |
10 bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) { | 10 bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) { |
(...skipping 12 matching lines...) Expand all Loading... |
23 case kSRGBA_8888_GrPixelConfig: | 23 case kSRGBA_8888_GrPixelConfig: |
24 *format = VK_FORMAT_R8G8B8A8_SRGB; | 24 *format = VK_FORMAT_R8G8B8A8_SRGB; |
25 break; | 25 break; |
26 case kSBGRA_8888_GrPixelConfig: | 26 case kSBGRA_8888_GrPixelConfig: |
27 *format = VK_FORMAT_B8G8R8A8_SRGB; | 27 *format = VK_FORMAT_B8G8R8A8_SRGB; |
28 break; | 28 break; |
29 case kRGB_565_GrPixelConfig: | 29 case kRGB_565_GrPixelConfig: |
30 *format = VK_FORMAT_R5G6B5_UNORM_PACK16; | 30 *format = VK_FORMAT_R5G6B5_UNORM_PACK16; |
31 break; | 31 break; |
32 case kRGBA_4444_GrPixelConfig: | 32 case kRGBA_4444_GrPixelConfig: |
33 // R4G4B4A4 is not required to be supported so we actually | 33 *format = VK_FORMAT_R4G4B4A4_UNORM_PACK16; |
34 // store the data is if it was B4G4R4A4 and swizzle in shaders | |
35 *format = VK_FORMAT_B4G4R4A4_UNORM_PACK16; | |
36 break; | 34 break; |
37 case kIndex_8_GrPixelConfig: | 35 case kIndex_8_GrPixelConfig: |
38 // No current vulkan support for this config | 36 // No current vulkan support for this config |
39 return false; | 37 return false; |
40 case kAlpha_8_GrPixelConfig: | 38 case kAlpha_8_GrPixelConfig: |
41 *format = VK_FORMAT_R8_UNORM; | 39 *format = VK_FORMAT_R8_UNORM; |
42 break; | 40 break; |
43 case kETC1_GrPixelConfig: | 41 case kETC1_GrPixelConfig: |
44 // converting to ETC2 which is a superset of ETC1 | 42 // converting to ETC2 which is a superset of ETC1 |
45 *format = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; | 43 *format = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 break; | 81 break; |
84 case VK_FORMAT_R8G8B8A8_SRGB: | 82 case VK_FORMAT_R8G8B8A8_SRGB: |
85 *config = kSRGBA_8888_GrPixelConfig; | 83 *config = kSRGBA_8888_GrPixelConfig; |
86 break; | 84 break; |
87 case VK_FORMAT_B8G8R8A8_SRGB: | 85 case VK_FORMAT_B8G8R8A8_SRGB: |
88 *config = kSBGRA_8888_GrPixelConfig; | 86 *config = kSBGRA_8888_GrPixelConfig; |
89 break; | 87 break; |
90 case VK_FORMAT_R5G6B5_UNORM_PACK16: | 88 case VK_FORMAT_R5G6B5_UNORM_PACK16: |
91 *config = kRGB_565_GrPixelConfig; | 89 *config = kRGB_565_GrPixelConfig; |
92 break; | 90 break; |
93 case VK_FORMAT_B4G4R4A4_UNORM_PACK16: | 91 case VK_FORMAT_R4G4B4A4_UNORM_PACK16: |
94 // R4G4B4A4 is not required to be supported so we actually | |
95 // store RGBA_4444 data as B4G4R4A4. | |
96 *config = kRGBA_4444_GrPixelConfig; | 92 *config = kRGBA_4444_GrPixelConfig; |
97 break; | 93 break; |
98 case VK_FORMAT_R8_UNORM: | 94 case VK_FORMAT_R8_UNORM: |
99 *config = kAlpha_8_GrPixelConfig; | 95 *config = kAlpha_8_GrPixelConfig; |
100 break; | 96 break; |
101 case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: | 97 case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: |
102 *config = kETC1_GrPixelConfig; | 98 *config = kETC1_GrPixelConfig; |
103 break; | 99 break; |
104 case VK_FORMAT_EAC_R11_UNORM_BLOCK: | 100 case VK_FORMAT_EAC_R11_UNORM_BLOCK: |
105 *config = kR11_EAC_GrPixelConfig; | 101 *config = kR11_EAC_GrPixelConfig; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 case 32: | 238 case 32: |
243 *vkSamples = VK_SAMPLE_COUNT_2_BIT; | 239 *vkSamples = VK_SAMPLE_COUNT_2_BIT; |
244 return true; | 240 return true; |
245 case 64: | 241 case 64: |
246 *vkSamples = VK_SAMPLE_COUNT_2_BIT; | 242 *vkSamples = VK_SAMPLE_COUNT_2_BIT; |
247 return true; | 243 return true; |
248 default: | 244 default: |
249 return false; | 245 return false; |
250 } | 246 } |
251 } | 247 } |
OLD | NEW |