Commit ea0f3496 by Geoff Lang Committed by Commit Bot

GL: Update VertexArrayGL to not store per-context state.

Move StateManagerGL and FunctionsGL members out of VertexArrayGL and query them directly from the context in methods. Bug: angleproject:5577, chromium:1167179 Change-Id: I376f3eff15fbd9855c5956737064f56d54acbceb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2647868Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent f6925344
...@@ -115,7 +115,12 @@ BufferImpl *ContextGL::createBuffer(const gl::BufferState &state) ...@@ -115,7 +115,12 @@ BufferImpl *ContextGL::createBuffer(const gl::BufferState &state)
VertexArrayImpl *ContextGL::createVertexArray(const gl::VertexArrayState &data) VertexArrayImpl *ContextGL::createVertexArray(const gl::VertexArrayState &data)
{ {
return new VertexArrayGL(data, getFunctions(), getStateManager()); const FunctionsGL *functions = getFunctions();
GLuint vao = 0;
functions->genVertexArrays(1, &vao);
return new VertexArrayGL(data, vao);
} }
QueryImpl *ContextGL::createQuery(gl::QueryType type) QueryImpl *ContextGL::createQuery(gl::QueryType type)
...@@ -216,7 +221,7 @@ ANGLE_INLINE angle::Result ContextGL::setDrawArraysState(const gl::Context *cont ...@@ -216,7 +221,7 @@ ANGLE_INLINE angle::Result ContextGL::setDrawArraysState(const gl::Context *cont
first, count, instanceCount)); first, count, instanceCount));
#if defined(ANGLE_STATE_VALIDATION_ENABLED) #if defined(ANGLE_STATE_VALIDATION_ENABLED)
vaoGL->validateState(); vaoGL->validateState(context);
#endif // ANGLE_STATE_VALIDATION_ENABLED #endif // ANGLE_STATE_VALIDATION_ENABLED
} }
...@@ -266,7 +271,7 @@ ANGLE_INLINE angle::Result ContextGL::setDrawElementsState(const gl::Context *co ...@@ -266,7 +271,7 @@ ANGLE_INLINE angle::Result ContextGL::setDrawElementsState(const gl::Context *co
#if defined(ANGLE_STATE_VALIDATION_ENABLED) #if defined(ANGLE_STATE_VALIDATION_ENABLED)
const VertexArrayGL *vaoGL = GetImplAs<VertexArrayGL>(vao); const VertexArrayGL *vaoGL = GetImplAs<VertexArrayGL>(vao);
vaoGL->validateState(); vaoGL->validateState(context);
#endif // ANGLE_STATE_VALIDATION_ENABLED #endif // ANGLE_STATE_VALIDATION_ENABLED
return angle::Result::Continue; return angle::Result::Continue;
......
...@@ -1940,7 +1940,7 @@ angle::Result StateManagerGL::syncState(const gl::Context *context, ...@@ -1940,7 +1940,7 @@ angle::Result StateManagerGL::syncState(const gl::Context *context,
const VertexArrayGL *vaoGL = GetImplAs<VertexArrayGL>(state.getVertexArray()); const VertexArrayGL *vaoGL = GetImplAs<VertexArrayGL>(state.getVertexArray());
bindVertexArray(vaoGL->getVertexArrayID(), vaoGL->getAppliedElementArrayBufferID()); bindVertexArray(vaoGL->getVertexArrayID(), vaoGL->getAppliedElementArrayBufferID());
propagateProgramToVAO(state.getProgram(), propagateProgramToVAO(context, state.getProgram(),
GetImplAs<VertexArrayGL>(state.getVertexArray())); GetImplAs<VertexArrayGL>(state.getVertexArray()));
break; break;
} }
...@@ -1998,7 +1998,7 @@ angle::Result StateManagerGL::syncState(const gl::Context *context, ...@@ -1998,7 +1998,7 @@ angle::Result StateManagerGL::syncState(const gl::Context *context,
if (!program || if (!program ||
!program->getExecutable().hasLinkedShaderStage(gl::ShaderType::Compute)) !program->getExecutable().hasLinkedShaderStage(gl::ShaderType::Compute))
{ {
propagateProgramToVAO(program, propagateProgramToVAO(context, program,
GetImplAs<VertexArrayGL>(state.getVertexArray())); GetImplAs<VertexArrayGL>(state.getVertexArray()));
} }
break; break;
...@@ -2320,7 +2320,9 @@ void StateManagerGL::setTextureCubemapSeamlessEnabled(bool enabled) ...@@ -2320,7 +2320,9 @@ void StateManagerGL::setTextureCubemapSeamlessEnabled(bool enabled)
} }
} }
void StateManagerGL::propagateProgramToVAO(const gl::Program *program, VertexArrayGL *vao) void StateManagerGL::propagateProgramToVAO(const gl::Context *context,
const gl::Program *program,
VertexArrayGL *vao)
{ {
if (vao == nullptr) if (vao == nullptr)
{ {
...@@ -2335,14 +2337,14 @@ void StateManagerGL::propagateProgramToVAO(const gl::Program *program, VertexArr ...@@ -2335,14 +2337,14 @@ void StateManagerGL::propagateProgramToVAO(const gl::Program *program, VertexArr
{ {
programNumViews = program->getNumViews(); programNumViews = program->getNumViews();
} }
vao->applyNumViewsToDivisor(programNumViews); vao->applyNumViewsToDivisor(context, programNumViews);
} }
// Attribute enabled mask: // Attribute enabled mask:
if (program) if (program)
{ {
vao->applyActiveAttribLocationsMask( vao->applyActiveAttribLocationsMask(
program->getExecutable().getActiveAttribLocationsMask()); context, program->getExecutable().getActiveAttribLocationsMask());
} }
} }
......
...@@ -268,7 +268,9 @@ class StateManagerGL final : angle::NonCopyable ...@@ -268,7 +268,9 @@ class StateManagerGL final : angle::NonCopyable
private: private:
void setTextureCubemapSeamlessEnabled(bool enabled); void setTextureCubemapSeamlessEnabled(bool enabled);
void propagateProgramToVAO(const gl::Program *program, VertexArrayGL *vao); void propagateProgramToVAO(const gl::Context *context,
const gl::Program *program,
VertexArrayGL *vao);
void updateProgramTextureBindings(const gl::Context *context); void updateProgramTextureBindings(const gl::Context *context);
void updateProgramStorageBufferBindings(const gl::Context *context); void updateProgramStorageBufferBindings(const gl::Context *context);
......
...@@ -86,13 +86,9 @@ static void ValidateStateHelperGetVertexAttribiv(const FunctionsGL *functions, ...@@ -86,13 +86,9 @@ static void ValidateStateHelperGetVertexAttribiv(const FunctionsGL *functions,
} // anonymous namespace } // anonymous namespace
VertexArrayGL::VertexArrayGL(const VertexArrayState &state, VertexArrayGL::VertexArrayGL(const VertexArrayState &state, GLuint id)
const FunctionsGL *functions,
StateManagerGL *stateManager)
: VertexArrayImpl(state), : VertexArrayImpl(state),
mFunctions(functions), mVertexArrayID(id),
mStateManager(stateManager),
mVertexArrayID(0),
mAppliedNumViews(1), mAppliedNumViews(1),
mAppliedElementArrayBuffer(), mAppliedElementArrayBuffer(),
mAppliedBindings(state.getMaxBindings()), mAppliedBindings(state.getMaxBindings()),
...@@ -101,10 +97,6 @@ VertexArrayGL::VertexArrayGL(const VertexArrayState &state, ...@@ -101,10 +97,6 @@ VertexArrayGL::VertexArrayGL(const VertexArrayState &state,
mStreamingArrayBufferSize(0), mStreamingArrayBufferSize(0),
mStreamingArrayBuffer(0) mStreamingArrayBuffer(0)
{ {
ASSERT(mFunctions);
ASSERT(mStateManager);
mFunctions->genVertexArrays(1, &mVertexArrayID);
// Set the cached vertex attribute array and vertex attribute binding array size // Set the cached vertex attribute array and vertex attribute binding array size
GLuint maxVertexAttribs = static_cast<GLuint>(state.getMaxAttribs()); GLuint maxVertexAttribs = static_cast<GLuint>(state.getMaxAttribs());
for (GLuint i = 0; i < maxVertexAttribs; i++) for (GLuint i = 0; i < maxVertexAttribs; i++)
...@@ -117,15 +109,17 @@ VertexArrayGL::~VertexArrayGL() {} ...@@ -117,15 +109,17 @@ VertexArrayGL::~VertexArrayGL() {}
void VertexArrayGL::destroy(const gl::Context *context) void VertexArrayGL::destroy(const gl::Context *context)
{ {
mStateManager->deleteVertexArray(mVertexArrayID); StateManagerGL *stateManager = GetStateManagerGL(context);
stateManager->deleteVertexArray(mVertexArrayID);
mVertexArrayID = 0; mVertexArrayID = 0;
mAppliedNumViews = 1; mAppliedNumViews = 1;
mStateManager->deleteBuffer(mStreamingElementArrayBuffer); stateManager->deleteBuffer(mStreamingElementArrayBuffer);
mStreamingElementArrayBufferSize = 0; mStreamingElementArrayBufferSize = 0;
mStreamingElementArrayBuffer = 0; mStreamingElementArrayBuffer = 0;
mStateManager->deleteBuffer(mStreamingArrayBuffer); stateManager->deleteBuffer(mStreamingArrayBuffer);
mStreamingArrayBufferSize = 0; mStreamingArrayBufferSize = 0;
mStreamingArrayBuffer = 0; mStreamingArrayBuffer = 0;
...@@ -151,8 +145,9 @@ void VertexArrayGL::updateElementArrayBufferBinding(const gl::Context *context) ...@@ -151,8 +145,9 @@ void VertexArrayGL::updateElementArrayBufferBinding(const gl::Context *context)
gl::Buffer *elementArrayBuffer = mState.getElementArrayBuffer(); gl::Buffer *elementArrayBuffer = mState.getElementArrayBuffer();
if (elementArrayBuffer != nullptr && elementArrayBuffer != mAppliedElementArrayBuffer.get()) if (elementArrayBuffer != nullptr && elementArrayBuffer != mAppliedElementArrayBuffer.get())
{ {
const BufferGL *bufferGL = GetImplAs<BufferGL>(elementArrayBuffer); StateManagerGL *stateManager = GetStateManagerGL(context);
mStateManager->bindBuffer(gl::BufferBinding::ElementArray, bufferGL->getBufferID()); const BufferGL *bufferGL = GetImplAs<BufferGL>(elementArrayBuffer);
stateManager->bindBuffer(gl::BufferBinding::ElementArray, bufferGL->getBufferID());
mAppliedElementArrayBuffer.set(context, elementArrayBuffer); mAppliedElementArrayBuffer.set(context, elementArrayBuffer);
} }
} }
...@@ -227,6 +222,9 @@ angle::Result VertexArrayGL::syncIndexData(const gl::Context *context, ...@@ -227,6 +222,9 @@ angle::Result VertexArrayGL::syncIndexData(const gl::Context *context,
} }
else else
{ {
const FunctionsGL *functions = GetFunctionsGL(context);
StateManagerGL *stateManager = GetStateManagerGL(context);
// Need to stream the index buffer // Need to stream the index buffer
// TODO: if GLES, nothing needs to be streamed // TODO: if GLES, nothing needs to be streamed
...@@ -239,13 +237,13 @@ angle::Result VertexArrayGL::syncIndexData(const gl::Context *context, ...@@ -239,13 +237,13 @@ angle::Result VertexArrayGL::syncIndexData(const gl::Context *context,
// Allocate the streaming element array buffer // Allocate the streaming element array buffer
if (mStreamingElementArrayBuffer == 0) if (mStreamingElementArrayBuffer == 0)
{ {
mFunctions->genBuffers(1, &mStreamingElementArrayBuffer); functions->genBuffers(1, &mStreamingElementArrayBuffer);
mStreamingElementArrayBufferSize = 0; mStreamingElementArrayBufferSize = 0;
} }
mStateManager->bindVertexArray(mVertexArrayID, getAppliedElementArrayBufferID()); stateManager->bindVertexArray(mVertexArrayID, getAppliedElementArrayBufferID());
mStateManager->bindBuffer(gl::BufferBinding::ElementArray, mStreamingElementArrayBuffer); stateManager->bindBuffer(gl::BufferBinding::ElementArray, mStreamingElementArrayBuffer);
mAppliedElementArrayBuffer.set(context, nullptr); mAppliedElementArrayBuffer.set(context, nullptr);
// Make sure the element array buffer is large enough // Make sure the element array buffer is large enough
...@@ -254,15 +252,15 @@ angle::Result VertexArrayGL::syncIndexData(const gl::Context *context, ...@@ -254,15 +252,15 @@ angle::Result VertexArrayGL::syncIndexData(const gl::Context *context,
if (requiredStreamingBufferSize > mStreamingElementArrayBufferSize) if (requiredStreamingBufferSize > mStreamingElementArrayBufferSize)
{ {
// Copy the indices in while resizing the buffer // Copy the indices in while resizing the buffer
mFunctions->bufferData(GL_ELEMENT_ARRAY_BUFFER, requiredStreamingBufferSize, indices, functions->bufferData(GL_ELEMENT_ARRAY_BUFFER, requiredStreamingBufferSize, indices,
GL_DYNAMIC_DRAW); GL_DYNAMIC_DRAW);
mStreamingElementArrayBufferSize = requiredStreamingBufferSize; mStreamingElementArrayBufferSize = requiredStreamingBufferSize;
} }
else else
{ {
// Put the indices at the beginning of the buffer // Put the indices at the beginning of the buffer
mFunctions->bufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, requiredStreamingBufferSize, functions->bufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, requiredStreamingBufferSize,
indices); indices);
} }
// Set the index offset for the draw call to zero since the supplied index pointer is to // Set the index offset for the draw call to zero since the supplied index pointer is to
...@@ -309,6 +307,9 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context, ...@@ -309,6 +307,9 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context,
GLsizei instanceCount, GLsizei instanceCount,
const gl::IndexRange &indexRange) const const gl::IndexRange &indexRange) const
{ {
const FunctionsGL *functions = GetFunctionsGL(context);
StateManagerGL *stateManager = GetStateManagerGL(context);
// Sync the vertex attribute state and track what data needs to be streamed // Sync the vertex attribute state and track what data needs to be streamed
size_t streamingDataSize = 0; size_t streamingDataSize = 0;
size_t maxAttributeDataSize = 0; size_t maxAttributeDataSize = 0;
...@@ -323,7 +324,7 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context, ...@@ -323,7 +324,7 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context,
if (mStreamingArrayBuffer == 0) if (mStreamingArrayBuffer == 0)
{ {
mFunctions->genBuffers(1, &mStreamingArrayBuffer); functions->genBuffers(1, &mStreamingArrayBuffer);
mStreamingArrayBufferSize = 0; mStreamingArrayBufferSize = 0;
} }
...@@ -332,14 +333,14 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context, ...@@ -332,14 +333,14 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context,
const size_t bufferEmptySpace = maxAttributeDataSize * indexRange.start; const size_t bufferEmptySpace = maxAttributeDataSize * indexRange.start;
const size_t requiredBufferSize = streamingDataSize + bufferEmptySpace; const size_t requiredBufferSize = streamingDataSize + bufferEmptySpace;
mStateManager->bindBuffer(gl::BufferBinding::Array, mStreamingArrayBuffer); stateManager->bindBuffer(gl::BufferBinding::Array, mStreamingArrayBuffer);
if (requiredBufferSize > mStreamingArrayBufferSize) if (requiredBufferSize > mStreamingArrayBufferSize)
{ {
mFunctions->bufferData(GL_ARRAY_BUFFER, requiredBufferSize, nullptr, GL_DYNAMIC_DRAW); functions->bufferData(GL_ARRAY_BUFFER, requiredBufferSize, nullptr, GL_DYNAMIC_DRAW);
mStreamingArrayBufferSize = requiredBufferSize; mStreamingArrayBufferSize = requiredBufferSize;
} }
mStateManager->bindVertexArray(mVertexArrayID, getAppliedElementArrayBufferID()); stateManager->bindVertexArray(mVertexArrayID, getAppliedElementArrayBufferID());
// Unmapping a buffer can return GL_FALSE to indicate that the system has corrupted the data // Unmapping a buffer can return GL_FALSE to indicate that the system has corrupted the data
// somehow (such as by a screen change), retry writing the data a few times and return // somehow (such as by a screen change), retry writing the data a few times and return
...@@ -348,7 +349,7 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context, ...@@ -348,7 +349,7 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context,
size_t unmapRetryAttempts = 5; size_t unmapRetryAttempts = 5;
while (unmapResult != GL_TRUE && --unmapRetryAttempts > 0) while (unmapResult != GL_TRUE && --unmapRetryAttempts > 0)
{ {
uint8_t *bufferPointer = MapBufferRangeWithFallback(mFunctions, GL_ARRAY_BUFFER, 0, uint8_t *bufferPointer = MapBufferRangeWithFallback(functions, GL_ARRAY_BUFFER, 0,
requiredBufferSize, GL_MAP_WRITE_BIT); requiredBufferSize, GL_MAP_WRITE_BIT);
size_t curBufferOffset = bufferEmptySpace; size_t curBufferOffset = bufferEmptySpace;
...@@ -399,7 +400,7 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context, ...@@ -399,7 +400,7 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context,
// Compute where the 0-index vertex would be. // Compute where the 0-index vertex would be.
const size_t vertexStartOffset = curBufferOffset - (firstIndex * destStride); const size_t vertexStartOffset = curBufferOffset - (firstIndex * destStride);
callVertexAttribPointer(static_cast<GLuint>(idx), attrib, callVertexAttribPointer(context, static_cast<GLuint>(idx), attrib,
static_cast<GLsizei>(destStride), static_cast<GLsizei>(destStride),
static_cast<GLintptr>(vertexStartOffset)); static_cast<GLintptr>(vertexStartOffset));
...@@ -416,7 +417,7 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context, ...@@ -416,7 +417,7 @@ angle::Result VertexArrayGL::streamAttributes(const gl::Context *context,
curBufferOffset += destStride * streamedVertexCount; curBufferOffset += destStride * streamedVertexCount;
} }
unmapResult = mFunctions->unmapBuffer(GL_ARRAY_BUFFER); unmapResult = functions->unmapBuffer(GL_ARRAY_BUFFER);
} }
ANGLE_CHECK(GetImplAs<ContextGL>(context), unmapResult == GL_TRUE, ANGLE_CHECK(GetImplAs<ContextGL>(context), unmapResult == GL_TRUE,
...@@ -439,7 +440,7 @@ GLuint VertexArrayGL::getAppliedElementArrayBufferID() const ...@@ -439,7 +440,7 @@ GLuint VertexArrayGL::getAppliedElementArrayBufferID() const
return GetImplAs<BufferGL>(mAppliedElementArrayBuffer.get())->getBufferID(); return GetImplAs<BufferGL>(mAppliedElementArrayBuffer.get())->getBufferID();
} }
void VertexArrayGL::updateAttribEnabled(size_t attribIndex) void VertexArrayGL::updateAttribEnabled(const gl::Context *context, size_t attribIndex)
{ {
const bool enabled = mState.getVertexAttribute(attribIndex).enabled & const bool enabled = mState.getVertexAttribute(attribIndex).enabled &
mProgramActiveAttribLocationsMask.test(attribIndex); mProgramActiveAttribLocationsMask.test(attribIndex);
...@@ -448,13 +449,15 @@ void VertexArrayGL::updateAttribEnabled(size_t attribIndex) ...@@ -448,13 +449,15 @@ void VertexArrayGL::updateAttribEnabled(size_t attribIndex)
return; return;
} }
const FunctionsGL *functions = GetFunctionsGL(context);
if (enabled) if (enabled)
{ {
mFunctions->enableVertexAttribArray(static_cast<GLuint>(attribIndex)); functions->enableVertexAttribArray(static_cast<GLuint>(attribIndex));
} }
else else
{ {
mFunctions->disableVertexAttribArray(static_cast<GLuint>(attribIndex)); functions->disableVertexAttribArray(static_cast<GLuint>(attribIndex));
} }
mAppliedAttributes[attribIndex].enabled = enabled; mAppliedAttributes[attribIndex].enabled = enabled;
...@@ -462,6 +465,7 @@ void VertexArrayGL::updateAttribEnabled(size_t attribIndex) ...@@ -462,6 +465,7 @@ void VertexArrayGL::updateAttribEnabled(size_t attribIndex)
void VertexArrayGL::updateAttribPointer(const gl::Context *context, size_t attribIndex) void VertexArrayGL::updateAttribPointer(const gl::Context *context, size_t attribIndex)
{ {
const VertexAttribute &attrib = mState.getVertexAttribute(attribIndex); const VertexAttribute &attrib = mState.getVertexAttribute(attribIndex);
// According to SPEC, VertexAttribPointer should update the binding indexed attribIndex instead // According to SPEC, VertexAttribPointer should update the binding indexed attribIndex instead
...@@ -499,9 +503,10 @@ void VertexArrayGL::updateAttribPointer(const gl::Context *context, size_t attri ...@@ -499,9 +503,10 @@ void VertexArrayGL::updateAttribPointer(const gl::Context *context, size_t attri
// zero is bound to the ARRAY_BUFFER buffer object binding point, and the pointer argument // zero is bound to the ARRAY_BUFFER buffer object binding point, and the pointer argument
// is not NULL. // is not NULL.
StateManagerGL *stateManager = GetStateManagerGL(context);
const BufferGL *arrayBufferGL = GetImplAs<BufferGL>(arrayBuffer); const BufferGL *arrayBufferGL = GetImplAs<BufferGL>(arrayBuffer);
mStateManager->bindBuffer(gl::BufferBinding::Array, arrayBufferGL->getBufferID()); stateManager->bindBuffer(gl::BufferBinding::Array, arrayBufferGL->getBufferID());
callVertexAttribPointer(static_cast<GLuint>(attribIndex), attrib, binding.getStride(), callVertexAttribPointer(context, static_cast<GLuint>(attribIndex), attrib, binding.getStride(),
binding.getOffset()); binding.getOffset());
mAppliedAttributes[attribIndex].format = attrib.format; mAppliedAttributes[attribIndex].format = attrib.format;
...@@ -518,36 +523,39 @@ void VertexArrayGL::updateAttribPointer(const gl::Context *context, size_t attri ...@@ -518,36 +523,39 @@ void VertexArrayGL::updateAttribPointer(const gl::Context *context, size_t attri
mAppliedBindings[attribIndex].setBuffer(context, binding.getBuffer().get()); mAppliedBindings[attribIndex].setBuffer(context, binding.getBuffer().get());
} }
void VertexArrayGL::callVertexAttribPointer(GLuint attribIndex, void VertexArrayGL::callVertexAttribPointer(const gl::Context *context,
GLuint attribIndex,
const VertexAttribute &attrib, const VertexAttribute &attrib,
GLsizei stride, GLsizei stride,
GLintptr offset) const GLintptr offset) const
{ {
const GLvoid *pointer = reinterpret_cast<const GLvoid *>(offset); const FunctionsGL *functions = GetFunctionsGL(context);
const angle::Format &format = *attrib.format; const GLvoid *pointer = reinterpret_cast<const GLvoid *>(offset);
const angle::Format &format = *attrib.format;
if (format.isPureInt()) if (format.isPureInt())
{ {
ASSERT(!format.isNorm()); ASSERT(!format.isNorm());
mFunctions->vertexAttribIPointer(attribIndex, format.channelCount, functions->vertexAttribIPointer(attribIndex, format.channelCount,
gl::ToGLenum(format.vertexAttribType), stride, pointer); gl::ToGLenum(format.vertexAttribType), stride, pointer);
} }
else else
{ {
mFunctions->vertexAttribPointer(attribIndex, format.channelCount, functions->vertexAttribPointer(attribIndex, format.channelCount,
gl::ToGLenum(format.vertexAttribType), format.isNorm(), gl::ToGLenum(format.vertexAttribType), format.isNorm(),
stride, pointer); stride, pointer);
} }
} }
bool VertexArrayGL::supportVertexAttribBinding() const bool VertexArrayGL::supportVertexAttribBinding(const gl::Context *context) const
{ {
ASSERT(mFunctions); const FunctionsGL *functions = GetFunctionsGL(context);
return (mFunctions->vertexAttribBinding != nullptr); ASSERT(functions);
return (functions->vertexAttribBinding != nullptr);
} }
void VertexArrayGL::updateAttribFormat(size_t attribIndex) void VertexArrayGL::updateAttribFormat(const gl::Context *context, size_t attribIndex)
{ {
ASSERT(supportVertexAttribBinding()); ASSERT(supportVertexAttribBinding(context));
const VertexAttribute &attrib = mState.getVertexAttribute(attribIndex); const VertexAttribute &attrib = mState.getVertexAttribute(attribIndex);
if (SameVertexAttribFormat(mAppliedAttributes[attribIndex], attrib)) if (SameVertexAttribFormat(mAppliedAttributes[attribIndex], attrib))
...@@ -555,28 +563,30 @@ void VertexArrayGL::updateAttribFormat(size_t attribIndex) ...@@ -555,28 +563,30 @@ void VertexArrayGL::updateAttribFormat(size_t attribIndex)
return; return;
} }
const FunctionsGL *functions = GetFunctionsGL(context);
const angle::Format &format = *attrib.format; const angle::Format &format = *attrib.format;
if (format.isPureInt()) if (format.isPureInt())
{ {
ASSERT(!format.isNorm()); ASSERT(!format.isNorm());
mFunctions->vertexAttribIFormat(static_cast<GLuint>(attribIndex), format.channelCount, functions->vertexAttribIFormat(static_cast<GLuint>(attribIndex), format.channelCount,
gl::ToGLenum(format.vertexAttribType), gl::ToGLenum(format.vertexAttribType),
attrib.relativeOffset); attrib.relativeOffset);
} }
else else
{ {
mFunctions->vertexAttribFormat(static_cast<GLuint>(attribIndex), format.channelCount, functions->vertexAttribFormat(static_cast<GLuint>(attribIndex), format.channelCount,
gl::ToGLenum(format.vertexAttribType), format.isNorm(), gl::ToGLenum(format.vertexAttribType), format.isNorm(),
attrib.relativeOffset); attrib.relativeOffset);
} }
mAppliedAttributes[attribIndex].format = attrib.format; mAppliedAttributes[attribIndex].format = attrib.format;
mAppliedAttributes[attribIndex].relativeOffset = attrib.relativeOffset; mAppliedAttributes[attribIndex].relativeOffset = attrib.relativeOffset;
} }
void VertexArrayGL::updateAttribBinding(size_t attribIndex) void VertexArrayGL::updateAttribBinding(const gl::Context *context, size_t attribIndex)
{ {
ASSERT(supportVertexAttribBinding()); ASSERT(supportVertexAttribBinding(context));
GLuint bindingIndex = mState.getVertexAttribute(attribIndex).bindingIndex; GLuint bindingIndex = mState.getVertexAttribute(attribIndex).bindingIndex;
if (mAppliedAttributes[attribIndex].bindingIndex == bindingIndex) if (mAppliedAttributes[attribIndex].bindingIndex == bindingIndex)
...@@ -584,14 +594,15 @@ void VertexArrayGL::updateAttribBinding(size_t attribIndex) ...@@ -584,14 +594,15 @@ void VertexArrayGL::updateAttribBinding(size_t attribIndex)
return; return;
} }
mFunctions->vertexAttribBinding(static_cast<GLuint>(attribIndex), bindingIndex); const FunctionsGL *functions = GetFunctionsGL(context);
functions->vertexAttribBinding(static_cast<GLuint>(attribIndex), bindingIndex);
mAppliedAttributes[attribIndex].bindingIndex = bindingIndex; mAppliedAttributes[attribIndex].bindingIndex = bindingIndex;
} }
void VertexArrayGL::updateBindingBuffer(const gl::Context *context, size_t bindingIndex) void VertexArrayGL::updateBindingBuffer(const gl::Context *context, size_t bindingIndex)
{ {
ASSERT(supportVertexAttribBinding()); ASSERT(supportVertexAttribBinding(context));
const VertexBinding &binding = mState.getVertexBinding(bindingIndex); const VertexBinding &binding = mState.getVertexBinding(bindingIndex);
if (SameVertexBuffer(mAppliedBindings[bindingIndex], binding)) if (SameVertexBuffer(mAppliedBindings[bindingIndex], binding))
...@@ -606,15 +617,16 @@ void VertexArrayGL::updateBindingBuffer(const gl::Context *context, size_t bindi ...@@ -606,15 +617,16 @@ void VertexArrayGL::updateBindingBuffer(const gl::Context *context, size_t bindi
bufferId = GetImplAs<BufferGL>(arrayBuffer)->getBufferID(); bufferId = GetImplAs<BufferGL>(arrayBuffer)->getBufferID();
} }
mFunctions->bindVertexBuffer(static_cast<GLuint>(bindingIndex), bufferId, binding.getOffset(), const FunctionsGL *functions = GetFunctionsGL(context);
binding.getStride()); functions->bindVertexBuffer(static_cast<GLuint>(bindingIndex), bufferId, binding.getOffset(),
binding.getStride());
mAppliedBindings[bindingIndex].setStride(binding.getStride()); mAppliedBindings[bindingIndex].setStride(binding.getStride());
mAppliedBindings[bindingIndex].setOffset(binding.getOffset()); mAppliedBindings[bindingIndex].setOffset(binding.getOffset());
mAppliedBindings[bindingIndex].setBuffer(context, binding.getBuffer().get()); mAppliedBindings[bindingIndex].setBuffer(context, binding.getBuffer().get());
} }
void VertexArrayGL::updateBindingDivisor(size_t bindingIndex) void VertexArrayGL::updateBindingDivisor(const gl::Context *context, size_t bindingIndex)
{ {
GLuint adjustedDivisor = GLuint adjustedDivisor =
GetAdjustedDivisor(mAppliedNumViews, mState.getVertexBinding(bindingIndex).getDivisor()); GetAdjustedDivisor(mAppliedNumViews, mState.getVertexBinding(bindingIndex).getDivisor());
...@@ -623,15 +635,16 @@ void VertexArrayGL::updateBindingDivisor(size_t bindingIndex) ...@@ -623,15 +635,16 @@ void VertexArrayGL::updateBindingDivisor(size_t bindingIndex)
return; return;
} }
if (supportVertexAttribBinding()) const FunctionsGL *functions = GetFunctionsGL(context);
if (supportVertexAttribBinding(context))
{ {
mFunctions->vertexBindingDivisor(static_cast<GLuint>(bindingIndex), adjustedDivisor); functions->vertexBindingDivisor(static_cast<GLuint>(bindingIndex), adjustedDivisor);
} }
else else
{ {
// We can only use VertexAttribDivisor on platforms that don't support Vertex Attrib // We can only use VertexAttribDivisor on platforms that don't support Vertex Attrib
// Binding. // Binding.
mFunctions->vertexAttribDivisor(static_cast<GLuint>(bindingIndex), adjustedDivisor); functions->vertexAttribDivisor(static_cast<GLuint>(bindingIndex), adjustedDivisor);
} }
mAppliedBindings[bindingIndex].setDivisor(adjustedDivisor); mAppliedBindings[bindingIndex].setDivisor(adjustedDivisor);
...@@ -648,7 +661,7 @@ void VertexArrayGL::syncDirtyAttrib(const gl::Context *context, ...@@ -648,7 +661,7 @@ void VertexArrayGL::syncDirtyAttrib(const gl::Context *context,
switch (dirtyBit) switch (dirtyBit)
{ {
case VertexArray::DIRTY_ATTRIB_ENABLED: case VertexArray::DIRTY_ATTRIB_ENABLED:
updateAttribEnabled(attribIndex); updateAttribEnabled(context, attribIndex);
break; break;
case VertexArray::DIRTY_ATTRIB_POINTER_BUFFER: case VertexArray::DIRTY_ATTRIB_POINTER_BUFFER:
...@@ -657,13 +670,13 @@ void VertexArrayGL::syncDirtyAttrib(const gl::Context *context, ...@@ -657,13 +670,13 @@ void VertexArrayGL::syncDirtyAttrib(const gl::Context *context,
break; break;
case VertexArray::DIRTY_ATTRIB_FORMAT: case VertexArray::DIRTY_ATTRIB_FORMAT:
ASSERT(supportVertexAttribBinding()); ASSERT(supportVertexAttribBinding(context));
updateAttribFormat(attribIndex); updateAttribFormat(context, attribIndex);
break; break;
case VertexArray::DIRTY_ATTRIB_BINDING: case VertexArray::DIRTY_ATTRIB_BINDING:
ASSERT(supportVertexAttribBinding()); ASSERT(supportVertexAttribBinding(context));
updateAttribBinding(attribIndex); updateAttribBinding(context, attribIndex);
break; break;
default: default:
...@@ -684,12 +697,12 @@ void VertexArrayGL::syncDirtyBinding(const gl::Context *context, ...@@ -684,12 +697,12 @@ void VertexArrayGL::syncDirtyBinding(const gl::Context *context,
switch (dirtyBit) switch (dirtyBit)
{ {
case VertexArray::DIRTY_BINDING_BUFFER: case VertexArray::DIRTY_BINDING_BUFFER:
ASSERT(supportVertexAttribBinding()); ASSERT(supportVertexAttribBinding(context));
updateBindingBuffer(context, bindingIndex); updateBindingBuffer(context, bindingIndex);
break; break;
case VertexArray::DIRTY_BINDING_DIVISOR: case VertexArray::DIRTY_BINDING_DIVISOR:
updateBindingDivisor(bindingIndex); updateBindingDivisor(context, bindingIndex);
break; break;
default: default:
...@@ -720,7 +733,8 @@ angle::Result VertexArrayGL::syncState(const gl::Context *context, ...@@ -720,7 +733,8 @@ angle::Result VertexArrayGL::syncState(const gl::Context *context,
gl::VertexArray::DirtyAttribBitsArray *attribBits, gl::VertexArray::DirtyAttribBitsArray *attribBits,
gl::VertexArray::DirtyBindingBitsArray *bindingBits) gl::VertexArray::DirtyBindingBitsArray *bindingBits)
{ {
mStateManager->bindVertexArray(mVertexArrayID, getAppliedElementArrayBufferID()); StateManagerGL *stateManager = GetStateManagerGL(context);
stateManager->bindVertexArray(mVertexArrayID, getAppliedElementArrayBufferID());
for (size_t dirtyBit : dirtyBits) for (size_t dirtyBit : dirtyBits)
{ {
...@@ -746,59 +760,64 @@ angle::Result VertexArrayGL::syncState(const gl::Context *context, ...@@ -746,59 +760,64 @@ angle::Result VertexArrayGL::syncState(const gl::Context *context,
return angle::Result::Continue; return angle::Result::Continue;
} }
void VertexArrayGL::applyNumViewsToDivisor(int numViews) void VertexArrayGL::applyNumViewsToDivisor(const gl::Context *context, int numViews)
{ {
if (numViews != mAppliedNumViews) if (numViews != mAppliedNumViews)
{ {
mStateManager->bindVertexArray(mVertexArrayID, getAppliedElementArrayBufferID()); StateManagerGL *stateManager = GetStateManagerGL(context);
stateManager->bindVertexArray(mVertexArrayID, getAppliedElementArrayBufferID());
mAppliedNumViews = numViews; mAppliedNumViews = numViews;
for (size_t index = 0u; index < mAppliedBindings.size(); ++index) for (size_t index = 0u; index < mAppliedBindings.size(); ++index)
{ {
updateBindingDivisor(index); updateBindingDivisor(context, index);
} }
} }
} }
void VertexArrayGL::applyActiveAttribLocationsMask(const gl::AttributesMask &activeMask) void VertexArrayGL::applyActiveAttribLocationsMask(const gl::Context *context,
const gl::AttributesMask &activeMask)
{ {
gl::AttributesMask updateMask = mProgramActiveAttribLocationsMask ^ activeMask; gl::AttributesMask updateMask = mProgramActiveAttribLocationsMask ^ activeMask;
if (!updateMask.any()) if (!updateMask.any())
{ {
return; return;
} }
ASSERT(mVertexArrayID == mStateManager->getVertexArrayID());
ASSERT(mVertexArrayID == GetStateManagerGL(context)->getVertexArrayID());
mProgramActiveAttribLocationsMask = activeMask; mProgramActiveAttribLocationsMask = activeMask;
for (size_t attribIndex : updateMask) for (size_t attribIndex : updateMask)
{ {
updateAttribEnabled(attribIndex); updateAttribEnabled(context, attribIndex);
} }
} }
void VertexArrayGL::validateState() const void VertexArrayGL::validateState(const gl::Context *context) const
{ {
const FunctionsGL *functions = GetFunctionsGL(context);
// Ensure this vao is currently bound // Ensure this vao is currently bound
ValidateStateHelperGetIntegerv(mFunctions, mVertexArrayID, GL_VERTEX_ARRAY_BINDING, ValidateStateHelperGetIntegerv(functions, mVertexArrayID, GL_VERTEX_ARRAY_BINDING,
"mVertexArrayID", "GL_VERTEX_ARRAY_BINDING"); "mVertexArrayID", "GL_VERTEX_ARRAY_BINDING");
// Element array buffer // Element array buffer
if (mAppliedElementArrayBuffer.get() == nullptr) if (mAppliedElementArrayBuffer.get() == nullptr)
{ {
ValidateStateHelperGetIntegerv( ValidateStateHelperGetIntegerv(
mFunctions, mStreamingElementArrayBuffer, GL_ELEMENT_ARRAY_BUFFER_BINDING, functions, mStreamingElementArrayBuffer, GL_ELEMENT_ARRAY_BUFFER_BINDING,
"mAppliedElementArrayBuffer", "GL_ELEMENT_ARRAY_BUFFER_BINDING"); "mAppliedElementArrayBuffer", "GL_ELEMENT_ARRAY_BUFFER_BINDING");
} }
else else
{ {
const BufferGL *bufferGL = GetImplAs<BufferGL>(mAppliedElementArrayBuffer.get()); const BufferGL *bufferGL = GetImplAs<BufferGL>(mAppliedElementArrayBuffer.get());
ValidateStateHelperGetIntegerv( ValidateStateHelperGetIntegerv(
mFunctions, bufferGL->getBufferID(), GL_ELEMENT_ARRAY_BUFFER_BINDING, functions, bufferGL->getBufferID(), GL_ELEMENT_ARRAY_BUFFER_BINDING,
"mAppliedElementArrayBuffer", "GL_ELEMENT_ARRAY_BUFFER_BINDING"); "mAppliedElementArrayBuffer", "GL_ELEMENT_ARRAY_BUFFER_BINDING");
} }
// ValidateStateHelperGetIntegerv but with > comparison instead of != // ValidateStateHelperGetIntegerv but with > comparison instead of !=
GLint queryValue; GLint queryValue;
mFunctions->getIntegerv(GL_MAX_VERTEX_ATTRIBS, &queryValue); functions->getIntegerv(GL_MAX_VERTEX_ATTRIBS, &queryValue);
if (mAppliedAttributes.size() > static_cast<GLuint>(queryValue)) if (mAppliedAttributes.size() > static_cast<GLuint>(queryValue))
{ {
WARN() << "mAppliedAttributes.size() (" << mAppliedAttributes.size() WARN() << "mAppliedAttributes.size() (" << mAppliedAttributes.size()
...@@ -815,7 +834,7 @@ void VertexArrayGL::validateState() const ...@@ -815,7 +834,7 @@ void VertexArrayGL::validateState() const
VertexBinding &binding = mAppliedBindings[attribute.bindingIndex]; VertexBinding &binding = mAppliedBindings[attribute.bindingIndex];
ValidateStateHelperGetVertexAttribiv( ValidateStateHelperGetVertexAttribiv(
mFunctions, index, attribute.enabled, GL_VERTEX_ATTRIB_ARRAY_ENABLED, functions, index, attribute.enabled, GL_VERTEX_ATTRIB_ARRAY_ENABLED,
"mAppliedAttributes.enabled", "GL_VERTEX_ATTRIB_ARRAY_ENABLED"); "mAppliedAttributes.enabled", "GL_VERTEX_ATTRIB_ARRAY_ENABLED");
if (attribute.enabled) if (attribute.enabled)
...@@ -823,25 +842,25 @@ void VertexArrayGL::validateState() const ...@@ -823,25 +842,25 @@ void VertexArrayGL::validateState() const
// Applied attributes // Applied attributes
ASSERT(attribute.format); ASSERT(attribute.format);
ValidateStateHelperGetVertexAttribiv( ValidateStateHelperGetVertexAttribiv(
mFunctions, index, ToGLenum(attribute.format->vertexAttribType), functions, index, ToGLenum(attribute.format->vertexAttribType),
GL_VERTEX_ATTRIB_ARRAY_TYPE, "mAppliedAttributes.format->vertexAttribType", GL_VERTEX_ATTRIB_ARRAY_TYPE, "mAppliedAttributes.format->vertexAttribType",
"GL_VERTEX_ATTRIB_ARRAY_TYPE"); "GL_VERTEX_ATTRIB_ARRAY_TYPE");
ValidateStateHelperGetVertexAttribiv( ValidateStateHelperGetVertexAttribiv(
mFunctions, index, attribute.format->channelCount, GL_VERTEX_ATTRIB_ARRAY_SIZE, functions, index, attribute.format->channelCount, GL_VERTEX_ATTRIB_ARRAY_SIZE,
"attribute.format->channelCount", "GL_VERTEX_ATTRIB_ARRAY_SIZE"); "attribute.format->channelCount", "GL_VERTEX_ATTRIB_ARRAY_SIZE");
ValidateStateHelperGetVertexAttribiv( ValidateStateHelperGetVertexAttribiv(
mFunctions, index, attribute.format->isNorm(), GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, functions, index, attribute.format->isNorm(), GL_VERTEX_ATTRIB_ARRAY_NORMALIZED,
"attribute.format->isNorm()", "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED"); "attribute.format->isNorm()", "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED");
ValidateStateHelperGetVertexAttribiv( ValidateStateHelperGetVertexAttribiv(
mFunctions, index, attribute.format->isPureInt(), GL_VERTEX_ATTRIB_ARRAY_INTEGER, functions, index, attribute.format->isPureInt(), GL_VERTEX_ATTRIB_ARRAY_INTEGER,
"attribute.format->isPureInt()", "GL_VERTEX_ATTRIB_ARRAY_INTEGER"); "attribute.format->isPureInt()", "GL_VERTEX_ATTRIB_ARRAY_INTEGER");
if (supportVertexAttribBinding()) if (supportVertexAttribBinding(context))
{ {
ValidateStateHelperGetVertexAttribiv( ValidateStateHelperGetVertexAttribiv(
mFunctions, index, attribute.relativeOffset, GL_VERTEX_ATTRIB_RELATIVE_OFFSET, functions, index, attribute.relativeOffset, GL_VERTEX_ATTRIB_RELATIVE_OFFSET,
"attribute.relativeOffset", "GL_VERTEX_ATTRIB_RELATIVE_OFFSET"); "attribute.relativeOffset", "GL_VERTEX_ATTRIB_RELATIVE_OFFSET");
ValidateStateHelperGetVertexAttribiv( ValidateStateHelperGetVertexAttribiv(
mFunctions, index, attribute.bindingIndex, GL_VERTEX_ATTRIB_BINDING, functions, index, attribute.bindingIndex, GL_VERTEX_ATTRIB_BINDING,
"attribute.bindingIndex", "GL_VERTEX_ATTRIB_BINDING"); "attribute.bindingIndex", "GL_VERTEX_ATTRIB_BINDING");
} }
...@@ -849,22 +868,22 @@ void VertexArrayGL::validateState() const ...@@ -849,22 +868,22 @@ void VertexArrayGL::validateState() const
if (binding.getBuffer().get() == nullptr) if (binding.getBuffer().get() == nullptr)
{ {
ValidateStateHelperGetVertexAttribiv( ValidateStateHelperGetVertexAttribiv(
mFunctions, index, mStreamingArrayBuffer, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, functions, index, mStreamingArrayBuffer, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,
"mAppliedBindings.bufferID", "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING"); "mAppliedBindings.bufferID", "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING");
} }
else else
{ {
const BufferGL *arrayBufferGL = GetImplAs<BufferGL>(binding.getBuffer().get()); const BufferGL *arrayBufferGL = GetImplAs<BufferGL>(binding.getBuffer().get());
ASSERT(arrayBufferGL); ASSERT(arrayBufferGL);
ValidateStateHelperGetVertexAttribiv(functions, index, arrayBufferGL->getBufferID(),
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,
"mAppliedBindings.bufferID",
"GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING");
ValidateStateHelperGetVertexAttribiv( ValidateStateHelperGetVertexAttribiv(
mFunctions, index, arrayBufferGL->getBufferID(), functions, index, binding.getStride(), GL_VERTEX_ATTRIB_ARRAY_STRIDE,
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, "mAppliedBindings.bufferID",
"GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING");
ValidateStateHelperGetVertexAttribiv(
mFunctions, index, binding.getStride(), GL_VERTEX_ATTRIB_ARRAY_STRIDE,
"binding.getStride()", "GL_VERTEX_ATTRIB_ARRAY_STRIDE"); "binding.getStride()", "GL_VERTEX_ATTRIB_ARRAY_STRIDE");
ValidateStateHelperGetVertexAttribiv( ValidateStateHelperGetVertexAttribiv(
mFunctions, index, binding.getDivisor(), GL_VERTEX_ATTRIB_ARRAY_DIVISOR, functions, index, binding.getDivisor(), GL_VERTEX_ATTRIB_ARRAY_DIVISOR,
"binding.getDivisor()", "GL_VERTEX_ATTRIB_ARRAY_DIVISOR"); "binding.getDivisor()", "GL_VERTEX_ATTRIB_ARRAY_DIVISOR");
} }
} }
......
...@@ -24,9 +24,7 @@ class StateManagerGL; ...@@ -24,9 +24,7 @@ class StateManagerGL;
class VertexArrayGL : public VertexArrayImpl class VertexArrayGL : public VertexArrayImpl
{ {
public: public:
VertexArrayGL(const gl::VertexArrayState &data, VertexArrayGL(const gl::VertexArrayState &data, GLuint id);
const FunctionsGL *functions,
StateManagerGL *stateManager);
~VertexArrayGL() override; ~VertexArrayGL() override;
void destroy(const gl::Context *context) override; void destroy(const gl::Context *context) override;
...@@ -53,10 +51,11 @@ class VertexArrayGL : public VertexArrayImpl ...@@ -53,10 +51,11 @@ class VertexArrayGL : public VertexArrayImpl
gl::VertexArray::DirtyAttribBitsArray *attribBits, gl::VertexArray::DirtyAttribBitsArray *attribBits,
gl::VertexArray::DirtyBindingBitsArray *bindingBits) override; gl::VertexArray::DirtyBindingBitsArray *bindingBits) override;
void applyNumViewsToDivisor(int numViews); void applyNumViewsToDivisor(const gl::Context *context, int numViews);
void applyActiveAttribLocationsMask(const gl::AttributesMask &activeMask); void applyActiveAttribLocationsMask(const gl::Context *context,
const gl::AttributesMask &activeMask);
void validateState() const; void validateState(const gl::Context *context) const;
private: private:
angle::Result syncDrawState(const gl::Context *context, angle::Result syncDrawState(const gl::Context *context,
...@@ -99,26 +98,24 @@ class VertexArrayGL : public VertexArrayImpl ...@@ -99,26 +98,24 @@ class VertexArrayGL : public VertexArrayImpl
size_t bindingIndex, size_t bindingIndex,
const gl::VertexArray::DirtyBindingBits &dirtyBindingBits); const gl::VertexArray::DirtyBindingBits &dirtyBindingBits);
void updateAttribEnabled(size_t attribIndex); void updateAttribEnabled(const gl::Context *context, size_t attribIndex);
void updateAttribPointer(const gl::Context *context, size_t attribIndex); void updateAttribPointer(const gl::Context *context, size_t attribIndex);
bool supportVertexAttribBinding() const; bool supportVertexAttribBinding(const gl::Context *context) const;
void updateAttribFormat(size_t attribIndex); void updateAttribFormat(const gl::Context *context, size_t attribIndex);
void updateAttribBinding(size_t attribIndex); void updateAttribBinding(const gl::Context *context, size_t attribIndex);
void updateBindingBuffer(const gl::Context *context, size_t bindingIndex); void updateBindingBuffer(const gl::Context *context, size_t bindingIndex);
void updateBindingDivisor(size_t bindingIndex); void updateBindingDivisor(const gl::Context *context, size_t bindingIndex);
void updateElementArrayBufferBinding(const gl::Context *context) const; void updateElementArrayBufferBinding(const gl::Context *context) const;
void callVertexAttribPointer(GLuint attribIndex, void callVertexAttribPointer(const gl::Context *context,
GLuint attribIndex,
const gl::VertexAttribute &attrib, const gl::VertexAttribute &attrib,
GLsizei stride, GLsizei stride,
GLintptr offset) const; GLintptr offset) const;
const FunctionsGL *mFunctions;
StateManagerGL *mStateManager;
GLuint mVertexArrayID; GLuint mVertexArrayID;
int mAppliedNumViews; int mAppliedNumViews;
......
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