Commit 5807a536 by Yuly Novikov

Fix buffer unbinding upon deletion.

- Remove buffer bindings for new ES3 buffer types. - Fix detachment behavior to GLES3 spec, i.e. detach only from currently bound containers. - Make pack/unpack buffer binding parameter available in GLES3. - Update test expectations. BUG=angleproject:1191 Change-Id: Iab4c1de8d96a523d5af55d22956d50c10f7c93c2 Reviewed-on: https://chromium-review.googlesource.com/315521 Tryjob-Request: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
parent d561057f
...@@ -1077,20 +1077,6 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu ...@@ -1077,20 +1077,6 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
} }
} }
return true; return true;
case GL_PIXEL_PACK_BUFFER_BINDING:
case GL_PIXEL_UNPACK_BUFFER_BINDING:
{
if (mExtensions.pixelBufferObject)
{
*type = GL_INT;
*numParams = 1;
}
else
{
return false;
}
}
return true;
case GL_MAX_VIEWPORT_DIMS: case GL_MAX_VIEWPORT_DIMS:
{ {
*type = GL_INT; *type = GL_INT;
...@@ -1194,6 +1180,15 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu ...@@ -1194,6 +1180,15 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
*type = GL_INT; *type = GL_INT;
*numParams = 1; *numParams = 1;
return true; return true;
case GL_PIXEL_PACK_BUFFER_BINDING:
case GL_PIXEL_UNPACK_BUFFER_BINDING:
if ((mClientVersion < 3) && !mExtensions.pixelBufferObject)
{
return false;
}
*type = GL_INT;
*numParams = 1;
return true;
} }
if (mClientVersion < 3) if (mClientVersion < 3)
...@@ -1519,24 +1514,15 @@ void Context::detachTexture(GLuint texture) ...@@ -1519,24 +1514,15 @@ void Context::detachTexture(GLuint texture)
void Context::detachBuffer(GLuint buffer) void Context::detachBuffer(GLuint buffer)
{ {
// Buffer detachment is handled by Context, because the buffer must also be // Simple pass-through to State's detachBuffer method, since
// attached from any VAOs in existence, and Context holds the VAO map. // only buffer attachments to container objects that are bound to the current context
// should be detached. And all those are available in State.
// [OpenGL ES 2.0.24] section 2.9 page 22:
// If a buffer object is deleted while it is bound, all bindings to that object in the current context
// (i.e. in the thread that called Delete-Buffers) are reset to zero.
mState.removeArrayBufferBinding(buffer); // [OpenGL ES 3.2] section 5.1.2 page 45:
// Attachments to unbound container objects, such as
// mark as freed among the vertex array objects // deletion of a buffer attached to a vertex array object which is not bound to the context,
for (auto &vaoPair : mVertexArrayMap) // are not affected and continue to act as references on the deleted object
{ mState.detachBuffer(buffer);
VertexArray* vertexArray = vaoPair.second;
if (vertexArray != nullptr)
{
vertexArray->detachBuffer(buffer);
}
}
} }
void Context::detachFramebuffer(GLuint framebuffer) void Context::detachFramebuffer(GLuint framebuffer)
......
...@@ -999,17 +999,6 @@ GLuint State::getArrayBufferId() const ...@@ -999,17 +999,6 @@ GLuint State::getArrayBufferId() const
return mArrayBuffer.id(); return mArrayBuffer.id();
} }
bool State::removeArrayBufferBinding(GLuint buffer)
{
if (mArrayBuffer.id() == buffer)
{
mArrayBuffer.set(NULL);
return true;
}
return false;
}
void State::setGenericUniformBufferBinding(Buffer *buffer) void State::setGenericUniformBufferBinding(Buffer *buffer)
{ {
mGenericUniformBuffer.set(buffer); mGenericUniformBuffer.set(buffer);
...@@ -1062,6 +1051,28 @@ Buffer *State::getTargetBuffer(GLenum target) const ...@@ -1062,6 +1051,28 @@ Buffer *State::getTargetBuffer(GLenum target) const
} }
} }
void State::detachBuffer(GLuint bufferName)
{
BindingPointer<Buffer> *buffers[] = {&mArrayBuffer, &mCopyReadBuffer,
&mCopyWriteBuffer, &mPack.pixelBuffer,
&mUnpack.pixelBuffer, &mGenericUniformBuffer};
for (auto buffer : buffers)
{
if (buffer->id() == bufferName)
{
buffer->set(nullptr);
}
}
TransformFeedback *curTransformFeedback = getCurrentTransformFeedback();
if (curTransformFeedback)
{
curTransformFeedback->detachBuffer(bufferName);
}
getVertexArray()->detachBuffer(bufferName);
}
void State::setEnableVertexAttribArray(unsigned int attribNum, bool enabled) void State::setEnableVertexAttribArray(unsigned int attribNum, bool enabled)
{ {
getVertexArray()->enableAttribute(attribNum, enabled); getVertexArray()->enableAttribute(attribNum, enabled);
......
...@@ -198,7 +198,6 @@ class State : angle::NonCopyable ...@@ -198,7 +198,6 @@ class State : angle::NonCopyable
// GL_ARRAY_BUFFER // GL_ARRAY_BUFFER
void setArrayBufferBinding(Buffer *buffer); void setArrayBufferBinding(Buffer *buffer);
GLuint getArrayBufferId() const; GLuint getArrayBufferId() const;
bool removeArrayBufferBinding(GLuint buffer);
// GL_UNIFORM_BUFFER - Both indexed and generic targets // GL_UNIFORM_BUFFER - Both indexed and generic targets
void setGenericUniformBufferBinding(Buffer *buffer); void setGenericUniformBufferBinding(Buffer *buffer);
...@@ -215,6 +214,8 @@ class State : angle::NonCopyable ...@@ -215,6 +214,8 @@ class State : angle::NonCopyable
// Retrieve typed buffer by target (non-indexed) // Retrieve typed buffer by target (non-indexed)
Buffer *getTargetBuffer(GLenum target) const; Buffer *getTargetBuffer(GLenum target) const;
// Detach a buffer from all bindings
void detachBuffer(GLuint bufferName);
// Vertex attrib manipulation // Vertex attrib manipulation
void setEnableVertexAttribArray(unsigned int attribNum, bool enabled); void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
......
...@@ -85,6 +85,24 @@ void TransformFeedback::bindGenericBuffer(Buffer *buffer) ...@@ -85,6 +85,24 @@ void TransformFeedback::bindGenericBuffer(Buffer *buffer)
mImplementation->bindGenericBuffer(mGenericBuffer); mImplementation->bindGenericBuffer(mGenericBuffer);
} }
void TransformFeedback::detachBuffer(GLuint bufferName)
{
for (size_t index = 0; index < mIndexedBuffers.size(); index++)
{
if (mIndexedBuffers[index].id() == bufferName)
{
mIndexedBuffers[index].set(nullptr);
mImplementation->bindIndexedBuffer(index, mIndexedBuffers[index]);
}
}
if (mGenericBuffer.id() == bufferName)
{
mGenericBuffer.set(nullptr);
mImplementation->bindGenericBuffer(mGenericBuffer);
}
}
const BindingPointer<Buffer> &TransformFeedback::getGenericBuffer() const const BindingPointer<Buffer> &TransformFeedback::getGenericBuffer() const
{ {
return mGenericBuffer; return mGenericBuffer;
......
...@@ -45,6 +45,8 @@ class TransformFeedback : public RefCountObject ...@@ -45,6 +45,8 @@ class TransformFeedback : public RefCountObject
const OffsetBindingPointer<Buffer> &getIndexedBuffer(size_t index) const; const OffsetBindingPointer<Buffer> &getIndexedBuffer(size_t index) const;
size_t getIndexedBufferCount() const; size_t getIndexedBufferCount() const;
void detachBuffer(GLuint bufferName);
rx::TransformFeedbackImpl *getImplementation(); rx::TransformFeedbackImpl *getImplementation();
const rx::TransformFeedbackImpl *getImplementation() const; const rx::TransformFeedbackImpl *getImplementation() const;
......
...@@ -583,34 +583,6 @@ ...@@ -583,34 +583,6 @@
1101 WIN : dEQP-GLES3.functional.negative_api.vertex_array.draw_range_elements_incomplete_primitive = FAIL 1101 WIN : dEQP-GLES3.functional.negative_api.vertex_array.draw_range_elements_incomplete_primitive = FAIL
1101 WIN : dEQP-GLES3.functional.negative_api.state.get_buffer_pointerv = FAIL 1101 WIN : dEQP-GLES3.functional.negative_api.state.get_buffer_pointerv = FAIL
1101 WIN : dEQP-GLES3.functional.negative_api.state.get_framebuffer_attachment_parameteriv = FAIL 1101 WIN : dEQP-GLES3.functional.negative_api.state.get_framebuffer_attachment_parameteriv = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.uniform_buffer_binding_getboolean = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.uniform_buffer_binding_getinteger = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.uniform_buffer_binding_getinteger64 = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.uniform_buffer_binding_getfloat = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.pixel_pack_buffer_binding_getboolean = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.pixel_pack_buffer_binding_getinteger = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.pixel_pack_buffer_binding_getinteger64 = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.pixel_pack_buffer_binding_getfloat = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.pixel_unpack_buffer_binding_getboolean = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.pixel_unpack_buffer_binding_getinteger = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.pixel_unpack_buffer_binding_getinteger64 = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.pixel_unpack_buffer_binding_getfloat = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.transform_feedback_buffer_binding_getboolean = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.transform_feedback_buffer_binding_getinteger = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.transform_feedback_buffer_binding_getinteger64 = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.transform_feedback_buffer_binding_getfloat = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.copy_read_buffer_binding_getboolean = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.copy_read_buffer_binding_getinteger = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.copy_read_buffer_binding_getinteger64 = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.copy_read_buffer_binding_getfloat = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.copy_write_buffer_binding_getboolean = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.copy_write_buffer_binding_getinteger = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.copy_write_buffer_binding_getinteger64 = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.copy_write_buffer_binding_getfloat = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.element_array_buffer_binding_getboolean = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.element_array_buffer_binding_getinteger = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.element_array_buffer_binding_getinteger64 = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.element_array_buffer_binding_getfloat = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.sampler_binding_getboolean = FAIL 1101 WIN : dEQP-GLES3.functional.state_query.integers.sampler_binding_getboolean = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.sampler_binding_getinteger = FAIL 1101 WIN : dEQP-GLES3.functional.state_query.integers.sampler_binding_getinteger = FAIL
1101 WIN : dEQP-GLES3.functional.state_query.integers.sampler_binding_getinteger64 = FAIL 1101 WIN : dEQP-GLES3.functional.state_query.integers.sampler_binding_getinteger64 = FAIL
......
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