зеркало из https://github.com/AvaloniaUI/angle.git
Don't reset the texture size to zero in TextureGL::releaseTexImage on Mac.
After unbinding IOSurface textures, we reset the texture size to 0 because some platforms don't correctly update their state tracking. This call ends up generating GL_INVALID_OPERATION errors on Mac for unknown reasons. Skip the call, the size reset is not required on Mac anyways. BUG=angleproject:3859 Change-Id: I5e39b6a36aaff41082a5fcc923970f8e97774675 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1769059 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Родитель
2ed7b2906c
Коммит
e2ea45bac5
|
@ -338,6 +338,12 @@ struct FeaturesGL : FeatureSetBase
|
|||
"clip_src_region_for_blitframebuffer", FeatureCategory::OpenGLWorkarounds,
|
||||
"Mac has issues with blitFramebuffer when the parameters don't match the framebuffer size.",
|
||||
&members, "http://crbug.com/830046"};
|
||||
|
||||
// Calling glTexImage2D with zero size on a rectangle texture generates GL errors
|
||||
Feature resettingRectangleTexturesGeneratesErrors = {
|
||||
"reset_rectangle_texture_generates_errors", FeatureCategory::OpenGLWorkarounds,
|
||||
"Calling glTexImage2D with zero size on a rectangle texture generates errors.", &members,
|
||||
"http://anglebug.com/3859"};
|
||||
};
|
||||
|
||||
inline FeaturesGL::FeaturesGL() = default;
|
||||
|
|
|
@ -1191,16 +1191,22 @@ angle::Result TextureGL::bindTexImage(const gl::Context *context, egl::Surface *
|
|||
|
||||
angle::Result TextureGL::releaseTexImage(const gl::Context *context)
|
||||
{
|
||||
// Not all Surface implementations reset the size of mip 0 when releasing, do it manually
|
||||
ASSERT(getType() == gl::TextureType::_2D || getType() == gl::TextureType::Rectangle);
|
||||
|
||||
const FunctionsGL *functions = GetFunctionsGL(context);
|
||||
StateManagerGL *stateManager = GetStateManagerGL(context);
|
||||
const angle::FeaturesGL &features = GetFeaturesGL(context);
|
||||
if (getType() != gl::TextureType::Rectangle &&
|
||||
!features.resettingRectangleTexturesGeneratesErrors.enabled)
|
||||
{
|
||||
// Not all Surface implementations reset the size of mip 0 when releasing, do it manually
|
||||
const FunctionsGL *functions = GetFunctionsGL(context);
|
||||
StateManagerGL *stateManager = GetStateManagerGL(context);
|
||||
|
||||
stateManager->bindTexture(getType(), mTextureID);
|
||||
ASSERT(nativegl::UseTexImage2D(getType()));
|
||||
functions->texImage2D(ToGLenum(getType()), 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
stateManager->bindTexture(getType(), mTextureID);
|
||||
ASSERT(nativegl::UseTexImage2D(getType()));
|
||||
functions->texImage2D(ToGLenum(getType()), 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
nullptr);
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1545,6 +1545,8 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
|
|||
IsLinux() || (IsAndroid() && IsNvidia(vendor)) || (IsWindows() && IsNvidia(vendor));
|
||||
|
||||
features->clipSrcRegionBlitFramebuffer.enabled = IsApple();
|
||||
|
||||
features->resettingRectangleTexturesGeneratesErrors.enabled = IsApple();
|
||||
}
|
||||
|
||||
void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features)
|
||||
|
|
Загрузка…
Ссылка в новой задаче