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( ...@@ -277,7 +277,7 @@ angle::Result CommandGraphResource::beginRenderPass(
mCurrentWritingNode->storeRenderPassInfo(framebuffer, renderArea, renderPassDesc, mCurrentWritingNode->storeRenderPassInfo(framebuffer, renderArea, renderPassDesc,
renderPassAttachmentOps, clearValues); renderPassAttachmentOps, clearValues);
mCurrentWritingNode->setCommandBufferOwner(contextVk); mCurrentWritingNode->setRenderPassOwner(contextVk);
return mCurrentWritingNode->beginInsideRenderPassRecording(contextVk, commandBufferOut); return mCurrentWritingNode->beginInsideRenderPassRecording(contextVk, commandBufferOut);
} }
...@@ -353,7 +353,7 @@ CommandGraphNode::CommandGraphNode(CommandGraphNodeFunction function, ...@@ -353,7 +353,7 @@ CommandGraphNode::CommandGraphNode(CommandGraphNodeFunction function,
mVisitedState(VisitedState::Unvisited), mVisitedState(VisitedState::Unvisited),
mGlobalMemoryBarrierSrcAccess(0), mGlobalMemoryBarrierSrcAccess(0),
mGlobalMemoryBarrierDstAccess(0), mGlobalMemoryBarrierDstAccess(0),
mCommandBufferOwner(nullptr) mRenderPassOwner(nullptr)
{} {}
CommandGraphNode::~CommandGraphNode() CommandGraphNode::~CommandGraphNode()
......
...@@ -58,19 +58,19 @@ enum class CommandGraphNodeFunction ...@@ -58,19 +58,19 @@ enum class CommandGraphNodeFunction
HostAvailabilityOperation, HostAvailabilityOperation,
}; };
// Receives notifications when a command buffer is no longer able to record. Can be used with // Receives notifications when a render pass command buffer is no longer able to record. Can be
// inheritance. Faster than using an interface class since it has inlined methods. Could be used // used with inheritance. Faster than using an interface class since it has inlined methods. Could
// with composition by adding a getCommandBuffer method. // be used with composition by adding a getCommandBuffer method.
class CommandBufferOwner class RenderPassOwner
{ {
public: public:
CommandBufferOwner() = default; RenderPassOwner() = default;
virtual ~CommandBufferOwner() {} virtual ~RenderPassOwner() {}
ANGLE_INLINE void onCommandBufferFinished() { mCommandBuffer = nullptr; } ANGLE_INLINE void onRenderPassFinished() { mRenderPassCommandBuffer = nullptr; }
protected: protected:
CommandBuffer *mCommandBuffer = nullptr; CommandBuffer *mRenderPassCommandBuffer = nullptr;
}; };
// Only used internally in the command graph. Kept in the header for better inlining performance. // Only used internally in the command graph. Kept in the header for better inlining performance.
...@@ -197,19 +197,19 @@ class CommandGraphNode final : angle::NonCopyable ...@@ -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. // 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); ASSERT(mRenderPassOwner == nullptr);
mCommandBufferOwner = owner; mRenderPassOwner = owner;
} }
private: private:
ANGLE_INLINE void setHasChildren() ANGLE_INLINE void setHasChildren()
{ {
mHasChildren = true; mHasChildren = true;
if (mCommandBufferOwner) if (mRenderPassOwner)
{ {
mCommandBufferOwner->onCommandBufferFinished(); mRenderPassOwner->onRenderPassFinished();
} }
} }
...@@ -257,8 +257,8 @@ class CommandGraphNode final : angle::NonCopyable ...@@ -257,8 +257,8 @@ class CommandGraphNode final : angle::NonCopyable
VkFlags mGlobalMemoryBarrierSrcAccess; VkFlags mGlobalMemoryBarrierSrcAccess;
VkFlags mGlobalMemoryBarrierDstAccess; VkFlags mGlobalMemoryBarrierDstAccess;
// Command buffer notifications. // Render pass command buffer notifications.
CommandBufferOwner *mCommandBufferOwner; RenderPassOwner *mRenderPassOwner;
}; };
// This is a helper class for back-end objects used in Vk command buffers. It records a serial // 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, ...@@ -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 // function than an inlined if. We should probably replace the dirty bit dispatch table
// with a switch with inlined handler functions. // with a switch with inlined handler functions.
// TODO(jmadill): Use dirty bit. http://anglebug.com/3014 // TODO(jmadill): Use dirty bit. http://anglebug.com/3014
if (!mCommandBuffer) if (!mRenderPassCommandBuffer)
{ {
mDirtyBits |= mNewCommandBufferDirtyBits; mDirtyBits |= mNewCommandBufferDirtyBits;
gl::Rectangle scissoredRenderArea = mDrawFramebuffer->getScissoredRenderArea(this); gl::Rectangle scissoredRenderArea = mDrawFramebuffer->getScissoredRenderArea(this);
if (!mDrawFramebuffer->appendToStartedRenderPass(getCurrentQueueSerial(), if (!mDrawFramebuffer->appendToStartedRenderPass(
scissoredRenderArea, &mCommandBuffer)) getCurrentQueueSerial(), scissoredRenderArea, &mRenderPassCommandBuffer))
{ {
ANGLE_TRY( ANGLE_TRY(mDrawFramebuffer->startNewRenderPass(this, scissoredRenderArea,
mDrawFramebuffer->startNewRenderPass(this, scissoredRenderArea, &mCommandBuffer)); &mRenderPassCommandBuffer));
} }
} }
...@@ -403,7 +403,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context, ...@@ -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. // 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 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. // command buffer will still be valid for the duration of this API call.
*commandBufferOut = mCommandBuffer; *commandBufferOut = mRenderPassCommandBuffer;
ASSERT(*commandBufferOut); ASSERT(*commandBufferOut);
if (mProgram->dirtyUniforms()) if (mProgram->dirtyUniforms())
...@@ -659,7 +659,7 @@ angle::Result ContextVk::submitFrame(const VkSubmitInfo &submitInfo, ...@@ -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 // 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 // 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. // using this VkQueue that they their current command buffer is no longer valid.
onCommandBufferFinished(); onRenderPassFinished();
// Store this command buffer in the in-flight list. // Store this command buffer in the in-flight list.
batch.commandPool = std::move(mCommandPool); batch.commandPool = std::move(mCommandPool);
...@@ -1545,7 +1545,7 @@ angle::Result ContextVk::syncState(const gl::Context *context, ...@@ -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 // 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 // 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. // command graph node can only support one RenderPass configuration at a time.
onCommandBufferFinished(); onRenderPassFinished();
mDrawFramebuffer = vk::GetImpl(glState.getDrawFramebuffer()); mDrawFramebuffer = vk::GetImpl(glState.getDrawFramebuffer());
updateFlipViewportDrawFramebuffer(glState); updateFlipViewportDrawFramebuffer(glState);
......
...@@ -27,7 +27,7 @@ namespace rx ...@@ -27,7 +27,7 @@ namespace rx
class RendererVk; class RendererVk;
class WindowSurfaceVk; class WindowSurfaceVk;
class ContextVk : public ContextImpl, public vk::Context, public vk::CommandBufferOwner class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassOwner
{ {
public: public:
ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk *renderer); 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