| 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 if (kRGBA_4444_GrPixelConfig == config) { | 140 glslCaps->fConfigTextureSwizzle[i] = GrSwizzle::RGBA(); |
| 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 } | |
| 150 } | 141 } |
| 151 } | 142 } |
| 152 | 143 |
| 153 // Vulkan is based off ES 3.0 so the following should all be supported | 144 // Vulkan is based off ES 3.0 so the following should all be supported |
| 154 glslCaps->fUsesPrecisionModifiers = true; | 145 glslCaps->fUsesPrecisionModifiers = true; |
| 155 glslCaps->fFlatInterpolationSupport = true; | 146 glslCaps->fFlatInterpolationSupport = true; |
| 156 | 147 |
| 157 // GrShaderCaps | 148 // GrShaderCaps |
| 158 | 149 |
| 159 glslCaps->fShaderDerivativeSupport = true; | 150 glslCaps->fShaderDerivativeSupport = true; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 237 |
| 247 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, | 238 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, |
| 248 VkPhysicalDevice physDev, | 239 VkPhysicalDevice physDev, |
| 249 VkFormat format) { | 240 VkFormat format) { |
| 250 VkFormatProperties props; | 241 VkFormatProperties props; |
| 251 memset(&props, 0, sizeof(VkFormatProperties)); | 242 memset(&props, 0, sizeof(VkFormatProperties)); |
| 252 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); | 243 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); |
| 253 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); | 244 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); |
| 254 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); | 245 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); |
| 255 } | 246 } |
| OLD | NEW |