Commit 6d3d381e by Geoff Lang Committed by Commit Bot

GL: Update BufferGL to use ANGLE_GL_TRY.

Refactor the check for keeping shadow data into a feature so it's only initialized once. Bug: angleproject:3020 Change-Id: I45575c246afa7cd54e3a07d7a8464f4d4f45b3be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1769064 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 556d812a
...@@ -492,6 +492,13 @@ struct FeaturesGL : FeatureSetBase ...@@ -492,6 +492,13 @@ struct FeaturesGL : FeatureSetBase
"Speculative fix for issues on Linux/Wayland where exposing GLX_OML_sync_control renders " "Speculative fix for issues on Linux/Wayland where exposing GLX_OML_sync_control renders "
"Chrome unusable", "Chrome unusable",
&members, "https://crbug.com/1137851"}; &members, "https://crbug.com/1137851"};
// Buffers need to maintain a shadow copy of data when buffer data readback is not possible
// through the GL API
Feature keepBufferShadowCopy = {
"keep_buffer_shadow_copy", FeatureCategory::OpenGLWorkarounds,
"Maintain a shadow copy of buffer data when the GL API does not permit reading data back.",
&members};
}; };
inline FeaturesGL::FeaturesGL() = default; inline FeaturesGL::FeaturesGL() = default;
......
...@@ -21,11 +21,11 @@ class StateManagerGL; ...@@ -21,11 +21,11 @@ class StateManagerGL;
class BufferGL : public BufferImpl class BufferGL : public BufferImpl
{ {
public: public:
BufferGL(const gl::BufferState &state, BufferGL(const gl::BufferState &state, GLuint buffer);
const FunctionsGL *functions,
StateManagerGL *stateManager);
~BufferGL() override; ~BufferGL() override;
void destroy(const gl::Context *context) override;
angle::Result setData(const gl::Context *context, angle::Result setData(const gl::Context *context,
gl::BufferBinding target, gl::BufferBinding target,
const void *data, const void *data,
...@@ -63,14 +63,10 @@ class BufferGL : public BufferImpl ...@@ -63,14 +63,10 @@ class BufferGL : public BufferImpl
size_t mMapOffset; size_t mMapOffset;
size_t mMapSize; size_t mMapSize;
bool mShadowBufferData;
angle::MemoryBuffer mShadowCopy; angle::MemoryBuffer mShadowCopy;
size_t mBufferSize; size_t mBufferSize;
const FunctionsGL *mFunctions;
StateManagerGL *mStateManager;
GLuint mBufferID; GLuint mBufferID;
}; };
......
...@@ -105,7 +105,12 @@ RenderbufferImpl *ContextGL::createRenderbuffer(const gl::RenderbufferState &sta ...@@ -105,7 +105,12 @@ RenderbufferImpl *ContextGL::createRenderbuffer(const gl::RenderbufferState &sta
BufferImpl *ContextGL::createBuffer(const gl::BufferState &state) BufferImpl *ContextGL::createBuffer(const gl::BufferState &state)
{ {
return new BufferGL(state, getFunctions(), getStateManager()); const FunctionsGL *functions = getFunctions();
GLuint buffer = 0;
functions->genBuffers(1, &buffer);
return new BufferGL(state, buffer);
} }
VertexArrayImpl *ContextGL::createVertexArray(const gl::VertexArrayState &data) VertexArrayImpl *ContextGL::createVertexArray(const gl::VertexArrayState &data)
......
...@@ -1834,6 +1834,8 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature ...@@ -1834,6 +1834,8 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
// http://crbug.com/1137851 // http://crbug.com/1137851
// Speculative fix for now, leave disabled so users can enable it via flags. // Speculative fix for now, leave disabled so users can enable it via flags.
ANGLE_FEATURE_CONDITION(features, disableSyncControlSupport, false); ANGLE_FEATURE_CONDITION(features, disableSyncControlSupport, false);
ANGLE_FEATURE_CONDITION(features, keepBufferShadowCopy, !CanMapBufferForRead(functions));
} }
void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features) void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment