Commit 6f0780f8 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Rename CommandBufferOwner to RenderPassOwner

It's really only used to track the render pass command buffer. The change is made in preparation for compute, where the dispatcher command buffer can change without affecting the render pass. Bug: angleproject:3562 Change-Id: Ia8246de731d5c6a272fa17d6f8952dc981eca36e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1703523Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent c6d48248
......@@ -277,7 +277,7 @@ angle::Result CommandGraphResource::beginRenderPass(
mCurrentWritingNode->storeRenderPassInfo(framebuffer, renderArea, renderPassDesc,
renderPassAttachmentOps, clearValues);
mCurrentWritingNode->setCommandBufferOwner(contextVk);
mCurrentWritingNode->setRenderPassOwner(contextVk);
return mCurrentWritingNode->beginInsideRenderPassRecording(contextVk, commandBufferOut);
}
......@@ -353,7 +353,7 @@ CommandGraphNode::CommandGraphNode(CommandGraphNodeFunction function,
mVisitedState(VisitedState::Unvisited),
mGlobalMemoryBarrierSrcAccess(0),
mGlobalMemoryBarrierDstAccess(0),
mCommandBufferOwner(nullptr)
mRenderPassOwner(nullptr)
{}
CommandGraphNode::~CommandGraphNode()
......
......@@ -58,19 +58,19 @@ enum class CommandGraphNodeFunction
HostAvailabilityOperation,
};
// Receives notifications when a command buffer is no longer able to record. Can be used with
// inheritance. Faster than using an interface class since it has inlined methods. Could be used
// with composition by adding a getCommandBuffer method.
class CommandBufferOwner
// Receives notifications when a render pass command buffer is no longer able to record. Can be
// used with inheritance. Faster than using an interface class since it has inlined methods. Could
// be used with composition by adding a getCommandBuffer method.
class RenderPassOwner
{
public:
CommandBufferOwner() = default;
virtual ~CommandBufferOwner() {}
RenderPassOwner() = default;
virtual ~RenderPassOwner() {}
ANGLE_INLINE void onCommandBufferFinished() { mCommandBuffer = nullptr; }
ANGLE_INLINE void onRenderPassFinished() { mRenderPassCommandBuffer = nullptr; }
protected:
CommandBuffer *mCommandBuffer = nullptr;
CommandBuffer *mRenderPassCommandBuffer = nullptr;
};
// Only used internally in the command graph. Kept in the header for better inlining performance.
......@@ -197,19 +197,19 @@ class CommandGraphNode final : angle::NonCopyable
}
// This can only be set for RenderPass nodes. Each RenderPass node can have at most one owner.
void setCommandBufferOwner(CommandBufferOwner *owner)
void setRenderPassOwner(RenderPassOwner *owner)
{
ASSERT(mCommandBufferOwner == nullptr);
mCommandBufferOwner = owner;
ASSERT(mRenderPassOwner == nullptr);
mRenderPassOwner = owner;
}
private:
ANGLE_INLINE void setHasChildren()
{
mHasChildren = true;
if (mCommandBufferOwner)
if (mRenderPassOwner)
{
mCommandBufferOwner->onCommandBufferFinished();
mRenderPassOwner->onRenderPassFinished();
}
}
......@@ -257,8 +257,8 @@ class CommandGraphNode final : angle::NonCopyable
VkFlags mGlobalMemoryBarrierSrcAccess;
VkFlags mGlobalMemoryBarrierDstAccess;
// Command buffer notifications.
CommandBufferOwner *mCommandBufferOwner;
// Render pass command buffer notifications.
RenderPassOwner *mRenderPassOwner;
};
// This is a helper class for back-end objects used in Vk command buffers. It records a serial
......
......@@ -386,16 +386,16 @@ angle::Result ContextVk::setupDraw(const gl::Context *context,
// function than an inlined if. We should probably replace the dirty bit dispatch table
// with a switch with inlined handler functions.
// TODO(jmadill): Use dirty bit. http://anglebug.com/3014
if (!mCommandBuffer)
if (!mRenderPassCommandBuffer)
{
mDirtyBits |= mNewCommandBufferDirtyBits;
gl::Rectangle scissoredRenderArea = mDrawFramebuffer->getScissoredRenderArea(this);
if (!mDrawFramebuffer->appendToStartedRenderPass(getCurrentQueueSerial(),
scissoredRenderArea, &mCommandBuffer))
if (!mDrawFramebuffer->appendToStartedRenderPass(
getCurrentQueueSerial(), scissoredRenderArea, &mRenderPassCommandBuffer))
{
ANGLE_TRY(
mDrawFramebuffer->startNewRenderPass(this, scissoredRenderArea, &mCommandBuffer));
ANGLE_TRY(mDrawFramebuffer->startNewRenderPass(this, scissoredRenderArea,
&mRenderPassCommandBuffer));
}
}
......@@ -403,7 +403,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context,
// trigger a command buffer invalidation. The local copy ensures we retain the reference.
// Command buffers are pool allocated and only deleted after submit. Thus we know the
// command buffer will still be valid for the duration of this API call.
*commandBufferOut = mCommandBuffer;
*commandBufferOut = mRenderPassCommandBuffer;
ASSERT(*commandBufferOut);
if (mProgram->dirtyUniforms())
......@@ -659,7 +659,7 @@ angle::Result ContextVk::submitFrame(const VkSubmitInfo &submitInfo,
// check for a new serial when starting a new command buffer. We just check that the current
// recording command buffer is valid. Thus we need to explicitly notify every other Context
// using this VkQueue that they their current command buffer is no longer valid.
onCommandBufferFinished();
onRenderPassFinished();
// Store this command buffer in the in-flight list.
batch.commandPool = std::move(mCommandPool);
......@@ -1545,7 +1545,7 @@ angle::Result ContextVk::syncState(const gl::Context *context,
// dirty bits. Thus we need to explicitly clear the current command buffer to
// ensure we start a new one. Note that we need a new command buffer because a
// command graph node can only support one RenderPass configuration at a time.
onCommandBufferFinished();
onRenderPassFinished();
mDrawFramebuffer = vk::GetImpl(glState.getDrawFramebuffer());
updateFlipViewportDrawFramebuffer(glState);
......
......@@ -27,7 +27,7 @@ namespace rx
class RendererVk;
class WindowSurfaceVk;
class ContextVk : public ContextImpl, public vk::Context, public vk::CommandBufferOwner
class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassOwner
{
public:
ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk *renderer);
......
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