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 "GrVkCaps.h" | 8 #include "GrVkCaps.h" |
9 | 9 |
10 #include "GrVkUtil.h" | 10 #include "GrVkUtil.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 glslCaps->fVersionDeclString = "#version 330\n"; | 130 glslCaps->fVersionDeclString = "#version 330\n"; |
131 | 131 |
132 | 132 |
133 // fConfigOutputSwizzle will default to RGBA so we only need to set it for a
lpha only config. | 133 // fConfigOutputSwizzle will default to RGBA so we only need to set it for a
lpha only config. |
134 for (int i = 0; i < kGrPixelConfigCnt; ++i) { | 134 for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
135 GrPixelConfig config = static_cast<GrPixelConfig>(i); | 135 GrPixelConfig config = static_cast<GrPixelConfig>(i); |
136 if (GrPixelConfigIsAlphaOnly(config)) { | 136 if (GrPixelConfigIsAlphaOnly(config)) { |
137 glslCaps->fConfigTextureSwizzle[i] = GrSwizzle::RRRR(); | 137 glslCaps->fConfigTextureSwizzle[i] = GrSwizzle::RRRR(); |
138 glslCaps->fConfigOutputSwizzle[i] = GrSwizzle::AAAA(); | 138 glslCaps->fConfigOutputSwizzle[i] = GrSwizzle::AAAA(); |
139 } else { | 139 } else { |
140 glslCaps->fConfigTextureSwizzle[i] = GrSwizzle::RGBA(); | 140 if (kRGBA_4444_GrPixelConfig == config) { |
| 141 // The vulkan spec does not require R4G4B4A4 to be supported for
texturing so we |
| 142 // store the data in a B4G4R4A4 texture and then swizzle it when
doing texture reads |
| 143 // or writing to outputs. Since we're not actually changing the
data at all, the |
| 144 // only extra work is the swizzle in the shader for all operatio
ns. |
| 145 glslCaps->fConfigTextureSwizzle[i] = GrSwizzle::BGRA(); |
| 146 glslCaps->fConfigOutputSwizzle[i] = GrSwizzle::BGRA(); |
| 147 } else { |
| 148 glslCaps->fConfigTextureSwizzle[i] = GrSwizzle::RGBA(); |
| 149 } |
141 } | 150 } |
142 } | 151 } |
143 | 152 |
144 // Vulkan is based off ES 3.0 so the following should all be supported | 153 // Vulkan is based off ES 3.0 so the following should all be supported |
145 glslCaps->fUsesPrecisionModifiers = true; | 154 glslCaps->fUsesPrecisionModifiers = true; |
146 glslCaps->fFlatInterpolationSupport = true; | 155 glslCaps->fFlatInterpolationSupport = true; |
147 | 156 |
148 // GrShaderCaps | 157 // GrShaderCaps |
149 | 158 |
150 glslCaps->fShaderDerivativeSupport = true; | 159 glslCaps->fShaderDerivativeSupport = true; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 246 |
238 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, | 247 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, |
239 VkPhysicalDevice physDev, | 248 VkPhysicalDevice physDev, |
240 VkFormat format) { | 249 VkFormat format) { |
241 VkFormatProperties props; | 250 VkFormatProperties props; |
242 memset(&props, 0, sizeof(VkFormatProperties)); | 251 memset(&props, 0, sizeof(VkFormatProperties)); |
243 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); | 252 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); |
244 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); | 253 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); |
245 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); | 254 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); |
246 } | 255 } |
OLD | NEW |