• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Android devices for loops used to initialize variables hit native GLSL compiler bugs.
209     Feature dontUseLoopsToInitializeVariables = {
210         "dont_use_loops_to_initialize_variables", FeatureCategory::OpenGLWorkarounds,
211         "For loops used to initialize variables hit native GLSL compiler bugs", &members,
212         "http://crbug.com/809422"};
213 
214     // On some NVIDIA drivers gl_FragDepth is not clamped correctly when rendering to a floating
215     // point depth buffer. Clamp it in the translated shader to fix this.
216     Feature clampFragDepth = {
217         "clamp_frag_depth", FeatureCategory::OpenGLWorkarounds,
218         "gl_FragDepth is not clamped correctly when rendering to a floating point depth buffer",
219         &members};
220 
221     // On some NVIDIA drivers before version 397.31 repeated assignment to swizzled values inside a
222     // GLSL user-defined function have incorrect results. Rewrite this type of statements to fix
223     // this.
224     Feature rewriteRepeatedAssignToSwizzled = {"rewrite_repeated_assign_to_swizzled",
225                                                FeatureCategory::OpenGLWorkarounds,
226                                                "Repeated assignment to swizzled values inside a "
227                                                "GLSL user-defined function have incorrect results",
228                                                &members};
229 
230     // On some AMD and Intel GL drivers ARB_blend_func_extended does not pass the tests.
231     // It might be possible to work around the Intel bug by rewriting *FragData to *FragColor
232     // instead of disabling the functionality entirely. The AMD bug looked like incorrect blending,
233     // not sure if a workaround is feasible. http://anglebug.com/1085
234     Feature disableBlendFuncExtended = {
235         "disable_blend_func_extended", FeatureCategory::OpenGLWorkarounds,
236         "ARB_blend_func_extended does not pass the tests", &members, "http://anglebug.com/1085"};
237 
238     // Qualcomm drivers returns raw sRGB values instead of linearized values when calling
239     // glReadPixels on unsized sRGB texture formats. http://crbug.com/550292 and
240     // http://crbug.com/565179
241     Feature unsizedsRGBReadPixelsDoesntTransform = {
242         "unsized_srgb_read_pixels_doesnt_transform", FeatureCategory::OpenGLWorkarounds,
243         "Drivers returning raw sRGB values instead of linearized values when calling glReadPixels "
244         "on unsized sRGB texture formats",
245         &members, "http://crbug.com/565179"};
246 
247     // Older Qualcomm drivers generate errors when querying the number of bits in timer queries, ex:
248     // GetQueryivEXT(GL_TIME_ELAPSED, GL_QUERY_COUNTER_BITS).  http://anglebug.com/3027
249     Feature queryCounterBitsGeneratesErrors = {
250         "query_counter_bits_generates_errors", FeatureCategory::OpenGLWorkarounds,
251         "Drivers generate errors when querying the number of bits in timer queries", &members,
252         "http://anglebug.com/3027"};
253 
254     // Re-linking a program in parallel is buggy on some Intel Windows OpenGL drivers and Android
255     // platforms.
256     // http://anglebug.com/3045
257     Feature dontRelinkProgramsInParallel = {
258         "dont_relink_programs_in_parallel", FeatureCategory::OpenGLWorkarounds,
259         "Relinking a program in parallel is buggy", &members, "http://anglebug.com/3045"};
260 
261     // Some tests have been seen to fail using worker contexts, this switch allows worker contexts
262     // to be disabled for some platforms. http://crbug.com/849576
263     Feature disableWorkerContexts = {"disable_worker_contexts", FeatureCategory::OpenGLWorkarounds,
264                                      "Some tests have been seen to fail using worker contexts",
265                                      &members, "http://crbug.com/849576"};
266 
267     // Most Android devices fail to allocate a texture that is larger than 4096. Limit the caps
268     // instead of generating GL_OUT_OF_MEMORY errors. Also causes system to hang on some older
269     // intel mesa drivers on Linux.
270     Feature limitMaxTextureSizeTo4096 = {"max_texture_size_limit_4096",
271                                          FeatureCategory::OpenGLWorkarounds,
272                                          "Limit max texture size to 4096 to avoid frequent "
273                                          "out-of-memory errors",
274                                          &members, "http://crbug.com/927470"};
275 
276     // Prevent excessive MSAA allocations on Android devices, various rendering bugs have been
277     // observed and they tend to be high DPI anyways. http://crbug.com/797243
278     Feature limitMaxMSAASamplesTo4 = {
279         "max_msaa_sample_count_4", FeatureCategory::OpenGLWorkarounds,
280         "Various rendering bugs have been observed when using higher MSAA counts", &members,
281         "http://crbug.com/797243"};
282 
283     // Prefer to do the robust resource init clear using a glClear. Calls to TexSubImage2D on large
284     // textures can take hundreds of milliseconds because of slow uploads on macOS. Do this only on
285     // macOS because clears are buggy on other drivers.
286     // https://crbug.com/848952 (slow uploads on macOS)
287     // https://crbug.com/883276 (buggy clears on Android)
288     Feature allowClearForRobustResourceInit = {
289         "allow_clear_for_robust_resource_init", FeatureCategory::OpenGLWorkarounds,
290         "Using glClear for robust resource initialization is buggy on some drivers and leads to "
291         "texture corruption. Default to data uploads except on MacOS where it is very slow.",
292         &members, "http://crbug.com/883276"};
293 
294     // Some drivers automatically handle out-of-bounds uniform array access but others need manual
295     // clamping to satisfy the WebGL requirements.
296     Feature clampArrayAccess = {"clamp_array_access", FeatureCategory::OpenGLWorkarounds,
297                                 "Clamp uniform array access to avoid reading invalid memory.",
298                                 &members, "http://anglebug.com/2978"};
299 
300     // Reset glTexImage2D base level to workaround pixel comparison failure above Mac OS 10.12.4 on
301     // Intel Mac.
302     Feature resetTexImage2DBaseLevel = {"reset_teximage2d_base_level",
303                                         FeatureCategory::OpenGLWorkarounds,
304                                         "Reset texture base level before calling glTexImage2D to "
305                                         "work around pixel comparison failure.",
306                                         &members, "https://crbug.com/705865"};
307 
308     // glClearColor does not always work on Intel 6xxx Mac drivers when the clear color made up of
309     // all zeros and ones.
310     Feature clearToZeroOrOneBroken = {
311         "clear_to_zero_or_one_broken", FeatureCategory::OpenGLWorkarounds,
312         "Clears when the clear color is all zeros or ones do not work.", &members,
313         "https://crbug.com/710443"};
314 
315     // Some older Linux Intel mesa drivers will hang the system when allocating large textures. Fix
316     // this by capping the max texture size.
317     Feature limitMax3dArrayTextureSizeTo1024 = {
318         "max_3d_array_texture_size_1024", FeatureCategory::OpenGLWorkarounds,
319         "Limit max 3d texture size and max array texture layers to 1024 to avoid system hang",
320         &members, "http://crbug.com/927470"};
321 
322     // BlitFramebuffer has issues on some platforms with large source/dest texture sizes. This
323     // workaround adjusts the destination rectangle source and dest rectangle to fit within maximum
324     // twice the size of the framebuffer.
325     Feature adjustSrcDstRegionBlitFramebuffer = {
326         "adjust_src_dst_region_for_blitframebuffer", FeatureCategory::OpenGLWorkarounds,
327         "Many platforms have issues with blitFramebuffer when the parameters are large.", &members,
328         "http://crbug.com/830046"};
329 
330     // BlitFramebuffer has issues on Mac when the source bounds aren't enclosed by the framebuffer.
331     // This workaround clips the source region and adjust the dest region proportionally.
332     Feature clipSrcRegionBlitFramebuffer = {
333         "clip_src_region_for_blitframebuffer", FeatureCategory::OpenGLWorkarounds,
334         "Issues with blitFramebuffer when the parameters don't match the framebuffer size.",
335         &members, "http://crbug.com/830046"};
336 
337     // Mac Intel samples transparent black from GL_COMPRESSED_RGB_S3TC_DXT1_EXT
338     Feature rgbDXT1TexturesSampleZeroAlpha = {
339         "rgb_dxt1_textures_sample_zero_alpha", FeatureCategory::OpenGLWorkarounds,
340         "Sampling BLACK texels from RGB DXT1 textures returns transparent black on Mac.", &members,
341         "http://anglebug.com/3729"};
342 
343     // Mac incorrectly executes both sides of && and || expressions when they should short-circuit.
344     Feature unfoldShortCircuits = {
345         "unfold_short_circuits", FeatureCategory::OpenGLWorkarounds,
346         "Mac incorrectly executes both sides of && and || expressions when they should "
347         "short-circuit.",
348         &members, "http://anglebug.com/482"};
349 
350     Feature emulatePrimitiveRestartFixedIndex = {
351         "emulate_primitive_restart_fixed_index", FeatureCategory::OpenGLWorkarounds,
352         "When GL_PRIMITIVE_RESTART_FIXED_INDEX is not available, emulate it with "
353         "GL_PRIMITIVE_RESTART and glPrimitiveRestartIndex.",
354         &members, "http://anglebug.com/3997"};
355 
356     Feature setPrimitiveRestartFixedIndexForDrawArrays = {
357         "set_primitive_restart_fixed_index_for_draw_arrays", FeatureCategory::OpenGLWorkarounds,
358         "Some drivers discard vertex data in DrawArrays calls when the fixed primitive restart "
359         "index is within the number of primitives being drawn.",
360         &members, "http://anglebug.com/3997"};
361 
362     // Dynamic indexing of swizzled l-values doesn't work correctly on various platforms.
363     Feature removeDynamicIndexingOfSwizzledVector = {
364         "remove_dynamic_indexing_of_swizzled_vector", FeatureCategory::OpenGLWorkarounds,
365         "Dynamic indexing of swizzled l-values doesn't work correctly on various platforms.",
366         &members, "http://crbug.com/709351"};
367 
368     // Intel Mac drivers does not treat texelFetchOffset() correctly.
369     Feature preAddTexelFetchOffsets = {
370         "pre_add_texel_fetch_offsets", FeatureCategory::OpenGLWorkarounds,
371         "Intel Mac drivers mistakenly consider the parameter position of nagative vaule as invalid "
372         "even if the sum of position and offset is in range, so we need to add workarounds by "
373         "rewriting texelFetchOffset(sampler, position, lod, offset) into texelFetch(sampler, "
374         "position + offset, lod).",
375         &members, "http://crbug.com/642605"};
376 
377     // All Mac drivers do not handle struct scopes correctly. This workaround overwrites a struct
378     // name with a unique prefix
379     Feature regenerateStructNames = {
380         "regenerate_struct_names", FeatureCategory::OpenGLWorkarounds,
381         "All Mac drivers do not handle struct scopes correctly. This workaround overwrites a struct"
382         "name with a unique prefix.",
383         &members, "http://crbug.com/403957"};
384 
385     // Quite some OpenGL ES drivers don't implement readPixels for RGBA/UNSIGNED_SHORT from
386     // EXT_texture_norm16 correctly
387     Feature readPixelsUsingImplementationColorReadFormatForNorm16 = {
388         "read_pixels_using_implementation_color_read_format", FeatureCategory::OpenGLWorkarounds,
389         "Quite some OpenGL ES drivers don't implement readPixels for RGBA/UNSIGNED_SHORT from "
390         "EXT_texture_norm16 correctly",
391         &members, "http://anglebug.com/4214"};
392 
393     // Bugs exist in some Intel drivers where dependencies are incorrectly
394     // tracked for textures which are copy destinations (via CopyTexImage2D, for
395     // example). Flush before DeleteTexture if these entry points have been
396     // called recently.
397     Feature flushBeforeDeleteTextureIfCopiedTo = {
398         "flush_before_delete_texture_if_copied_to", FeatureCategory::OpenGLWorkarounds,
399         "Some drivers track CopyTex{Sub}Image texture dependencies incorrectly. Flush"
400         " before glDeleteTextures in this case",
401         &members, "http://anglebug.com/4267"};
402 
403     // Rewrite row-major matrices as column-major as a driver bug workaround if
404     // necessary.
405     Feature rewriteRowMajorMatrices = {
406         "rewrite_row_major_matrices", FeatureCategory::OpenGLWorkarounds,
407         "Rewrite row major matrices in shaders as column major as a driver bug workaround",
408         &members, "http://anglebug.com/2273"};
409 
410     // Bugs exist in various OpenGL Intel drivers on Windows that produce incorrect
411     // values for GL_COMPRESSED_SRGB_S3TC_DXT1_EXT format. Replace it with
412     // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT as it's the closest option allowed by
413     // the WebGL extension spec.
414     Feature avoidDXT1sRGBTextureFormat = {
415         "avoid_dxt1_srgb_texture_format", FeatureCategory::OpenGLWorkarounds,
416         "Replaces DXT1 sRGB with DXT1 sRGB Alpha as a driver bug workaround.", &members};
417 
418     // Bugs exist in OpenGL AMD drivers on Windows that produce incorrect pipeline state for
419     // colorMaski calls.
420     Feature disableDrawBuffersIndexed = {"disable_draw_buffers_indexed",
421                                          FeatureCategory::OpenGLWorkarounds,
422                                          "Disable OES_draw_buffers_indexed extension.", &members};
423 
424     // GL_EXT_semaphore_fd doesn't work properly with Mesa 19.3.4 and earlier versions.
425     Feature disableSemaphoreFd = {"disable_semaphore_fd", FeatureCategory::OpenGLWorkarounds,
426                                   "Disable GL_EXT_semaphore_fd extension", &members,
427                                   "https://crbug.com/1046462"};
428 
429     // GL_EXT_disjoint_timer_query doesn't work properly with Linux VMWare drivers.
430     Feature disableTimestampQueries = {
431         "disable_timestamp_queries", FeatureCategory::OpenGLWorkarounds,
432         "Disable GL_EXT_disjoint_timer_query extension", &members, "https://crbug.com/811661"};
433 
434     // Some drivers use linear blending when generating mipmaps for sRGB textures. Work around this
435     // by generating mipmaps in a linear texture and copying back to sRGB.
436     Feature encodeAndDecodeSRGBForGenerateMipmap = {
437         "decode_encode_srgb_for_generatemipmap", FeatureCategory::OpenGLWorkarounds,
438         "Decode and encode before generateMipmap for srgb format textures.", &members,
439         "http://anglebug.com/4646"};
440 
441     Feature emulateCopyTexImage2DFromRenderbuffers = {
442         "emulate_copyteximage2d_from_renderbuffers", FeatureCategory::OpenGLWorkarounds,
443         "CopyTexImage2D spuriously returns errors on iOS when copying from renderbuffers.",
444         &members, "https://anglebug.com/4674"};
445 
446     Feature disableGPUSwitchingSupport = {
447         "disable_gpu_switching_support", FeatureCategory::OpenGLWorkarounds,
448         "Disable GPU switching support (use only the low-power GPU) on older MacBook Pros.",
449         &members, "https://crbug.com/1091824"};
450 
451     // KHR_parallel_shader_compile fails TSAN on Linux, so we avoid using it with this workaround.
452     Feature disableNativeParallelCompile = {
453         "disable_native_parallel_compile", FeatureCategory::OpenGLWorkarounds,
454         "Do not use native KHR_parallel_shader_compile even when available.", &members,
455         "http://crbug.com/1094869"};
456 
457     Feature emulatePackSkipRowsAndPackSkipPixels = {
458         "emulate_pack_skip_rows_and_pack_skip_pixels", FeatureCategory::OpenGLWorkarounds,
459         "GL_PACK_SKIP_ROWS and GL_PACK_SKIP_PIXELS are ignored in Apple's OpenGL driver.", &members,
460         "https://anglebug.com/4849"};
461 
462     // Some drivers return bogus/1hz values for GetMscRate, which we may want to clamp
463     Feature clampMscRate = {
464         "clamp_msc_rate", FeatureCategory::OpenGLWorkarounds,
465         "Some drivers return bogus values for GetMscRate, so we clamp it to 30Hz", &members,
466         "https://crbug.com/1042393"};
467 
468     // Mac drivers generate GL_INVALID_VALUE when binding a transform feedback buffer with
469     // glBindBufferRange before first binding it to some generic binding point.
470     Feature bindTransformFeedbackBufferBeforeBindBufferRange = {
471         "bind_transform_feedback_buffer_before_bind_buffer_range",
472         FeatureCategory::OpenGLWorkarounds,
473         "Bind transform feedback buffers to the generic binding point before calling "
474         "glBindBufferBase or glBindBufferRange.",
475         &members, "https://anglebug.com/5140"};
476 
477     // Speculative fix for issues on Linux/Wayland where exposing GLX_OML_sync_control renders
478     // Chrome unusable
479     Feature disableSyncControlSupport = {
480         "disable_sync_control_support", FeatureCategory::OpenGLWorkarounds,
481         "Speculative fix for issues on Linux/Wayland where exposing GLX_OML_sync_control renders "
482         "Chrome unusable",
483         &members, "https://crbug.com/1137851"};
484 
485     // Buffers need to maintain a shadow copy of data when buffer data readback is not possible
486     // through the GL API
487     Feature keepBufferShadowCopy = {
488         "keep_buffer_shadow_copy", FeatureCategory::OpenGLWorkarounds,
489         "Maintain a shadow copy of buffer data when the GL API does not permit reading data back.",
490         &members};
491 
492     // glGenerateMipmap fails if the zero texture level is not set on some Mac drivers
493     Feature setZeroLevelBeforeGenerateMipmap = {
494         "set_zero_level_before_generating_mipmap", FeatureCategory::OpenGLWorkarounds,
495         "glGenerateMipmap fails if the zero texture level is not set on some Mac drivers.",
496         &members};
497 
498     // On macOS with AMD GPUs, packed color formats like RGB565 and RGBA4444 are buggy. Promote them
499     // to 8 bit per channel formats.
500     Feature promotePackedFormatsTo8BitPerChannel = {
501         "promote_packed_formats_to_8_bit_per_channel", FeatureCategory::OpenGLWorkarounds,
502         "Packed color formats are buggy on Macs with AMD GPUs", &members,
503         "http://anglebug.com/5469"};
504 
505     // If gl_FragColor is not written by fragment shader, it may cause context lost with Adreno 42x
506     // and 3xx.
507     Feature initFragmentOutputVariables = {
508         "init_fragment_output_variables", FeatureCategory::OpenGLWorkarounds,
509         "No init gl_FragColor causes context lost", &members, "http://crbug.com/1171371"};
510 
511     // On macOS with Intel GPUs, instanced array with divisor > 0 is buggy when first > 0 in
512     // drawArraysInstanced. Shift the attributes with extra offset to workaround.
513     Feature shiftInstancedArrayDataWithExtraOffset = {
514         "shift_instanced_array_data_with_offset", FeatureCategory::OpenGLWorkarounds,
515         "glDrawArraysInstanced is buggy on certain new Mac Intel GPUs", &members,
516         "http://crbug.com/1144207"};
517 
518     // ANGLE needs to support devices that have no native VAOs. Sync everything to the default VAO.
519     Feature syncVertexArraysToDefault = {
520         "sync_vertex_arrays_to_default", FeatureCategory::OpenGLWorkarounds,
521         "Only use the default VAO because of missing support or driver bugs", &members,
522         "http://anglebug.com/5577"};
523 
524     // On desktop Linux/AMD when using the amdgpu drivers, the precise kernel and DRM version are
525     // leaked via GL_RENDERER. We workaround this to improve user privacy.
526     Feature sanitizeAmdGpuRendererString = {
527         "sanitize_amdgpu_renderer_string", FeatureCategory::OpenGLWorkarounds,
528         "Strip precise kernel and DRM version information from amdgpu renderer strings.", &members,
529         "http://crbug.com/1181193"};
530 
531     // Imagination GL drivers are buggy with context switching. We need to ubind fbo to workaround a
532     // crash in the driver.
533     Feature unbindFBOOnContextSwitch = {"unbind_fbo_before_switching_context",
534                                         FeatureCategory::OpenGLWorkarounds,
535                                         "Imagination GL drivers are buggy with context switching.",
536                                         &members, "http://crbug.com/1181193"};
537 
538     Feature flushOnFramebufferChange = {"flush_on_framebuffer_change",
539                                         FeatureCategory::OpenGLWorkarounds,
540                                         "Switching framebuffers without a flush can lead to "
541                                         "crashes on Intel 9th Generation GPU Macs.",
542                                         &members, "http://crbug.com/1181068"};
543 
544     Feature disableMultisampledRenderToTexture = {
545         "disable_mutlisampled_render_to_texture", FeatureCategory::OpenGLWorkarounds,
546         "Many drivers have bugs when using GL_EXT_multisampled_render_to_texture", &members,
547         "http://anglebug.com/2894"};
548 
549     // Mac OpenGL drivers often hang when calling glTexSubImage with >120kb of data. Instead, upload
550     // the data in <120kb chunks.
551     static constexpr const size_t kUploadTextureDataInChunksUploadSize = (120 * 1024) - 1;
552     Feature uploadTextureDataInChunks                                  = {
553         "chunked_texture_upload", FeatureCategory::OpenGLWorkarounds,
554         "Upload texture data in <120kb chunks to work around Mac driver hangs and crashes.",
555         &members, "http://crbug.com/1181068"};
556 
557     // Qualcomm drivers may sometimes reject immutable ASTC sliced 3D texture
558     // allocation. Instead, use non-immutable allocation internally.
559     Feature emulateImmutableCompressedTexture3D = {
560         "emulate_immutable_compressed_texture_3d", FeatureCategory::OpenGLWorkarounds,
561         "Use non-immutable texture allocation to work around a driver bug.", &members,
562         "https://crbug.com/1060012"};
563 };
564 
565 inline FeaturesGL::FeaturesGL()  = default;
566 inline FeaturesGL::~FeaturesGL() = default;
567 
568 }  // namespace angle
569 
570 #endif  // ANGLE_PLATFORM_FEATURESGL_H_
571