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