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 fAllowInitializationErrorOnTearDown = false; |
21 fSupportsCopiesAsDraws = false; | 21 fSupportsCopiesAsDraws = false; |
| 22 fMustSubmitCommandsBeforeCopyOp = false; |
22 | 23 |
23 /************************************************************************** | 24 /************************************************************************** |
24 * GrDrawTargetCaps fields | 25 * GrDrawTargetCaps fields |
25 **************************************************************************/ | 26 **************************************************************************/ |
26 fMipMapSupport = true; // always available in Vulkan | 27 fMipMapSupport = true; // always available in Vulkan |
27 fSRGBSupport = true; // always available in Vulkan | 28 fSRGBSupport = true; // always available in Vulkan |
28 fNPOTTextureTileSupport = true; // always available in Vulkan | 29 fNPOTTextureTileSupport = true; // always available in Vulkan |
29 fTwoSidedStencilSupport = true; // always available in Vulkan | 30 fTwoSidedStencilSupport = true; // always available in Vulkan |
30 fStencilWrapOpsSupport = true; // always available in Vulkan | 31 fStencilWrapOpsSupport = true; // always available in Vulkan |
31 fDiscardRenderTargetSupport = true; | 32 fDiscardRenderTargetSupport = true; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Currently disabling this feature since it does not play well with val
idation layers which | 68 // Currently disabling this feature since it does not play well with val
idation layers which |
68 // expect a SPIR-V shader | 69 // expect a SPIR-V shader |
69 // fCanUseGLSLForShaderModule = true; | 70 // fCanUseGLSLForShaderModule = true; |
70 } | 71 } |
71 | 72 |
72 if (kQualcomm_VkVendor == properties.vendorID) { | 73 if (kQualcomm_VkVendor == properties.vendorID) { |
73 fMustDoCopiesFromOrigin = true; | 74 fMustDoCopiesFromOrigin = true; |
74 fAllowInitializationErrorOnTearDown = true; | 75 fAllowInitializationErrorOnTearDown = true; |
75 } | 76 } |
76 | 77 |
| 78 if (kNvidia_VkVendor == properties.vendorID) { |
| 79 fSupportsCopiesAsDraws = true; |
| 80 fMustSubmitCommandsBeforeCopyOp = true; |
| 81 } |
| 82 |
77 this->applyOptionsOverrides(contextOptions); | 83 this->applyOptionsOverrides(contextOptions); |
78 GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get()); | 84 GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get()); |
79 glslCaps->applyOptionsOverrides(contextOptions); | 85 glslCaps->applyOptionsOverrides(contextOptions); |
80 } | 86 } |
81 | 87 |
82 int get_max_sample_count(VkSampleCountFlags flags) { | 88 int get_max_sample_count(VkSampleCountFlags flags) { |
83 SkASSERT(flags & VK_SAMPLE_COUNT_1_BIT); | 89 SkASSERT(flags & VK_SAMPLE_COUNT_1_BIT); |
84 if (!(flags & VK_SAMPLE_COUNT_2_BIT)) { | 90 if (!(flags & VK_SAMPLE_COUNT_2_BIT)) { |
85 return 0; | 91 return 0; |
86 } | 92 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 262 |
257 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, | 263 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, |
258 VkPhysicalDevice physDev, | 264 VkPhysicalDevice physDev, |
259 VkFormat format) { | 265 VkFormat format) { |
260 VkFormatProperties props; | 266 VkFormatProperties props; |
261 memset(&props, 0, sizeof(VkFormatProperties)); | 267 memset(&props, 0, sizeof(VkFormatProperties)); |
262 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); | 268 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); |
263 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); | 269 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); |
264 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); | 270 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); |
265 } | 271 } |
OLD | NEW |