Path: blob/main_old/include/platform/FeaturesGL.h
1693 views
//1// Copyright 2015 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56// FeaturesGL.h: Features and workarounds for GL driver bugs and other issues.78#ifndef ANGLE_PLATFORM_FEATURESGL_H_9#define ANGLE_PLATFORM_FEATURESGL_H_1011#include "platform/Feature.h"1213namespace angle14{1516struct FeaturesGL : FeatureSetBase17{18FeaturesGL();19~FeaturesGL();2021// When writing a float to a normalized integer framebuffer, desktop OpenGL is allowed to write22// one of the two closest normalized integer representations (although round to nearest is23// preferred) (see section 2.3.5.2 of the GL 4.5 core specification). OpenGL ES requires that24// round-to-nearest is used (see "Conversion from Floating-Point to Framebuffer Fixed-Point" in25// section 2.1.2 of the OpenGL ES 2.0.25 spec). This issue only shows up on AMD drivers on26// framebuffer formats that have 1-bit alpha, work around this by using higher precision formats27// instead.28Feature avoid1BitAlphaTextureFormats = {"avoid_1_bit_alpha_texture_formats",29FeatureCategory::OpenGLWorkarounds,30"Issue with 1-bit alpha framebuffer formats", &members};3132// On some older Intel drivers, GL_RGBA4 is not color renderable, glCheckFramebufferStatus33// returns GL_FRAMEBUFFER_UNSUPPORTED. Work around this by using a known color-renderable34// format.35Feature rgba4IsNotSupportedForColorRendering = {"rgba4_is_not_supported_for_color_rendering",36FeatureCategory::OpenGLWorkarounds,37"GL_RGBA4 is not color renderable", &members};3839// Newer Intel GPUs natively support ETC2/EAC compressed texture formats.40Feature allowEtcFormats = {"allow_etc_formats", FeatureCategory::OpenGLWorkarounds,41"Enable ETC2/EAC on desktop OpenGL", &members};4243// When clearing a framebuffer on Intel or AMD drivers, when GL_FRAMEBUFFER_SRGB is enabled, the44// driver clears to the linearized clear color despite the framebuffer not supporting SRGB45// blending. It only seems to do this when the framebuffer has only linear attachments, mixed46// attachments appear to get the correct clear color.47Feature doesSRGBClearsOnLinearFramebufferAttachments = {48"does_srgb_clears_on_linear_framebuffer_attachments", FeatureCategory::OpenGLWorkarounds,49"Issue clearing framebuffers with linear attachments when GL_FRAMEBUFFER_SRGB is enabled",50&members};5152// On Mac some GLSL constructs involving do-while loops cause GPU hangs, such as the following:53// int i = 1;54// do {55// i --;56// continue;57// } while (i > 0)58// Work around this by rewriting the do-while to use another GLSL construct (block + while)59Feature doWhileGLSLCausesGPUHang = {60"do_while_glsl_causes_gpu_hang", FeatureCategory::OpenGLWorkarounds,61"Some GLSL constructs involving do-while loops cause GPU hangs", &members,62"http://crbug.com/644669"};6364// On Mac AMD GPU gl_VertexID in GLSL vertex shader doesn't include base vertex value,65// Work aronud this by replace gl_VertexID with (gl_VertexID - angle_BaseVertex) when66// angle_BaseVertex is present.67Feature addBaseVertexToVertexID = {68"vertex_id_does_not_include_base_vertex", FeatureCategory::OpenGLWorkarounds,69"gl_VertexID in GLSL vertex shader doesn't include base vertex value", &members};7071// Calling glFinish doesn't cause all queries to report that the result is available on some72// (NVIDIA) drivers. It was found that enabling GL_DEBUG_OUTPUT_SYNCHRONOUS before the finish73// causes it to fully finish.74Feature finishDoesNotCauseQueriesToBeAvailable = {75"finish_does_not_cause_queries_to_be_available", FeatureCategory::OpenGLWorkarounds,76"glFinish doesn't cause all queries to report available result", &members};7778// Always call useProgram after a successful link to avoid a driver bug.79// This workaround is meant to reproduce the use_current_program_after_successful_link80// workaround in Chromium (http://crbug.com/110263). It has been shown that this workaround is81// not necessary for MacOSX 10.9 and higher (http://crrev.com/39eb535b).82Feature alwaysCallUseProgramAfterLink = {83"always_call_use_program_after_link", FeatureCategory::OpenGLWorkarounds,84"Always call useProgram after a successful link to avoid a driver bug", &members,85"http://crbug.com/110263"};8687// On NVIDIA, in the case of unpacking from a pixel unpack buffer, unpack overlapping rows row88// by row.89Feature unpackOverlappingRowsSeparatelyUnpackBuffer = {90"unpack_overlapping_rows_separately_unpack_buffer", FeatureCategory::OpenGLWorkarounds,91"In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row",92&members};9394// On NVIDIA, in the case of packing to a pixel pack buffer, pack overlapping rows row by row.95Feature packOverlappingRowsSeparatelyPackBuffer = {96"pack_overlapping_rows_separately_pack_buffer", FeatureCategory::OpenGLWorkarounds,97"In the case of packing to a pixel pack buffer, pack overlapping rows row by row",98&members};99100// On NVIDIA, during initialization, assign the current vertex attributes to the spec-mandated101// defaults.102Feature initializeCurrentVertexAttributes = {103"initialize_current_vertex_attributes", FeatureCategory::OpenGLWorkarounds,104"During initialization, assign the current vertex attributes to the spec-mandated defaults",105&members};106107// abs(i) where i is an integer returns unexpected result on Intel Mac.108// Emulate abs(i) with i * sign(i).109Feature emulateAbsIntFunction = {"emulate_abs_int_function", FeatureCategory::OpenGLWorkarounds,110"abs(i) where i is an integer returns unexpected result",111&members, "http://crbug.com/642227"};112113// On Intel Mac, calculation of loop conditions in for and while loop has bug.114// Add "&& true" to the end of the condition expression to work around the bug.115Feature addAndTrueToLoopCondition = {116"add_and_true_to_loop_condition", FeatureCategory::OpenGLWorkarounds,117"Calculation of loop conditions in for and while loop has bug", &members};118119// When uploading textures from an unpack buffer, some drivers count an extra row padding when120// checking if the pixel unpack buffer is big enough. Tracking bug: http://anglebug.com/1512121// For example considering the pixel buffer below where in memory, each row data (D) of the122// texture is followed by some unused data (the dots):123// +-------+--+124// |DDDDDDD|..|125// |DDDDDDD|..|126// |DDDDDDD|..|127// |DDDDDDD|..|128// +-------A--B129// The last pixel read will be A, but the driver will think it is B, causing it to generate an130// error when the pixel buffer is just big enough.131Feature unpackLastRowSeparatelyForPaddingInclusion = {132"unpack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds,133"When uploading textures from an unpack buffer, some drivers count an extra row padding",134&members, "http://anglebug.com/1512"};135136// Equivalent workaround when uploading data from a pixel pack buffer.137Feature packLastRowSeparatelyForPaddingInclusion = {138"pack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds,139"When uploading textures from an pack buffer, some drivers count an extra row padding",140&members, "http://anglebug.com/1512"};141142// On some Intel drivers, using isnan() on highp float will get wrong answer. To work around143// this bug, we use an expression to emulate function isnan().144// Tracking bug: http://crbug.com/650547145Feature emulateIsnanFloat = {"emulate_isnan_float", FeatureCategory::OpenGLWorkarounds,146"Using isnan() on highp float will get wrong answer", &members,147"http://crbug.com/650547"};148149// On Mac with OpenGL version 4.1, unused std140 or shared uniform blocks will be150// treated as inactive which is not consistent with WebGL2.0 spec. Reference all members in a151// unused std140 or shared uniform block at the beginning of main to work around it.152// Also used on Linux AMD.153Feature useUnusedBlocksWithStandardOrSharedLayout = {154"use_unused_blocks_with_standard_or_shared_layout", FeatureCategory::OpenGLWorkarounds,155"Unused std140 or shared uniform blocks will be treated as inactive", &members};156157// This flag is used to fix spec difference between GLSL 4.1 or lower and ESSL3.158Feature removeInvariantAndCentroidForESSL3 = {159"remove_invarient_and_centroid_for_essl3", FeatureCategory::OpenGLWorkarounds,160"Fix spec difference between GLSL 4.1 or lower and ESSL3", &members};161162// On Intel Mac OSX 10.11 driver, using "-float" will get wrong answer. Use "0.0 - float" to163// replace "-float".164// Tracking bug: http://crbug.com/308366165Feature rewriteFloatUnaryMinusOperator = {166"rewrite_float_unary_minus_operator", FeatureCategory::OpenGLWorkarounds,167"Using '-<float>' will get wrong answer", &members, "http://crbug.com/308366"};168169// On NVIDIA drivers, atan(y, x) may return a wrong answer.170// Tracking bug: http://crbug.com/672380171Feature emulateAtan2Float = {"emulate_atan_2_float", FeatureCategory::OpenGLWorkarounds,172"atan(y, x) may return a wrong answer", &members,173"http://crbug.com/672380"};174175// Some drivers seem to forget about UBO bindings when using program binaries. Work around176// this by re-applying the bindings after the program binary is loaded or saved.177// This only seems to affect AMD OpenGL drivers, and some Android devices.178// http://anglebug.com/1637179Feature reapplyUBOBindingsAfterUsingBinaryProgram = {180"reapply_ubo_bindings_after_using_binary_program", FeatureCategory::OpenGLWorkarounds,181"Some drivers forget about UBO bindings when using program binaries", &members,182"http://anglebug.com/1637"};183184// Some Linux OpenGL drivers return 0 when we query MAX_VERTEX_ATTRIB_STRIDE in an OpenGL 4.4 or185// higher context.186// This only seems to affect AMD OpenGL drivers.187// Tracking bug: http://anglebug.com/1936188Feature emulateMaxVertexAttribStride = {189"emulate_max_vertex_attrib_stride", FeatureCategory::OpenGLWorkarounds,190"Some drivers return 0 when MAX_VERTEX_ATTRIB_STRIED queried", &members,191"http://anglebug.com/1936"};192193// Initializing uninitialized locals caused odd behavior on Android Qualcomm in a few WebGL 2194// tests. Tracking bug: http://anglebug.com/2046195Feature dontInitializeUninitializedLocals = {196"dont_initialize_uninitialized_locals", FeatureCategory::OpenGLWorkarounds,197"Initializing uninitialized locals caused odd behavior in a few WebGL 2 tests", &members,198"http://anglebug.com/2046"};199200// On some NVIDIA drivers the point size range reported from the API is inconsistent with the201// actual behavior. Clamp the point size to the value from the API to fix this.202Feature clampPointSize = {203"clamp_point_size", FeatureCategory::OpenGLWorkarounds,204"The point size range reported from the API is inconsistent with the actual behavior",205&members};206207// On some Android devices for loops used to initialize variables hit native GLSL compiler bugs.208Feature dontUseLoopsToInitializeVariables = {209"dont_use_loops_to_initialize_variables", FeatureCategory::OpenGLWorkarounds,210"For loops used to initialize variables hit native GLSL compiler bugs", &members,211"http://crbug.com/809422"};212213// On some NVIDIA drivers gl_FragDepth is not clamped correctly when rendering to a floating214// point depth buffer. Clamp it in the translated shader to fix this.215Feature clampFragDepth = {216"clamp_frag_depth", FeatureCategory::OpenGLWorkarounds,217"gl_FragDepth is not clamped correctly when rendering to a floating point depth buffer",218&members};219220// On some NVIDIA drivers before version 397.31 repeated assignment to swizzled values inside a221// GLSL user-defined function have incorrect results. Rewrite this type of statements to fix222// this.223Feature rewriteRepeatedAssignToSwizzled = {"rewrite_repeated_assign_to_swizzled",224FeatureCategory::OpenGLWorkarounds,225"Repeated assignment to swizzled values inside a "226"GLSL user-defined function have incorrect results",227&members};228229// On some AMD and Intel GL drivers ARB_blend_func_extended does not pass the tests.230// It might be possible to work around the Intel bug by rewriting *FragData to *FragColor231// instead of disabling the functionality entirely. The AMD bug looked like incorrect blending,232// not sure if a workaround is feasible. http://anglebug.com/1085233Feature disableBlendFuncExtended = {234"disable_blend_func_extended", FeatureCategory::OpenGLWorkarounds,235"ARB_blend_func_extended does not pass the tests", &members, "http://anglebug.com/1085"};236237// Qualcomm drivers returns raw sRGB values instead of linearized values when calling238// glReadPixels on unsized sRGB texture formats. http://crbug.com/550292 and239// http://crbug.com/565179240Feature unsizedsRGBReadPixelsDoesntTransform = {241"unsized_srgb_read_pixels_doesnt_transform", FeatureCategory::OpenGLWorkarounds,242"Drivers returning raw sRGB values instead of linearized values when calling glReadPixels "243"on unsized sRGB texture formats",244&members, "http://crbug.com/565179"};245246// Older Qualcomm drivers generate errors when querying the number of bits in timer queries, ex:247// GetQueryivEXT(GL_TIME_ELAPSED, GL_QUERY_COUNTER_BITS). http://anglebug.com/3027248Feature queryCounterBitsGeneratesErrors = {249"query_counter_bits_generates_errors", FeatureCategory::OpenGLWorkarounds,250"Drivers generate errors when querying the number of bits in timer queries", &members,251"http://anglebug.com/3027"};252253// Re-linking a program in parallel is buggy on some Intel Windows OpenGL drivers and Android254// platforms.255// http://anglebug.com/3045256Feature dontRelinkProgramsInParallel = {257"dont_relink_programs_in_parallel", FeatureCategory::OpenGLWorkarounds,258"Relinking a program in parallel is buggy", &members, "http://anglebug.com/3045"};259260// Some tests have been seen to fail using worker contexts, this switch allows worker contexts261// to be disabled for some platforms. http://crbug.com/849576262Feature disableWorkerContexts = {"disable_worker_contexts", FeatureCategory::OpenGLWorkarounds,263"Some tests have been seen to fail using worker contexts",264&members, "http://crbug.com/849576"};265266// Most Android devices fail to allocate a texture that is larger than 4096. Limit the caps267// instead of generating GL_OUT_OF_MEMORY errors. Also causes system to hang on some older268// intel mesa drivers on Linux.269Feature limitMaxTextureSizeTo4096 = {"max_texture_size_limit_4096",270FeatureCategory::OpenGLWorkarounds,271"Limit max texture size to 4096 to avoid frequent "272"out-of-memory errors",273&members, "http://crbug.com/927470"};274275// Prevent excessive MSAA allocations on Android devices, various rendering bugs have been276// observed and they tend to be high DPI anyways. http://crbug.com/797243277Feature limitMaxMSAASamplesTo4 = {278"max_msaa_sample_count_4", FeatureCategory::OpenGLWorkarounds,279"Various rendering bugs have been observed when using higher MSAA counts", &members,280"http://crbug.com/797243"};281282// Prefer to do the robust resource init clear using a glClear. Calls to TexSubImage2D on large283// textures can take hundreds of milliseconds because of slow uploads on macOS. Do this only on284// macOS because clears are buggy on other drivers.285// https://crbug.com/848952 (slow uploads on macOS)286// https://crbug.com/883276 (buggy clears on Android)287Feature allowClearForRobustResourceInit = {288"allow_clear_for_robust_resource_init", FeatureCategory::OpenGLWorkarounds,289"Using glClear for robust resource initialization is buggy on some drivers and leads to "290"texture corruption. Default to data uploads except on MacOS where it is very slow.",291&members, "http://crbug.com/883276"};292293// Some drivers automatically handle out-of-bounds uniform array access but others need manual294// clamping to satisfy the WebGL requirements.295Feature clampArrayAccess = {"clamp_array_access", FeatureCategory::OpenGLWorkarounds,296"Clamp uniform array access to avoid reading invalid memory.",297&members, "http://anglebug.com/2978"};298299// Reset glTexImage2D base level to workaround pixel comparison failure above Mac OS 10.12.4 on300// Intel Mac.301Feature resetTexImage2DBaseLevel = {"reset_teximage2d_base_level",302FeatureCategory::OpenGLWorkarounds,303"Reset texture base level before calling glTexImage2D to "304"work around pixel comparison failure.",305&members, "https://crbug.com/705865"};306307// glClearColor does not always work on Intel 6xxx Mac drivers when the clear color made up of308// all zeros and ones.309Feature clearToZeroOrOneBroken = {310"clear_to_zero_or_one_broken", FeatureCategory::OpenGLWorkarounds,311"Clears when the clear color is all zeros or ones do not work.", &members,312"https://crbug.com/710443"};313314// Some older Linux Intel mesa drivers will hang the system when allocating large textures. Fix315// this by capping the max texture size.316Feature limitMax3dArrayTextureSizeTo1024 = {317"max_3d_array_texture_size_1024", FeatureCategory::OpenGLWorkarounds,318"Limit max 3d texture size and max array texture layers to 1024 to avoid system hang",319&members, "http://crbug.com/927470"};320321// BlitFramebuffer has issues on some platforms with large source/dest texture sizes. This322// workaround adjusts the destination rectangle source and dest rectangle to fit within maximum323// twice the size of the framebuffer.324Feature adjustSrcDstRegionBlitFramebuffer = {325"adjust_src_dst_region_for_blitframebuffer", FeatureCategory::OpenGLWorkarounds,326"Many platforms have issues with blitFramebuffer when the parameters are large.", &members,327"http://crbug.com/830046"};328329// BlitFramebuffer has issues on Mac when the source bounds aren't enclosed by the framebuffer.330// This workaround clips the source region and adjust the dest region proportionally.331Feature clipSrcRegionBlitFramebuffer = {332"clip_src_region_for_blitframebuffer", FeatureCategory::OpenGLWorkarounds,333"Issues with blitFramebuffer when the parameters don't match the framebuffer size.",334&members, "http://crbug.com/830046"};335336// Mac Intel samples transparent black from GL_COMPRESSED_RGB_S3TC_DXT1_EXT337Feature rgbDXT1TexturesSampleZeroAlpha = {338"rgb_dxt1_textures_sample_zero_alpha", FeatureCategory::OpenGLWorkarounds,339"Sampling BLACK texels from RGB DXT1 textures returns transparent black on Mac.", &members,340"http://anglebug.com/3729"};341342// Mac incorrectly executes both sides of && and || expressions when they should short-circuit.343Feature unfoldShortCircuits = {344"unfold_short_circuits", FeatureCategory::OpenGLWorkarounds,345"Mac incorrectly executes both sides of && and || expressions when they should "346"short-circuit.",347&members, "http://anglebug.com/482"};348349Feature emulatePrimitiveRestartFixedIndex = {350"emulate_primitive_restart_fixed_index", FeatureCategory::OpenGLWorkarounds,351"When GL_PRIMITIVE_RESTART_FIXED_INDEX is not available, emulate it with "352"GL_PRIMITIVE_RESTART and glPrimitiveRestartIndex.",353&members, "http://anglebug.com/3997"};354355Feature setPrimitiveRestartFixedIndexForDrawArrays = {356"set_primitive_restart_fixed_index_for_draw_arrays", FeatureCategory::OpenGLWorkarounds,357"Some drivers discard vertex data in DrawArrays calls when the fixed primitive restart "358"index is within the number of primitives being drawn.",359&members, "http://anglebug.com/3997"};360361// Dynamic indexing of swizzled l-values doesn't work correctly on various platforms.362Feature removeDynamicIndexingOfSwizzledVector = {363"remove_dynamic_indexing_of_swizzled_vector", FeatureCategory::OpenGLWorkarounds,364"Dynamic indexing of swizzled l-values doesn't work correctly on various platforms.",365&members, "http://crbug.com/709351"};366367// Intel Mac drivers does not treat texelFetchOffset() correctly.368Feature preAddTexelFetchOffsets = {369"pre_add_texel_fetch_offsets", FeatureCategory::OpenGLWorkarounds,370"Intel Mac drivers mistakenly consider the parameter position of nagative vaule as invalid "371"even if the sum of position and offset is in range, so we need to add workarounds by "372"rewriting texelFetchOffset(sampler, position, lod, offset) into texelFetch(sampler, "373"position + offset, lod).",374&members, "http://crbug.com/642605"};375376// All Mac drivers do not handle struct scopes correctly. This workaround overwrites a struct377// name with a unique prefix378Feature regenerateStructNames = {379"regenerate_struct_names", FeatureCategory::OpenGLWorkarounds,380"All Mac drivers do not handle struct scopes correctly. This workaround overwrites a struct"381"name with a unique prefix.",382&members, "http://crbug.com/403957"};383384// Quite some OpenGL ES drivers don't implement readPixels for RGBA/UNSIGNED_SHORT from385// EXT_texture_norm16 correctly386Feature readPixelsUsingImplementationColorReadFormatForNorm16 = {387"read_pixels_using_implementation_color_read_format", FeatureCategory::OpenGLWorkarounds,388"Quite some OpenGL ES drivers don't implement readPixels for RGBA/UNSIGNED_SHORT from "389"EXT_texture_norm16 correctly",390&members, "http://anglebug.com/4214"};391392// Bugs exist in some Intel drivers where dependencies are incorrectly393// tracked for textures which are copy destinations (via CopyTexImage2D, for394// example). Flush before DeleteTexture if these entry points have been395// called recently.396Feature flushBeforeDeleteTextureIfCopiedTo = {397"flush_before_delete_texture_if_copied_to", FeatureCategory::OpenGLWorkarounds,398"Some drivers track CopyTex{Sub}Image texture dependencies incorrectly. Flush"399" before glDeleteTextures in this case",400&members, "http://anglebug.com/4267"};401402// Rewrite row-major matrices as column-major as a driver bug workaround if403// necessary.404Feature rewriteRowMajorMatrices = {405"rewrite_row_major_matrices", FeatureCategory::OpenGLWorkarounds,406"Rewrite row major matrices in shaders as column major as a driver bug workaround",407&members, "http://anglebug.com/2273"};408409// Bugs exist in various OpenGL Intel drivers on Windows that produce incorrect410// values for GL_COMPRESSED_SRGB_S3TC_DXT1_EXT format. Replace it with411// GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT as it's the closest option allowed by412// the WebGL extension spec.413Feature avoidDXT1sRGBTextureFormat = {414"avoid_dxt1_srgb_texture_format", FeatureCategory::OpenGLWorkarounds,415"Replaces DXT1 sRGB with DXT1 sRGB Alpha as a driver bug workaround.", &members};416417// Bugs exist in OpenGL AMD drivers on Windows that produce incorrect pipeline state for418// colorMaski calls.419Feature disableDrawBuffersIndexed = {"disable_draw_buffers_indexed",420FeatureCategory::OpenGLWorkarounds,421"Disable OES_draw_buffers_indexed extension.", &members};422423// GL_EXT_semaphore_fd doesn't work properly with Mesa 19.3.4 and earlier versions.424Feature disableSemaphoreFd = {"disable_semaphore_fd", FeatureCategory::OpenGLWorkarounds,425"Disable GL_EXT_semaphore_fd extension", &members,426"https://crbug.com/1046462"};427428// GL_EXT_disjoint_timer_query doesn't work properly with Linux VMWare drivers.429Feature disableTimestampQueries = {430"disable_timestamp_queries", FeatureCategory::OpenGLWorkarounds,431"Disable GL_EXT_disjoint_timer_query extension", &members, "https://crbug.com/811661"};432433// Some drivers use linear blending when generating mipmaps for sRGB textures. Work around this434// by generating mipmaps in a linear texture and copying back to sRGB.435Feature encodeAndDecodeSRGBForGenerateMipmap = {436"decode_encode_srgb_for_generatemipmap", FeatureCategory::OpenGLWorkarounds,437"Decode and encode before generateMipmap for srgb format textures.", &members,438"http://anglebug.com/4646"};439440Feature emulateCopyTexImage2DFromRenderbuffers = {441"emulate_copyteximage2d_from_renderbuffers", FeatureCategory::OpenGLWorkarounds,442"CopyTexImage2D spuriously returns errors on iOS when copying from renderbuffers.",443&members, "https://anglebug.com/4674"};444445Feature disableGPUSwitchingSupport = {446"disable_gpu_switching_support", FeatureCategory::OpenGLWorkarounds,447"Disable GPU switching support (use only the low-power GPU) on older MacBook Pros.",448&members, "https://crbug.com/1091824"};449450// KHR_parallel_shader_compile fails TSAN on Linux, so we avoid using it with this workaround.451Feature disableNativeParallelCompile = {452"disable_native_parallel_compile", FeatureCategory::OpenGLWorkarounds,453"Do not use native KHR_parallel_shader_compile even when available.", &members,454"http://crbug.com/1094869"};455456Feature emulatePackSkipRowsAndPackSkipPixels = {457"emulate_pack_skip_rows_and_pack_skip_pixels", FeatureCategory::OpenGLWorkarounds,458"GL_PACK_SKIP_ROWS and GL_PACK_SKIP_PIXELS are ignored in Apple's OpenGL driver.", &members,459"https://anglebug.com/4849"};460461// Some drivers return bogus/1hz values for GetMscRate, which we may want to clamp462Feature clampMscRate = {463"clamp_msc_rate", FeatureCategory::OpenGLWorkarounds,464"Some drivers return bogus values for GetMscRate, so we clamp it to 30Hz", &members,465"https://crbug.com/1042393"};466467// Mac drivers generate GL_INVALID_VALUE when binding a transform feedback buffer with468// glBindBufferRange before first binding it to some generic binding point.469Feature bindTransformFeedbackBufferBeforeBindBufferRange = {470"bind_transform_feedback_buffer_before_bind_buffer_range",471FeatureCategory::OpenGLWorkarounds,472"Bind transform feedback buffers to the generic binding point before calling "473"glBindBufferBase or glBindBufferRange.",474&members, "https://anglebug.com/5140"};475476// Speculative fix for issues on Linux/Wayland where exposing GLX_OML_sync_control renders477// Chrome unusable478Feature disableSyncControlSupport = {479"disable_sync_control_support", FeatureCategory::OpenGLWorkarounds,480"Speculative fix for issues on Linux/Wayland where exposing GLX_OML_sync_control renders "481"Chrome unusable",482&members, "https://crbug.com/1137851"};483484// Buffers need to maintain a shadow copy of data when buffer data readback is not possible485// through the GL API486Feature keepBufferShadowCopy = {487"keep_buffer_shadow_copy", FeatureCategory::OpenGLWorkarounds,488"Maintain a shadow copy of buffer data when the GL API does not permit reading data back.",489&members};490491// glGenerateMipmap fails if the zero texture level is not set on some Mac drivers492Feature setZeroLevelBeforeGenerateMipmap = {493"set_zero_level_before_generating_mipmap", FeatureCategory::OpenGLWorkarounds,494"glGenerateMipmap fails if the zero texture level is not set on some Mac drivers.",495&members};496497// On macOS with AMD GPUs, packed color formats like RGB565 and RGBA4444 are buggy. Promote them498// to 8 bit per channel formats.499Feature promotePackedFormatsTo8BitPerChannel = {500"promote_packed_formats_to_8_bit_per_channel", FeatureCategory::OpenGLWorkarounds,501"Packed color formats are buggy on Macs with AMD GPUs", &members,502"http://anglebug.com/5469"};503504// If gl_FragColor is not written by fragment shader, it may cause context lost with Adreno 42x505// and 3xx.506Feature initFragmentOutputVariables = {507"init_fragment_output_variables", FeatureCategory::OpenGLWorkarounds,508"No init gl_FragColor causes context lost", &members, "http://crbug.com/1171371"};509510// On macOS with Intel GPUs, instanced array with divisor > 0 is buggy when first > 0 in511// drawArraysInstanced. Shift the attributes with extra offset to workaround.512Feature shiftInstancedArrayDataWithExtraOffset = {513"shift_instanced_array_data_with_offset", FeatureCategory::OpenGLWorkarounds,514"glDrawArraysInstanced is buggy on certain new Mac Intel GPUs", &members,515"http://crbug.com/1144207"};516517// ANGLE needs to support devices that have no native VAOs. Sync everything to the default VAO.518Feature syncVertexArraysToDefault = {519"sync_vertex_arrays_to_default", FeatureCategory::OpenGLWorkarounds,520"Only use the default VAO because of missing support or driver bugs", &members,521"http://anglebug.com/5577"};522523// On desktop Linux/AMD when using the amdgpu drivers, the precise kernel and DRM version are524// leaked via GL_RENDERER. We workaround this to improve user privacy.525Feature sanitizeAmdGpuRendererString = {526"sanitize_amdgpu_renderer_string", FeatureCategory::OpenGLWorkarounds,527"Strip precise kernel and DRM version information from amdgpu renderer strings.", &members,528"http://crbug.com/1181193"};529530// Imagination GL drivers are buggy with context switching. We need to ubind fbo to workaround a531// crash in the driver.532Feature unbindFBOOnContextSwitch = {"unbind_fbo_before_switching_context",533FeatureCategory::OpenGLWorkarounds,534"Imagination GL drivers are buggy with context switching.",535&members, "http://crbug.com/1181193"};536537Feature flushOnFramebufferChange = {"flush_on_framebuffer_change",538FeatureCategory::OpenGLWorkarounds,539"Switching framebuffers without a flush can lead to "540"crashes on Intel 9th Generation GPU Macs.",541&members, "http://crbug.com/1181068"};542543Feature disableMultisampledRenderToTexture = {544"disable_mutlisampled_render_to_texture", FeatureCategory::OpenGLWorkarounds,545"Many drivers have bugs when using GL_EXT_multisampled_render_to_texture", &members,546"http://anglebug.com/2894"};547548// Mac OpenGL drivers often hang when calling glTexSubImage with >120kb of data. Instead, upload549// the data in <120kb chunks.550static constexpr const size_t kUploadTextureDataInChunksUploadSize = (120 * 1024) - 1;551Feature uploadTextureDataInChunks = {552"chunked_texture_upload", FeatureCategory::OpenGLWorkarounds,553"Upload texture data in <120kb chunks to work around Mac driver hangs and crashes.",554&members, "http://crbug.com/1181068"};555556// Qualcomm drivers may sometimes reject immutable ASTC sliced 3D texture557// allocation. Instead, use non-immutable allocation internally.558Feature emulateImmutableCompressedTexture3D = {559"emulate_immutable_compressed_texture_3d", FeatureCategory::OpenGLWorkarounds,560"Use non-immutable texture allocation to work around a driver bug.", &members,561"https://crbug.com/1060012"};562};563564inline FeaturesGL::FeaturesGL() = default;565inline FeaturesGL::~FeaturesGL() = default;566567} // namespace angle568569#endif // ANGLE_PLATFORM_FEATURESGL_H_570571572