FeaturesVk.h 37 KB
Newer Older
Jamie Madill's avatar
Jamie Madill committed
1
2
3
4
5
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
6
7
// FeaturesVk.h: Optional features for the Vulkan renderer.
//
Jamie Madill's avatar
Jamie Madill committed
8

9
10
#ifndef ANGLE_PLATFORM_FEATURESVK_H_
#define ANGLE_PLATFORM_FEATURESVK_H_
Jamie Madill's avatar
Jamie Madill committed
11

12
13
#include "platform/Feature.h"

14
15
#include <array>

16
namespace angle
Jamie Madill's avatar
Jamie Madill committed
17
{
18

Jonah Ryan-Davis's avatar
Jonah Ryan-Davis committed
19
struct FeaturesVk : FeatureSetBase
Jamie Madill's avatar
Jamie Madill committed
20
{
21
    FeaturesVk();
22
    ~FeaturesVk();
23

Jamie Madill's avatar
Jamie Madill committed
24
25
26
27
    // Line segment rasterization must follow OpenGL rules. This means using an algorithm similar
    // to Bresenham's. Vulkan uses a different algorithm. This feature enables the use of pixel
    // shader patching to implement OpenGL basic line rasterization rules. This feature will
    // normally always be enabled. Exposing it as an option enables performance testing.
Jonah Ryan-Davis's avatar
Jonah Ryan-Davis committed
28
    Feature basicGLLineRasterization = {
29
        "basicGLLineRasterization", FeatureCategory::VulkanFeatures,
30
31
32
        "Enable the use of pixel shader patching to implement OpenGL basic line "
        "rasterization rules",
        &members};
33

34
35
36
    // If the VK_EXT_line_rasterization extension is available we'll use it to get
    // Bresenham line rasterization.
    Feature bresenhamLineRasterization = {
37
        "bresenhamLineRasterization", FeatureCategory::VulkanFeatures,
38
39
        "Enable Bresenham line rasterization via VK_EXT_line_rasterization extension", &members};

40
41
    // If the VK_EXT_provoking_vertex extension is available, we'll use it to set
    // the provoking vertex mode
42
    Feature provokingVertex = {"provokingVertex", FeatureCategory::VulkanFeatures,
43
44
                               "Enable provoking vertex mode via VK_EXT_provoking_vertex extension",
                               &members};
45

46
47
48
    // This flag is added for the sole purpose of end2end tests, to test the correctness
    // of various algorithms when a fallback format is used, such as using a packed format to
    // emulate a depth- or stencil-only format.
49
    Feature forceFallbackFormat = {"forceFallbackFormat", FeatureCategory::VulkanWorkarounds,
Jonah Ryan-Davis's avatar
Jonah Ryan-Davis committed
50
                                   "Force a fallback format for angle_end2end_tests", &members};
51
52
53
54

    // On some NVIDIA drivers the point size range reported from the API is inconsistent with the
    // actual behavior. Clamp the point size to the value from the API to fix this.
    // Tracked in http://anglebug.com/2970.
Jonah Ryan-Davis's avatar
Jonah Ryan-Davis committed
55
    Feature clampPointSize = {
56
        "clampPointSize", FeatureCategory::VulkanWorkarounds,
57
        "The point size range reported from the API is inconsistent with the actual behavior",
58
        &members, "http://anglebug.com/2970"};
59

60
61
62
63
64
65
66
    // On some NVIDIA drivers the depth value is not clamped to [0,1] for floating point depth
    // buffers. This is NVIDIA bug 3171019, see http://anglebug.com/3970 for details.
    Feature depthClamping = {
        "depth_clamping", FeatureCategory::VulkanWorkarounds,
        "The depth value is not clamped to [0,1] for floating point depth buffers.", &members,
        "http://anglebug.com/3970"};

67
    Feature supportsRenderpass2 = {"supportsRenderpass2", FeatureCategory::VulkanFeatures,
68
69
70
                                   "VkDevice supports the VK_KHR_create_renderpass2 extension",
                                   &members};

71
72
    // Whether the VkDevice supports the VK_KHR_incremental_present extension, on which the
    // EGL_KHR_swap_buffers_with_damage extension can be layered.
Jonah Ryan-Davis's avatar
Jonah Ryan-Davis committed
73
    Feature supportsIncrementalPresent = {
74
        "supportsIncrementalPresent", FeatureCategory::VulkanFeatures,
75
        "VkDevice supports the VK_KHR_incremental_present extension", &members};
76

77
78
    // Whether the VkDevice supports the VK_ANDROID_external_memory_android_hardware_buffer
    // extension, on which the EGL_ANDROID_image_native_buffer extension can be layered.
Jonah Ryan-Davis's avatar
Jonah Ryan-Davis committed
79
    Feature supportsAndroidHardwareBuffer = {
80
        "supportsAndroidHardwareBuffer", FeatureCategory::VulkanFeatures,
81
82
83
        "VkDevice supports the VK_ANDROID_external_memory_android_hardware_buffer extension",
        &members};

84
85
    // Whether the VkDevice supports the VK_GGP_frame_token extension, on which
    // the EGL_ANGLE_swap_with_frame_token extension can be layered.
86
    Feature supportsGGPFrameToken = {"supportsGGPFrameToken", FeatureCategory::VulkanFeatures,
87
88
89
                                     "VkDevice supports the VK_GGP_frame_token extension",
                                     &members};

90
91
    // Whether the VkDevice supports the VK_KHR_external_memory_fd extension, on which the
    // GL_EXT_memory_object_fd extension can be layered.
92
93
94
    Feature supportsExternalMemoryFd = {"supportsExternalMemoryFd", FeatureCategory::VulkanFeatures,
                                        "VkDevice supports the VK_KHR_external_memory_fd extension",
                                        &members};
95

96
97
    // Whether the VkDevice supports the VK_FUCHSIA_external_memory
    // extension, on which the GL_ANGLE_memory_object_fuchsia extension can be layered.
98
    Feature supportsExternalMemoryFuchsia = {
99
        "supportsExternalMemoryFuchsia", FeatureCategory::VulkanFeatures,
100
101
        "VkDevice supports the VK_FUCHSIA_external_memory extension", &members};

102
    Feature supportsFilteringPrecision = {
103
        "supportsFilteringPrecision", FeatureCategory::VulkanFeatures,
104
105
        "VkDevice supports the VK_GOOGLE_sampler_filtering_precision extension", &members};

106
107
    // Whether the VkDevice supports the VK_KHR_external_fence_capabilities extension.
    Feature supportsExternalFenceCapabilities = {
108
        "supportsExternalFenceCapabilities", FeatureCategory::VulkanFeatures,
109
110
111
112
        "VkDevice supports the VK_KHR_external_fence_capabilities extension", &members};

    // Whether the VkDevice supports the VK_KHR_external_semaphore_capabilities extension.
    Feature supportsExternalSemaphoreCapabilities = {
113
        "supportsExternalSemaphoreCapabilities", FeatureCategory::VulkanFeatures,
114
115
        "VkDevice supports the VK_KHR_external_semaphore_capabilities extension", &members};

116
117
    // Whether the VkDevice supports the VK_KHR_external_semaphore_fd extension, on which the
    // GL_EXT_semaphore_fd extension can be layered.
Jonah Ryan-Davis's avatar
Jonah Ryan-Davis committed
118
    Feature supportsExternalSemaphoreFd = {
119
        "supportsExternalSemaphoreFd", FeatureCategory::VulkanFeatures,
120
        "VkDevice supports the VK_KHR_external_semaphore_fd extension", &members};
121

122
123
124
    // Whether the VkDevice supports the VK_FUCHSIA_external_semaphore
    // extension, on which the GL_ANGLE_semaphore_fuchsia extension can be layered.
    angle::Feature supportsExternalSemaphoreFuchsia = {
125
        "supportsExternalSemaphoreFuchsia", FeatureCategory::VulkanFeatures,
126
127
        "VkDevice supports the VK_FUCHSIA_external_semaphore extension", &members};

128
129
    // Whether the VkDevice supports the VK_KHR_external_fence_fd extension, on which the
    // EGL_ANDROID_native_fence extension can be layered.
130
    Feature supportsExternalFenceFd = {"supportsExternalFenceFd", FeatureCategory::VulkanFeatures,
131
132
133
134
135
                                       "VkDevice supports the VK_KHR_external_fence_fd extension",
                                       &members, "http://anglebug.com/2517"};

    // Whether the VkDevice can support EGL_ANDROID_native_fence_sync extension.
    Feature supportsAndroidNativeFenceSync = {
136
        "supportsAndroidNativeFenceSync", FeatureCategory::VulkanFeatures,
137
138
139
        "VkDevice supports the EGL_ANDROID_native_fence_sync extension", &members,
        "http://anglebug.com/2517"};

140
    // Whether the VkDevice can support the imageCubeArray feature properly.
141
    Feature supportsImageCubeArray = {"supportsImageCubeArray", FeatureCategory::VulkanFeatures,
142
143
144
                                      "VkDevice supports the imageCubeArray feature properly",
                                      &members, "http://anglebug.com/3584"};

145
146
147
148
149
150
    // Whether the VkDevice supports the pipelineStatisticsQuery feature.
    Feature supportsPipelineStatisticsQuery = {
        "supportsPipelineStatisticsQuery", FeatureCategory::VulkanFeatures,
        "VkDevice supports the pipelineStatisticsQuery feature", &members,
        "http://anglebug.com/5430"};

151
152
153
154
    // Whether the VkDevice supports the VK_EXT_shader_stencil_export extension, which is used to
    // perform multisampled resolve of stencil buffer.  A multi-step workaround is used instead if
    // this extension is not available.
    Feature supportsShaderStencilExport = {
155
        "supportsShaderStencilExport", FeatureCategory::VulkanFeatures,
156
157
        "VkDevice supports the VK_EXT_shader_stencil_export extension", &members};

158
159
160
    // Whether the VkDevice supports the VK_KHR_sampler_ycbcr_conversion extension, which is needed
    // to support Ycbcr conversion with external images.
    Feature supportsYUVSamplerConversion = {
161
        "supportsYUVSamplerConversion", FeatureCategory::VulkanFeatures,
162
163
        "VkDevice supports the VK_KHR_sampler_ycbcr_conversion extension", &members};

164
165
166
    // Where VK_EXT_transform_feedback is not support, an emulation path is used.
    // http://anglebug.com/3205
    Feature emulateTransformFeedback = {
167
        "emulateTransformFeedback", FeatureCategory::VulkanFeatures,
168
169
170
        "Emulate transform feedback as the VK_EXT_transform_feedback is not present.", &members,
        "http://anglebug.com/3205"};

171
172
173
    // Where VK_EXT_transform_feedback is supported, it's preferred over an emulation path.
    // http://anglebug.com/3206
    Feature supportsTransformFeedbackExtension = {
174
        "supportsTransformFeedbackExtension", FeatureCategory::VulkanFeatures,
175
176
177
        "Transform feedback uses the VK_EXT_transform_feedback extension.", &members,
        "http://anglebug.com/3206"};

178
179
180
181
182
    Feature supportsGeometryStreamsCapability = {
        "supportsGeometryStreamsCapability", FeatureCategory::VulkanFeatures,
        "Implementation supports the GeometryStreams SPIR-V capability.", &members,
        "http://anglebug.com/3206"};

183
184
    // Whether the VkDevice supports the VK_EXT_index_type_uint8 extension
    // http://anglebug.com/4405
185
    Feature supportsIndexTypeUint8 = {"supportsIndexTypeUint8", FeatureCategory::VulkanFeatures,
186
187
188
                                      "VkDevice supports the VK_EXT_index_type_uint8 extension",
                                      &members, "http://anglebug.com/4405"};

189
190
    // Whether the VkDevice supports the VK_EXT_custom_border_color extension
    // http://anglebug.com/3577
191
192
    Feature supportsCustomBorderColor = {
        "supportsCustomBorderColor", FeatureCategory::VulkanFeatures,
193
194
195
        "VkDevice supports the VK_EXT_custom_border_color extension", &members,
        "http://anglebug.com/3577"};

196
197
198
199
200
201
    // Whether the VkDevice supports multiDrawIndirect (drawIndirect with drawCount > 1)
    // http://anglebug.com/6439
    Feature supportsMultiDrawIndirect = {
        "supportsMultiDrawIndirect", FeatureCategory::VulkanFeatures,
        "VkDevice supports the multiDrawIndirect extension", &members, "http://anglebug.com/6439"};

202
203
204
    // Whether the VkDevice supports the VK_KHR_depth_stencil_resolve extension with the
    // independentResolveNone feature.
    // http://anglebug.com/4836
205
    Feature supportsDepthStencilResolve = {"supportsDepthStencilResolve",
206
207
208
209
210
                                           FeatureCategory::VulkanFeatures,
                                           "VkDevice supports the VK_KHR_depth_stencil_resolve "
                                           "extension with the independentResolveNone feature",
                                           &members, "http://anglebug.com/4836"};

211
212
213
214
215
216
217
    // Whether the VkDevice supports the VK_EXT_multisampled_render_to_single_sampled extension.
    // http://anglebug.com/4836
    Feature supportsMultisampledRenderToSingleSampled = {
        "supportsMultisampledRenderToSingleSampled", FeatureCategory::VulkanFeatures,
        "VkDevice supports the VK_EXT_multisampled_render_to_single_sampled extension", &members,
        "http://anglebug.com/4836"};

218
219
220
221
222
    // Whether the VkDevice supports the VK_KHR_multiview extension.  http://anglebug.com/6048
    Feature supportsMultiview = {"supportsMultiview", FeatureCategory::VulkanFeatures,
                                 "VkDevice supports the VK_KHR_multiview extension", &members,
                                 "http://anglebug.com/6048"};

223
    // VK_PRESENT_MODE_FIFO_KHR causes random timeouts on Linux Intel. http://anglebug.com/3153
224
225
226
    Feature disableFifoPresentMode = {"disableFifoPresentMode", FeatureCategory::VulkanWorkarounds,
                                      "VK_PRESENT_MODE_FIFO_KHR causes random timeouts", &members,
                                      "http://anglebug.com/3153"};
227

228
229
230
231
    // On Qualcomm, gaps in bound descriptor set indices causes the post-gap sets to misbehave.
    // For example, binding only descriptor set 3 results in zero being read from a uniform buffer
    // object within that set.  This flag results in empty descriptor sets being bound for any
    // unused descriptor set to work around this issue.  http://anglebug.com/2727
Jonah Ryan-Davis's avatar
Jonah Ryan-Davis committed
232
    Feature bindEmptyForUnusedDescriptorSets = {
233
        "bindEmptyForUnusedDescriptorSets", FeatureCategory::VulkanWorkarounds,
234
235
        "Gaps in bound descriptor set indices causes the post-gap sets to misbehave", &members,
        "http://anglebug.com/2727"};
236

237
238
239
240
241
    // OES_depth_texture is a commonly expected feature on Android. However it
    // requires that D16_UNORM support texture filtering
    // (e.g. VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) and some devices
    // do not. Work-around this by setting saying D16_UNORM supports filtering
    // anyway.
242
    Feature forceD16TexFilter = {
243
        "forceD16TexFilter", FeatureCategory::VulkanWorkarounds,
244
245
246
        "VK_FORMAT_D16_UNORM does not support VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT, "
        "which prevents OES_depth_texture from being supported.",
        &members, "http://anglebug.com/3452"};
Shahbaz Youssefi's avatar
Shahbaz Youssefi committed
247
248
249
250

    // On some android devices, vkCmdBlitImage with flipped coordinates blits incorrectly.  This
    // workaround makes sure this path is avoided.  http://anglebug.com/3498
    Feature disableFlippingBlitWithCommand = {
251
        "disableFlippingBlitWithCommand", FeatureCategory::VulkanWorkarounds,
252
253
        "vkCmdBlitImage with flipped coordinates blits incorrectly.", &members,
        "http://anglebug.com/3498"};
254
255
256
257
258
259

    // On platform with Intel or AMD GPU, a window resizing would not trigger the vulkan driver to
    // return VK_ERROR_OUT_OF_DATE on swapchain present.  Work-around by query current window extent
    // every frame to detect a window resizing.
    // http://anglebug.com/3623, http://anglebug.com/3624, http://anglebug.com/3625
    Feature perFrameWindowSizeQuery = {
260
        "perFrameWindowSizeQuery", FeatureCategory::VulkanWorkarounds,
261
262
        "Vulkan swapchain is not returning VK_ERROR_OUT_OF_DATE when window resizing", &members,
        "http://anglebug.com/3623, http://anglebug.com/3624, http://anglebug.com/3625"};
263

264
265
    // Seamful cube map emulation misbehaves on the AMD windows driver, so it's disallowed.
    Feature disallowSeamfulCubeMapEmulation = {
266
        "disallowSeamfulCubeMapEmulation", FeatureCategory::VulkanWorkarounds,
267
268
        "Seamful cube map emulation misbehaves on some drivers, so it's disallowed", &members,
        "http://anglebug.com/3243"};
269

270
271
272
273
274
275
276
277
    // Vulkan considers vertex attribute accesses to count up to the last multiple of the stride.
    // This additional access supports AMD's robust buffer access implementation.
    // AMDVLK in particular will return incorrect values when the vertex access extends into the
    // range that would be the stride padding and the buffer is too small.
    // This workaround limits GL_MAX_VERTEX_ATTRIB_STRIDE to a reasonable value and pads out
    // every buffer allocation size to be large enough to support a maximum vertex stride.
    // http://anglebug.com/4428
    Feature padBuffersToMaxVertexAttribStride = {
278
        "padBuffersToMaxVertexAttribStride", FeatureCategory::VulkanWorkarounds,
279
280
281
282
283
284
285
        "Vulkan considers vertex attribute accesses to count up to the last multiple of the "
        "stride. This additional access supports AMD's robust buffer access implementation. "
        "AMDVLK in particular will return incorrect values when the vertex access extends into "
        "the range that would be the stride padding and the buffer is too small. "
        "This workaround limits GL_MAX_VERTEX_ATTRIB_STRIDE to a maximum value and "
        "pads up every buffer allocation size to be a multiple of the maximum stride.",
        &members, "http://anglebug.com/4428"};
286

287
288
289
290
291
292
293
294
295
    // Whether the VkDevice supports the VK_EXT_external_memory_dma_buf and
    // VK_EXT_image_drm_format_modifier extensions.  These extensions are always used together to
    // implement EGL_EXT_image_dma_buf_import and EGL_EXT_image_dma_buf_import_modifiers.
    Feature supportsExternalMemoryDmaBufAndModifiers = {
        "supportsExternalMemoryDmaBufAndModifiers", FeatureCategory::VulkanFeatures,
        "VkDevice supports the VK_EXT_external_memory_dma_buf and VK_EXT_image_drm_format_modifier "
        "extensions",
        &members, "http://anglebug.com/6248"};

296
297
298
    // Whether the VkDevice supports the VK_EXT_external_memory_host extension, on which the
    // ANGLE_iosurface_client_buffer extension can be layered.
    Feature supportsExternalMemoryHost = {
299
        "supportsExternalMemoryHost", FeatureCategory::VulkanFeatures,
300
        "VkDevice supports the VK_EXT_external_memory_host extension", &members};
301
302
303
304

    // Whether to fill new buffers and textures with nonzero data to sanitize robust resource
    // initialization and flush out assumptions about zero init.
    Feature allocateNonZeroMemory = {
305
        "allocateNonZeroMemory", FeatureCategory::VulkanFeatures,
306
307
        "Fill new allocations with non-zero values to flush out errors.", &members,
        "http://anglebug.com/4384"};
308

309
310
311
312
313
314
315
316
317
318
319
    // Whether to log each callback from the VK_EXT_device_memory_report extension.  This feature is
    // used for trying to debug GPU memory leaks.
    Feature logMemoryReportCallbacks = {"logMemoryReportCallbacks", FeatureCategory::VulkanFeatures,
                                        "Log each callback from VK_EXT_device_memory_report",
                                        &members};

    // Whether to log statistics from the VK_EXT_device_memory_report extension each eglSwapBuffer.
    Feature logMemoryReportStats = {"logMemoryReportStats", FeatureCategory::VulkanFeatures,
                                    "Log stats from VK_EXT_device_memory_report each swap",
                                    &members};

Mohan Maiya's avatar
Mohan Maiya committed
320
321
322
323
    // Allocate a "shadow" buffer for GL buffer objects. For GPU-read only buffers
    // glMap* latency can be reduced by maintaining a copy of the buffer which is
    // writeable only by the CPU. We then return this shadow buffer on glMap* calls.
    Feature shadowBuffers = {
324
        "shadowBuffers", FeatureCategory::VulkanFeatures,
Mohan Maiya's avatar
Mohan Maiya committed
325
326
327
        "Allocate a shadow buffer for GL buffer objects to reduce glMap* latency.", &members,
        "http://anglebug.com/4339"};

328
329
330
331
332
333
334
335
336
    // When we update buffer data we usually face a choice to either clone a buffer and copy the
    // data or stage a buffer update and use the GPU to do the copy. For some GPUs, a performance
    // penalty to use the GPU to do copies. Setting this flag to true will always try to create a
    // new buffer and use the CPU to copy data when possible.
    Feature preferCPUForBufferSubData = {
        "preferCPUForBufferSubData", FeatureCategory::VulkanFeatures,
        "Prefer use CPU to do bufferSubData instead of staged update.", &members,
        "http://issuetracker.google.com/200067929"};

337
338
339
    // Persistently map buffer memory until destroy, saves on map/unmap IOCTL overhead
    // for buffers that are updated frequently.
    Feature persistentlyMappedBuffers = {
340
        "persistentlyMappedBuffers", FeatureCategory::VulkanFeatures,
341
342
343
        "Persistently map buffer memory to reduce map/unmap IOCTL overhead.", &members,
        "http://anglebug.com/2162"};

344
345
346
    // Android needs to pre-rotate surfaces that are not oriented per the native device's
    // orientation (e.g. a landscape application on a Pixel phone).  This feature works for
    // full-screen applications. http://anglebug.com/3502
347
    Feature enablePreRotateSurfaces = {"enablePreRotateSurfaces", FeatureCategory::VulkanFeatures,
348
349
                                       "Enable Android pre-rotation for landscape applications",
                                       &members, "http://anglebug.com/3502"};
350

351
352
    // Enable precision qualifiers for shaders generated by Vulkan backend http://anglebug.com/3078
    Feature enablePrecisionQualifiers = {
353
        "enablePrecisionQualifiers", FeatureCategory::VulkanFeatures,
354
        "Enable precision qualifiers in shaders", &members, "http://anglebug.com/3078"};
355

356
357
358
359
    // Desktop (at least NVIDIA) drivers prefer combining barriers into one vkCmdPipelineBarrier
    // call over issuing multiple barrier calls with fine grained dependency information to have
    // better performance. http://anglebug.com/4633
    Feature preferAggregateBarrierCalls = {
360
        "preferAggregateBarrierCalls", FeatureCategory::VulkanWorkarounds,
361
362
363
        "Single barrier call is preferred over multiple calls with "
        "fine grained pipeline stage dependency information",
        &members, "http://anglebug.com/4633"};
364

365
366
367
368
369
    // Tell the Vulkan back-end to use the async command queue to dispatch work to the GPU. Command
    // buffer work will happened in a worker thread. Otherwise use Renderer::CommandQueue directly.
    Feature asyncCommandQueue = {"asyncCommandQueue", FeatureCategory::VulkanFeatures,
                                 "Use CommandQueue worker thread to dispatch work to GPU.",
                                 &members, "http://anglebug.com/4324"};
370

371
372
    // Whether the VkDevice supports the VK_KHR_shader_float16_int8 extension and has the
    // shaderFloat16 feature.
373
    Feature supportsShaderFloat16 = {"supportsShaderFloat16", FeatureCategory::VulkanFeatures,
374
375
376
377
378
379
380
381
                                     "VkDevice supports the VK_KHR_shader_float16_int8 extension "
                                     "and has the shaderFloat16 feature",
                                     &members, "http://anglebug.com/4551"};

    // Some devices don't meet the limits required to perform mipmap generation using the built-in
    // compute shader.  On some other devices, VK_IMAGE_USAGE_STORAGE_BIT is detrimental to
    // performance, making this solution impractical.
    Feature allowGenerateMipmapWithCompute = {
382
        "allowGenerateMipmapWithCompute", FeatureCategory::VulkanFeatures,
383
384
385
        "Use the compute path to generate mipmaps on devices that meet the minimum requirements, "
        "and the performance is better.",
        &members, "http://anglebug.com/4551"};
386

387
388
389
    // Whether the VkDevice supports the VK_QCOM_render_pass_store_ops extension
    // http://anglebug.com/5505
    Feature supportsRenderPassStoreOpNoneQCOM = {
390
        "supportsRenderPassStoreOpNoneQCOM", FeatureCategory::VulkanFeatures,
391
392
393
        "VkDevice supports VK_QCOM_render_pass_store_ops extension.", &members,
        "http://anglebug.com/5055"};

394
395
396
397
398
399
400
    // Whether the VkDevice supports the VK_EXT_load_store_op_none extension
    // http://anglebug.com/5371
    Feature supportsRenderPassLoadStoreOpNone = {
        "supportsRenderPassLoadStoreOpNone", FeatureCategory::VulkanFeatures,
        "VkDevice supports VK_EXT_load_store_op_none extension.", &members,
        "http://anglebug.com/5371"};

401
402
403
404
405
    // Force maxUniformBufferSize to 16K on Qualcomm's Adreno 540. Pixel2's Adreno540 reports
    // maxUniformBufferSize 64k but various tests failed with that size. For that specific
    // device, we set to 16k for now which is known to pass all tests.
    // https://issuetracker.google.com/161903006
    Feature forceMaxUniformBufferSize16KB = {
406
        "forceMaxUniformBufferSize16KB", FeatureCategory::VulkanWorkarounds,
407
408
        "Force max uniform buffer size to 16K on some device due to bug", &members,
        "https://issuetracker.google.com/161903006"};
409

410
411
412
413
414
415
416
417
    // Enable mutable bit by default for ICD's that support VK_KHR_image_format_list.
    // http://anglebug.com/5281
    Feature supportsImageFormatList = {
        "supportsImageFormatList", FeatureCategory::VulkanFeatures,
        "Enable VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT by default for ICDs "
        "that support VK_KHR_image_format_list",
        &members, "http://anglebug.com/5281"};

418
419
420
421
    // Swiftshader on mac fails to initialize WebGL context when EXT_multisampled_render_to_texture
    // is used by Chromium.
    // http://anglebug.com/4937
    Feature enableMultisampledRenderToTexture = {
422
        "enableMultisampledRenderToTexture", FeatureCategory::VulkanWorkarounds,
423
        "Expose EXT_multisampled_render_to_texture", &members, "http://anglebug.com/4937"};
424
425
426
427

    // Qualcomm fails some tests when reducing the preferred block size to 4M.
    // http://anglebug.com/4995
    Feature preferredLargeHeapBlockSize4MB = {
428
        "preferredLargeHeapBlockSize4MB", FeatureCategory::VulkanWorkarounds,
429
430
        "Use 4 MB preferred large heap block size with AMD allocator", &members,
        "http://anglebug.com/4995"};
431
432
433
434
435
436

    // Manhattan is calling glFlush in the middle of renderpass which breaks renderpass and hurts
    // performance on tile based GPU. When this is enabled, we will defer the glFlush call made in
    // the middle of renderpass to the end of renderpass.
    // https://issuetracker.google.com/issues/166475273
    Feature deferFlushUntilEndRenderPass = {
437
        "deferFlushUntilEndRenderPass", FeatureCategory::VulkanWorkarounds,
438
439
        "Allow glFlush to be deferred until renderpass ends", &members,
        "https://issuetracker.google.com/issues/166475273"};
440
441
442
443

    // Android mistakenly destroys oldSwapchain passed to vkCreateSwapchainKHR, causing crashes on
    // certain drivers.  http://anglebug.com/5061
    Feature waitIdleBeforeSwapchainRecreation = {
444
        "waitIdleBeforeSwapchainRecreation", FeatureCategory::VulkanWorkarounds,
445
446
447
        "Before passing an oldSwapchain to VkSwapchainCreateInfoKHR, wait for queue to be idle. "
        "Works around a bug on platforms which destroy oldSwapchain in vkCreateSwapchainKHR.",
        &members, "http://anglebug.com/5061"};
448

449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
    // Allow forcing an LOD offset on all sampling operations for performance comparisons. ANGLE is
    // non-conformant if this feature is enabled.
    std::array<angle::Feature, 4> forceTextureLODOffset = {
        angle::Feature{"force_texture_lod_offset_1", angle::FeatureCategory::VulkanWorkarounds,
                       "Increase the minimum texture level-of-detail by 1 when sampling.",
                       &members},
        angle::Feature{"force_texture_lod_offset_2", angle::FeatureCategory::VulkanWorkarounds,
                       "Increase the minimum texture level-of-detail by 2 when sampling.",
                       &members},
        angle::Feature{"force_texture_lod_offset_3", angle::FeatureCategory::VulkanWorkarounds,
                       "Increase the minimum texture level-of-detail by 3 when sampling.",
                       &members},
        angle::Feature{"force_texture_lod_offset_4", angle::FeatureCategory::VulkanWorkarounds,
                       "Increase the minimum texture level-of-detail by 4 when sampling.",
                       &members},
    };

    // Translate non-nearest filtering modes to nearest for all samplers for performance
    // comparisons. ANGLE is non-conformant if this feature is enabled.
    Feature forceNearestFiltering = {"force_nearest_filtering", FeatureCategory::VulkanWorkarounds,
                                     "Force nearest filtering when sampling.", &members};

471
472
    // Translate  non-nearest mip filtering modes to nearest mip for all samplers for performance
    // comparisons. ANGLE is non-conformant if this feature is enabled.
473
    Feature forceNearestMipFiltering = {"forceNearestMipFiltering",
474
475
                                        FeatureCategory::VulkanWorkarounds,
                                        "Force nearest mip filtering when sampling.", &members};
476

477
478
479
480
481
482
483
484
    // Compress float32 vertices in static buffers to float16 at draw time. ANGLE is non-conformant
    // if this feature is enabled.
    angle::Feature compressVertexData = {"compress_vertex_data",
                                         angle::FeatureCategory::VulkanWorkarounds,
                                         "Compress vertex data to smaller data types when "
                                         "possible. Using this feature makes ANGLE non-conformant.",
                                         &members};

485
486
487
    // Qualcomm missynchronizes vkCmdClearAttachments in the middle of render pass.
    // https://issuetracker.google.com/166809097
    Feature preferDrawClearOverVkCmdClearAttachments = {
488
        "preferDrawClearOverVkCmdClearAttachments", FeatureCategory::VulkanWorkarounds,
489
490
491
        "On some hardware, clear using a draw call instead of vkCmdClearAttachments in the middle "
        "of render pass due to bugs",
        &members, "https://issuetracker.google.com/166809097"};
492
493

    // Whether prerotation is being emulated for testing.  90 degree rotation.
494
    Feature emulatedPrerotation90 = {"emulatedPrerotation90", FeatureCategory::VulkanFeatures,
495
496
497
498
                                     "Emulate 90-degree prerotation.", &members,
                                     "http://anglebug.com/4901"};

    // Whether prerotation is being emulated for testing.  180 degree rotation.
499
    Feature emulatedPrerotation180 = {"emulatedPrerotation180", FeatureCategory::VulkanFeatures,
500
501
502
503
                                      "Emulate 180-degree prerotation.", &members,
                                      "http://anglebug.com/4901"};

    // Whether prerotation is being emulated for testing.  270 degree rotation.
504
    Feature emulatedPrerotation270 = {"emulatedPrerotation270", FeatureCategory::VulkanFeatures,
505
506
                                      "Emulate 270-degree prerotation.", &members,
                                      "http://anglebug.com/4901"};
507

508
509
510
511
512
    // Whether SPIR-V should be generated through glslang.  Transitory feature while confidence is
    // built on the SPIR-V generation code.
    Feature generateSPIRVThroughGlslang = {
        "generateSPIRVThroughGlslang", FeatureCategory::VulkanFeatures,
        "Translate SPIR-V through glslang.", &members, "http://anglebug.com/4889"};
513

514
515
516
517
518
519
    // Whether we should use driver uniforms over specialization constants for some shader
    // modifications like yflip and rotation.
    Feature forceDriverUniformOverSpecConst = {
        "forceDriverUniformOverSpecConst", FeatureCategory::VulkanWorkarounds,
        "Forces using driver uniforms instead of specialization constants.", &members,
        "http://issuetracker.google.com/173636783"};
520
521
522
523
524
525
526
527

    // Whether non-conformant configurations and extensions should be exposed.  When an extension is
    // in development, or a GLES version is not supported on a device, we may still want to expose
    // them for partial testing.  This feature is enabled by our test harness.
    Feature exposeNonConformantExtensionsAndVersions = {
        "exposeNonConformantExtensionsAndVersions", FeatureCategory::VulkanWorkarounds,
        "Expose GLES versions and extensions that are not conformant.", &members,
        "http://anglebug.com/5375"};
528
529
530
531
532
533
534
535

    // imageAtomicExchange is expected to work for r32f formats, but support for atomic operations
    // for VK_FORMAT_R32_SFLOAT is rare.  This support is emulated by using an r32ui format for such
    // images instead.
    Feature emulateR32fImageAtomicExchange = {
        "emulateR32fImageAtomicExchange", FeatureCategory::VulkanWorkarounds,
        "Emulate r32f images with r32ui to support imageAtomicExchange.", &members,
        "http://anglebug.com/5535"};
536
537
538
539

    Feature supportsNegativeViewport = {
        "supportsNegativeViewport", FeatureCategory::VulkanFeatures,
        "The driver supports inverting the viewport with a negative height.", &members};
540

541
542
543
544
545
546
    // Whether we should force any highp precision in the fragment shader to mediump.
    // ANGLE is non-conformant if this feature is enabled.
    Feature forceFragmentShaderPrecisionHighpToMediump = {
        "forceFragmentShaderPrecisionHighpToMediump", FeatureCategory::VulkanWorkarounds,
        "Forces highp precision in fragment shader to mediump.", &members,
        "https://issuetracker.google.com/184850002"};
547
548
549
550
551
552

    // Whether we should submit at each FBO boundary.
    Feature preferSubmitAtFBOBoundary = {
        "preferSubmitAtFBOBoundary", FeatureCategory::VulkanWorkarounds,
        "Submit commands to driver at each FBO boundary for performance improvements.", &members,
        "https://issuetracker.google.com/187425444"};
553
554
555
556
557
558
559

    // Workaround for gap in Vulkan spec related to querying descriptor count for immutable samplers
    // tied to an external format.
    Feature useMultipleDescriptorsForExternalFormats = {
        "useMultipleDescriptorsForExternalFormats", FeatureCategory::VulkanWorkarounds,
        "Return a default descriptor count for external formats.", &members,
        "http://anglebug.com/6141"};
560
561

    // Whether the VkDevice can support Protected Memory.
562
    Feature supportsProtectedMemory = {"supportsProtectedMemory", FeatureCategory::VulkanFeatures,
563
564
565
                                       "VkDevice supports protected memory", &members,
                                       "http://anglebug.com/3965"};

566
567
568
569
570
571
    // Whether the VkDevice supports the VK_EXT_host_query_reset extension
    // http://anglebug.com/6692
    Feature supportsHostQueryReset = {"supportsHostQueryReset", FeatureCategory::VulkanFeatures,
                                      "VkDevice supports VK_EXT_host_query_reset extension",
                                      &members, "http://anglebug.com/6692"};

572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
    // Whether the VkInstance supports the VK_KHR_get_surface_capabilities2 extension.
    Feature supportsSurfaceCapabilities2Extension = {
        "supportsSurfaceCapabilities2Extension", FeatureCategory::VulkanFeatures,
        "VkInstance supports the VK_KHR_get_surface_capabilities2 extension", &members};

    // Whether the VkInstance supports the VK_KHR_surface_protected_capabilities extension.
    Feature supportsSurfaceProtectedCapabilitiesExtension = {
        "supportsSurfaceProtectedCapabilitiesExtension", FeatureCategory::VulkanFeatures,
        "VkInstance supports the VK_KHR_surface_protected_capabilities extension", &members};

    // Whether the VkSurface supports protected swapchains from
    // supportsSurfaceProtectedCapabilitiesExtension.
    Feature supportsSurfaceProtectedSwapchains = {
        "supportsSurfaceProtectedSwapchains", FeatureCategory::VulkanFeatures,
        "VkSurface supportsProtected for protected swapchains", &members};
587
588
589
590
591

    // Whether surface format GL_RGB8 should be overridden to GL_RGBA8.
    Feature overrideSurfaceFormatRGB8toRGBA8 = {
        "overrideSurfaceFormatRGB8toRGBA8", FeatureCategory::VulkanWorkarounds,
        "Override surface format GL_RGB8 to GL_RGBA8", &members, "http://anglebug.com/6651"};
592
593
594
595
596

    // Whether the VkSurface supports VK_KHR_shared_presentable_images.
    Feature supportsSharedPresentableImageExtension = {
        "supportsSharedPresentableImageExtension", FeatureCategory::VulkanFeatures,
        "VkSurface supports the VK_KHR_shared_presentable_images extension", &members};
597
598
599
600
601
602
603
604
605
606
607
608

    // Feature to control whether the Vulkan backend can support
    // GL_EXT_shader_framebuffer_fetch
    Feature supportsShaderFramebufferFetch = {
        "supportsShaderFramebufferFetch", FeatureCategory::VulkanFeatures,
        "Whether the Vulkan backend supports coherent framebuffer fetch", &members};

    // Feature to control whether the Vulkan backend can support
    // GL_EXT_shader_framebuffer_fetch_non_coherent
    Feature supportsShaderFramebufferFetchNonCoherent = {
        "supportsShaderFramebufferFetchNonCoherent", FeatureCategory::VulkanFeatures,
        "Whether the Vulkan backend supports non-coherent framebuffer fetch", &members};
609
610
611
612
613

    // Whether the Surface supports EGL_KHR_lock_surface3.
    Feature supportsLockSurfaceExtension = {
        "supportsLockSurfaceExtension", FeatureCategory::VulkanFeatures,
        "Surface supports the EGL_KHR_lock_surface3 extension", &members};
614
615
616
617
618
619
620
621

    // When mutable_render_buffer goes into SINGLE_BUFFER mode, need to call swapbuffers at
    // flush and finish so that the image is updated and presented to the display.
    Feature swapbuffersOnFlushOrFinishWithSingleBuffer = {
        "swapbuffersOnFlushOrFinishWithSingleBuffer", FeatureCategory::VulkanFeatures,
        "Bypass deferredFlush with calling swapbuffers on flush or finish when in Shared Present "
        "mode",
        &members, "http://anglebug.com/6878"};
Shahbaz Youssefi's avatar
Shahbaz Youssefi committed
622
623
624
625

    // Whether dithering should be emulated.
    Feature emulateDithering = {"emulateDithering", FeatureCategory::VulkanFeatures,
                                "Emulate OpenGL dithering", &members, "http://anglebug.com/6755"};
626
627
628
629
630
631
632
633

    // Android bug workaround which assumes VkPresentRegionsKHR to have a bottom-left origin
    // instead of top-left as specified by VK_KHR_incremental_present
    Feature bottomLeftOriginPresentRegionRectangles = {
        "bottomLeftOriginPresentRegionRectangles", FeatureCategory::VulkanWorkarounds,
        "On some platforms present region rectangles are expected to have a bottom-left origin, "
        "instead of top-left origin as from spec",
        &members};
Jamie Madill's avatar
Jamie Madill committed
634
635
};

636
inline FeaturesVk::FeaturesVk()  = default;
637
638
inline FeaturesVk::~FeaturesVk() = default;

639
640
641
}  // namespace angle

#endif  // ANGLE_PLATFORM_FEATURESVK_H_