Skip to content

Commit

Permalink
GL: Re-enable sRGB and BGRA8 extensions
Browse files Browse the repository at this point in the history
GL_EXT_sRGB_write_control and GL_EXT_texture_format_BGRA8888 were
disabled on all of Android as a workaround for Nexus5X driver bugs.
Scope the disablement to Qualcomm only.

Bug: angleproject:347724909
Change-Id: I99d55ee12a98c1b46613be4aa92e92a0e576a82b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637249
Reviewed-by: Amirali Abdolrashidi <[email protected]>
Reviewed-by: Yuxin Hu <[email protected]>
Commit-Queue: Geoff Lang <[email protected]>
  • Loading branch information
vonture authored and Angle LUCI CQ committed Jun 19, 2024
1 parent b991668 commit 1160fda
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 15 deletions.
17 changes: 17 additions & 0 deletions include/platform/autogen/FeaturesGL_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,23 @@ struct FeaturesGL : FeatureSetBase
&members, "https://anglebug.com/8646"
};

FeatureInfo srgbBlendingBroken = {
"srgbBlendingBroken",
FeatureCategory::OpenGLWorkarounds,
"SRGB blending does not appear to work correctly on the some Qualcomm devices. "
"Writing to an SRGB framebuffer with GL_FRAMEBUFFER_SRGB enabled and "
"then reading back returns the same value. Disabling GL_FRAMEBUFFER_SRGB "
"will then convert in the wrong direction.",
&members, "https://crbug.com/40488750"
};

FeatureInfo bgraTexImageFormatsBroken = {
"bgraTexImageFormatsBroken",
FeatureCategory::OpenGLWorkarounds,
"BGRA formats do not appear to be accepted by some qualcomm despite the extension being exposed.",
&members, "https://anglebug.com/40096376"
};

};

inline FeaturesGL::FeaturesGL() = default;
Expand Down
19 changes: 19 additions & 0 deletions include/platform/gl_features.json
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,25 @@
"Qualcomm drivers fail to link after binding fragment data locations."
],
"issue": "https://anglebug.com/8646"
},
{
"name": "srgb_blending_broken",
"category": "Workarounds",
"description": [
"SRGB blending does not appear to work correctly on the some Qualcomm devices. ",
"Writing to an SRGB framebuffer with GL_FRAMEBUFFER_SRGB enabled and ",
"then reading back returns the same value. Disabling GL_FRAMEBUFFER_SRGB ",
"will then convert in the wrong direction."
],
"issue": "https://crbug.com/40488750"
},
{
"name": "bgra_tex_image_formats_broken",
"category": "Workarounds",
"description": [
"BGRA formats do not appear to be accepted by some qualcomm despite the extension being exposed."
],
"issue": "https://anglebug.com/40096376"
}
]
}
34 changes: 19 additions & 15 deletions src/libANGLE/renderer/gl/renderergl_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1837,21 +1837,16 @@ void GenerateCaps(const FunctionsGL *functions,
}
#endif

extensions->sRGBWriteControlEXT = functions->isAtLeastGL(gl::Version(3, 0)) ||
functions->hasGLExtension("GL_EXT_framebuffer_sRGB") ||
functions->hasGLExtension("GL_ARB_framebuffer_sRGB") ||
functions->hasGLESExtension("GL_EXT_sRGB_write_control");

#if defined(ANGLE_PLATFORM_ANDROID)
// SRGB blending does not appear to work correctly on the Nexus 5. Writing to an SRGB
// framebuffer with GL_FRAMEBUFFER_SRGB enabled and then reading back returns the same value.
// Disabling GL_FRAMEBUFFER_SRGB will then convert in the wrong direction.
extensions->sRGBWriteControlEXT = false;

// BGRA formats do not appear to be accepted by the Nexus 5X driver despite the extension being
// exposed.
extensions->textureFormatBGRA8888EXT = false;
#endif
extensions->sRGBWriteControlEXT = !features.srgbBlendingBroken.enabled &&
(functions->isAtLeastGL(gl::Version(3, 0)) ||
functions->hasGLExtension("GL_EXT_framebuffer_sRGB") ||
functions->hasGLExtension("GL_ARB_framebuffer_sRGB") ||
functions->hasGLESExtension("GL_EXT_sRGB_write_control"));

if (features.bgraTexImageFormatsBroken.enabled)
{
extensions->textureFormatBGRA8888EXT = false;
}

// EXT_discard_framebuffer can be implemented as long as glDiscardFramebufferEXT or
// glInvalidateFramebuffer is available
Expand Down Expand Up @@ -2681,6 +2676,15 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
// https://crbug.com/40279678
ANGLE_FEATURE_CONDITION(features, useIntermediateTextureForGenerateMipmap,
IsPixel7OrPixel8(functions));

// SRGB blending does not appear to work correctly on the Nexus 5 + other QC devices. Writing to
// an SRGB framebuffer with GL_FRAMEBUFFER_SRGB enabled and then reading back returns the same
// value. Disabling GL_FRAMEBUFFER_SRGB will then convert in the wrong direction.
ANGLE_FEATURE_CONDITION(features, srgbBlendingBroken, IsQualcomm(vendor));

// BGRA formats do not appear to be accepted by the qualcomm driver despite the extension being
// exposed.
ANGLE_FEATURE_CONDITION(features, bgraTexImageFormatsBroken, IsQualcomm(vendor));
}

void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features)
Expand Down
2 changes: 2 additions & 0 deletions util/autogen/angle_features_autogen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ constexpr PackedEnumMap<Feature, const char *> kFeatureNames = {{
{Feature::AvoidBindFragDataLocation, "avoidBindFragDataLocation"},
{Feature::AvoidOpSelectWithMismatchingRelaxedPrecision, "avoidOpSelectWithMismatchingRelaxedPrecision"},
{Feature::AvoidStencilTextureSwizzle, "avoidStencilTextureSwizzle"},
{Feature::BgraTexImageFormatsBroken, "bgraTexImageFormatsBroken"},
{Feature::BindCompleteFramebufferForTimerQueries, "bindCompleteFramebufferForTimerQueries"},
{Feature::BindTransformFeedbackBufferBeforeBindBufferRange, "bindTransformFeedbackBufferBeforeBindBufferRange"},
{Feature::BorderColorSrgb, "borderColorSrgb"},
Expand Down Expand Up @@ -281,6 +282,7 @@ constexpr PackedEnumMap<Feature, const char *> kFeatureNames = {{
{Feature::SkipVSConstantRegisterZero, "skipVSConstantRegisterZero"},
{Feature::SlowAsyncCommandQueueForTesting, "slowAsyncCommandQueueForTesting"},
{Feature::SlowDownMonolithicPipelineCreationForTesting, "slowDownMonolithicPipelineCreationForTesting"},
{Feature::SrgbBlendingBroken, "srgbBlendingBroken"},
{Feature::Supports16BitInputOutput, "supports16BitInputOutput"},
{Feature::Supports16BitPushConstant, "supports16BitPushConstant"},
{Feature::Supports16BitStorageBuffer, "supports16BitStorageBuffer"},
Expand Down
2 changes: 2 additions & 0 deletions util/autogen/angle_features_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum class Feature
AvoidBindFragDataLocation,
AvoidOpSelectWithMismatchingRelaxedPrecision,
AvoidStencilTextureSwizzle,
BgraTexImageFormatsBroken,
BindCompleteFramebufferForTimerQueries,
BindTransformFeedbackBufferBeforeBindBufferRange,
BorderColorSrgb,
Expand Down Expand Up @@ -281,6 +282,7 @@ enum class Feature
SkipVSConstantRegisterZero,
SlowAsyncCommandQueueForTesting,
SlowDownMonolithicPipelineCreationForTesting,
SrgbBlendingBroken,
Supports16BitInputOutput,
Supports16BitPushConstant,
Supports16BitStorageBuffer,
Expand Down

0 comments on commit 1160fda

Please sign in to comment.