Commit 5b6b9c63 by Jiajia Qin Committed by Commit Bot

Use dirty bit for draw indirect buffer

Bug: angleproject:1595 Change-Id: I031beab818daca8a20726d7bff564649feefc1f3 Reviewed-on: https://chromium-review.googlesource.com/844214 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent ea78d2bb
......@@ -729,14 +729,14 @@ gl::Error RendererGL::dispatchCompute(const gl::Context *context,
GLuint numGroupsY,
GLuint numGroupsZ)
{
ANGLE_TRY(mStateManager->setDispatchComputeState(context, false));
ANGLE_TRY(mStateManager->setDispatchComputeState(context));
mFunctions->dispatchCompute(numGroupsX, numGroupsY, numGroupsZ);
return gl::NoError();
}
gl::Error RendererGL::dispatchComputeIndirect(const gl::Context *context, GLintptr indirect)
{
ANGLE_TRY(mStateManager->setDispatchComputeState(context, true));
ANGLE_TRY(mStateManager->setDispatchComputeState(context));
mFunctions->dispatchComputeIndirect(indirect);
return gl::NoError();
}
......
......@@ -168,8 +168,7 @@ StateManagerGL::StateManagerGL(const FunctionsGL *functions,
mLocalDirtyBits(),
mMultiviewDirtyBits(),
mProgramTexturesAndSamplersDirty(true),
mProgramStorageBuffersDirty(true),
mProgramDispatchIndirectBufferDirty(false)
mProgramStorageBuffersDirty(true)
{
ASSERT(mFunctions);
ASSERT(extensions.maxViews >= 1u);
......@@ -753,33 +752,34 @@ gl::Error StateManagerGL::setDrawIndirectState(const gl::Context *context, GLenu
}
bindVertexArray(vaoGL->getVertexArrayID(), vaoGL->getAppliedElementArrayBufferID());
gl::Buffer *drawIndirectBuffer = glState.getTargetBuffer(gl::BufferBinding::DrawIndirect);
ASSERT(drawIndirectBuffer);
const BufferGL *bufferGL = GetImplAs<BufferGL>(drawIndirectBuffer);
bindBuffer(gl::BufferBinding::DrawIndirect, bufferGL->getBufferID());
return setGenericDrawState(context);
}
void StateManagerGL::updateProgramDispatchIndirectBufferBinding(const gl::Context *context)
void StateManagerGL::updateDrawIndirectBufferBinding(const gl::Context *context)
{
gl::Buffer *dispatchIndirectBuffer =
context->getGLState().getTargetBuffer(gl::BufferBinding::DispatchIndirect);
ASSERT(dispatchIndirectBuffer);
const BufferGL *bufferGL = GetImplAs<BufferGL>(dispatchIndirectBuffer);
bindBuffer(gl::BufferBinding::DispatchIndirect, bufferGL->getBufferID());
gl::Buffer *drawIndirectBuffer =
context->getGLState().getTargetBuffer(gl::BufferBinding::DrawIndirect);
if (drawIndirectBuffer != nullptr)
{
const BufferGL *bufferGL = GetImplAs<BufferGL>(drawIndirectBuffer);
bindBuffer(gl::BufferBinding::DrawIndirect, bufferGL->getBufferID());
}
}
gl::Error StateManagerGL::setDispatchComputeState(const gl::Context *context, bool isIndirect)
void StateManagerGL::updateDispatchIndirectBufferBinding(const gl::Context *context)
{
setGenericShaderState(context);
if (isIndirect && mProgramDispatchIndirectBufferDirty)
gl::Buffer *dispatchIndirectBuffer =
context->getGLState().getTargetBuffer(gl::BufferBinding::DispatchIndirect);
if (dispatchIndirectBuffer != nullptr)
{
updateProgramDispatchIndirectBufferBinding(context);
mProgramDispatchIndirectBufferDirty = false;
const BufferGL *bufferGL = GetImplAs<BufferGL>(dispatchIndirectBuffer);
bindBuffer(gl::BufferBinding::DispatchIndirect, bufferGL->getBufferID());
}
}
gl::Error StateManagerGL::setDispatchComputeState(const gl::Context *context)
{
setGenericShaderState(context);
return gl::NoError();
}
......@@ -1946,10 +1946,10 @@ void StateManagerGL::syncState(const gl::Context *context, const gl::State::Dirt
GetImplAs<VertexArrayGL>(state.getVertexArray()));
break;
case gl::State::DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING:
// TODO: implement this
updateDrawIndirectBufferBinding(context);
break;
case gl::State::DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING:
mProgramDispatchIndirectBufferDirty = true;
updateDispatchIndirectBufferBinding(context);
break;
case gl::State::DIRTY_BIT_PROGRAM_BINDING:
{
......
......@@ -168,7 +168,7 @@ class StateManagerGL final : angle::NonCopyable
const void **outIndices);
gl::Error setDrawIndirectState(const gl::Context *context, GLenum type);
gl::Error setDispatchComputeState(const gl::Context *context, bool isIndirect);
gl::Error setDispatchComputeState(const gl::Context *context);
void pauseTransformFeedback();
gl::Error pauseAllQueries();
......@@ -200,7 +200,9 @@ class StateManagerGL final : angle::NonCopyable
void updateProgramTextureAndSamplerBindings(const gl::Context *context);
void updateProgramStorageBufferBindings(const gl::Context *context);
void updateProgramDispatchIndirectBufferBinding(const gl::Context *context);
void updateDispatchIndirectBufferBinding(const gl::Context *context);
void updateDrawIndirectBufferBinding(const gl::Context *context);
void syncTransformFeedbackState(const gl::Context *context);
......@@ -359,7 +361,6 @@ class StateManagerGL final : angle::NonCopyable
bool mProgramTexturesAndSamplersDirty;
bool mProgramStorageBuffersDirty;
bool mProgramDispatchIndirectBufferDirty;
};
}
......
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