blob: 16b46096e462509926b76adf8a77a3bfc4f60d26 [file] [log] [blame]
Greg Daniel164a9f02016-02-22 09:56:40 -05001/*
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"
Robert Phillipsbf25d432017-04-07 10:08:53 -04009#include "GrRenderTargetProxy.h"
Brian Salomon94efbf52016-11-29 13:43:05 -050010#include "GrShaderCaps.h"
Greg Daniel164a9f02016-02-22 09:56:40 -050011#include "GrVkUtil.h"
jvanverthfd7bd452016-03-25 06:29:52 -070012#include "vk/GrVkBackendContext.h"
Brian Salomon467921e2017-03-06 16:17:12 -050013#include "vk/GrVkInterface.h"
Greg Daniel164a9f02016-02-22 09:56:40 -050014
15GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,
egdanielc5ec1402016-03-28 12:14:42 -070016 VkPhysicalDevice physDev, uint32_t featureFlags, uint32_t extensionFlags)
17 : INHERITED(contextOptions) {
18 fCanUseGLSLForShaderModule = false;
egdaniel6fa0a912016-09-12 11:51:29 -070019 fMustDoCopiesFromOrigin = false;
egdanielbc9b2962016-09-27 08:00:53 -070020 fSupportsCopiesAsDraws = false;
egdanielfd016d72016-09-27 12:13:05 -070021 fMustSubmitCommandsBeforeCopyOp = false;
Greg Daniel80a08dd2017-01-20 10:45:49 -050022 fMustSleepOnTearDown = false;
Greg Daniele3cd6912017-05-17 11:15:55 -040023 fNewCBOnPipelineChange = false;
egdanielc5ec1402016-03-28 12:14:42 -070024
Greg Daniel164a9f02016-02-22 09:56:40 -050025 /**************************************************************************
26 * GrDrawTargetCaps fields
27 **************************************************************************/
jvanverth62340062016-04-26 08:01:44 -070028 fMipMapSupport = true; // always available in Vulkan
brianosmanf05ab1b2016-05-12 11:01:10 -070029 fSRGBSupport = true; // always available in Vulkan
brianosman88791862016-05-23 10:15:27 -070030 fNPOTTextureTileSupport = true; // always available in Vulkan
egdaniel37535c92016-06-30 08:23:30 -070031 fDiscardRenderTargetSupport = true;
Greg Daniel164a9f02016-02-22 09:56:40 -050032 fReuseScratchTextures = true; //TODO: figure this out
33 fGpuTracingSupport = false; //TODO: figure this out
Greg Daniel164a9f02016-02-22 09:56:40 -050034 fOversizedStencilSupport = false; //TODO: figure this out
35
egdaniel9cb63402016-06-23 08:37:05 -070036 fUseDrawInsteadOfClear = false;
jvanverth84741b32016-09-30 08:39:02 -070037 fFenceSyncSupport = true; // always available in Vulkan
Greg Daniela63e7ab2017-05-16 14:38:54 -040038 fCrossContextTextureSupport = false;
Greg Daniel164a9f02016-02-22 09:56:40 -050039
40 fMapBufferFlags = kNone_MapFlags; //TODO: figure this out
cdalton397536c2016-03-25 12:15:03 -070041 fBufferMapThreshold = SK_MaxS32; //TODO: figure this out
Greg Daniel164a9f02016-02-22 09:56:40 -050042
43 fMaxRenderTargetSize = 4096; // minimum required by spec
44 fMaxTextureSize = 4096; // minimum required by spec
45 fMaxColorSampleCount = 4; // minimum required by spec
46 fMaxStencilSampleCount = 4; // minimum required by spec
47
Brian Salomon94efbf52016-11-29 13:43:05 -050048 fShaderCaps.reset(new GrShaderCaps(contextOptions));
Greg Daniel164a9f02016-02-22 09:56:40 -050049
egdanielc5ec1402016-03-28 12:14:42 -070050 this->init(contextOptions, vkInterface, physDev, featureFlags, extensionFlags);
Greg Daniel164a9f02016-02-22 09:56:40 -050051}
52
Robert Phillipsbf25d432017-04-07 10:08:53 -040053bool GrVkCaps::initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
Eric Karl74480882017-04-03 14:49:05 -070054 bool* rectsMustMatch, bool* disallowSubrect) const {
55 // Vk doesn't use rectsMustMatch or disallowSubrect. Always return false.
56 *rectsMustMatch = false;
57 *disallowSubrect = false;
58
Brian Salomon467921e2017-03-06 16:17:12 -050059 // We can always succeed here with either a CopyImage (none msaa src) or ResolveImage (msaa).
60 // For CopyImage we can make a simple texture, for ResolveImage we require the dst to be a
61 // render target as well.
62 desc->fOrigin = src->origin();
63 desc->fConfig = src->config();
Robert Phillipsbf25d432017-04-07 10:08:53 -040064 if (src->numColorSamples() > 1 || (src->asTextureProxy() && this->supportsCopiesAsDraws())) {
Brian Salomon467921e2017-03-06 16:17:12 -050065 desc->fFlags = kRenderTarget_GrSurfaceFlag;
66 } else {
67 // Just going to use CopyImage here
68 desc->fFlags = kNone_GrSurfaceFlags;
69 }
70
71 return true;
72}
73
Greg Daniel164a9f02016-02-22 09:56:40 -050074void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,
egdanielc5ec1402016-03-28 12:14:42 -070075 VkPhysicalDevice physDev, uint32_t featureFlags, uint32_t extensionFlags) {
Greg Daniel164a9f02016-02-22 09:56:40 -050076
egdanield5e3b9e2016-03-08 12:19:54 -080077 VkPhysicalDeviceProperties properties;
78 GR_VK_CALL(vkInterface, GetPhysicalDeviceProperties(physDev, &properties));
79
egdanield5e3b9e2016-03-08 12:19:54 -080080 VkPhysicalDeviceMemoryProperties memoryProperties;
81 GR_VK_CALL(vkInterface, GetPhysicalDeviceMemoryProperties(physDev, &memoryProperties));
82
jvanverthfd7bd452016-03-25 06:29:52 -070083 this->initGrCaps(properties, memoryProperties, featureFlags);
Brian Salomon1edc5b92016-11-29 13:43:46 -050084 this->initShaderCaps(properties, featureFlags);
egdaniel8f1dcaa2016-04-01 10:10:45 -070085 this->initConfigTable(vkInterface, physDev);
86 this->initStencilFormat(vkInterface, physDev);
Greg Daniel164a9f02016-02-22 09:56:40 -050087
egdanielc5ec1402016-03-28 12:14:42 -070088 if (SkToBool(extensionFlags & kNV_glsl_shader_GrVkExtensionFlag)) {
egdanield632bb42016-03-30 12:06:48 -070089 // Currently disabling this feature since it does not play well with validation layers which
90 // expect a SPIR-V shader
91 // fCanUseGLSLForShaderModule = true;
egdanielc5ec1402016-03-28 12:14:42 -070092 }
Greg Daniel164a9f02016-02-22 09:56:40 -050093
egdaniel6fa0a912016-09-12 11:51:29 -070094 if (kQualcomm_VkVendor == properties.vendorID) {
95 fMustDoCopiesFromOrigin = true;
96 }
97
egdanielfd016d72016-09-27 12:13:05 -070098 if (kNvidia_VkVendor == properties.vendorID) {
egdanielfd016d72016-09-27 12:13:05 -070099 fMustSubmitCommandsBeforeCopyOp = true;
100 }
101
Greg Daniel1cdbdda2017-05-16 14:52:57 -0400102 if (kQualcomm_VkVendor != properties.vendorID) {
103 fSupportsCopiesAsDraws = true;
104 }
105
Greg Daniela63e7ab2017-05-16 14:38:54 -0400106 if (fSupportsCopiesAsDraws) {
107 fCrossContextTextureSupport = true;
108 }
109
Greg Daniel80a08dd2017-01-20 10:45:49 -0500110#if defined(SK_BUILD_FOR_WIN)
111 if (kNvidia_VkVendor == properties.vendorID) {
112 fMustSleepOnTearDown = true;
113 }
114#elif defined(SK_BUILD_FOR_ANDROID)
115 if (kImagination_VkVendor == properties.vendorID) {
116 fMustSleepOnTearDown = true;
117 }
118#endif
119
Greg Daniel164a9f02016-02-22 09:56:40 -0500120 this->applyOptionsOverrides(contextOptions);
Brian Salomon1edc5b92016-11-29 13:43:46 -0500121 fShaderCaps->applyOptionsOverrides(contextOptions);
Greg Daniel164a9f02016-02-22 09:56:40 -0500122}
123
124int get_max_sample_count(VkSampleCountFlags flags) {
125 SkASSERT(flags & VK_SAMPLE_COUNT_1_BIT);
126 if (!(flags & VK_SAMPLE_COUNT_2_BIT)) {
127 return 0;
128 }
129 if (!(flags & VK_SAMPLE_COUNT_4_BIT)) {
130 return 2;
131 }
132 if (!(flags & VK_SAMPLE_COUNT_8_BIT)) {
133 return 4;
134 }
135 if (!(flags & VK_SAMPLE_COUNT_16_BIT)) {
136 return 8;
137 }
138 if (!(flags & VK_SAMPLE_COUNT_32_BIT)) {
139 return 16;
140 }
141 if (!(flags & VK_SAMPLE_COUNT_64_BIT)) {
142 return 32;
143 }
144 return 64;
145}
146
147void GrVkCaps::initSampleCount(const VkPhysicalDeviceProperties& properties) {
148 VkSampleCountFlags colorSamples = properties.limits.framebufferColorSampleCounts;
149 VkSampleCountFlags stencilSamples = properties.limits.framebufferStencilSampleCounts;
150
151 fMaxColorSampleCount = get_max_sample_count(colorSamples);
Greg Daniel1e9ddcc2017-04-19 13:01:22 -0400152 if (kImagination_VkVendor == properties.vendorID) {
153 fMaxColorSampleCount = 0;
154 }
Greg Daniel164a9f02016-02-22 09:56:40 -0500155 fMaxStencilSampleCount = get_max_sample_count(stencilSamples);
156}
157
egdanield5e3b9e2016-03-08 12:19:54 -0800158void GrVkCaps::initGrCaps(const VkPhysicalDeviceProperties& properties,
jvanverthfd7bd452016-03-25 06:29:52 -0700159 const VkPhysicalDeviceMemoryProperties& memoryProperties,
160 uint32_t featureFlags) {
Greg Danielc5cc2de2017-03-20 11:40:58 -0400161 // So GPUs, like AMD, are reporting MAX_INT support vertex attributes. In general, there is no
162 // need for us ever to support that amount, and it makes tests which tests all the vertex
163 // attribs timeout looping over that many. For now, we'll cap this at 64 max and can raise it if
164 // we ever find that need.
165 static const uint32_t kMaxVertexAttributes = 64;
166 fMaxVertexAttributes = SkTMin(properties.limits.maxVertexInputAttributes, kMaxVertexAttributes);
167 // AMD advertises support for MAX_UINT vertex input attributes, but in reality only supports 32.
168 if (kAMD_VkVendor == properties.vendorID) {
169 fMaxVertexAttributes = SkTMin(fMaxVertexAttributes, 32);
170 }
171
egdanield5e3b9e2016-03-08 12:19:54 -0800172 // We could actually query and get a max size for each config, however maxImageDimension2D will
173 // give the minimum max size across all configs. So for simplicity we will use that for now.
jvanverthe78d4872016-09-27 03:33:05 -0700174 fMaxRenderTargetSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
175 fMaxTextureSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
egdanield5e3b9e2016-03-08 12:19:54 -0800176
177 this->initSampleCount(properties);
178
egdanield5e3b9e2016-03-08 12:19:54 -0800179 // Assuming since we will always map in the end to upload the data we might as well just map
180 // from the get go. There is no hard data to suggest this is faster or slower.
cdalton397536c2016-03-25 12:15:03 -0700181 fBufferMapThreshold = 0;
egdanield5e3b9e2016-03-08 12:19:54 -0800182
183 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag;
184
egdanield5e3b9e2016-03-08 12:19:54 -0800185 fOversizedStencilSupport = true;
ethannicholas28ef4452016-03-25 09:26:03 -0700186 fSampleShadingSupport = SkToBool(featureFlags & kSampleRateShading_GrVkFeatureFlag);
Greg Daniel22bc8652017-03-22 15:45:43 -0400187
188 // AMD seems to have issues binding new VkPipelines inside a secondary command buffer.
189 // Current workaround is to use a different secondary command buffer for each new VkPipeline.
190 if (kAMD_VkVendor == properties.vendorID) {
Greg Daniele3cd6912017-05-17 11:15:55 -0400191 fNewCBOnPipelineChange = true;
Greg Daniel22bc8652017-03-22 15:45:43 -0400192 }
Greg Daniel01907872017-05-23 15:21:02 -0400193
194#if defined(SK_CPU_X86)
195 if (kImagination_VkVendor == properties.vendorID) {
196 fSRGBSupport = false;
197 }
198#endif
egdanield5e3b9e2016-03-08 12:19:54 -0800199}
200
Brian Salomon1edc5b92016-11-29 13:43:46 -0500201void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties, uint32_t featureFlags) {
202 GrShaderCaps* shaderCaps = fShaderCaps.get();
203 shaderCaps->fVersionDeclString = "#version 330\n";
egdaniel3a15fd42016-04-05 11:00:29 -0700204
Greg Daniel164a9f02016-02-22 09:56:40 -0500205
206 // fConfigOutputSwizzle will default to RGBA so we only need to set it for alpha only config.
207 for (int i = 0; i < kGrPixelConfigCnt; ++i) {
208 GrPixelConfig config = static_cast<GrPixelConfig>(i);
209 if (GrPixelConfigIsAlphaOnly(config)) {
Brian Salomon1edc5b92016-11-29 13:43:46 -0500210 shaderCaps->fConfigTextureSwizzle[i] = GrSwizzle::RRRR();
211 shaderCaps->fConfigOutputSwizzle[i] = GrSwizzle::AAAA();
Greg Daniel164a9f02016-02-22 09:56:40 -0500212 } else {
Brian Osman986563b2017-01-10 14:20:02 -0500213 if (kGray_8_GrPixelConfig == config) {
214 shaderCaps->fConfigTextureSwizzle[i] = GrSwizzle::RRRA();
215 } else if (kRGBA_4444_GrPixelConfig == config) {
egdaniel3fe03272016-08-15 10:59:17 -0700216 // The vulkan spec does not require R4G4B4A4 to be supported for texturing so we
217 // store the data in a B4G4R4A4 texture and then swizzle it when doing texture reads
218 // or writing to outputs. Since we're not actually changing the data at all, the
219 // only extra work is the swizzle in the shader for all operations.
Brian Salomon1edc5b92016-11-29 13:43:46 -0500220 shaderCaps->fConfigTextureSwizzle[i] = GrSwizzle::BGRA();
221 shaderCaps->fConfigOutputSwizzle[i] = GrSwizzle::BGRA();
egdaniel3fe03272016-08-15 10:59:17 -0700222 } else {
Brian Salomon1edc5b92016-11-29 13:43:46 -0500223 shaderCaps->fConfigTextureSwizzle[i] = GrSwizzle::RGBA();
egdaniel3fe03272016-08-15 10:59:17 -0700224 }
Greg Daniel164a9f02016-02-22 09:56:40 -0500225 }
226 }
egdaniel67acb832016-02-26 08:32:20 -0800227
Greg Daniel80a08dd2017-01-20 10:45:49 -0500228 if (kImagination_VkVendor == properties.vendorID) {
229 shaderCaps->fAtan2ImplementedAsAtanYOverX = true;
230 }
231
egdanield5e3b9e2016-03-08 12:19:54 -0800232 // Vulkan is based off ES 3.0 so the following should all be supported
Brian Salomon1edc5b92016-11-29 13:43:46 -0500233 shaderCaps->fUsesPrecisionModifiers = true;
234 shaderCaps->fFlatInterpolationSupport = true;
egdanield5e3b9e2016-03-08 12:19:54 -0800235
236 // GrShaderCaps
237
Brian Salomon1edc5b92016-11-29 13:43:46 -0500238 shaderCaps->fShaderDerivativeSupport = true;
239 shaderCaps->fGeometryShaderSupport = SkToBool(featureFlags & kGeometryShader_GrVkFeatureFlag);
egdanield632bb42016-03-30 12:06:48 -0700240
Brian Salomon1edc5b92016-11-29 13:43:46 -0500241 shaderCaps->fDualSourceBlendingSupport = SkToBool(featureFlags & kDualSrcBlend_GrVkFeatureFlag);
Greg Daniel84cff132017-03-22 16:25:53 -0400242 if (kAMD_VkVendor == properties.vendorID) {
243 // Currently DualSourceBlending is not working on AMD. vkCreateGraphicsPipeline fails when
244 // using a draw with dual source. Looking into whether it is driver bug or issue with our
245 // SPIR-V. Bug skia:6405
246 shaderCaps->fDualSourceBlendingSupport = false;
247 }
egdanield632bb42016-03-30 12:06:48 -0700248
Brian Salomon1edc5b92016-11-29 13:43:46 -0500249 shaderCaps->fIntegerSupport = true;
cdalton9c3f1432016-03-11 10:07:37 -0800250
cdaltona6b92ad2016-04-11 12:03:08 -0700251 // Assume the minimum precisions mandated by the SPIR-V spec.
Brian Salomon1edc5b92016-11-29 13:43:46 -0500252 shaderCaps->fShaderPrecisionVaries = true;
cdaltona6b92ad2016-04-11 12:03:08 -0700253 for (int s = 0; s < kGrShaderTypeCount; ++s) {
Brian Salomon1edc5b92016-11-29 13:43:46 -0500254 auto& highp = shaderCaps->fFloatPrecisions[s][kHigh_GrSLPrecision];
cdaltona6b92ad2016-04-11 12:03:08 -0700255 highp.fLogRangeLow = highp.fLogRangeHigh = 127;
256 highp.fBits = 23;
257
Brian Salomon1edc5b92016-11-29 13:43:46 -0500258 auto& mediump = shaderCaps->fFloatPrecisions[s][kMedium_GrSLPrecision];
cdaltona6b92ad2016-04-11 12:03:08 -0700259 mediump.fLogRangeLow = mediump.fLogRangeHigh = 14;
260 mediump.fBits = 10;
261
Brian Salomon1edc5b92016-11-29 13:43:46 -0500262 shaderCaps->fFloatPrecisions[s][kLow_GrSLPrecision] = mediump;
cdaltona6b92ad2016-04-11 12:03:08 -0700263 }
Brian Salomon1edc5b92016-11-29 13:43:46 -0500264 shaderCaps->initSamplerPrecisionTable();
cdaltona6b92ad2016-04-11 12:03:08 -0700265
Brian Salomon1edc5b92016-11-29 13:43:46 -0500266 shaderCaps->fMaxVertexSamplers =
267 shaderCaps->fMaxGeometrySamplers =
268 shaderCaps->fMaxFragmentSamplers = SkTMin(
269 SkTMin(properties.limits.maxPerStageDescriptorSampledImages,
270 properties.limits.maxPerStageDescriptorSamplers),
271 (uint32_t)INT_MAX);
272 shaderCaps->fMaxCombinedSamplers = SkTMin(
273 SkTMin(properties.limits.maxDescriptorSetSampledImages,
274 properties.limits.maxDescriptorSetSamplers),
275 (uint32_t)INT_MAX);
Greg Daniel164a9f02016-02-22 09:56:40 -0500276}
277
egdaniel8f1dcaa2016-04-01 10:10:45 -0700278bool stencil_format_supported(const GrVkInterface* interface,
279 VkPhysicalDevice physDev,
280 VkFormat format) {
Greg Daniel164a9f02016-02-22 09:56:40 -0500281 VkFormatProperties props;
282 memset(&props, 0, sizeof(VkFormatProperties));
283 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &props));
egdaniel8f1dcaa2016-04-01 10:10:45 -0700284 return SkToBool(VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT & props.optimalTilingFeatures);
Greg Daniel164a9f02016-02-22 09:56:40 -0500285}
286
egdaniel8f1dcaa2016-04-01 10:10:45 -0700287void GrVkCaps::initStencilFormat(const GrVkInterface* interface, VkPhysicalDevice physDev) {
288 // List of legal stencil formats (though perhaps not supported on
289 // the particular gpu/driver) from most preferred to least. We are guaranteed to have either
jvanvertha4b0fed2016-04-27 11:42:21 -0700290 // VK_FORMAT_D24_UNORM_S8_UINT or VK_FORMAT_D32_SFLOAT_S8_UINT. VK_FORMAT_D32_SFLOAT_S8_UINT
egdaniel8f1dcaa2016-04-01 10:10:45 -0700291 // can optionally have 24 unused bits at the end so we assume the total bits is 64.
Greg Daniel164a9f02016-02-22 09:56:40 -0500292 static const StencilFormat
293 // internal Format stencil bits total bits packed?
294 gS8 = { VK_FORMAT_S8_UINT, 8, 8, false },
egdaniel8f1dcaa2016-04-01 10:10:45 -0700295 gD24S8 = { VK_FORMAT_D24_UNORM_S8_UINT, 8, 32, true },
296 gD32S8 = { VK_FORMAT_D32_SFLOAT_S8_UINT, 8, 64, true };
Greg Daniel164a9f02016-02-22 09:56:40 -0500297
egdaniel8f1dcaa2016-04-01 10:10:45 -0700298 if (stencil_format_supported(interface, physDev, VK_FORMAT_S8_UINT)) {
299 fPreferedStencilFormat = gS8;
300 } else if (stencil_format_supported(interface, physDev, VK_FORMAT_D24_UNORM_S8_UINT)) {
301 fPreferedStencilFormat = gD24S8;
302 } else {
303 SkASSERT(stencil_format_supported(interface, physDev, VK_FORMAT_D32_SFLOAT_S8_UINT));
304 fPreferedStencilFormat = gD32S8;
305 }
306}
307
308void GrVkCaps::initConfigTable(const GrVkInterface* interface, VkPhysicalDevice physDev) {
309 for (int i = 0; i < kGrPixelConfigCnt; ++i) {
310 VkFormat format;
311 if (GrPixelConfigToVkFormat(static_cast<GrPixelConfig>(i), &format)) {
Greg Daniel01907872017-05-23 15:21:02 -0400312 if (!GrPixelConfigIsSRGB(static_cast<GrPixelConfig>(i)) || fSRGBSupport) {
313 fConfigTable[i].init(interface, physDev, format);
314 }
egdaniel8f1dcaa2016-04-01 10:10:45 -0700315 }
316 }
317}
318
319void GrVkCaps::ConfigInfo::InitConfigFlags(VkFormatFeatureFlags vkFlags, uint16_t* flags) {
320 if (SkToBool(VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT & vkFlags) &&
321 SkToBool(VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT & vkFlags)) {
322 *flags = *flags | kTextureable_Flag;
egdaniel8f1dcaa2016-04-01 10:10:45 -0700323
Robert Phillipsb7b7e5f2017-05-22 13:23:19 -0400324 // Ganesh assumes that all renderable surfaces are also texturable
325 if (SkToBool(VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT & vkFlags)) {
326 *flags = *flags | kRenderable_Flag;
327 }
egdaniel8f1dcaa2016-04-01 10:10:45 -0700328 }
329
330 if (SkToBool(VK_FORMAT_FEATURE_BLIT_SRC_BIT & vkFlags)) {
331 *flags = *flags | kBlitSrc_Flag;
332 }
333
334 if (SkToBool(VK_FORMAT_FEATURE_BLIT_DST_BIT & vkFlags)) {
335 *flags = *flags | kBlitDst_Flag;
336 }
337}
338
339void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface,
340 VkPhysicalDevice physDev,
341 VkFormat format) {
342 VkFormatProperties props;
343 memset(&props, 0, sizeof(VkFormatProperties));
344 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &props));
345 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags);
346 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags);
Greg Daniel164a9f02016-02-22 09:56:40 -0500347}