1 // 2 // Copyright 2015 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 7 // FeaturesGL.h: Features and workarounds for GL driver bugs and other issues. 8 9 #ifndef ANGLE_PLATFORM_FEATURESGL_H_ 10 #define ANGLE_PLATFORM_FEATURESGL_H_ 11 12 #include "platform/Feature.h" 13 14 namespace angle 15 { 16 17 struct FeaturesGL : FeatureSetBase 18 { 19 FeaturesGL(); 20 ~FeaturesGL(); 21 22 // When writing a float to a normalized integer framebuffer, desktop OpenGL is allowed to write 23 // one of the two closest normalized integer representations (although round to nearest is 24 // preferred) (see section 2.3.5.2 of the GL 4.5 core specification). OpenGL ES requires that 25 // round-to-nearest is used (see "Conversion from Floating-Point to Framebuffer Fixed-Point" in 26 // section 2.1.2 of the OpenGL ES 2.0.25 spec). This issue only shows up on AMD drivers on 27 // framebuffer formats that have 1-bit alpha, work around this by using higher precision formats 28 // instead. 29 Feature avoid1BitAlphaTextureFormats = {"avoid_1_bit_alpha_texture_formats", 30 FeatureCategory::OpenGLWorkarounds, 31 "Issue with 1-bit alpha framebuffer formats", &members}; 32 33 // On some older Intel drivers, GL_RGBA4 is not color renderable, glCheckFramebufferStatus 34 // returns GL_FRAMEBUFFER_UNSUPPORTED. Work around this by using a known color-renderable 35 // format. 36 Feature rgba4IsNotSupportedForColorRendering = {"rgba4_is_not_supported_for_color_rendering", 37 FeatureCategory::OpenGLWorkarounds, 38 "GL_RGBA4 is not color renderable", &members}; 39 40 // Newer Intel GPUs natively support ETC2/EAC compressed texture formats. 41 Feature allowEtcFormats = {"allow_etc_formats", FeatureCategory::OpenGLWorkarounds, 42 "Enable ETC2/EAC on desktop OpenGL", &members}; 43 44 // When clearing a framebuffer on Intel or AMD drivers, when GL_FRAMEBUFFER_SRGB is enabled, the 45 // driver clears to the linearized clear color despite the framebuffer not supporting SRGB 46 // blending. It only seems to do this when the framebuffer has only linear attachments, mixed 47 // attachments appear to get the correct clear color. 48 Feature doesSRGBClearsOnLinearFramebufferAttachments = { 49 "does_srgb_clears_on_linear_framebuffer_attachments", FeatureCategory::OpenGLWorkarounds, 50 "Issue clearing framebuffers with linear attachments when GL_FRAMEBUFFER_SRGB is enabled", 51 &members}; 52 53 // On Mac some GLSL constructs involving do-while loops cause GPU hangs, such as the following: 54 // int i = 1; 55 // do { 56 // i --; 57 // continue; 58 // } while (i > 0) 59 // Work around this by rewriting the do-while to use another GLSL construct (block + while) 60 Feature doWhileGLSLCausesGPUHang = { 61 "do_while_glsl_causes_gpu_hang", FeatureCategory::OpenGLWorkarounds, 62 "Some GLSL constructs involving do-while loops cause GPU hangs", &members, 63 "http://crbug.com/644669"}; 64 65 // On Mac AMD GPU gl_VertexID in GLSL vertex shader doesn't include base vertex value, 66 // Work aronud this by replace gl_VertexID with (gl_VertexID - angle_BaseVertex) when 67 // angle_BaseVertex is present. 68 Feature addBaseVertexToVertexID = { 69 "vertex_id_does_not_include_base_vertex", FeatureCategory::OpenGLWorkarounds, 70 "gl_VertexID in GLSL vertex shader doesn't include base vertex value", &members}; 71 72 // Calling glFinish doesn't cause all queries to report that the result is available on some 73 // (NVIDIA) drivers. It was found that enabling GL_DEBUG_OUTPUT_SYNCHRONOUS before the finish 74 // causes it to fully finish. 75 Feature finishDoesNotCauseQueriesToBeAvailable = { 76 "finish_does_not_cause_queries_to_be_available", FeatureCategory::OpenGLWorkarounds, 77 "glFinish doesn't cause all queries to report available result", &members}; 78 79 // Always call useProgram after a successful link to avoid a driver bug. 80 // This workaround is meant to reproduce the use_current_program_after_successful_link 81 // workaround in Chromium (http://crbug.com/110263). It has been shown that this workaround is 82 // not necessary for MacOSX 10.9 and higher (http://crrev.com/39eb535b). 83 Feature alwaysCallUseProgramAfterLink = { 84 "always_call_use_program_after_link", FeatureCategory::OpenGLWorkarounds, 85 "Always call useProgram after a successful link to avoid a driver bug", &members, 86 "http://crbug.com/110263"}; 87 88 // On NVIDIA, in the case of unpacking from a pixel unpack buffer, unpack overlapping rows row 89 // by row. 90 Feature unpackOverlappingRowsSeparatelyUnpackBuffer = { 91 "unpack_overlapping_rows_separately_unpack_buffer", FeatureCategory::OpenGLWorkarounds, 92 "In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row", 93 &members}; 94 95 // On NVIDIA, in the case of packing to a pixel pack buffer, pack overlapping rows row by row. 96 Feature packOverlappingRowsSeparatelyPackBuffer = { 97 "pack_overlapping_rows_separately_pack_buffer", FeatureCategory::OpenGLWorkarounds, 98 "In the case of packing to a pixel pack buffer, pack overlapping rows row by row", 99 &members}; 100 101 // On NVIDIA, during initialization, assign the current vertex attributes to the spec-mandated 102 // defaults. 103 Feature initializeCurrentVertexAttributes = { 104 "initialize_current_vertex_attributes", FeatureCategory::OpenGLWorkarounds, 105 "During initialization, assign the current vertex attributes to the spec-mandated defaults", 106 &members}; 107 108 // abs(i) where i is an integer returns unexpected result on Intel Mac. 109 // Emulate abs(i) with i * sign(i). 110 Feature emulateAbsIntFunction = {"emulate_abs_int_function", FeatureCategory::OpenGLWorkarounds, 111 "abs(i) where i is an integer returns unexpected result", 112 &members, "http://crbug.com/642227"}; 113 114 // On Intel Mac, calculation of loop conditions in for and while loop has bug. 115 // Add "&& true" to the end of the condition expression to work around the bug. 116 Feature addAndTrueToLoopCondition = { 117 "add_and_true_to_loop_condition", FeatureCategory::OpenGLWorkarounds, 118 "Calculation of loop conditions in for and while loop has bug", &members}; 119 120 // When uploading textures from an unpack buffer, some drivers count an extra row padding when 121 // checking if the pixel unpack buffer is big enough. Tracking bug: http://anglebug.com/1512 122 // For example considering the pixel buffer below where in memory, each row data (D) of the 123 // texture is followed by some unused data (the dots): 124 // +-------+--+ 125 // |DDDDDDD|..| 126 // |DDDDDDD|..| 127 // |DDDDDDD|..| 128 // |DDDDDDD|..| 129 // +-------A--B 130 // The last pixel read will be A, but the driver will think it is B, causing it to generate an 131 // error when the pixel buffer is just big enough. 132 Feature unpackLastRowSeparatelyForPaddingInclusion = { 133 "unpack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds, 134 "When uploading textures from an unpack buffer, some drivers count an extra row padding", 135 &members, "http://anglebug.com/1512"}; 136 137 // Equivalent workaround when uploading data from a pixel pack buffer. 138 Feature packLastRowSeparatelyForPaddingInclusion = { 139 "pack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds, 140 "When uploading textures from an pack buffer, some drivers count an extra row padding", 141 &members, "http://anglebug.com/1512"}; 142 143 // On some Intel drivers, using isnan() on highp float will get wrong answer. To work around 144 // this bug, we use an expression to emulate function isnan(). 145 // Tracking bug: http://crbug.com/650547 146 Feature emulateIsnanFloat = {"emulate_isnan_float", FeatureCategory::OpenGLWorkarounds, 147 "Using isnan() on highp float will get wrong answer", &members, 148 "http://crbug.com/650547"}; 149 150 // On Mac with OpenGL version 4.1, unused std140 or shared uniform blocks will be 151 // treated as inactive which is not consistent with WebGL2.0 spec. Reference all members in a 152 // unused std140 or shared uniform block at the beginning of main to work around it. 153 // Also used on Linux AMD. 154 Feature useUnusedBlocksWithStandardOrSharedLayout = { 155 "use_unused_blocks_with_standard_or_shared_layout", FeatureCategory::OpenGLWorkarounds, 156 "Unused std140 or shared uniform blocks will be treated as inactive", &members}; 157 158 // This flag is used to fix spec difference between GLSL 4.1 or lower and ESSL3. 159 Feature removeInvariantAndCentroidForESSL3 = { 160 "remove_invarient_and_centroid_for_essl3", FeatureCategory::OpenGLWorkarounds, 161 "Fix spec difference between GLSL 4.1 or lower and ESSL3", &members}; 162 163 // On Intel Mac OSX 10.11 driver, using "-float" will get wrong answer. Use "0.0 - float" to 164 // replace "-float". 165 // Tracking bug: http://crbug.com/308366 166 Feature rewriteFloatUnaryMinusOperator = { 167 "rewrite_float_unary_minus_operator", FeatureCategory::OpenGLWorkarounds, 168 "Using '-<float>' will get wrong answer", &members, "http://crbug.com/308366"}; 169 170 // On NVIDIA drivers, atan(y, x) may return a wrong answer. 171 // Tracking bug: http://crbug.com/672380 172 Feature emulateAtan2Float = {"emulate_atan_2_float", FeatureCategory::OpenGLWorkarounds, 173 "atan(y, x) may return a wrong answer", &members, 174 "http://crbug.com/672380"}; 175 176 // Some drivers seem to forget about UBO bindings when using program binaries. Work around 177 // this by re-applying the bindings after the program binary is loaded or saved. 178 // This only seems to affect AMD OpenGL drivers, and some Android devices. 179 // http://anglebug.com/1637 180 Feature reapplyUBOBindingsAfterUsingBinaryProgram = { 181 "reapply_ubo_bindings_after_using_binary_program", FeatureCategory::OpenGLWorkarounds, 182 "Some drivers forget about UBO bindings when using program binaries", &members, 183 "http://anglebug.com/1637"}; 184 185 // Some Linux OpenGL drivers return 0 when we query MAX_VERTEX_ATTRIB_STRIDE in an OpenGL 4.4 or 186 // higher context. 187 // This only seems to affect AMD OpenGL drivers. 188 // Tracking bug: http://anglebug.com/1936 189 Feature emulateMaxVertexAttribStride = { 190 "emulate_max_vertex_attrib_stride", FeatureCategory::OpenGLWorkarounds, 191 "Some drivers return 0 when MAX_VERTEX_ATTRIB_STRIED queried", &members, 192 "http://anglebug.com/1936"}; 193 194 // Initializing uninitialized locals caused odd behavior on Android Qualcomm in a few WebGL 2 195 // tests. Tracking bug: http://anglebug.com/2046 196 Feature dontInitializeUninitializedLocals = { 197 "dont_initialize_uninitialized_locals", FeatureCategory::OpenGLWorkarounds, 198 "Initializing uninitialized locals caused odd behavior in a few WebGL 2 tests", &members, 199 "http://anglebug.com/2046"}; 200 201 // On some NVIDIA drivers the point size range reported from the API is inconsistent with the 202 // actual behavior. Clamp the point size to the value from the API to fix this. 203 Feature clampPointSize = { 204 "clamp_point_size", FeatureCategory::OpenGLWorkarounds, 205 "The point size range reported from the API is inconsistent with the actual behavior", 206 &members}; 207 208 // On some NVIDIA drivers certain types of GLSL arithmetic ops mixing vectors and scalars may be 209 // executed incorrectly. Change them in the shader translator. Tracking bug: 210 // http://crbug.com/772651 211 Feature rewriteVectorScalarArithmetic = {"rewrite_vector_scalar_arithmetic", 212 FeatureCategory::OpenGLWorkarounds, 213 "Certain types of GLSL arithmetic ops mixing vectors " 214 "and scalars may be executed incorrectly", 215 &members, "http://crbug.com/772651"}; 216 217 // On some Android devices for loops used to initialize variables hit native GLSL compiler bugs. 218 Feature dontUseLoopsToInitializeVariables = { 219 "dont_use_loops_to_initialize_variables", FeatureCategory::OpenGLWorkarounds, 220 "For loops used to initialize variables hit native GLSL compiler bugs", &members, 221 "http://crbug.com/809422"}; 222 223 // On some NVIDIA drivers gl_FragDepth is not clamped correctly when rendering to a floating 224 // point depth buffer. Clamp it in the translated shader to fix this. 225 Feature clampFragDepth = { 226 "clamp_frag_depth", FeatureCategory::OpenGLWorkarounds, 227 "gl_FragDepth is not clamped correctly when rendering to a floating point depth buffer", 228 &members}; 229 230 // On some NVIDIA drivers before version 397.31 repeated assignment to swizzled values inside a 231 // GLSL user-defined function have incorrect results. Rewrite this type of statements to fix 232 // this. 233 Feature rewriteRepeatedAssignToSwizzled = {"rewrite_repeated_assign_to_swizzled", 234 FeatureCategory::OpenGLWorkarounds, 235 "Repeated assignment to swizzled values inside a " 236 "GLSL user-defined function have incorrect results", 237 &members}; 238 239 // On some AMD and Intel GL drivers ARB_blend_func_extended does not pass the tests. 240 // It might be possible to work around the Intel bug by rewriting *FragData to *FragColor 241 // instead of disabling the functionality entirely. The AMD bug looked like incorrect blending, 242 // not sure if a workaround is feasible. http://anglebug.com/1085 243 Feature disableBlendFuncExtended = { 244 "disable_blend_func_extended", FeatureCategory::OpenGLWorkarounds, 245 "ARB_blend_func_extended does not pass the tests", &members, "http://anglebug.com/1085"}; 246 247 // Qualcomm drivers returns raw sRGB values instead of linearized values when calling 248 // glReadPixels on unsized sRGB texture formats. http://crbug.com/550292 and 249 // http://crbug.com/565179 250 Feature unsizedsRGBReadPixelsDoesntTransform = { 251 "unsized_srgb_read_pixels_doesnt_transform", FeatureCategory::OpenGLWorkarounds, 252 "Drivers returning raw sRGB values instead of linearized values when calling glReadPixels " 253 "on unsized sRGB texture formats", 254 &members, "http://crbug.com/565179"}; 255 256 // Older Qualcomm drivers generate errors when querying the number of bits in timer queries, ex: 257 // GetQueryivEXT(GL_TIME_ELAPSED, GL_QUERY_COUNTER_BITS). http://anglebug.com/3027 258 Feature queryCounterBitsGeneratesErrors = { 259 "query_counter_bits_generates_errors", FeatureCategory::OpenGLWorkarounds, 260 "Drivers generate errors when querying the number of bits in timer queries", &members, 261 "http://anglebug.com/3027"}; 262 263 // Re-linking a program in parallel is buggy on some Intel Windows OpenGL drivers and Android 264 // platforms. 265 // http://anglebug.com/3045 266 Feature dontRelinkProgramsInParallel = { 267 "dont_relink_programs_in_parallel", FeatureCategory::OpenGLWorkarounds, 268 "Relinking a program in parallel is buggy", &members, "http://anglebug.com/3045"}; 269 270 // Some tests have been seen to fail using worker contexts, this switch allows worker contexts 271 // to be disabled for some platforms. http://crbug.com/849576 272 Feature disableWorkerContexts = {"disable_worker_contexts", FeatureCategory::OpenGLWorkarounds, 273 "Some tests have been seen to fail using worker contexts", 274 &members, "http://crbug.com/849576"}; 275 276 // Most Android devices fail to allocate a texture that is larger than 4096. Limit the caps 277 // instead of generating GL_OUT_OF_MEMORY errors. Also causes system to hang on some older 278 // intel mesa drivers on Linux. 279 Feature limitMaxTextureSizeTo4096 = {"max_texture_size_limit_4096", 280 FeatureCategory::OpenGLWorkarounds, 281 "Limit max texture size to 4096 to avoid frequent " 282 "out-of-memory errors", 283 &members, "http://crbug.com/927470"}; 284 285 // Prevent excessive MSAA allocations on Android devices, various rendering bugs have been 286 // observed and they tend to be high DPI anyways. http://crbug.com/797243 287 Feature limitMaxMSAASamplesTo4 = { 288 "max_msaa_sample_count_4", FeatureCategory::OpenGLWorkarounds, 289 "Various rendering bugs have been observed when using higher MSAA counts", &members, 290 "http://crbug.com/797243"}; 291 292 // Prefer to do the robust resource init clear using a glClear. Calls to TexSubImage2D on large 293 // textures can take hundreds of milliseconds because of slow uploads on macOS. Do this only on 294 // macOS because clears are buggy on other drivers. 295 // https://crbug.com/848952 (slow uploads on macOS) 296 // https://crbug.com/883276 (buggy clears on Android) 297 Feature allowClearForRobustResourceInit = { 298 "allow_clear_for_robust_resource_init", FeatureCategory::OpenGLWorkarounds, 299 "Using glClear for robust resource initialization is buggy on some drivers and leads to " 300 "texture corruption. Default to data uploads except on MacOS where it is very slow.", 301 &members, "http://crbug.com/883276"}; 302 303 // Some drivers automatically handle out-of-bounds uniform array access but others need manual 304 // clamping to satisfy the WebGL requirements. 305 Feature clampArrayAccess = {"clamp_array_access", FeatureCategory::OpenGLWorkarounds, 306 "Clamp uniform array access to avoid reading invalid memory.", 307 &members, "http://anglebug.com/2978"}; 308 309 // Reset glTexImage2D base level to workaround pixel comparison failure above Mac OS 10.12.4 on 310 // Intel Mac. 311 Feature resetTexImage2DBaseLevel = {"reset_teximage2d_base_level", 312 FeatureCategory::OpenGLWorkarounds, 313 "Reset texture base level before calling glTexImage2D to " 314 "work around pixel comparison failure.", 315 &members, "https://crbug.com/705865"}; 316 317 // glClearColor does not always work on Intel 6xxx Mac drivers when the clear color made up of 318 // all zeros and ones. 319 Feature clearToZeroOrOneBroken = { 320 "clear_to_zero_or_one_broken", FeatureCategory::OpenGLWorkarounds, 321 "Clears when the clear color is all zeros or ones do not work.", &members, 322 "https://crbug.com/710443"}; 323 324 // Some older Linux Intel mesa drivers will hang the system when allocating large textures. Fix 325 // this by capping the max texture size. 326 Feature limitMax3dArrayTextureSizeTo1024 = { 327 "max_3d_array_texture_size_1024", FeatureCategory::OpenGLWorkarounds, 328 "Limit max 3d texture size and max array texture layers to 1024 to avoid system hang", 329 &members, "http://crbug.com/927470"}; 330 331 // BlitFramebuffer has issues on some platforms with large source/dest texture sizes. This 332 // workaround adjusts the destination rectangle source and dest rectangle to fit within maximum 333 // twice the size of the framebuffer. 334 Feature adjustSrcDstRegionBlitFramebuffer = { 335 "adjust_src_dst_region_for_blitframebuffer", FeatureCategory::OpenGLWorkarounds, 336 "Many platforms have issues with blitFramebuffer when the parameters are large.", &members, 337 "http://crbug.com/830046"}; 338 339 // BlitFramebuffer has issues on Mac when the source bounds aren't enclosed by the framebuffer. 340 // This workaround clips the source region and adjust the dest region proportionally. 341 Feature clipSrcRegionBlitFramebuffer = { 342 "clip_src_region_for_blitframebuffer", FeatureCategory::OpenGLWorkarounds, 343 "Issues with blitFramebuffer when the parameters don't match the framebuffer size.", 344 &members, "http://crbug.com/830046"}; 345 346 // Mac Intel samples transparent black from GL_COMPRESSED_RGB_S3TC_DXT1_EXT 347 Feature rgbDXT1TexturesSampleZeroAlpha = { 348 "rgb_dxt1_textures_sample_zero_alpha", FeatureCategory::OpenGLWorkarounds, 349 "Sampling BLACK texels from RGB DXT1 textures returns transparent black on Mac.", &members, 350 "http://anglebug.com/3729"}; 351 352 // Mac incorrectly executes both sides of && and || expressions when they should short-circuit. 353 Feature unfoldShortCircuits = { 354 "unfold_short_circuits", FeatureCategory::OpenGLWorkarounds, 355 "Mac incorrectly executes both sides of && and || expressions when they should " 356 "short-circuit.", 357 &members, "http://anglebug.com/482"}; 358 359 Feature emulatePrimitiveRestartFixedIndex = { 360 "emulate_primitive_restart_fixed_index", FeatureCategory::OpenGLWorkarounds, 361 "When GL_PRIMITIVE_RESTART_FIXED_INDEX is not available, emulate it with " 362 "GL_PRIMITIVE_RESTART and glPrimitiveRestartIndex.", 363 &members, "http://anglebug.com/3997"}; 364 365 Feature setPrimitiveRestartFixedIndexForDrawArrays = { 366 "set_primitive_restart_fixed_index_for_draw_arrays", FeatureCategory::OpenGLWorkarounds, 367 "Some drivers discard vertex data in DrawArrays calls when the fixed primitive restart " 368 "index is within the number of primitives being drawn.", 369 &members, "http://anglebug.com/3997"}; 370 371 // Dynamic indexing of swizzled l-values doesn't work correctly on various platforms. 372 Feature removeDynamicIndexingOfSwizzledVector = { 373 "remove_dynamic_indexing_of_swizzled_vector", FeatureCategory::OpenGLWorkarounds, 374 "Dynamic indexing of swizzled l-values doesn't work correctly on various platforms.", 375 &members, "http://crbug.com/709351"}; 376 377 // Intel Mac drivers does not treat texelFetchOffset() correctly. 378 Feature preAddTexelFetchOffsets = { 379 "pre_add_texel_fetch_offsets", FeatureCategory::OpenGLWorkarounds, 380 "Intel Mac drivers mistakenly consider the parameter position of nagative vaule as invalid " 381 "even if the sum of position and offset is in range, so we need to add workarounds by " 382 "rewriting texelFetchOffset(sampler, position, lod, offset) into texelFetch(sampler, " 383 "position + offset, lod).", 384 &members, "http://crbug.com/642605"}; 385 386 // All Mac drivers do not handle struct scopes correctly. This workaround overwrites a struct 387 // name with a unique prefix 388 Feature regenerateStructNames = { 389 "regenerate_struct_names", FeatureCategory::OpenGLWorkarounds, 390 "All Mac drivers do not handle struct scopes correctly. This workaround overwrites a struct" 391 "name with a unique prefix.", 392 &members, "http://crbug.com/403957"}; 393 394 // Quite some OpenGL ES drivers don't implement readPixels for RGBA/UNSIGNED_SHORT from 395 // EXT_texture_norm16 correctly 396 Feature readPixelsUsingImplementationColorReadFormatForNorm16 = { 397 "read_pixels_using_implementation_color_read_format", FeatureCategory::OpenGLWorkarounds, 398 "Quite some OpenGL ES drivers don't implement readPixels for RGBA/UNSIGNED_SHORT from " 399 "EXT_texture_norm16 correctly", 400 &members, "http://anglebug.com/4214"}; 401 402 // Bugs exist in some Intel drivers where dependencies are incorrectly 403 // tracked for textures which are copy destinations (via CopyTexImage2D, for 404 // example). Flush before DeleteTexture if these entry points have been 405 // called recently. 406 Feature flushBeforeDeleteTextureIfCopiedTo = { 407 "flush_before_delete_texture_if_copied_to", FeatureCategory::OpenGLWorkarounds, 408 "Some drivers track CopyTex{Sub}Image texture dependencies incorrectly. Flush" 409 " before glDeleteTextures in this case", 410 &members, "http://anglebug.com/4267"}; 411 412 // Rewrite row-major matrices as column-major as a driver bug workaround if 413 // necessary. 414 Feature rewriteRowMajorMatrices = { 415 "rewrite_row_major_matrices", FeatureCategory::OpenGLWorkarounds, 416 "Rewrite row major matrices in shaders as column major as a driver bug workaround", 417 &members, "http://anglebug.com/2273"}; 418 419 // Bugs exist in various OpenGL Intel drivers on Windows that produce incorrect 420 // values for GL_COMPRESSED_SRGB_S3TC_DXT1_EXT format. Replace it with 421 // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT as it's the closest option allowed by 422 // the WebGL extension spec. 423 Feature avoidDXT1sRGBTextureFormat = { 424 "avoid_dxt1_srgb_texture_format", FeatureCategory::OpenGLWorkarounds, 425 "Replaces DXT1 sRGB with DXT1 sRGB Alpha as a driver bug workaround.", &members}; 426 427 // Bugs exist in OpenGL AMD drivers on Windows that produce incorrect pipeline state for 428 // colorMaski calls. 429 Feature disableDrawBuffersIndexed = {"disable_draw_buffers_indexed", 430 FeatureCategory::OpenGLWorkarounds, 431 "Disable OES_draw_buffers_indexed extension.", &members}; 432 433 // GL_EXT_semaphore_fd doesn't work properly with Mesa 19.3.4 and earlier versions. 434 Feature disableSemaphoreFd = {"disable_semaphore_fd", FeatureCategory::OpenGLWorkarounds, 435 "Disable GL_EXT_semaphore_fd extension", &members, 436 "https://crbug.com/1046462"}; 437 438 // GL_EXT_disjoint_timer_query doesn't work properly with Linux VMWare drivers. 439 Feature disableTimestampQueries = { 440 "disable_timestamp_queries", FeatureCategory::OpenGLWorkarounds, 441 "Disable GL_EXT_disjoint_timer_query extension", &members, "https://crbug.com/811661"}; 442 443 // Some drivers use linear blending when generating mipmaps for sRGB textures. Work around this 444 // by generating mipmaps in a linear texture and copying back to sRGB. 445 Feature encodeAndDecodeSRGBForGenerateMipmap = { 446 "decode_encode_srgb_for_generatemipmap", FeatureCategory::OpenGLWorkarounds, 447 "Decode and encode before generateMipmap for srgb format textures.", &members, 448 "http://anglebug.com/4646"}; 449 450 Feature emulateCopyTexImage2DFromRenderbuffers = { 451 "emulate_copyteximage2d_from_renderbuffers", FeatureCategory::OpenGLWorkarounds, 452 "CopyTexImage2D spuriously returns errors on iOS when copying from renderbuffers.", 453 &members, "https://anglebug.com/4674"}; 454 455 Feature disableGPUSwitchingSupport = { 456 "disable_gpu_switching_support", FeatureCategory::OpenGLWorkarounds, 457 "Disable GPU switching support (use only the low-power GPU) on older MacBook Pros.", 458 &members, "https://crbug.com/1091824"}; 459 460 // KHR_parallel_shader_compile fails TSAN on Linux, so we avoid using it with this workaround. 461 Feature disableNativeParallelCompile = { 462 "disable_native_parallel_compile", FeatureCategory::OpenGLWorkarounds, 463 "Do not use native KHR_parallel_shader_compile even when available.", &members, 464 "http://crbug.com/1094869"}; 465 466 Feature emulatePackSkipRowsAndPackSkipPixels = { 467 "emulate_pack_skip_rows_and_pack_skip_pixels", FeatureCategory::OpenGLWorkarounds, 468 "GL_PACK_SKIP_ROWS and GL_PACK_SKIP_PIXELS are ignored in Apple's OpenGL driver.", &members, 469 "https://anglebug.com/4849"}; 470 471 // Some drivers return bogus/1hz values for GetMscRate, which we may want to clamp 472 Feature clampMscRate = { 473 "clamp_msc_rate", FeatureCategory::OpenGLWorkarounds, 474 "Some drivers return bogus values for GetMscRate, so we clamp it to 30Hz", &members, 475 "https://crbug.com/1042393"}; 476 477 // Mac drivers generate GL_INVALID_VALUE when binding a transform feedback buffer with 478 // glBindBufferRange before first binding it to some generic binding point. 479 Feature bindTransformFeedbackBufferBeforeBindBufferRange = { 480 "bind_transform_feedback_buffer_before_bind_buffer_range", 481 FeatureCategory::OpenGLWorkarounds, 482 "Bind transform feedback buffers to the generic binding point before calling " 483 "glBindBufferBase or glBindBufferRange.", 484 &members, "https://anglebug.com/5140"}; 485 486 // Speculative fix for issues on Linux/Wayland where exposing GLX_OML_sync_control renders 487 // Chrome unusable 488 Feature disableSyncControlSupport = { 489 "disable_sync_control_support", FeatureCategory::OpenGLWorkarounds, 490 "Speculative fix for issues on Linux/Wayland where exposing GLX_OML_sync_control renders " 491 "Chrome unusable", 492 &members, "https://crbug.com/1137851"}; 493 494 // Buffers need to maintain a shadow copy of data when buffer data readback is not possible 495 // through the GL API 496 Feature keepBufferShadowCopy = { 497 "keep_buffer_shadow_copy", FeatureCategory::OpenGLWorkarounds, 498 "Maintain a shadow copy of buffer data when the GL API does not permit reading data back.", 499 &members}; 500 501 // glGenerateMipmap fails if the zero texture level is not set on some Mac drivers 502 Feature setZeroLevelBeforeGenerateMipmap = { 503 "set_zero_level_before_generating_mipmap", FeatureCategory::OpenGLWorkarounds, 504 "glGenerateMipmap fails if the zero texture level is not set on some Mac drivers.", 505 &members}; 506 507 // On macOS with AMD GPUs, packed color formats like RGB565 and RGBA4444 are buggy. Promote them 508 // to 8 bit per channel formats. 509 Feature promotePackedFormatsTo8BitPerChannel = { 510 "promote_packed_formats_to_8_bit_per_channel", FeatureCategory::OpenGLWorkarounds, 511 "Packed color formats are buggy on Macs with AMD GPUs", &members, 512 "http://anglebug.com/5469"}; 513 514 // If gl_FragColor is not written by fragment shader, it may cause context lost with Adreno 42x 515 // and 3xx. 516 Feature initFragmentOutputVariables = { 517 "init_fragment_output_variables", FeatureCategory::OpenGLWorkarounds, 518 "No init gl_FragColor causes context lost", &members, "http://crbug.com/1171371"}; 519 520 // On macOS with Intel GPUs, instanced array with divisor > 0 is buggy when first > 0 in 521 // drawArraysInstanced. Shift the attributes with extra offset to workaround. 522 Feature shiftInstancedArrayDataWithExtraOffset = { 523 "shift_instanced_array_data_with_offset", FeatureCategory::OpenGLWorkarounds, 524 "glDrawArraysInstanced is buggy on certain new Mac Intel GPUs", &members, 525 "http://crbug.com/1144207"}; 526 527 // ANGLE needs to support devices that have no native VAOs. Sync everything to the default VAO. 528 Feature syncVertexArraysToDefault = { 529 "sync_vertex_arrays_to_default", FeatureCategory::OpenGLWorkarounds, 530 "Only use the default VAO because of missing support or driver bugs", &members, 531 "http://anglebug.com/5577"}; 532 533 // On desktop Linux/AMD when using the amdgpu drivers, the precise kernel and DRM version are 534 // leaked via GL_RENDERER. We workaround this to improve user privacy. 535 Feature sanitizeAmdGpuRendererString = { 536 "sanitize_amdgpu_renderer_string", FeatureCategory::OpenGLWorkarounds, 537 "Strip precise kernel and DRM version information from amdgpu renderer strings.", &members, 538 "http://crbug.com/1181193"}; 539 540 // Imagination GL drivers are buggy with context switching. We need to ubind fbo to workaround a 541 // crash in the driver. 542 Feature unbindFBOOnContextSwitch = {"unbind_fbo_before_switching_context", 543 FeatureCategory::OpenGLWorkarounds, 544 "Imagination GL drivers are buggy with context switching.", 545 &members, "http://crbug.com/1181193"}; 546 547 Feature flushOnFramebufferChange = {"flush_on_framebuffer_change", 548 FeatureCategory::OpenGLWorkarounds, 549 "Switching framebuffers without a flush can lead to " 550 "crashes on Intel 9th Generation GPU Macs.", 551 &members, "http://crbug.com/1181068"}; 552 553 Feature disableMultisampledRenderToTexture = { 554 "disable_mutlisampled_render_to_texture", FeatureCategory::OpenGLWorkarounds, 555 "Many drivers have bugs when using GL_EXT_multisampled_render_to_texture", &members, 556 "http://anglebug.com/2894"}; 557 558 // Mac OpenGL drivers often hang when calling glTexSubImage with >120kb of data. Instead, upload 559 // the data in <120kb chunks. 560 static constexpr const size_t kUploadTextureDataInChunksUploadSize = (120 * 1024) - 1; 561 Feature uploadTextureDataInChunks = { 562 "chunked_texture_upload", FeatureCategory::OpenGLWorkarounds, 563 "Upload texture data in <120kb chunks to work around Mac driver hangs and crashes.", 564 &members, "http://crbug.com/1181068"}; 565 }; 566 567 inline FeaturesGL::FeaturesGL() = default; 568 inline FeaturesGL::~FeaturesGL() = default; 569 570 } // namespace angle 571 572 #endif // ANGLE_PLATFORM_FEATURESGL_H_ 573