| Index: Source/core/html/canvas/WebGLVertexArrayObjectOES.cpp
|
| diff --git a/Source/core/html/canvas/WebGLVertexArrayObjectOES.cpp b/Source/core/html/canvas/WebGLVertexArrayObjectOES.cpp
|
| index 82a21d0ba8f7d3abf65a61b551fa3abeac821060..ce137dbc9df194a9b26c1a2df31f6b8b8172ab51 100644
|
| --- a/Source/core/html/canvas/WebGLVertexArrayObjectOES.cpp
|
| +++ b/Source/core/html/canvas/WebGLVertexArrayObjectOES.cpp
|
| @@ -37,150 +37,8 @@ PassRefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> WebGLVertexArrayObjectOES::cre
|
| }
|
|
|
| WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES(WebGLRenderingContextBase* ctx, VaoType type)
|
| - : WebGLContextObject(ctx)
|
| - , m_object(0)
|
| - , m_type(type)
|
| - , m_hasEverBeenBound(false)
|
| -#if ENABLE(OILPAN)
|
| - , m_destructionInProgress(false)
|
| -#endif
|
| - , m_boundElementArrayBuffer(nullptr)
|
| + : WebGLVertexArrayObjectBase(ctx, type)
|
| {
|
| - m_vertexAttribState.reserveCapacity(ctx->maxVertexAttribs());
|
| -
|
| - switch (m_type) {
|
| - case VaoTypeDefault:
|
| - break;
|
| - default:
|
| - m_object = context()->webContext()->createVertexArrayOES();
|
| - break;
|
| - }
|
| -}
|
| -
|
| -WebGLVertexArrayObjectOES::~WebGLVertexArrayObjectOES()
|
| -{
|
| -#if ENABLE(OILPAN)
|
| - m_destructionInProgress = true;
|
| -#endif
|
| -
|
| - // Delete the platform framebuffer resource. Explicit detachment
|
| - // is for the benefit of Oilpan, where this vertex array object
|
| - // isn't detached when it and the WebGLRenderingContextBase object
|
| - // it is registered with are both finalized. Without Oilpan, the
|
| - // object will have been detached.
|
| - //
|
| - // To keep the code regular, the trivial detach()ment is always
|
| - // performed.
|
| - detachAndDeleteObject();
|
| -}
|
| -
|
| -void WebGLVertexArrayObjectOES::dispatchDetached(WebGraphicsContext3D* context3d)
|
| -{
|
| - if (m_boundElementArrayBuffer)
|
| - m_boundElementArrayBuffer->onDetached(context3d);
|
| -
|
| - for (size_t i = 0; i < m_vertexAttribState.size(); ++i) {
|
| - VertexAttribState* state = m_vertexAttribState[i].get();
|
| - if (state->bufferBinding)
|
| - state->bufferBinding->onDetached(context3d);
|
| - }
|
| -}
|
| -
|
| -void WebGLVertexArrayObjectOES::deleteObjectImpl(WebGraphicsContext3D* context3d)
|
| -{
|
| - switch (m_type) {
|
| - case VaoTypeDefault:
|
| - break;
|
| - default:
|
| - context3d->deleteVertexArrayOES(m_object);
|
| - m_object = 0;
|
| - break;
|
| - }
|
| -
|
| -#if ENABLE(OILPAN)
|
| - // These m_boundElementArrayBuffer and m_vertexAttribState heap
|
| - // objects must not be accessed during destruction in the oilpan
|
| - // build. They could have been already finalized. The finalizers
|
| - // of these objects (and their elements) will themselves handle
|
| - // detachment.
|
| - if (!m_destructionInProgress)
|
| - dispatchDetached(context3d);
|
| -#else
|
| - dispatchDetached(context3d);
|
| -#endif
|
| -}
|
| -
|
| -void WebGLVertexArrayObjectOES::setElementArrayBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer> buffer)
|
| -{
|
| - if (buffer)
|
| - buffer->onAttached();
|
| - if (m_boundElementArrayBuffer)
|
| - m_boundElementArrayBuffer->onDetached(context()->webContext());
|
| - m_boundElementArrayBuffer = buffer;
|
| -}
|
| -
|
| -WebGLVertexArrayObjectOES::VertexAttribState* WebGLVertexArrayObjectOES::getVertexAttribState(size_t index)
|
| -{
|
| - ASSERT(index < context()->maxVertexAttribs());
|
| - // Lazily create the vertex attribute states.
|
| - for (size_t i = m_vertexAttribState.size(); i <= index; i++)
|
| - m_vertexAttribState.append(adoptPtrWillBeNoop(new VertexAttribState()));
|
| - return m_vertexAttribState[index].get();
|
| -}
|
| -
|
| -void WebGLVertexArrayObjectOES::setVertexAttribState(
|
| - GLuint index, GLsizei bytesPerElement, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset, PassRefPtrWillBeRawPtr<WebGLBuffer> buffer)
|
| -{
|
| - GLsizei validatedStride = stride ? stride : bytesPerElement;
|
| - VertexAttribState* state = getVertexAttribState(index);
|
| -
|
| - if (buffer)
|
| - buffer->onAttached();
|
| - if (state->bufferBinding)
|
| - state->bufferBinding->onDetached(context()->webContext());
|
| -
|
| - state->bufferBinding = buffer;
|
| - state->bytesPerElement = bytesPerElement;
|
| - state->size = size;
|
| - state->type = type;
|
| - state->normalized = normalized;
|
| - state->stride = validatedStride;
|
| - state->originalStride = stride;
|
| - state->offset = offset;
|
| -}
|
| -
|
| -void WebGLVertexArrayObjectOES::unbindBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer> buffer)
|
| -{
|
| - if (m_boundElementArrayBuffer == buffer) {
|
| - m_boundElementArrayBuffer->onDetached(context()->webContext());
|
| - m_boundElementArrayBuffer = nullptr;
|
| - }
|
| -
|
| - for (size_t i = 0; i < m_vertexAttribState.size(); ++i) {
|
| - VertexAttribState* state = m_vertexAttribState[i].get();
|
| - if (state->bufferBinding == buffer) {
|
| - buffer->onDetached(context()->webContext());
|
| - state->bufferBinding = nullptr;
|
| - }
|
| - }
|
| -}
|
| -
|
| -void WebGLVertexArrayObjectOES::setVertexAttribDivisor(GLuint index, GLuint divisor)
|
| -{
|
| - VertexAttribState* state = getVertexAttribState(index);
|
| - state->divisor = divisor;
|
| -}
|
| -
|
| -DEFINE_TRACE(WebGLVertexArrayObjectOES::VertexAttribState)
|
| -{
|
| - visitor->trace(bufferBinding);
|
| -}
|
| -
|
| -DEFINE_TRACE(WebGLVertexArrayObjectOES)
|
| -{
|
| - visitor->trace(m_boundElementArrayBuffer);
|
| - visitor->trace(m_vertexAttribState);
|
| - WebGLContextObject::trace(visitor);
|
| }
|
|
|
| } // namespace blink
|
|
|