Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "GrVkCaps.h" |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 9 | #include "GrBackendSurface.h" |
Robert Phillips | bf25d43 | 2017-04-07 10:08:53 -0400 | [diff] [blame] | 10 | #include "GrRenderTargetProxy.h" |
Brian Salomon | 3d86a19 | 2018-02-27 16:46:11 -0500 | [diff] [blame] | 11 | #include "GrRenderTarget.h" |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 12 | #include "GrShaderCaps.h" |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 13 | #include "GrVkUtil.h" |
jvanverth | fd7bd45 | 2016-03-25 06:29:52 -0700 | [diff] [blame] | 14 | #include "vk/GrVkBackendContext.h" |
Brian Salomon | 467921e | 2017-03-06 16:17:12 -0500 | [diff] [blame] | 15 | #include "vk/GrVkInterface.h" |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 16 | |
| 17 | GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface, |
egdaniel | c5ec140 | 2016-03-28 12:14:42 -0700 | [diff] [blame] | 18 | VkPhysicalDevice physDev, uint32_t featureFlags, uint32_t extensionFlags) |
| 19 | : INHERITED(contextOptions) { |
| 20 | fCanUseGLSLForShaderModule = false; |
egdaniel | 6fa0a91 | 2016-09-12 11:51:29 -0700 | [diff] [blame] | 21 | fMustDoCopiesFromOrigin = false; |
egdaniel | fd016d7 | 2016-09-27 12:13:05 -0700 | [diff] [blame] | 22 | fMustSubmitCommandsBeforeCopyOp = false; |
Greg Daniel | 80a08dd | 2017-01-20 10:45:49 -0500 | [diff] [blame] | 23 | fMustSleepOnTearDown = false; |
Greg Daniel | e3cd691 | 2017-05-17 11:15:55 -0400 | [diff] [blame] | 24 | fNewCBOnPipelineChange = false; |
Greg Daniel | 8385a8a | 2018-02-26 13:29:37 -0500 | [diff] [blame] | 25 | fCanUseWholeSizeOnFlushMappedMemory = true; |
egdaniel | c5ec140 | 2016-03-28 12:14:42 -0700 | [diff] [blame] | 26 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 27 | /************************************************************************** |
| 28 | * GrDrawTargetCaps fields |
| 29 | **************************************************************************/ |
jvanverth | 6234006 | 2016-04-26 08:01:44 -0700 | [diff] [blame] | 30 | fMipMapSupport = true; // always available in Vulkan |
brianosman | f05ab1b | 2016-05-12 11:01:10 -0700 | [diff] [blame] | 31 | fSRGBSupport = true; // always available in Vulkan |
Brian Osman | 57bc3ea | 2017-07-27 09:58:11 -0400 | [diff] [blame] | 32 | fSRGBDecodeDisableSupport = true; // always available in Vulkan |
brianosman | 8879186 | 2016-05-23 10:15:27 -0700 | [diff] [blame] | 33 | fNPOTTextureTileSupport = true; // always available in Vulkan |
egdaniel | 37535c9 | 2016-06-30 08:23:30 -0700 | [diff] [blame] | 34 | fDiscardRenderTargetSupport = true; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 35 | fReuseScratchTextures = true; //TODO: figure this out |
| 36 | fGpuTracingSupport = false; //TODO: figure this out |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 37 | fOversizedStencilSupport = false; //TODO: figure this out |
Chris Dalton | 1d61635 | 2017-05-31 12:51:23 -0600 | [diff] [blame] | 38 | fInstanceAttribSupport = true; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 39 | |
Greg Daniel | 0fe4ed8 | 2018-03-15 12:27:29 +0000 | [diff] [blame] | 40 | fBlacklistCoverageCounting = true; // blacklisting ccpr until we work through a few issues. |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 41 | fFenceSyncSupport = true; // always available in Vulkan |
Greg Daniel | 691f5e7 | 2018-02-28 14:21:34 -0500 | [diff] [blame] | 42 | fCrossContextTextureSupport = true; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 43 | |
| 44 | fMapBufferFlags = kNone_MapFlags; //TODO: figure this out |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 45 | fBufferMapThreshold = SK_MaxS32; //TODO: figure this out |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 46 | |
| 47 | fMaxRenderTargetSize = 4096; // minimum required by spec |
| 48 | fMaxTextureSize = 4096; // minimum required by spec |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 49 | |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 50 | fShaderCaps.reset(new GrShaderCaps(contextOptions)); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 51 | |
egdaniel | c5ec140 | 2016-03-28 12:14:42 -0700 | [diff] [blame] | 52 | this->init(contextOptions, vkInterface, physDev, featureFlags, extensionFlags); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 53 | } |
| 54 | |
Robert Phillips | bf25d43 | 2017-04-07 10:08:53 -0400 | [diff] [blame] | 55 | bool GrVkCaps::initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc, |
Brian Salomon | 2a4f983 | 2018-03-03 22:43:43 -0500 | [diff] [blame] | 56 | GrSurfaceOrigin* origin, bool* rectsMustMatch, |
| 57 | bool* disallowSubrect) const { |
Eric Karl | 7448088 | 2017-04-03 14:49:05 -0700 | [diff] [blame] | 58 | // Vk doesn't use rectsMustMatch or disallowSubrect. Always return false. |
| 59 | *rectsMustMatch = false; |
| 60 | *disallowSubrect = false; |
| 61 | |
Brian Salomon | 467921e | 2017-03-06 16:17:12 -0500 | [diff] [blame] | 62 | // We can always succeed here with either a CopyImage (none msaa src) or ResolveImage (msaa). |
| 63 | // For CopyImage we can make a simple texture, for ResolveImage we require the dst to be a |
| 64 | // render target as well. |
Brian Salomon | 2a4f983 | 2018-03-03 22:43:43 -0500 | [diff] [blame] | 65 | *origin = src->origin(); |
Brian Salomon | 467921e | 2017-03-06 16:17:12 -0500 | [diff] [blame] | 66 | desc->fConfig = src->config(); |
Greg Daniel | 55fa647 | 2018-03-16 16:13:10 -0400 | [diff] [blame] | 67 | if (src->numColorSamples() > 1 || src->asTextureProxy()) { |
Brian Salomon | 467921e | 2017-03-06 16:17:12 -0500 | [diff] [blame] | 68 | desc->fFlags = kRenderTarget_GrSurfaceFlag; |
| 69 | } else { |
| 70 | // Just going to use CopyImage here |
| 71 | desc->fFlags = kNone_GrSurfaceFlags; |
| 72 | } |
| 73 | |
| 74 | return true; |
| 75 | } |
| 76 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 77 | void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface, |
egdaniel | c5ec140 | 2016-03-28 12:14:42 -0700 | [diff] [blame] | 78 | VkPhysicalDevice physDev, uint32_t featureFlags, uint32_t extensionFlags) { |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 79 | |
Jim Van Verth | 6a40abc | 2017-11-02 16:56:09 +0000 | [diff] [blame] | 80 | VkPhysicalDeviceProperties properties; |
| 81 | GR_VK_CALL(vkInterface, GetPhysicalDeviceProperties(physDev, &properties)); |
egdaniel | d5e3b9e | 2016-03-08 12:19:54 -0800 | [diff] [blame] | 82 | |
egdaniel | d5e3b9e | 2016-03-08 12:19:54 -0800 | [diff] [blame] | 83 | VkPhysicalDeviceMemoryProperties memoryProperties; |
| 84 | GR_VK_CALL(vkInterface, GetPhysicalDeviceMemoryProperties(physDev, &memoryProperties)); |
| 85 | |
jvanverth | fd7bd45 | 2016-03-25 06:29:52 -0700 | [diff] [blame] | 86 | this->initGrCaps(properties, memoryProperties, featureFlags); |
Brian Salomon | 1edc5b9 | 2016-11-29 13:43:46 -0500 | [diff] [blame] | 87 | this->initShaderCaps(properties, featureFlags); |
Greg Daniel | f3b1162 | 2018-03-01 15:01:27 -0500 | [diff] [blame] | 88 | |
| 89 | if (!contextOptions.fDisableDriverCorrectnessWorkarounds) { |
| 90 | #if defined(SK_CPU_X86) |
| 91 | // We need to do this before initing the config table since it uses fSRGBSupport |
| 92 | if (kImagination_VkVendor == properties.vendorID) { |
| 93 | fSRGBSupport = false; |
| 94 | } |
| 95 | #endif |
| 96 | } |
| 97 | |
Greg Daniel | 2bb6ecc | 2017-07-20 13:11:14 +0000 | [diff] [blame] | 98 | this->initConfigTable(vkInterface, physDev, properties); |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 99 | this->initStencilFormat(vkInterface, physDev); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 100 | |
Greg Daniel | 691f5e7 | 2018-02-28 14:21:34 -0500 | [diff] [blame] | 101 | if (!contextOptions.fDisableDriverCorrectnessWorkarounds) { |
| 102 | this->applyDriverCorrectnessWorkarounds(properties); |
egdaniel | c5ec140 | 2016-03-28 12:14:42 -0700 | [diff] [blame] | 103 | } |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 104 | |
Greg Daniel | 691f5e7 | 2018-02-28 14:21:34 -0500 | [diff] [blame] | 105 | this->applyOptionsOverrides(contextOptions); |
| 106 | fShaderCaps->applyOptionsOverrides(contextOptions); |
| 107 | } |
| 108 | |
| 109 | void GrVkCaps::applyDriverCorrectnessWorkarounds(const VkPhysicalDeviceProperties& properties) { |
egdaniel | 6fa0a91 | 2016-09-12 11:51:29 -0700 | [diff] [blame] | 110 | if (kQualcomm_VkVendor == properties.vendorID) { |
| 111 | fMustDoCopiesFromOrigin = true; |
| 112 | } |
| 113 | |
egdaniel | fd016d7 | 2016-09-27 12:13:05 -0700 | [diff] [blame] | 114 | if (kNvidia_VkVendor == properties.vendorID) { |
egdaniel | fd016d7 | 2016-09-27 12:13:05 -0700 | [diff] [blame] | 115 | fMustSubmitCommandsBeforeCopyOp = true; |
| 116 | } |
| 117 | |
Greg Daniel | 80a08dd | 2017-01-20 10:45:49 -0500 | [diff] [blame] | 118 | #if defined(SK_BUILD_FOR_WIN) |
| 119 | if (kNvidia_VkVendor == properties.vendorID) { |
| 120 | fMustSleepOnTearDown = true; |
| 121 | } |
| 122 | #elif defined(SK_BUILD_FOR_ANDROID) |
| 123 | if (kImagination_VkVendor == properties.vendorID) { |
| 124 | fMustSleepOnTearDown = true; |
| 125 | } |
| 126 | #endif |
Greg Daniel | bce5eb9 | 2018-03-01 13:13:44 -0500 | [diff] [blame] | 127 | |
| 128 | // AMD seems to have issues binding new VkPipelines inside a secondary command buffer. |
| 129 | // Current workaround is to use a different secondary command buffer for each new VkPipeline. |
| 130 | if (kAMD_VkVendor == properties.vendorID) { |
| 131 | fNewCBOnPipelineChange = true; |
| 132 | } |
| 133 | |
| 134 | //////////////////////////////////////////////////////////////////////////// |
| 135 | // GrCaps workarounds |
| 136 | //////////////////////////////////////////////////////////////////////////// |
| 137 | |
| 138 | if (kARM_VkVendor == properties.vendorID) { |
| 139 | fInstanceAttribSupport = false; |
| 140 | } |
| 141 | |
| 142 | // AMD advertises support for MAX_UINT vertex input attributes, but in reality only supports 32. |
| 143 | if (kAMD_VkVendor == properties.vendorID) { |
| 144 | fMaxVertexAttributes = SkTMin(fMaxVertexAttributes, 32); |
| 145 | } |
| 146 | |
Chris Dalton | df1681e | 2018-03-29 23:16:55 +0000 | [diff] [blame^] | 147 | if (kIntel_VkVendor == properties.vendorID) { |
| 148 | fCanUseWholeSizeOnFlushMappedMemory = false; |
Greg Daniel | bce5eb9 | 2018-03-01 13:13:44 -0500 | [diff] [blame] | 149 | } |
| 150 | |
Greg Daniel | bce5eb9 | 2018-03-01 13:13:44 -0500 | [diff] [blame] | 151 | //////////////////////////////////////////////////////////////////////////// |
| 152 | // GrShaderCaps workarounds |
| 153 | //////////////////////////////////////////////////////////////////////////// |
| 154 | |
Greg Daniel | bce5eb9 | 2018-03-01 13:13:44 -0500 | [diff] [blame] | 155 | if (kImagination_VkVendor == properties.vendorID) { |
| 156 | fShaderCaps->fAtan2ImplementedAsAtanYOverX = true; |
| 157 | } |
| 158 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | int get_max_sample_count(VkSampleCountFlags flags) { |
| 162 | SkASSERT(flags & VK_SAMPLE_COUNT_1_BIT); |
| 163 | if (!(flags & VK_SAMPLE_COUNT_2_BIT)) { |
| 164 | return 0; |
| 165 | } |
| 166 | if (!(flags & VK_SAMPLE_COUNT_4_BIT)) { |
| 167 | return 2; |
| 168 | } |
| 169 | if (!(flags & VK_SAMPLE_COUNT_8_BIT)) { |
| 170 | return 4; |
| 171 | } |
| 172 | if (!(flags & VK_SAMPLE_COUNT_16_BIT)) { |
| 173 | return 8; |
| 174 | } |
| 175 | if (!(flags & VK_SAMPLE_COUNT_32_BIT)) { |
| 176 | return 16; |
| 177 | } |
| 178 | if (!(flags & VK_SAMPLE_COUNT_64_BIT)) { |
| 179 | return 32; |
| 180 | } |
| 181 | return 64; |
| 182 | } |
| 183 | |
egdaniel | d5e3b9e | 2016-03-08 12:19:54 -0800 | [diff] [blame] | 184 | void GrVkCaps::initGrCaps(const VkPhysicalDeviceProperties& properties, |
jvanverth | fd7bd45 | 2016-03-25 06:29:52 -0700 | [diff] [blame] | 185 | const VkPhysicalDeviceMemoryProperties& memoryProperties, |
| 186 | uint32_t featureFlags) { |
Greg Daniel | c5cc2de | 2017-03-20 11:40:58 -0400 | [diff] [blame] | 187 | // So GPUs, like AMD, are reporting MAX_INT support vertex attributes. In general, there is no |
| 188 | // need for us ever to support that amount, and it makes tests which tests all the vertex |
| 189 | // attribs timeout looping over that many. For now, we'll cap this at 64 max and can raise it if |
| 190 | // we ever find that need. |
| 191 | static const uint32_t kMaxVertexAttributes = 64; |
| 192 | fMaxVertexAttributes = SkTMin(properties.limits.maxVertexInputAttributes, kMaxVertexAttributes); |
Greg Daniel | c5cc2de | 2017-03-20 11:40:58 -0400 | [diff] [blame] | 193 | |
egdaniel | d5e3b9e | 2016-03-08 12:19:54 -0800 | [diff] [blame] | 194 | // We could actually query and get a max size for each config, however maxImageDimension2D will |
| 195 | // give the minimum max size across all configs. So for simplicity we will use that for now. |
jvanverth | e78d487 | 2016-09-27 03:33:05 -0700 | [diff] [blame] | 196 | fMaxRenderTargetSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX); |
| 197 | fMaxTextureSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX); |
egdaniel | d5e3b9e | 2016-03-08 12:19:54 -0800 | [diff] [blame] | 198 | |
Chris Dalton | 2612bae | 2018-02-22 13:41:37 -0700 | [diff] [blame] | 199 | // TODO: check if RT's larger than 4k incur a performance cost on ARM. |
| 200 | fMaxPreferredRenderTargetSize = fMaxRenderTargetSize; |
| 201 | |
egdaniel | d5e3b9e | 2016-03-08 12:19:54 -0800 | [diff] [blame] | 202 | // Assuming since we will always map in the end to upload the data we might as well just map |
| 203 | // from the get go. There is no hard data to suggest this is faster or slower. |
cdalton | 397536c | 2016-03-25 12:15:03 -0700 | [diff] [blame] | 204 | fBufferMapThreshold = 0; |
egdaniel | d5e3b9e | 2016-03-08 12:19:54 -0800 | [diff] [blame] | 205 | |
| 206 | fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; |
| 207 | |
egdaniel | d5e3b9e | 2016-03-08 12:19:54 -0800 | [diff] [blame] | 208 | fOversizedStencilSupport = true; |
ethannicholas | 28ef445 | 2016-03-25 09:26:03 -0700 | [diff] [blame] | 209 | fSampleShadingSupport = SkToBool(featureFlags & kSampleRateShading_GrVkFeatureFlag); |
Greg Daniel | 22bc865 | 2017-03-22 15:45:43 -0400 | [diff] [blame] | 210 | |
Greg Daniel | 0190787 | 2017-05-23 15:21:02 -0400 | [diff] [blame] | 211 | |
egdaniel | d5e3b9e | 2016-03-08 12:19:54 -0800 | [diff] [blame] | 212 | } |
| 213 | |
Brian Salomon | 1edc5b9 | 2016-11-29 13:43:46 -0500 | [diff] [blame] | 214 | void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties, uint32_t featureFlags) { |
| 215 | GrShaderCaps* shaderCaps = fShaderCaps.get(); |
| 216 | shaderCaps->fVersionDeclString = "#version 330\n"; |
egdaniel | 3a15fd4 | 2016-04-05 11:00:29 -0700 | [diff] [blame] | 217 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 218 | |
| 219 | // fConfigOutputSwizzle will default to RGBA so we only need to set it for alpha only config. |
| 220 | for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
| 221 | GrPixelConfig config = static_cast<GrPixelConfig>(i); |
Greg Daniel | ef59d87 | 2017-11-17 16:47:21 -0500 | [diff] [blame] | 222 | // Vulkan doesn't support a single channel format stored in alpha. |
| 223 | if (GrPixelConfigIsAlphaOnly(config) && |
| 224 | kAlpha_8_as_Alpha_GrPixelConfig != config) { |
Brian Salomon | 1edc5b9 | 2016-11-29 13:43:46 -0500 | [diff] [blame] | 225 | shaderCaps->fConfigTextureSwizzle[i] = GrSwizzle::RRRR(); |
| 226 | shaderCaps->fConfigOutputSwizzle[i] = GrSwizzle::AAAA(); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 227 | } else { |
Greg Daniel | 7af060a | 2017-12-05 16:27:11 -0500 | [diff] [blame] | 228 | if (kGray_8_GrPixelConfig == config || |
| 229 | kGray_8_as_Red_GrPixelConfig == config) { |
Brian Osman | 986563b | 2017-01-10 14:20:02 -0500 | [diff] [blame] | 230 | shaderCaps->fConfigTextureSwizzle[i] = GrSwizzle::RRRA(); |
| 231 | } else if (kRGBA_4444_GrPixelConfig == config) { |
egdaniel | 3fe0327 | 2016-08-15 10:59:17 -0700 | [diff] [blame] | 232 | // The vulkan spec does not require R4G4B4A4 to be supported for texturing so we |
| 233 | // store the data in a B4G4R4A4 texture and then swizzle it when doing texture reads |
| 234 | // or writing to outputs. Since we're not actually changing the data at all, the |
| 235 | // only extra work is the swizzle in the shader for all operations. |
Brian Salomon | 1edc5b9 | 2016-11-29 13:43:46 -0500 | [diff] [blame] | 236 | shaderCaps->fConfigTextureSwizzle[i] = GrSwizzle::BGRA(); |
| 237 | shaderCaps->fConfigOutputSwizzle[i] = GrSwizzle::BGRA(); |
egdaniel | 3fe0327 | 2016-08-15 10:59:17 -0700 | [diff] [blame] | 238 | } else { |
Brian Salomon | 1edc5b9 | 2016-11-29 13:43:46 -0500 | [diff] [blame] | 239 | shaderCaps->fConfigTextureSwizzle[i] = GrSwizzle::RGBA(); |
egdaniel | 3fe0327 | 2016-08-15 10:59:17 -0700 | [diff] [blame] | 240 | } |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 241 | } |
| 242 | } |
egdaniel | 67acb83 | 2016-02-26 08:32:20 -0800 | [diff] [blame] | 243 | |
egdaniel | d5e3b9e | 2016-03-08 12:19:54 -0800 | [diff] [blame] | 244 | // Vulkan is based off ES 3.0 so the following should all be supported |
Brian Salomon | 1edc5b9 | 2016-11-29 13:43:46 -0500 | [diff] [blame] | 245 | shaderCaps->fUsesPrecisionModifiers = true; |
| 246 | shaderCaps->fFlatInterpolationSupport = true; |
Brian Salomon | 4127456 | 2017-09-15 09:40:03 -0700 | [diff] [blame] | 247 | // Flat interpolation appears to be slow on Qualcomm GPUs. This was tested in GL and is assumed |
| 248 | // to be true with Vulkan as well. |
| 249 | shaderCaps->fPreferFlatInterpolation = kQualcomm_VkVendor != properties.vendorID; |
egdaniel | d5e3b9e | 2016-03-08 12:19:54 -0800 | [diff] [blame] | 250 | |
| 251 | // GrShaderCaps |
| 252 | |
Brian Salomon | 1edc5b9 | 2016-11-29 13:43:46 -0500 | [diff] [blame] | 253 | shaderCaps->fShaderDerivativeSupport = true; |
Chris Dalton | f1b47bb | 2017-10-06 11:57:51 -0600 | [diff] [blame] | 254 | |
Brian Salomon | 1edc5b9 | 2016-11-29 13:43:46 -0500 | [diff] [blame] | 255 | shaderCaps->fGeometryShaderSupport = SkToBool(featureFlags & kGeometryShader_GrVkFeatureFlag); |
Chris Dalton | f1b47bb | 2017-10-06 11:57:51 -0600 | [diff] [blame] | 256 | shaderCaps->fGSInvocationsSupport = shaderCaps->fGeometryShaderSupport; |
egdaniel | d632bb4 | 2016-03-30 12:06:48 -0700 | [diff] [blame] | 257 | |
Brian Salomon | 1edc5b9 | 2016-11-29 13:43:46 -0500 | [diff] [blame] | 258 | shaderCaps->fDualSourceBlendingSupport = SkToBool(featureFlags & kDualSrcBlend_GrVkFeatureFlag); |
egdaniel | d632bb4 | 2016-03-30 12:06:48 -0700 | [diff] [blame] | 259 | |
Brian Salomon | 1edc5b9 | 2016-11-29 13:43:46 -0500 | [diff] [blame] | 260 | shaderCaps->fIntegerSupport = true; |
Chris Dalton | 6b65b98 | 2017-07-06 11:04:00 -0600 | [diff] [blame] | 261 | shaderCaps->fTexelBufferSupport = true; |
| 262 | shaderCaps->fTexelFetchSupport = true; |
Chris Dalton | 1d61635 | 2017-05-31 12:51:23 -0600 | [diff] [blame] | 263 | shaderCaps->fVertexIDSupport = true; |
cdalton | 9c3f143 | 2016-03-11 10:07:37 -0800 | [diff] [blame] | 264 | |
cdalton | a6b92ad | 2016-04-11 12:03:08 -0700 | [diff] [blame] | 265 | // Assume the minimum precisions mandated by the SPIR-V spec. |
Chris Dalton | 47c8ed3 | 2017-11-15 18:27:09 -0700 | [diff] [blame] | 266 | shaderCaps->fFloatIs32Bits = true; |
| 267 | shaderCaps->fHalfIs32Bits = false; |
cdalton | a6b92ad | 2016-04-11 12:03:08 -0700 | [diff] [blame] | 268 | |
Brian Salomon | 1edc5b9 | 2016-11-29 13:43:46 -0500 | [diff] [blame] | 269 | shaderCaps->fMaxVertexSamplers = |
| 270 | shaderCaps->fMaxGeometrySamplers = |
| 271 | shaderCaps->fMaxFragmentSamplers = SkTMin( |
| 272 | SkTMin(properties.limits.maxPerStageDescriptorSampledImages, |
| 273 | properties.limits.maxPerStageDescriptorSamplers), |
| 274 | (uint32_t)INT_MAX); |
| 275 | shaderCaps->fMaxCombinedSamplers = SkTMin( |
| 276 | SkTMin(properties.limits.maxDescriptorSetSampledImages, |
| 277 | properties.limits.maxDescriptorSetSamplers), |
| 278 | (uint32_t)INT_MAX); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 279 | } |
| 280 | |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 281 | bool stencil_format_supported(const GrVkInterface* interface, |
| 282 | VkPhysicalDevice physDev, |
| 283 | VkFormat format) { |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 284 | VkFormatProperties props; |
| 285 | memset(&props, 0, sizeof(VkFormatProperties)); |
| 286 | GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &props)); |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 287 | return SkToBool(VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT & props.optimalTilingFeatures); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 288 | } |
| 289 | |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 290 | void GrVkCaps::initStencilFormat(const GrVkInterface* interface, VkPhysicalDevice physDev) { |
| 291 | // List of legal stencil formats (though perhaps not supported on |
| 292 | // the particular gpu/driver) from most preferred to least. We are guaranteed to have either |
jvanverth | a4b0fed | 2016-04-27 11:42:21 -0700 | [diff] [blame] | 293 | // VK_FORMAT_D24_UNORM_S8_UINT or VK_FORMAT_D32_SFLOAT_S8_UINT. VK_FORMAT_D32_SFLOAT_S8_UINT |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 294 | // can optionally have 24 unused bits at the end so we assume the total bits is 64. |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 295 | static const StencilFormat |
| 296 | // internal Format stencil bits total bits packed? |
| 297 | gS8 = { VK_FORMAT_S8_UINT, 8, 8, false }, |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 298 | gD24S8 = { VK_FORMAT_D24_UNORM_S8_UINT, 8, 32, true }, |
| 299 | gD32S8 = { VK_FORMAT_D32_SFLOAT_S8_UINT, 8, 64, true }; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 300 | |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 301 | if (stencil_format_supported(interface, physDev, VK_FORMAT_S8_UINT)) { |
| 302 | fPreferedStencilFormat = gS8; |
| 303 | } else if (stencil_format_supported(interface, physDev, VK_FORMAT_D24_UNORM_S8_UINT)) { |
| 304 | fPreferedStencilFormat = gD24S8; |
| 305 | } else { |
| 306 | SkASSERT(stencil_format_supported(interface, physDev, VK_FORMAT_D32_SFLOAT_S8_UINT)); |
| 307 | fPreferedStencilFormat = gD32S8; |
| 308 | } |
| 309 | } |
| 310 | |
Greg Daniel | 2bb6ecc | 2017-07-20 13:11:14 +0000 | [diff] [blame] | 311 | void GrVkCaps::initConfigTable(const GrVkInterface* interface, VkPhysicalDevice physDev, |
| 312 | const VkPhysicalDeviceProperties& properties) { |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 313 | for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
| 314 | VkFormat format; |
| 315 | if (GrPixelConfigToVkFormat(static_cast<GrPixelConfig>(i), &format)) { |
Greg Daniel | 0190787 | 2017-05-23 15:21:02 -0400 | [diff] [blame] | 316 | if (!GrPixelConfigIsSRGB(static_cast<GrPixelConfig>(i)) || fSRGBSupport) { |
Greg Daniel | 2bb6ecc | 2017-07-20 13:11:14 +0000 | [diff] [blame] | 317 | fConfigTable[i].init(interface, physDev, properties, format); |
Greg Daniel | 0190787 | 2017-05-23 15:21:02 -0400 | [diff] [blame] | 318 | } |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | void GrVkCaps::ConfigInfo::InitConfigFlags(VkFormatFeatureFlags vkFlags, uint16_t* flags) { |
| 324 | if (SkToBool(VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT & vkFlags) && |
| 325 | SkToBool(VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT & vkFlags)) { |
| 326 | *flags = *flags | kTextureable_Flag; |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 327 | |
Robert Phillips | b7b7e5f | 2017-05-22 13:23:19 -0400 | [diff] [blame] | 328 | // Ganesh assumes that all renderable surfaces are also texturable |
| 329 | if (SkToBool(VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT & vkFlags)) { |
| 330 | *flags = *flags | kRenderable_Flag; |
| 331 | } |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | if (SkToBool(VK_FORMAT_FEATURE_BLIT_SRC_BIT & vkFlags)) { |
| 335 | *flags = *flags | kBlitSrc_Flag; |
| 336 | } |
| 337 | |
| 338 | if (SkToBool(VK_FORMAT_FEATURE_BLIT_DST_BIT & vkFlags)) { |
| 339 | *flags = *flags | kBlitDst_Flag; |
| 340 | } |
| 341 | } |
| 342 | |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 343 | void GrVkCaps::ConfigInfo::initSampleCounts(const GrVkInterface* interface, |
| 344 | VkPhysicalDevice physDev, |
Greg Daniel | 2bb6ecc | 2017-07-20 13:11:14 +0000 | [diff] [blame] | 345 | const VkPhysicalDeviceProperties& physProps, |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 346 | VkFormat format) { |
| 347 | VkImageUsageFlags usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | |
| 348 | VK_IMAGE_USAGE_TRANSFER_DST_BIT | |
| 349 | VK_IMAGE_USAGE_SAMPLED_BIT | |
| 350 | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; |
| 351 | VkImageCreateFlags createFlags = GrVkFormatIsSRGB(format, nullptr) |
| 352 | ? VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT : 0; |
| 353 | VkImageFormatProperties properties; |
| 354 | GR_VK_CALL(interface, GetPhysicalDeviceImageFormatProperties(physDev, |
| 355 | format, |
| 356 | VK_IMAGE_TYPE_2D, |
| 357 | VK_IMAGE_TILING_OPTIMAL, |
| 358 | usage, |
| 359 | createFlags, |
| 360 | &properties)); |
| 361 | VkSampleCountFlags flags = properties.sampleCounts; |
| 362 | if (flags & VK_SAMPLE_COUNT_1_BIT) { |
Brian Salomon | bdecacf | 2018-02-02 20:32:49 -0500 | [diff] [blame] | 363 | fColorSampleCounts.push(1); |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 364 | } |
Greg Daniel | 2bb6ecc | 2017-07-20 13:11:14 +0000 | [diff] [blame] | 365 | if (kImagination_VkVendor == physProps.vendorID) { |
| 366 | // MSAA does not work on imagination |
| 367 | return; |
| 368 | } |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 369 | if (flags & VK_SAMPLE_COUNT_2_BIT) { |
| 370 | fColorSampleCounts.push(2); |
| 371 | } |
| 372 | if (flags & VK_SAMPLE_COUNT_4_BIT) { |
| 373 | fColorSampleCounts.push(4); |
| 374 | } |
| 375 | if (flags & VK_SAMPLE_COUNT_8_BIT) { |
| 376 | fColorSampleCounts.push(8); |
| 377 | } |
| 378 | if (flags & VK_SAMPLE_COUNT_16_BIT) { |
| 379 | fColorSampleCounts.push(16); |
| 380 | } |
| 381 | if (flags & VK_SAMPLE_COUNT_32_BIT) { |
| 382 | fColorSampleCounts.push(32); |
| 383 | } |
| 384 | if (flags & VK_SAMPLE_COUNT_64_BIT) { |
| 385 | fColorSampleCounts.push(64); |
| 386 | } |
| 387 | } |
| 388 | |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 389 | void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, |
| 390 | VkPhysicalDevice physDev, |
Greg Daniel | 2bb6ecc | 2017-07-20 13:11:14 +0000 | [diff] [blame] | 391 | const VkPhysicalDeviceProperties& properties, |
egdaniel | 8f1dcaa | 2016-04-01 10:10:45 -0700 | [diff] [blame] | 392 | VkFormat format) { |
| 393 | VkFormatProperties props; |
| 394 | memset(&props, 0, sizeof(VkFormatProperties)); |
| 395 | GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &props)); |
| 396 | InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); |
| 397 | InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 398 | if (fOptimalFlags & kRenderable_Flag) { |
Greg Daniel | 2bb6ecc | 2017-07-20 13:11:14 +0000 | [diff] [blame] | 399 | this->initSampleCounts(interface, physDev, properties, format); |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 400 | } |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 401 | } |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 402 | |
Brian Salomon | bdecacf | 2018-02-02 20:32:49 -0500 | [diff] [blame] | 403 | int GrVkCaps::getRenderTargetSampleCount(int requestedCount, GrPixelConfig config) const { |
| 404 | requestedCount = SkTMax(1, requestedCount); |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 405 | int count = fConfigTable[config].fColorSampleCounts.count(); |
Brian Salomon | bdecacf | 2018-02-02 20:32:49 -0500 | [diff] [blame] | 406 | |
| 407 | if (!count) { |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 408 | return 0; |
| 409 | } |
| 410 | |
Brian Salomon | bdecacf | 2018-02-02 20:32:49 -0500 | [diff] [blame] | 411 | if (1 == requestedCount) { |
| 412 | SkASSERT(fConfigTable[config].fColorSampleCounts.count() && |
| 413 | fConfigTable[config].fColorSampleCounts[0] == 1); |
| 414 | return 1; |
| 415 | } |
| 416 | |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 417 | for (int i = 0; i < count; ++i) { |
| 418 | if (fConfigTable[config].fColorSampleCounts[i] >= requestedCount) { |
| 419 | return fConfigTable[config].fColorSampleCounts[i]; |
| 420 | } |
| 421 | } |
Brian Salomon | bdecacf | 2018-02-02 20:32:49 -0500 | [diff] [blame] | 422 | return 0; |
| 423 | } |
| 424 | |
| 425 | int GrVkCaps::maxRenderTargetSampleCount(GrPixelConfig config) const { |
| 426 | const auto& table = fConfigTable[config].fColorSampleCounts; |
| 427 | if (!table.count()) { |
| 428 | return 0; |
| 429 | } |
| 430 | return table[table.count() - 1]; |
Brian Salomon | d653cac | 2018-02-01 13:58:00 -0500 | [diff] [blame] | 431 | } |
| 432 | |
Brian Salomon | 3d86a19 | 2018-02-27 16:46:11 -0500 | [diff] [blame] | 433 | bool GrVkCaps::surfaceSupportsWritePixels(const GrSurface* surface) const { |
| 434 | if (auto rt = surface->asRenderTarget()) { |
| 435 | return rt->numColorSamples() <= 1 && SkToBool(surface->asTexture()); |
| 436 | } |
| 437 | return true; |
| 438 | } |
| 439 | |
Robert Phillips | fc711a2 | 2018-02-13 17:03:00 -0500 | [diff] [blame] | 440 | bool validate_image_info(VkFormat format, SkColorType ct, GrPixelConfig* config) { |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 441 | *config = kUnknown_GrPixelConfig; |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 442 | |
| 443 | switch (ct) { |
| 444 | case kUnknown_SkColorType: |
| 445 | return false; |
| 446 | case kAlpha_8_SkColorType: |
| 447 | if (VK_FORMAT_R8_UNORM == format) { |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 448 | *config = kAlpha_8_as_Red_GrPixelConfig; |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 449 | } |
| 450 | break; |
| 451 | case kRGB_565_SkColorType: |
| 452 | if (VK_FORMAT_R5G6B5_UNORM_PACK16 == format) { |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 453 | *config = kRGB_565_GrPixelConfig; |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 454 | } |
| 455 | break; |
| 456 | case kARGB_4444_SkColorType: |
| 457 | if (VK_FORMAT_B4G4R4A4_UNORM_PACK16 == format) { |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 458 | *config = kRGBA_4444_GrPixelConfig; |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 459 | } |
| 460 | break; |
| 461 | case kRGBA_8888_SkColorType: |
| 462 | if (VK_FORMAT_R8G8B8A8_UNORM == format) { |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 463 | *config = kRGBA_8888_GrPixelConfig; |
Greg Daniel | 7b219ac | 2017-12-18 14:49:04 -0500 | [diff] [blame] | 464 | } else if (VK_FORMAT_R8G8B8A8_SRGB == format) { |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 465 | *config = kSRGBA_8888_GrPixelConfig; |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 466 | } |
| 467 | break; |
Brian Salomon | e41e176 | 2018-01-25 14:07:47 -0500 | [diff] [blame] | 468 | case kRGB_888x_SkColorType: |
Brian Salomon | 5fba7ad | 2018-03-22 10:01:16 -0400 | [diff] [blame] | 469 | // TODO: VK_FORMAT_R8G8B8_UNORM |
Brian Salomon | e41e176 | 2018-01-25 14:07:47 -0500 | [diff] [blame] | 470 | return false; |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 471 | case kBGRA_8888_SkColorType: |
| 472 | if (VK_FORMAT_B8G8R8A8_UNORM == format) { |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 473 | *config = kBGRA_8888_GrPixelConfig; |
Greg Daniel | 7b219ac | 2017-12-18 14:49:04 -0500 | [diff] [blame] | 474 | } else if (VK_FORMAT_B8G8R8A8_SRGB == format) { |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 475 | *config = kSBGRA_8888_GrPixelConfig; |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 476 | } |
| 477 | break; |
Brian Salomon | e41e176 | 2018-01-25 14:07:47 -0500 | [diff] [blame] | 478 | case kRGBA_1010102_SkColorType: |
Brian Osman | 10fc6fd | 2018-03-02 11:01:10 -0500 | [diff] [blame] | 479 | if (VK_FORMAT_A2B10G10R10_UNORM_PACK32 == format) { |
| 480 | *config = kRGBA_1010102_GrPixelConfig; |
| 481 | } |
| 482 | break; |
Brian Salomon | e41e176 | 2018-01-25 14:07:47 -0500 | [diff] [blame] | 483 | case kRGB_101010x_SkColorType: |
| 484 | return false; |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 485 | case kGray_8_SkColorType: |
| 486 | if (VK_FORMAT_R8_UNORM == format) { |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 487 | *config = kGray_8_as_Red_GrPixelConfig; |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 488 | } |
| 489 | break; |
| 490 | case kRGBA_F16_SkColorType: |
| 491 | if (VK_FORMAT_R16G16B16A16_SFLOAT == format) { |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 492 | *config = kRGBA_half_GrPixelConfig; |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 493 | } |
| 494 | break; |
| 495 | } |
| 496 | |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 497 | return kUnknown_GrPixelConfig != *config; |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 498 | } |
| 499 | |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 500 | bool GrVkCaps::validateBackendTexture(const GrBackendTexture& tex, SkColorType ct, |
| 501 | GrPixelConfig* config) const { |
Robert Phillips | fc711a2 | 2018-02-13 17:03:00 -0500 | [diff] [blame] | 502 | const GrVkImageInfo* imageInfo = tex.getVkImageInfo(); |
| 503 | if (!imageInfo) { |
| 504 | return false; |
| 505 | } |
| 506 | |
| 507 | return validate_image_info(imageInfo->fFormat, ct, config); |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 508 | } |
| 509 | |
| 510 | bool GrVkCaps::validateBackendRenderTarget(const GrBackendRenderTarget& rt, SkColorType ct, |
| 511 | GrPixelConfig* config) const { |
Robert Phillips | fc711a2 | 2018-02-13 17:03:00 -0500 | [diff] [blame] | 512 | const GrVkImageInfo* imageInfo = rt.getVkImageInfo(); |
| 513 | if (!imageInfo) { |
| 514 | return false; |
| 515 | } |
| 516 | |
| 517 | return validate_image_info(imageInfo->fFormat, ct, config); |
| 518 | } |
| 519 | |
| 520 | bool GrVkCaps::getConfigFromBackendFormat(const GrBackendFormat& format, SkColorType ct, |
| 521 | GrPixelConfig* config) const { |
| 522 | const VkFormat* vkFormat = format.getVkFormat(); |
| 523 | if (!vkFormat) { |
| 524 | return false; |
| 525 | } |
| 526 | return validate_image_info(*vkFormat, ct, config); |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 527 | } |
Greg Daniel | f5d8758 | 2017-12-18 14:48:15 -0500 | [diff] [blame] | 528 | |