1 // 2 // Copyright 2018 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 // FeaturesVk.h: Optional features for the Vulkan renderer. 7 // 8 9 #ifndef ANGLE_PLATFORM_FEATURESVK_H_ 10 #define ANGLE_PLATFORM_FEATURESVK_H_ 11 12 #include "platform/Feature.h" 13 14 namespace angle 15 { 16 17 struct FeaturesVk : FeatureSetBase 18 { 19 FeaturesVk(); 20 ~FeaturesVk(); 21 22 // Line segment rasterization must follow OpenGL rules. This means using an algorithm similar 23 // to Bresenham's. Vulkan uses a different algorithm. This feature enables the use of pixel 24 // shader patching to implement OpenGL basic line rasterization rules. This feature will 25 // normally always be enabled. Exposing it as an option enables performance testing. 26 Feature basicGLLineRasterization = { 27 "basic_gl_line_rasterization", FeatureCategory::VulkanFeatures, 28 "Enable the use of pixel shader patching to implement OpenGL basic line " 29 "rasterization rules", 30 &members}; 31 32 // Flips the viewport to render upside-down. This has the effect to render the same way as 33 // OpenGL. If this feature gets enabled, we enable the KHR_MAINTENANCE_1 extension to allow 34 // negative viewports. We inverse rendering to the backbuffer by reversing the height of the 35 // viewport and increasing Y by the height. So if the viewport was (0,0,width,height), it 36 // becomes (0, height, width, -height). Unfortunately, when we start doing this, we also need 37 // to adjust a lot of places since the rendering now happens upside-down. Affected places so 38 // far: 39 // -readPixels 40 // -copyTexImage 41 // -framebuffer blit 42 // -generating mipmaps 43 // -Point sprites tests 44 // -texStorage 45 Feature flipViewportY = {"flip_viewport_y", FeatureCategory::VulkanFeatures, 46 "Flips the viewport to render upside-down", &members}; 47 48 // Add an extra copy region when using vkCmdCopyBuffer as the Windows Intel driver seems 49 // to have a bug where the last region is ignored. 50 Feature extraCopyBufferRegion = { 51 "extra_copy_buffer_region", FeatureCategory::VulkanWorkarounds, 52 "Windows Intel driver seems to have a bug where the last copy region in " 53 "vkCmdCopyBuffer is ignored", 54 &members}; 55 56 // This flag is added for the sole purpose of end2end tests, to test the correctness 57 // of various algorithms when a fallback format is used, such as using a packed format to 58 // emulate a depth- or stencil-only format. 59 Feature forceFallbackFormat = {"force_fallback_format", FeatureCategory::VulkanWorkarounds, 60 "Force a fallback format for angle_end2end_tests", &members}; 61 62 // On some NVIDIA drivers the point size range reported from the API is inconsistent with the 63 // actual behavior. Clamp the point size to the value from the API to fix this. 64 // Tracked in http://anglebug.com/2970. 65 Feature clampPointSize = { 66 "clamp_point_size", FeatureCategory::VulkanWorkarounds, 67 "On some NVIDIA drivers, the point size range reported from the API is " 68 "inconsistent with the actual behavior", 69 &members, "http://anglebug.com/2970"}; 70 71 // On some android devices, the memory barrier between the compute shader that converts vertex 72 // attributes and the vertex shader that reads from it is ineffective. Only known workaround is 73 // to perform a flush after the conversion. http://anglebug.com/3016 74 Feature flushAfterVertexConversion = { 75 "flush_after_vertex_conversion", FeatureCategory::VulkanWorkarounds, 76 "On some android devices, the memory barrier between the compute shader that converts " 77 "vertex attributes and the vertex shader that reads from it is ineffective", 78 &members, "http://anglebug.com/3016"}; 79 80 // Whether the VkDevice supports the VK_KHR_incremental_present extension, on which the 81 // EGL_KHR_swap_buffers_with_damage extension can be layered. 82 Feature supportsIncrementalPresent = { 83 "supports_incremental_present", FeatureCategory::VulkanFeatures, 84 "VkDevice supports the VK_KHR_incremental_present extension", &members}; 85 86 // Whether texture copies on cube map targets should be done on GPU. This is a workaround for 87 // Intel drivers on windows that have an issue with creating single-layer views on cube map 88 // textures. 89 Feature forceCpuPathForCubeMapCopy = { 90 "force_cpu_path_for_cube_map_copy", FeatureCategory::VulkanWorkarounds, 91 "Some Intel Windows drivers have an issue with creating single-layer " 92 "views on cube map textures", 93 &members}; 94 95 // Whether the VkDevice supports the VK_ANDROID_external_memory_android_hardware_buffer 96 // extension, on which the EGL_ANDROID_image_native_buffer extension can be layered. 97 Feature supportsAndroidHardwareBuffer = { 98 "supports_android_hardware_buffer", FeatureCategory::VulkanFeatures, 99 "VkDevice supports the VK_ANDROID_external_memory_android_hardware_buffer extension", 100 &members}; 101 102 // Whether the VkDevice supports the VK_KHR_external_memory_fd extension, on which the 103 // GL_EXT_memory_object_fd extension can be layered. 104 Feature supportsExternalMemoryFd = { 105 "supports_external_memory_fd", FeatureCategory::VulkanFeatures, 106 "VkDevice supports the VK_KHR_external_memory_fd extension", &members}; 107 108 // Whether the VkDevice supports the VK_KHR_external_semaphore_fd extension, on which the 109 // GL_EXT_semaphore_fd extension can be layered. 110 Feature supportsExternalSemaphoreFd = { 111 "supports_external_semaphore_fd", FeatureCategory::VulkanFeatures, 112 "VkDevice supports the VK_KHR_external_semaphore_fd extension", &members}; 113 114 // Whether the VkDevice supports the VK_EXT_shader_stencil_export extension, which is used to 115 // perform multisampled resolve of stencil buffer. A multi-step workaround is used instead if 116 // this extension is not available. 117 Feature supportsShaderStencilExport = { 118 "supports_shader_stencil_export", FeatureCategory::VulkanFeatures, 119 "VkDevice supports the VK_EXT_shader_stencil_export extension", &members}; 120 121 // Where VK_EXT_transform_feedback is not support, an emulation path is used. 122 // http://anglebug.com/3205 123 Feature emulateTransformFeedback = { 124 "emulate_transform_feedback", FeatureCategory::VulkanFeatures, 125 "Emulate transform feedback as the VK_EXT_transform_feedback is not present.", &members, 126 "http://anglebug.com/3205"}; 127 128 // VK_PRESENT_MODE_FIFO_KHR causes random timeouts on Linux Intel. http://anglebug.com/3153 129 Feature disableFifoPresentMode = { 130 "disable_fifo_present_mode", FeatureCategory::VulkanWorkarounds, 131 "On Linux Intel, VK_PRESENT_MODE_FIFO_KHR causes random timeouts", &members, 132 "http://anglebug.com/3153"}; 133 134 // On Qualcomm, a bug is preventing us from using loadOp=Clear with inline commands in the 135 // render pass. http://anglebug.com/2361 136 Feature restartRenderPassAfterLoadOpClear = { 137 "restart_render_pass_after_load_op_clear", FeatureCategory::VulkanWorkarounds, 138 "On Qualcomm, a bug is preventing us from using loadOp=Clear with inline " 139 "commands in the render pass", 140 &members, "http://anglebug.com/2361"}; 141 142 // On Qualcomm, gaps in bound descriptor set indices causes the post-gap sets to misbehave. 143 // For example, binding only descriptor set 3 results in zero being read from a uniform buffer 144 // object within that set. This flag results in empty descriptor sets being bound for any 145 // unused descriptor set to work around this issue. http://anglebug.com/2727 146 Feature bindEmptyForUnusedDescriptorSets = { 147 "bind_empty_for_unused_descriptor_sets", FeatureCategory::VulkanWorkarounds, 148 "On Qualcomm, gaps in bound descriptor set indices causes the post-gap sets to misbehave", 149 &members, "http://anglebug.com/2727"}; 150 151 // When the scissor is (0,0,0,0) on Windows Intel, the driver acts as if the scissor was 152 // disabled. Work-around this by setting the scissor to just outside of the render area 153 // (e.g. (renderArea.x, renderArea.y, 1, 1)). http://anglebug.com/3407 154 Feature forceNonZeroScissor = { 155 "force_non_zero_scissor", FeatureCategory::VulkanWorkarounds, 156 "On Windows Intel, when the scissor is (0,0,0,0), the driver acts as if the " 157 "scissor was disabled", 158 &members, "http://anglebug.com/3407"}; 159 160 // OES_depth_texture is a commonly expected feature on Android. However it 161 // requires that D16_UNORM support texture filtering 162 // (e.g. VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) and some devices 163 // do not. Work-around this by setting saying D16_UNORM supports filtering 164 // anyway. 165 Feature forceD16TexFilter = {"force_D16_texture_filter", FeatureCategory::VulkanWorkarounds, 166 "On some Android devices, VK_FORMAT_D16_UNORM does not support " 167 "VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT, " 168 "which prevents OES_depth_texture from being supported.", 169 &members, "http://anglebug.com/3452"}; 170 171 // On some android devices, vkCmdBlitImage with flipped coordinates blits incorrectly. This 172 // workaround makes sure this path is avoided. http://anglebug.com/3498 173 Feature disableFlippingBlitWithCommand = { 174 "disable_flipping_blit_with_command", FeatureCategory::VulkanWorkarounds, 175 "On some android devices, vkCmdBlitImage with flipped coordinates blits incorrectly.", 176 &members, "http://anglebug.com/3498"}; 177 178 // On platform with Intel or AMD GPU, a window resizing would not trigger the vulkan driver to 179 // return VK_ERROR_OUT_OF_DATE on swapchain present. Work-around by query current window extent 180 // every frame to detect a window resizing. 181 // http://anglebug.com/3623, http://anglebug.com/3624, http://anglebug.com/3625 182 Feature perFrameWindowSizeQuery = { 183 "per_frame_window_size_query", FeatureCategory::VulkanWorkarounds, 184 "On platform with Intel or AMD gpu, vulkan swapchain is not returning VK_ERROR_OUT_OF_DATE" 185 "when window resizing", 186 &members, "http://anglebug.com/3623, http://anglebug.com/3624, http://anglebug.com/3625"}; 187 188 // On Pixel1XL and Pixel2, reset a vkCommandBuffer seems to have side effects on binding 189 // descriptor sets to it afterwards, Work-around by keep using transient vkCommandBuffer on 190 // those devices. 191 // http://b/135763283 192 Feature transientCommandBuffer = { 193 "transient_command_buffer", FeatureCategory::VulkanWorkarounds, 194 "On Pixel2, keep using transient vkCommandBuffer to work around driver issue in reseting" 195 "vkCommandBuffer", 196 &members, "http://b/135763283"}; 197 198 // Seamful cube map emulation misbehaves on the AMD windows driver, so it's disallowed. 199 Feature disallowSeamfulCubeMapEmulation = { 200 "disallow_seamful_cube_map_emulation", FeatureCategory::VulkanWorkarounds, 201 "Seamful cube map emulation misbehaves on the AMD windows driver, so it's disallowed", 202 &members, "http://anglebug.com/3243"}; 203 }; 204 205 inline FeaturesVk::FeaturesVk() = default; 206 inline FeaturesVk::~FeaturesVk() = default; 207 208 } // namespace angle 209 210 #endif // ANGLE_PLATFORM_FEATURESVK_H_ 211