Commit ebf75698 by Ian Elliott Committed by Angle LUCI CQ

Vulkan: Fix AGI clear hierarchy bug for clear commands

This approach properly handles outside-render-pass clears. Bug: b/190622922 Change-Id: Ia4a9d6ec13d7da8c4a445af1127e82c03f37e8b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2951960Reviewed-by: 's avatarMark Lobodzinski <mark@lunarg.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
parent bc913c70
...@@ -440,7 +440,7 @@ ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk ...@@ -440,7 +440,7 @@ ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk
mEmulateSeamfulCubeMapSampling(false), mEmulateSeamfulCubeMapSampling(false),
mOutsideRenderPassCommands(nullptr), mOutsideRenderPassCommands(nullptr),
mRenderPassCommands(nullptr), mRenderPassCommands(nullptr),
mQueryEventType(QueryEventCmdBuf::NotInQueryCmd), mQueryEventType(GraphicsEventCmdBuf::NotInQueryCmd),
mGpuEventsEnabled(false), mGpuEventsEnabled(false),
mEGLSyncObjectPendingFlush(false), mEGLSyncObjectPendingFlush(false),
mHasDeferredFlush(false), mHasDeferredFlush(false),
...@@ -3040,10 +3040,10 @@ void ContextVk::endEventLog(angle::EntryPoint entryPoint, PipelineType pipelineT ...@@ -3040,10 +3040,10 @@ void ContextVk::endEventLog(angle::EntryPoint entryPoint, PipelineType pipelineT
mOutsideRenderPassCommands->getCommandBuffer().endDebugUtilsLabelEXT(); mOutsideRenderPassCommands->getCommandBuffer().endDebugUtilsLabelEXT();
} }
} }
void ContextVk::endEventLogForQuery() void ContextVk::endEventLogForClearOrQuery()
{ {
ASSERT(mQueryEventType == QueryEventCmdBuf::InOutsideCmdBufQueryCmd || ASSERT(mQueryEventType == GraphicsEventCmdBuf::InOutsideCmdBufQueryCmd ||
mQueryEventType == QueryEventCmdBuf::InRenderPassCmdBufQueryCmd); mQueryEventType == GraphicsEventCmdBuf::InRenderPassCmdBufQueryCmd);
if (!mRenderer->angleDebuggerMode()) if (!mRenderer->angleDebuggerMode())
{ {
return; return;
...@@ -3052,11 +3052,11 @@ void ContextVk::endEventLogForQuery() ...@@ -3052,11 +3052,11 @@ void ContextVk::endEventLogForQuery()
vk::CommandBuffer *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
switch (mQueryEventType) switch (mQueryEventType)
{ {
case QueryEventCmdBuf::InOutsideCmdBufQueryCmd: case GraphicsEventCmdBuf::InOutsideCmdBufQueryCmd:
ASSERT(mOutsideRenderPassCommands); ASSERT(mOutsideRenderPassCommands);
commandBuffer = &mOutsideRenderPassCommands->getCommandBuffer(); commandBuffer = &mOutsideRenderPassCommands->getCommandBuffer();
break; break;
case QueryEventCmdBuf::InRenderPassCmdBufQueryCmd: case GraphicsEventCmdBuf::InRenderPassCmdBufQueryCmd:
ASSERT(mRenderPassCommands); ASSERT(mRenderPassCommands);
commandBuffer = &mRenderPassCommands->getCommandBuffer(); commandBuffer = &mRenderPassCommands->getCommandBuffer();
break; break;
...@@ -3065,7 +3065,7 @@ void ContextVk::endEventLogForQuery() ...@@ -3065,7 +3065,7 @@ void ContextVk::endEventLogForQuery()
} }
commandBuffer->endDebugUtilsLabelEXT(); commandBuffer->endDebugUtilsLabelEXT();
mQueryEventType = QueryEventCmdBuf::NotInQueryCmd; mQueryEventType = GraphicsEventCmdBuf::NotInQueryCmd;
} }
angle::Result ContextVk::handleNoopDrawEvent() angle::Result ContextVk::handleNoopDrawEvent()
...@@ -3074,14 +3074,9 @@ angle::Result ContextVk::handleNoopDrawEvent() ...@@ -3074,14 +3074,9 @@ angle::Result ContextVk::handleNoopDrawEvent()
return handleDirtyEventLogImpl(mRenderPassCommandBuffer); return handleDirtyEventLogImpl(mRenderPassCommandBuffer);
} }
angle::Result ContextVk::handleMidRenderPassClearEvent() angle::Result ContextVk::handleGraphicsEventLog(GraphicsEventCmdBuf queryEventType)
{ {
return handleDirtyEventLogImpl(mRenderPassCommandBuffer); ASSERT(mQueryEventType == GraphicsEventCmdBuf::NotInQueryCmd);
}
angle::Result ContextVk::handleQueryEvent(QueryEventCmdBuf queryEventType)
{
ASSERT(mQueryEventType == QueryEventCmdBuf::NotInQueryCmd);
if (!mRenderer->angleDebuggerMode()) if (!mRenderer->angleDebuggerMode())
{ {
return angle::Result::Continue; return angle::Result::Continue;
...@@ -3092,11 +3087,11 @@ angle::Result ContextVk::handleQueryEvent(QueryEventCmdBuf queryEventType) ...@@ -3092,11 +3087,11 @@ angle::Result ContextVk::handleQueryEvent(QueryEventCmdBuf queryEventType)
vk::CommandBuffer *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
switch (mQueryEventType) switch (mQueryEventType)
{ {
case QueryEventCmdBuf::InOutsideCmdBufQueryCmd: case GraphicsEventCmdBuf::InOutsideCmdBufQueryCmd:
ASSERT(mOutsideRenderPassCommands); ASSERT(mOutsideRenderPassCommands);
commandBuffer = &mOutsideRenderPassCommands->getCommandBuffer(); commandBuffer = &mOutsideRenderPassCommands->getCommandBuffer();
break; break;
case QueryEventCmdBuf::InRenderPassCmdBufQueryCmd: case GraphicsEventCmdBuf::InRenderPassCmdBufQueryCmd:
ASSERT(mRenderPassCommands); ASSERT(mRenderPassCommands);
commandBuffer = &mRenderPassCommands->getCommandBuffer(); commandBuffer = &mRenderPassCommands->getCommandBuffer();
break; break;
...@@ -5698,7 +5693,7 @@ angle::Result ContextVk::flushOutsideRenderPassCommands() ...@@ -5698,7 +5693,7 @@ angle::Result ContextVk::flushOutsideRenderPassCommands()
angle::Result ContextVk::beginRenderPassQuery(QueryVk *queryVk) angle::Result ContextVk::beginRenderPassQuery(QueryVk *queryVk)
{ {
// Emit debug-util markers before calling the query command. // Emit debug-util markers before calling the query command.
ANGLE_TRY(handleQueryEvent(rx::QueryEventCmdBuf::InRenderPassCmdBufQueryCmd)); ANGLE_TRY(handleGraphicsEventLog(rx::GraphicsEventCmdBuf::InRenderPassCmdBufQueryCmd));
// To avoid complexity, we always start and end these queries inside the render pass. If the // To avoid complexity, we always start and end these queries inside the render pass. If the
// render pass has not yet started, the query is deferred until it does. // render pass has not yet started, the query is deferred until it does.
...@@ -5718,7 +5713,7 @@ angle::Result ContextVk::beginRenderPassQuery(QueryVk *queryVk) ...@@ -5718,7 +5713,7 @@ angle::Result ContextVk::beginRenderPassQuery(QueryVk *queryVk)
angle::Result ContextVk::endRenderPassQuery(QueryVk *queryVk) angle::Result ContextVk::endRenderPassQuery(QueryVk *queryVk)
{ {
// Emit debug-util markers before calling the query command. // Emit debug-util markers before calling the query command.
ANGLE_TRY(handleQueryEvent(rx::QueryEventCmdBuf::InRenderPassCmdBufQueryCmd)); ANGLE_TRY(handleGraphicsEventLog(rx::GraphicsEventCmdBuf::InRenderPassCmdBufQueryCmd));
if (mRenderPassCommandBuffer) if (mRenderPassCommandBuffer)
{ {
......
...@@ -53,7 +53,7 @@ struct ContextVkPerfCounters ...@@ -53,7 +53,7 @@ struct ContextVkPerfCounters
ContextVkDescriptorSetList descriptorSetsAllocated; ContextVkDescriptorSetList descriptorSetsAllocated;
}; };
enum class QueryEventCmdBuf enum class GraphicsEventCmdBuf
{ {
NotInQueryCmd = 0, NotInQueryCmd = 0,
InOutsideCmdBufQueryCmd = 1, InOutsideCmdBufQueryCmd = 1,
...@@ -219,7 +219,7 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText ...@@ -219,7 +219,7 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText
// Record GL API calls for debuggers // Record GL API calls for debuggers
void logEvent(const char *eventString); void logEvent(const char *eventString);
void endEventLog(angle::EntryPoint entryPoint, PipelineType pipelineType); void endEventLog(angle::EntryPoint entryPoint, PipelineType pipelineType);
void endEventLogForQuery(); void endEventLogForClearOrQuery();
bool isViewportFlipEnabledForDrawFBO() const; bool isViewportFlipEnabledForDrawFBO() const;
bool isViewportFlipEnabledForReadFBO() const; bool isViewportFlipEnabledForReadFBO() const;
...@@ -627,8 +627,7 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText ...@@ -627,8 +627,7 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText
void onProgramExecutableReset(ProgramExecutableVk *executableVk); void onProgramExecutableReset(ProgramExecutableVk *executableVk);
angle::Result handleMidRenderPassClearEvent(); angle::Result handleGraphicsEventLog(GraphicsEventCmdBuf queryEventType);
angle::Result handleQueryEvent(QueryEventCmdBuf queryEventType);
private: private:
// Dirty bits. // Dirty bits.
...@@ -1074,14 +1073,14 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText ...@@ -1074,14 +1073,14 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText
// The following is used when creating debug-util markers for graphics debuggers (e.g. AGI). A // The following is used when creating debug-util markers for graphics debuggers (e.g. AGI). A
// given gl{Begin|End}Query command may result in commands being submitted to the outside or // given gl{Begin|End}Query command may result in commands being submitted to the outside or
// render-pass command buffer. The ContextVk::handleQueryEvent() method records the // render-pass command buffer. The ContextVk::handleGraphicsEventLog() method records the
// appropriate command buffer for use by ContextVk::endEventLogForQuery(). The knowledge of // appropriate command buffer for use by ContextVk::endEventLogForQuery(). The knowledge of
// which command buffer to use depends on the particular type of query (e.g. samples // which command buffer to use depends on the particular type of query (e.g. samples
// vs. timestamp), and is only known by the query code, which is what calls // vs. timestamp), and is only known by the query code, which is what calls
// ContextVk::handleQueryEvent(). After all back-end processing of the gl*Query command is // ContextVk::handleGraphicsEventLog(). After all back-end processing of the gl*Query command
// complete, the front-end calls ContextVk::endEventLogForQuery(), which needs to know which // is complete, the front-end calls ContextVk::endEventLogForQuery(), which needs to know which
// command buffer to call endDebugUtilsLabelEXT() for. // command buffer to call endDebugUtilsLabelEXT() for.
QueryEventCmdBuf mQueryEventType; GraphicsEventCmdBuf mQueryEventType;
// Transform feedback buffers. // Transform feedback buffers.
angle::FastUnorderedSet<const vk::BufferHelper *, angle::FastUnorderedSet<const vk::BufferHelper *,
......
...@@ -40,7 +40,7 @@ void DebugAnnotatorVk::endEvent(gl::Context *context, ...@@ -40,7 +40,7 @@ void DebugAnnotatorVk::endEvent(gl::Context *context,
if (vkCmdBeginDebugUtilsLabelEXT && context) if (vkCmdBeginDebugUtilsLabelEXT && context)
{ {
ContextVk *contextVk = vk::GetImpl(static_cast<gl::Context *>(context)); ContextVk *contextVk = vk::GetImpl(static_cast<gl::Context *>(context));
if (isDrawOrClearEntryPoint(entryPoint)) if (isDrawEntryPoint(entryPoint))
{ {
contextVk->endEventLog(entryPoint, PipelineType::Graphics); contextVk->endEventLog(entryPoint, PipelineType::Graphics);
} }
...@@ -48,9 +48,9 @@ void DebugAnnotatorVk::endEvent(gl::Context *context, ...@@ -48,9 +48,9 @@ void DebugAnnotatorVk::endEvent(gl::Context *context,
{ {
contextVk->endEventLog(entryPoint, PipelineType::Compute); contextVk->endEventLog(entryPoint, PipelineType::Compute);
} }
else if (isQueryEntryPoint(entryPoint)) else if (isClearOrQueryEntryPoint(entryPoint))
{ {
contextVk->endEventLogForQuery(); contextVk->endEventLogForClearOrQuery();
} }
} }
} }
...@@ -60,15 +60,10 @@ bool DebugAnnotatorVk::getStatus() ...@@ -60,15 +60,10 @@ bool DebugAnnotatorVk::getStatus()
return true; return true;
} }
bool DebugAnnotatorVk::isDrawOrClearEntryPoint(angle::EntryPoint entryPoint) const bool DebugAnnotatorVk::isDrawEntryPoint(angle::EntryPoint entryPoint) const
{ {
switch (entryPoint) switch (entryPoint)
{ {
case angle::EntryPoint::GLClear:
case angle::EntryPoint::GLClearBufferfi:
case angle::EntryPoint::GLClearBufferfv:
case angle::EntryPoint::GLClearBufferiv:
case angle::EntryPoint::GLClearBufferuiv:
case angle::EntryPoint::GLDrawArrays: case angle::EntryPoint::GLDrawArrays:
case angle::EntryPoint::GLDrawArraysIndirect: case angle::EntryPoint::GLDrawArraysIndirect:
case angle::EntryPoint::GLDrawArraysInstanced: case angle::EntryPoint::GLDrawArraysInstanced:
...@@ -125,10 +120,15 @@ bool DebugAnnotatorVk::isDispatchEntryPoint(angle::EntryPoint entryPoint) const ...@@ -125,10 +120,15 @@ bool DebugAnnotatorVk::isDispatchEntryPoint(angle::EntryPoint entryPoint) const
} }
} }
bool DebugAnnotatorVk::isQueryEntryPoint(angle::EntryPoint entryPoint) const bool DebugAnnotatorVk::isClearOrQueryEntryPoint(angle::EntryPoint entryPoint) const
{ {
switch (entryPoint) switch (entryPoint)
{ {
case angle::EntryPoint::GLClear:
case angle::EntryPoint::GLClearBufferfi:
case angle::EntryPoint::GLClearBufferfv:
case angle::EntryPoint::GLClearBufferiv:
case angle::EntryPoint::GLClearBufferuiv:
case angle::EntryPoint::GLBeginQuery: case angle::EntryPoint::GLBeginQuery:
case angle::EntryPoint::GLBeginQueryEXT: case angle::EntryPoint::GLBeginQueryEXT:
case angle::EntryPoint::GLBeginQueryIndexed: case angle::EntryPoint::GLBeginQueryIndexed:
......
...@@ -29,9 +29,9 @@ class DebugAnnotatorVk : public angle::LoggingAnnotator ...@@ -29,9 +29,9 @@ class DebugAnnotatorVk : public angle::LoggingAnnotator
bool getStatus() override; bool getStatus() override;
private: private:
bool isDrawOrClearEntryPoint(angle::EntryPoint entryPoint) const; bool isDrawEntryPoint(angle::EntryPoint entryPoint) const;
bool isDispatchEntryPoint(angle::EntryPoint entryPoint) const; bool isDispatchEntryPoint(angle::EntryPoint entryPoint) const;
bool isQueryEntryPoint(angle::EntryPoint entryPoint) const; bool isClearOrQueryEntryPoint(angle::EntryPoint entryPoint) const;
// Note: To avoid any race conditions between threads, this class has no private data; all // Note: To avoid any race conditions between threads, this class has no private data; all
// events are stored in ContextVk. // events are stored in ContextVk.
......
...@@ -501,6 +501,16 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context, ...@@ -501,6 +501,16 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
vk::Framebuffer *currentFramebuffer = nullptr; vk::Framebuffer *currentFramebuffer = nullptr;
ANGLE_TRY(getFramebuffer(contextVk, &currentFramebuffer, nullptr)); ANGLE_TRY(getFramebuffer(contextVk, &currentFramebuffer, nullptr));
ASSERT(contextVk->hasStartedRenderPassWithFramebuffer(currentFramebuffer)); ASSERT(contextVk->hasStartedRenderPassWithFramebuffer(currentFramebuffer));
// Emit debug-util markers for this mid-render-pass clear
ANGLE_TRY(
contextVk->handleGraphicsEventLog(rx::GraphicsEventCmdBuf::InRenderPassCmdBufQueryCmd));
}
else
{
// Emit debug-util markers for this outside-render-pass clear
ANGLE_TRY(
contextVk->handleGraphicsEventLog(rx::GraphicsEventCmdBuf::InOutsideCmdBufQueryCmd));
} }
const bool preferDrawOverClearAttachments = const bool preferDrawOverClearAttachments =
...@@ -2344,9 +2354,6 @@ angle::Result FramebufferVk::clearWithCommand(ContextVk *contextVk, ...@@ -2344,9 +2354,6 @@ angle::Result FramebufferVk::clearWithCommand(ContextVk *contextVk,
updateRenderPassReadOnlyDepthMode(contextVk, renderpassCommands); updateRenderPassReadOnlyDepthMode(contextVk, renderpassCommands);
} }
// Emit debug-util markers for this mid-render-pass clear
ANGLE_TRY(contextVk->handleMidRenderPassClearEvent());
VkClearRect rect = {}; VkClearRect rect = {};
rect.rect.extent.width = scissoredRenderArea.width; rect.rect.extent.width = scissoredRenderArea.width;
rect.rect.extent.height = scissoredRenderArea.height; rect.rect.extent.height = scissoredRenderArea.height;
......
...@@ -2800,7 +2800,7 @@ angle::Result QueryHelper::beginQuery(ContextVk *contextVk) ...@@ -2800,7 +2800,7 @@ angle::Result QueryHelper::beginQuery(ContextVk *contextVk)
CommandBuffer *commandBuffer; CommandBuffer *commandBuffer;
ANGLE_TRY(contextVk->getOutsideRenderPassCommandBuffer({}, &commandBuffer)); ANGLE_TRY(contextVk->getOutsideRenderPassCommandBuffer({}, &commandBuffer));
ANGLE_TRY(contextVk->handleQueryEvent(rx::QueryEventCmdBuf::InOutsideCmdBufQueryCmd)); ANGLE_TRY(contextVk->handleGraphicsEventLog(rx::GraphicsEventCmdBuf::InOutsideCmdBufQueryCmd));
beginQueryImpl(contextVk, commandBuffer, commandBuffer); beginQueryImpl(contextVk, commandBuffer, commandBuffer);
...@@ -2817,7 +2817,7 @@ angle::Result QueryHelper::endQuery(ContextVk *contextVk) ...@@ -2817,7 +2817,7 @@ angle::Result QueryHelper::endQuery(ContextVk *contextVk)
CommandBuffer *commandBuffer; CommandBuffer *commandBuffer;
ANGLE_TRY(contextVk->getOutsideRenderPassCommandBuffer({}, &commandBuffer)); ANGLE_TRY(contextVk->getOutsideRenderPassCommandBuffer({}, &commandBuffer));
ANGLE_TRY(contextVk->handleQueryEvent(rx::QueryEventCmdBuf::InOutsideCmdBufQueryCmd)); ANGLE_TRY(contextVk->handleGraphicsEventLog(rx::GraphicsEventCmdBuf::InOutsideCmdBufQueryCmd));
endQueryImpl(contextVk, commandBuffer); endQueryImpl(contextVk, commandBuffer);
......
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