| 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" |
| 11 #include "glsl/GrGLSLCaps.h" | 11 #include "glsl/GrGLSLCaps.h" |
| 12 #include "vk/GrVkInterface.h" | 12 #include "vk/GrVkInterface.h" |
| 13 #include "vk/GrVkBackendContext.h" | 13 #include "vk/GrVkBackendContext.h" |
| 14 | 14 |
| 15 GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface*
vkInterface, | 15 GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface*
vkInterface, |
| 16 VkPhysicalDevice physDev, uint32_t featureFlags, uint32_t ext
ensionFlags) | 16 VkPhysicalDevice physDev, uint32_t featureFlags, uint32_t ext
ensionFlags) |
| 17 : INHERITED(contextOptions) { | 17 : INHERITED(contextOptions) { |
| 18 fCanUseGLSLForShaderModule = false; | 18 fCanUseGLSLForShaderModule = false; |
| 19 fMustDoCopiesFromOrigin = false; | 19 fMustDoCopiesFromOrigin = false; |
| 20 fAllowInitializationErrorOnTearDown = false; |
| 20 | 21 |
| 21 /************************************************************************** | 22 /************************************************************************** |
| 22 * GrDrawTargetCaps fields | 23 * GrDrawTargetCaps fields |
| 23 **************************************************************************/ | 24 **************************************************************************/ |
| 24 fMipMapSupport = true; // always available in Vulkan | 25 fMipMapSupport = true; // always available in Vulkan |
| 25 fSRGBSupport = true; // always available in Vulkan | 26 fSRGBSupport = true; // always available in Vulkan |
| 26 fNPOTTextureTileSupport = true; // always available in Vulkan | 27 fNPOTTextureTileSupport = true; // always available in Vulkan |
| 27 fTwoSidedStencilSupport = true; // always available in Vulkan | 28 fTwoSidedStencilSupport = true; // always available in Vulkan |
| 28 fStencilWrapOpsSupport = true; // always available in Vulkan | 29 fStencilWrapOpsSupport = true; // always available in Vulkan |
| 29 fDiscardRenderTargetSupport = true; | 30 fDiscardRenderTargetSupport = true; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 this->initStencilFormat(vkInterface, physDev); | 63 this->initStencilFormat(vkInterface, physDev); |
| 63 | 64 |
| 64 if (SkToBool(extensionFlags & kNV_glsl_shader_GrVkExtensionFlag)) { | 65 if (SkToBool(extensionFlags & kNV_glsl_shader_GrVkExtensionFlag)) { |
| 65 // Currently disabling this feature since it does not play well with val
idation layers which | 66 // Currently disabling this feature since it does not play well with val
idation layers which |
| 66 // expect a SPIR-V shader | 67 // expect a SPIR-V shader |
| 67 // fCanUseGLSLForShaderModule = true; | 68 // fCanUseGLSLForShaderModule = true; |
| 68 } | 69 } |
| 69 | 70 |
| 70 if (kQualcomm_VkVendor == properties.vendorID) { | 71 if (kQualcomm_VkVendor == properties.vendorID) { |
| 71 fMustDoCopiesFromOrigin = true; | 72 fMustDoCopiesFromOrigin = true; |
| 73 fAllowInitializationErrorOnTearDown = true; |
| 72 } | 74 } |
| 73 | 75 |
| 74 this->applyOptionsOverrides(contextOptions); | 76 this->applyOptionsOverrides(contextOptions); |
| 75 GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get()); | 77 GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get()); |
| 76 glslCaps->applyOptionsOverrides(contextOptions); | 78 glslCaps->applyOptionsOverrides(contextOptions); |
| 77 } | 79 } |
| 78 | 80 |
| 79 int get_max_sample_count(VkSampleCountFlags flags) { | 81 int get_max_sample_count(VkSampleCountFlags flags) { |
| 80 SkASSERT(flags & VK_SAMPLE_COUNT_1_BIT); | 82 SkASSERT(flags & VK_SAMPLE_COUNT_1_BIT); |
| 81 if (!(flags & VK_SAMPLE_COUNT_2_BIT)) { | 83 if (!(flags & VK_SAMPLE_COUNT_2_BIT)) { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 253 |
| 252 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, | 254 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, |
| 253 VkPhysicalDevice physDev, | 255 VkPhysicalDevice physDev, |
| 254 VkFormat format) { | 256 VkFormat format) { |
| 255 VkFormatProperties props; | 257 VkFormatProperties props; |
| 256 memset(&props, 0, sizeof(VkFormatProperties)); | 258 memset(&props, 0, sizeof(VkFormatProperties)); |
| 257 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); | 259 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); |
| 258 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); | 260 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); |
| 259 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); | 261 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); |
| 260 } | 262 } |
| OLD | NEW |