Commit c37b1ef8 by Mark Lobodzinski Committed by Angle LUCI CQ

Balance debuglabel begin/end pairs for skipped drawcalls

Some drawcalls may be no-op'd due to shader issues or having zero instance or element counts. In these cases, the ANGLE markers used for AGI will become imbalanced as it is the drawcalls that trigger the 'begin' marker. This patch ensures that the dirty-bit draw event handler is called for no-op'd drawcalls to keep the AGI commandTree in balance. Bug: b/184888395 Change-Id: I1041d2f06fb313934365340c35e458bc5a66ba64 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2895330Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarIan Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
parent 019eda5c
...@@ -2449,6 +2449,7 @@ void Context::drawArraysInstanced(PrimitiveMode mode, ...@@ -2449,6 +2449,7 @@ void Context::drawArraysInstanced(PrimitiveMode mode,
// No-op if count draws no primitives for given mode // No-op if count draws no primitives for given mode
if (noopDrawInstanced(mode, count, instanceCount)) if (noopDrawInstanced(mode, count, instanceCount))
{ {
ANGLE_CONTEXT_TRY(mImplementation->handleNoopDrawEvent());
return; return;
} }
...@@ -2468,6 +2469,7 @@ void Context::drawElementsInstanced(PrimitiveMode mode, ...@@ -2468,6 +2469,7 @@ void Context::drawElementsInstanced(PrimitiveMode mode,
// No-op if count draws no primitives for given mode // No-op if count draws no primitives for given mode
if (noopDrawInstanced(mode, count, instances)) if (noopDrawInstanced(mode, count, instances))
{ {
ANGLE_CONTEXT_TRY(mImplementation->handleNoopDrawEvent());
return; return;
} }
...@@ -2486,6 +2488,7 @@ void Context::drawElementsBaseVertex(PrimitiveMode mode, ...@@ -2486,6 +2488,7 @@ void Context::drawElementsBaseVertex(PrimitiveMode mode,
// No-op if count draws no primitives for given mode // No-op if count draws no primitives for given mode
if (noopDraw(mode, count)) if (noopDraw(mode, count))
{ {
ANGLE_CONTEXT_TRY(mImplementation->handleNoopDrawEvent());
return; return;
} }
...@@ -2505,6 +2508,7 @@ void Context::drawElementsInstancedBaseVertex(PrimitiveMode mode, ...@@ -2505,6 +2508,7 @@ void Context::drawElementsInstancedBaseVertex(PrimitiveMode mode,
// No-op if count draws no primitives for given mode // No-op if count draws no primitives for given mode
if (noopDrawInstanced(mode, count, instancecount)) if (noopDrawInstanced(mode, count, instancecount))
{ {
ANGLE_CONTEXT_TRY(mImplementation->handleNoopDrawEvent());
return; return;
} }
...@@ -2524,6 +2528,7 @@ void Context::drawRangeElements(PrimitiveMode mode, ...@@ -2524,6 +2528,7 @@ void Context::drawRangeElements(PrimitiveMode mode,
// No-op if count draws no primitives for given mode // No-op if count draws no primitives for given mode
if (noopDraw(mode, count)) if (noopDraw(mode, count))
{ {
ANGLE_CONTEXT_TRY(mImplementation->handleNoopDrawEvent());
return; return;
} }
...@@ -2544,6 +2549,7 @@ void Context::drawRangeElementsBaseVertex(PrimitiveMode mode, ...@@ -2544,6 +2549,7 @@ void Context::drawRangeElementsBaseVertex(PrimitiveMode mode,
// No-op if count draws no primitives for given mode // No-op if count draws no primitives for given mode
if (noopDraw(mode, count)) if (noopDraw(mode, count))
{ {
ANGLE_CONTEXT_TRY(mImplementation->handleNoopDrawEvent());
return; return;
} }
...@@ -5851,6 +5857,11 @@ void Context::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLc ...@@ -5851,6 +5857,11 @@ void Context::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLc
mState.getDebug().pushGroup(source, id, std::move(msg)); mState.getDebug().pushGroup(source, id, std::move(msg));
} }
angle::Result Context::handleNoopDrawEvent()
{
return (mImplementation->handleNoopDrawEvent());
}
void Context::popDebugGroup() void Context::popDebugGroup()
{ {
mState.getDebug().popGroup(); mState.getDebug().popGroup();
...@@ -6356,6 +6367,7 @@ void Context::drawArraysInstancedBaseInstance(PrimitiveMode mode, ...@@ -6356,6 +6367,7 @@ void Context::drawArraysInstancedBaseInstance(PrimitiveMode mode,
{ {
if (noopDraw(mode, count)) if (noopDraw(mode, count))
{ {
ANGLE_CONTEXT_TRY(mImplementation->handleNoopDrawEvent());
return; return;
} }
...@@ -6388,6 +6400,7 @@ void Context::drawElementsInstancedBaseVertexBaseInstance(PrimitiveMode mode, ...@@ -6388,6 +6400,7 @@ void Context::drawElementsInstancedBaseVertexBaseInstance(PrimitiveMode mode,
{ {
if (noopDraw(mode, count)) if (noopDraw(mode, count))
{ {
ANGLE_CONTEXT_TRY(mImplementation->handleNoopDrawEvent());
return; return;
} }
......
...@@ -444,6 +444,8 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -444,6 +444,8 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
ANGLE_GLES_3_2_CONTEXT_API ANGLE_GLES_3_2_CONTEXT_API
ANGLE_GLES_EXT_CONTEXT_API ANGLE_GLES_EXT_CONTEXT_API
angle::Result handleNoopDrawEvent();
// Consumes an error. // Consumes an error.
void handleError(GLenum errorCode, void handleError(GLenum errorCode,
const char *message, const char *message,
......
...@@ -124,6 +124,7 @@ ANGLE_INLINE void Context::drawArrays(PrimitiveMode mode, GLint first, GLsizei c ...@@ -124,6 +124,7 @@ ANGLE_INLINE void Context::drawArrays(PrimitiveMode mode, GLint first, GLsizei c
// No-op if count draws no primitives for given mode // No-op if count draws no primitives for given mode
if (noopDraw(mode, count)) if (noopDraw(mode, count))
{ {
ANGLE_CONTEXT_TRY(mImplementation->handleNoopDrawEvent());
return; return;
} }
...@@ -140,6 +141,7 @@ ANGLE_INLINE void Context::drawElements(PrimitiveMode mode, ...@@ -140,6 +141,7 @@ ANGLE_INLINE void Context::drawElements(PrimitiveMode mode,
// No-op if count draws no primitives for given mode // No-op if count draws no primitives for given mode
if (noopDraw(mode, count)) if (noopDraw(mode, count))
{ {
ANGLE_CONTEXT_TRY(mImplementation->handleNoopDrawEvent());
return; return;
} }
......
...@@ -29,6 +29,11 @@ angle::Result ContextImpl::onUnMakeCurrent(const gl::Context *context) ...@@ -29,6 +29,11 @@ angle::Result ContextImpl::onUnMakeCurrent(const gl::Context *context)
return angle::Result::Continue; return angle::Result::Continue;
} }
angle::Result ContextImpl::handleNoopDrawEvent()
{
return angle::Result::Continue;
}
void ContextImpl::setMemoryProgramCache(gl::MemoryProgramCache *memoryProgramCache) void ContextImpl::setMemoryProgramCache(gl::MemoryProgramCache *memoryProgramCache)
{ {
mMemoryProgramCache = memoryProgramCache; mMemoryProgramCache = memoryProgramCache;
......
...@@ -172,6 +172,7 @@ class ContextImpl : public GLImplFactory ...@@ -172,6 +172,7 @@ class ContextImpl : public GLImplFactory
GLuint id, GLuint id,
const std::string &message) = 0; const std::string &message) = 0;
virtual angle::Result popDebugGroup(const gl::Context *context) = 0; virtual angle::Result popDebugGroup(const gl::Context *context) = 0;
virtual angle::Result handleNoopDrawEvent();
// KHR_parallel_shader_compile // KHR_parallel_shader_compile
virtual void setMaxShaderCompilerThreads(GLuint count) {} virtual void setMaxShaderCompilerThreads(GLuint count) {}
......
...@@ -1045,6 +1045,7 @@ void GetSamplePosition(GLsizei sampleCount, size_t index, GLfloat *xy) ...@@ -1045,6 +1045,7 @@ void GetSamplePosition(GLsizei sampleCount, size_t index, GLfloat *xy)
{ \ { \
if (ANGLE_NOOP_DRAW(instanced)) \ if (ANGLE_NOOP_DRAW(instanced)) \
{ \ { \
ANGLE_TRY(contextImpl->handleNoopDrawEvent()); \
continue; \ continue; \
} \ } \
ANGLE_SET_DRAW_ID_UNIFORM(hasDrawID)(drawID); \ ANGLE_SET_DRAW_ID_UNIFORM(hasDrawID)(drawID); \
......
...@@ -3017,6 +3017,18 @@ void ContextVk::endEventLog(angle::EntryPoint entryPoint) ...@@ -3017,6 +3017,18 @@ void ContextVk::endEventLog(angle::EntryPoint entryPoint)
mRenderPassCommands->getCommandBuffer().endDebugUtilsLabelEXT(); mRenderPassCommands->getCommandBuffer().endDebugUtilsLabelEXT();
} }
angle::Result ContextVk::handleNoopDrawEvent()
{
if (!mRenderer->angleDebuggerMode())
{
return angle::Result::Continue;
}
ASSERT(mRenderPassCommandBuffer);
// Even though this draw call is being no-op'd, we still must handle the dirty event log
return handleDirtyEventLogImpl(mRenderPassCommandBuffer);
}
bool ContextVk::isViewportFlipEnabledForDrawFBO() const bool ContextVk::isViewportFlipEnabledForDrawFBO() const
{ {
return mFlipViewportForDrawFramebuffer && mFlipYForCurrentSurface; return mFlipViewportForDrawFramebuffer && mFlipYForCurrentSurface;
......
...@@ -791,6 +791,8 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText ...@@ -791,6 +791,8 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText
void invalidateGraphicsDriverUniforms(); void invalidateGraphicsDriverUniforms();
void invalidateDriverUniforms(); void invalidateDriverUniforms();
angle::Result handleNoopDrawEvent() override;
// Handlers for graphics pipeline dirty bits. // Handlers for graphics pipeline dirty bits.
angle::Result handleDirtyGraphicsMemoryBarrier(DirtyBits::Iterator *dirtyBitsIterator, angle::Result handleDirtyGraphicsMemoryBarrier(DirtyBits::Iterator *dirtyBitsIterator,
DirtyBits dirtyBitMask); DirtyBits dirtyBitMask);
......
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