Commit 2660b503 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Restore CommandBuffer to namespace vk

Moved vk::CommandBuffer and vk::SecondaryCommandBuffer to vk::priv:: and aliased vk::CommandBuffer to one or the other. This allows the rest of the classes to continue seeing vk::CommandBuffer as they used to do. Used a special alias for the primary command buffer that gets submitted (vk::PrimaryCommandBuffer). Bug: angleproject:3136 Change-Id: I61236fd182230991db7395d05e3da3be5e3f45be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1534456Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent a8ff8814
...@@ -246,7 +246,7 @@ angle::Result BufferVk::copyToBuffer(ContextVk *contextVk, ...@@ -246,7 +246,7 @@ angle::Result BufferVk::copyToBuffer(ContextVk *contextVk,
uint32_t copyCount, uint32_t copyCount,
const VkBufferCopy *copies) const VkBufferCopy *copies)
{ {
CommandBufferT *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(mBuffer.recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mBuffer.recordCommands(contextVk, &commandBuffer));
commandBuffer->copyBuffer(mBuffer.getBuffer(), destBuffer->getBuffer(), copyCount, copies); commandBuffer->copyBuffer(mBuffer.getBuffer(), destBuffer->getBuffer(), copyCount, copies);
......
...@@ -31,7 +31,7 @@ angle::Result InitAndBeginCommandBuffer(vk::Context *context, ...@@ -31,7 +31,7 @@ angle::Result InitAndBeginCommandBuffer(vk::Context *context,
const VkCommandBufferInheritanceInfo &inheritanceInfo, const VkCommandBufferInheritanceInfo &inheritanceInfo,
VkCommandBufferUsageFlags flags, VkCommandBufferUsageFlags flags,
angle::PoolAllocator *poolAllocator, angle::PoolAllocator *poolAllocator,
SecondaryCommandBuffer *commandBuffer) priv::SecondaryCommandBuffer *commandBuffer)
{ {
ASSERT(!commandBuffer->valid()); ASSERT(!commandBuffer->valid());
commandBuffer->initialize(poolAllocator); commandBuffer->initialize(poolAllocator);
...@@ -44,7 +44,7 @@ angle::Result InitAndBeginCommandBuffer(vk::Context *context, ...@@ -44,7 +44,7 @@ angle::Result InitAndBeginCommandBuffer(vk::Context *context,
const VkCommandBufferInheritanceInfo &inheritanceInfo, const VkCommandBufferInheritanceInfo &inheritanceInfo,
VkCommandBufferUsageFlags flags, VkCommandBufferUsageFlags flags,
angle::PoolAllocator *poolAllocator, angle::PoolAllocator *poolAllocator,
CommandBuffer *commandBuffer) PrimaryCommandBuffer *commandBuffer)
{ {
ASSERT(!commandBuffer->valid()); ASSERT(!commandBuffer->valid());
VkCommandBufferAllocateInfo createInfo = {}; VkCommandBufferAllocateInfo createInfo = {};
...@@ -146,13 +146,14 @@ constexpr VkSubpassContents kRenderPassContents = VK_SUBPASS_CONTENTS_SECONDARY_ ...@@ -146,13 +146,14 @@ constexpr VkSubpassContents kRenderPassContents = VK_SUBPASS_CONTENTS_SECONDARY_
// Helpers to unify executeCommands call based on underlying cmd buffer type // Helpers to unify executeCommands call based on underlying cmd buffer type
ANGLE_MAYBE_UNUSED ANGLE_MAYBE_UNUSED
void ExecuteCommands(CommandBuffer *primCmdBuffer, SecondaryCommandBuffer *secCmdBuffer) void ExecuteCommands(PrimaryCommandBuffer *primCmdBuffer,
priv::SecondaryCommandBuffer *secCmdBuffer)
{ {
secCmdBuffer->executeCommands(primCmdBuffer->getHandle()); secCmdBuffer->executeCommands(primCmdBuffer->getHandle());
} }
ANGLE_MAYBE_UNUSED ANGLE_MAYBE_UNUSED
void ExecuteCommands(CommandBuffer *primCmdBuffer, CommandBuffer *secCmdBuffer) void ExecuteCommands(PrimaryCommandBuffer *primCmdBuffer, priv::CommandBuffer *secCmdBuffer)
{ {
primCmdBuffer->executeCommands(1, secCmdBuffer); primCmdBuffer->executeCommands(1, secCmdBuffer);
} }
...@@ -172,7 +173,7 @@ bool CommandGraphResource::isResourceInUse(RendererVk *renderer) const ...@@ -172,7 +173,7 @@ bool CommandGraphResource::isResourceInUse(RendererVk *renderer) const
} }
angle::Result CommandGraphResource::recordCommands(Context *context, angle::Result CommandGraphResource::recordCommands(Context *context,
CommandBufferT **commandBufferOut) CommandBuffer **commandBufferOut)
{ {
updateQueueSerial(context->getRenderer()->getCurrentQueueSerial()); updateQueueSerial(context->getRenderer()->getCurrentQueueSerial());
...@@ -183,7 +184,7 @@ angle::Result CommandGraphResource::recordCommands(Context *context, ...@@ -183,7 +184,7 @@ angle::Result CommandGraphResource::recordCommands(Context *context,
context, context->getRenderer()->getCommandPool(), commandBufferOut); context, context->getRenderer()->getCommandPool(), commandBufferOut);
} }
CommandBufferT *outsideRenderPassCommands = mCurrentWritingNode->getOutsideRenderPassCommands(); CommandBuffer *outsideRenderPassCommands = mCurrentWritingNode->getOutsideRenderPassCommands();
if (!outsideRenderPassCommands->valid()) if (!outsideRenderPassCommands->valid())
{ {
ANGLE_TRY(mCurrentWritingNode->beginOutsideRenderPassRecording( ANGLE_TRY(mCurrentWritingNode->beginOutsideRenderPassRecording(
...@@ -208,7 +209,7 @@ angle::Result CommandGraphResource::beginRenderPass(ContextVk *contextVk, ...@@ -208,7 +209,7 @@ angle::Result CommandGraphResource::beginRenderPass(ContextVk *contextVk,
const gl::Rectangle &renderArea, const gl::Rectangle &renderArea,
const RenderPassDesc &renderPassDesc, const RenderPassDesc &renderPassDesc,
const std::vector<VkClearValue> &clearValues, const std::vector<VkClearValue> &clearValues,
CommandBufferT **commandBufferOut) CommandBuffer **commandBufferOut)
{ {
// If a barrier has been inserted in the meantime, stop the command buffer. // If a barrier has been inserted in the meantime, stop the command buffer.
if (!hasChildlessWritingNode()) if (!hasChildlessWritingNode())
...@@ -309,7 +310,7 @@ CommandGraphNode::~CommandGraphNode() ...@@ -309,7 +310,7 @@ CommandGraphNode::~CommandGraphNode()
angle::Result CommandGraphNode::beginOutsideRenderPassRecording(Context *context, angle::Result CommandGraphNode::beginOutsideRenderPassRecording(Context *context,
const CommandPool &commandPool, const CommandPool &commandPool,
CommandBufferT **commandsOut) CommandBuffer **commandsOut)
{ {
ASSERT(!mHasChildren); ASSERT(!mHasChildren);
...@@ -331,7 +332,7 @@ angle::Result CommandGraphNode::beginOutsideRenderPassRecording(Context *context ...@@ -331,7 +332,7 @@ angle::Result CommandGraphNode::beginOutsideRenderPassRecording(Context *context
} }
angle::Result CommandGraphNode::beginInsideRenderPassRecording(Context *context, angle::Result CommandGraphNode::beginInsideRenderPassRecording(Context *context,
CommandBufferT **commandsOut) CommandBuffer **commandsOut)
{ {
ASSERT(!mHasChildren); ASSERT(!mHasChildren);
...@@ -466,7 +467,7 @@ void CommandGraphNode::visitParents(std::vector<CommandGraphNode *> *stack) ...@@ -466,7 +467,7 @@ void CommandGraphNode::visitParents(std::vector<CommandGraphNode *> *stack)
angle::Result CommandGraphNode::visitAndExecute(vk::Context *context, angle::Result CommandGraphNode::visitAndExecute(vk::Context *context,
Serial serial, Serial serial,
RenderPassCache *renderPassCache, RenderPassCache *renderPassCache,
CommandBuffer *primaryCommandBuffer) PrimaryCommandBuffer *primaryCommandBuffer)
{ {
switch (mFunction) switch (mFunction)
{ {
...@@ -683,7 +684,7 @@ angle::Result CommandGraph::submitCommands(Context *context, ...@@ -683,7 +684,7 @@ angle::Result CommandGraph::submitCommands(Context *context,
Serial serial, Serial serial,
RenderPassCache *renderPassCache, RenderPassCache *renderPassCache,
CommandPool *commandPool, CommandPool *commandPool,
CommandBuffer *primaryCommandBufferOut) PrimaryCommandBuffer *primaryCommandBufferOut)
{ {
// There is no point in submitting an empty command buffer, so make sure not to call this // There is no point in submitting an empty command buffer, so make sure not to call this
// function if there's nothing to do. // function if there's nothing to do.
......
...@@ -13,12 +13,6 @@ ...@@ -13,12 +13,6 @@
#include "libANGLE/renderer/vulkan/SecondaryCommandBuffer.h" #include "libANGLE/renderer/vulkan/SecondaryCommandBuffer.h"
#include "libANGLE/renderer/vulkan/vk_cache_utils.h" #include "libANGLE/renderer/vulkan/vk_cache_utils.h"
#if ANGLE_USE_CUSTOM_VULKAN_CMD_BUFFERS
using CommandBufferT = rx::vk::SecondaryCommandBuffer;
#else
using CommandBufferT = rx::vk::CommandBuffer;
#endif
namespace rx namespace rx
{ {
...@@ -69,7 +63,7 @@ class CommandBufferOwner ...@@ -69,7 +63,7 @@ class CommandBufferOwner
ANGLE_INLINE void onCommandBufferFinished() { mCommandBuffer = nullptr; } ANGLE_INLINE void onCommandBufferFinished() { mCommandBuffer = nullptr; }
protected: protected:
CommandBufferT *mCommandBuffer = nullptr; CommandBuffer *mCommandBuffer = 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.
...@@ -80,13 +74,13 @@ class CommandGraphNode final : angle::NonCopyable ...@@ -80,13 +74,13 @@ class CommandGraphNode final : angle::NonCopyable
~CommandGraphNode(); ~CommandGraphNode();
// Immutable queries for when we're walking the commands tree. // Immutable queries for when we're walking the commands tree.
CommandBufferT *getOutsideRenderPassCommands() CommandBuffer *getOutsideRenderPassCommands()
{ {
ASSERT(!mHasChildren); ASSERT(!mHasChildren);
return &mOutsideRenderPassCommands; return &mOutsideRenderPassCommands;
} }
CommandBufferT *getInsideRenderPassCommands() CommandBuffer *getInsideRenderPassCommands()
{ {
ASSERT(!mHasChildren); ASSERT(!mHasChildren);
return &mInsideRenderPassCommands; return &mInsideRenderPassCommands;
...@@ -95,10 +89,10 @@ class CommandGraphNode final : angle::NonCopyable ...@@ -95,10 +89,10 @@ class CommandGraphNode final : angle::NonCopyable
// For outside the render pass (copies, transitions, etc). // For outside the render pass (copies, transitions, etc).
angle::Result beginOutsideRenderPassRecording(Context *context, angle::Result beginOutsideRenderPassRecording(Context *context,
const CommandPool &commandPool, const CommandPool &commandPool,
CommandBufferT **commandsOut); CommandBuffer **commandsOut);
// For rendering commands (draws). // For rendering commands (draws).
angle::Result beginInsideRenderPassRecording(Context *context, CommandBufferT **commandsOut); angle::Result beginInsideRenderPassRecording(Context *context, CommandBuffer **commandsOut);
// storeRenderPassInfo and append*RenderTarget store info relevant to the RenderPass. // storeRenderPassInfo and append*RenderTarget store info relevant to the RenderPass.
void storeRenderPassInfo(const Framebuffer &framebuffer, void storeRenderPassInfo(const Framebuffer &framebuffer,
...@@ -134,7 +128,7 @@ class CommandGraphNode final : angle::NonCopyable ...@@ -134,7 +128,7 @@ class CommandGraphNode final : angle::NonCopyable
angle::Result visitAndExecute(Context *context, angle::Result visitAndExecute(Context *context,
Serial serial, Serial serial,
RenderPassCache *renderPassCache, RenderPassCache *renderPassCache,
CommandBuffer *primaryCommandBuffer); PrimaryCommandBuffer *primaryCommandBuffer);
// Only used in the command graph diagnostics. // Only used in the command graph diagnostics.
const std::vector<CommandGraphNode *> &getParentsForDiagnostics() const; const std::vector<CommandGraphNode *> &getParentsForDiagnostics() const;
...@@ -190,8 +184,8 @@ class CommandGraphNode final : angle::NonCopyable ...@@ -190,8 +184,8 @@ class CommandGraphNode final : angle::NonCopyable
angle::PoolAllocator *mPoolAllocator; angle::PoolAllocator *mPoolAllocator;
// Keep separate buffers for commands inside and outside a RenderPass. // Keep separate buffers for commands inside and outside a RenderPass.
// TODO(jmadill): We might not need inside and outside RenderPass commands separate. // TODO(jmadill): We might not need inside and outside RenderPass commands separate.
CommandBufferT mOutsideRenderPassCommands; CommandBuffer mOutsideRenderPassCommands;
CommandBufferT mInsideRenderPassCommands; CommandBuffer mInsideRenderPassCommands;
// Special-function additional data: // Special-function additional data:
// Queries: // Queries:
...@@ -265,7 +259,7 @@ class CommandGraphResource : angle::NonCopyable ...@@ -265,7 +259,7 @@ class CommandGraphResource : angle::NonCopyable
// Allocates a write node via getNewWriteNode and returns a started command buffer. // Allocates a write node via getNewWriteNode and returns a started command buffer.
// The started command buffer will render outside of a RenderPass. // The started command buffer will render outside of a RenderPass.
// Will append to an existing command buffer/graph node if possible. // Will append to an existing command buffer/graph node if possible.
angle::Result recordCommands(Context *context, CommandBufferT **commandBufferOut); angle::Result recordCommands(Context *context, CommandBuffer **commandBufferOut);
// Begins a command buffer on the current graph node for in-RenderPass rendering. // Begins a command buffer on the current graph node for in-RenderPass rendering.
// Called from FramebufferVk::startNewRenderPass and UtilsVk functions. // Called from FramebufferVk::startNewRenderPass and UtilsVk functions.
...@@ -274,12 +268,12 @@ class CommandGraphResource : angle::NonCopyable ...@@ -274,12 +268,12 @@ class CommandGraphResource : angle::NonCopyable
const gl::Rectangle &renderArea, const gl::Rectangle &renderArea,
const RenderPassDesc &renderPassDesc, const RenderPassDesc &renderPassDesc,
const std::vector<VkClearValue> &clearValues, const std::vector<VkClearValue> &clearValues,
CommandBufferT **commandBufferOut); CommandBuffer **commandBufferOut);
// Checks if we're in a RenderPass, returning true if so. Updates serial internally. // Checks if we're in a RenderPass, returning true if so. Updates serial internally.
// Returns the started command buffer in commandBufferOut. // Returns the started command buffer in commandBufferOut.
ANGLE_INLINE bool appendToStartedRenderPass(Serial currentQueueSerial, ANGLE_INLINE bool appendToStartedRenderPass(Serial currentQueueSerial,
CommandBufferT **commandBufferOut) CommandBuffer **commandBufferOut)
{ {
updateQueueSerial(currentQueueSerial); updateQueueSerial(currentQueueSerial);
if (hasStartedRenderPass()) if (hasStartedRenderPass())
...@@ -382,7 +376,7 @@ class CommandGraph final : angle::NonCopyable ...@@ -382,7 +376,7 @@ class CommandGraph final : angle::NonCopyable
Serial serial, Serial serial,
RenderPassCache *renderPassCache, RenderPassCache *renderPassCache,
CommandPool *commandPool, CommandPool *commandPool,
CommandBuffer *primaryCommandBufferOut); PrimaryCommandBuffer *primaryCommandBufferOut);
bool empty() const; bool empty() const;
void clear(); void clear();
......
...@@ -206,7 +206,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context, ...@@ -206,7 +206,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context,
gl::DrawElementsType indexTypeOrNone, gl::DrawElementsType indexTypeOrNone,
const void *indices, const void *indices,
DirtyBits dirtyBitMask, DirtyBits dirtyBitMask,
CommandBufferT **commandBufferOut) vk::CommandBuffer **commandBufferOut)
{ {
// Set any dirty bits that depend on draw call parameters or other objects. // Set any dirty bits that depend on draw call parameters or other objects.
if (mode != mCurrentDrawMode) if (mode != mCurrentDrawMode)
...@@ -273,7 +273,7 @@ angle::Result ContextVk::setupIndexedDraw(const gl::Context *context, ...@@ -273,7 +273,7 @@ angle::Result ContextVk::setupIndexedDraw(const gl::Context *context,
GLsizei instanceCount, GLsizei instanceCount,
gl::DrawElementsType indexType, gl::DrawElementsType indexType,
const void *indices, const void *indices,
CommandBufferT **commandBufferOut) vk::CommandBuffer **commandBufferOut)
{ {
if (indexType != mCurrentDrawElementsType) if (indexType != mCurrentDrawElementsType)
{ {
...@@ -312,7 +312,7 @@ angle::Result ContextVk::setupLineLoopDraw(const gl::Context *context, ...@@ -312,7 +312,7 @@ angle::Result ContextVk::setupLineLoopDraw(const gl::Context *context,
GLsizei vertexOrIndexCount, GLsizei vertexOrIndexCount,
gl::DrawElementsType indexTypeOrInvalid, gl::DrawElementsType indexTypeOrInvalid,
const void *indices, const void *indices,
CommandBufferT **commandBufferOut) vk::CommandBuffer **commandBufferOut)
{ {
ANGLE_TRY(mVertexArray->handleLineLoop(this, firstVertex, vertexOrIndexCount, ANGLE_TRY(mVertexArray->handleLineLoop(this, firstVertex, vertexOrIndexCount,
indexTypeOrInvalid, indices)); indexTypeOrInvalid, indices));
...@@ -325,7 +325,7 @@ angle::Result ContextVk::setupLineLoopDraw(const gl::Context *context, ...@@ -325,7 +325,7 @@ angle::Result ContextVk::setupLineLoopDraw(const gl::Context *context,
} }
angle::Result ContextVk::handleDirtyDefaultAttribs(const gl::Context *context, angle::Result ContextVk::handleDirtyDefaultAttribs(const gl::Context *context,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
ASSERT(mDirtyDefaultAttribsMask.any()); ASSERT(mDirtyDefaultAttribsMask.any());
...@@ -339,7 +339,7 @@ angle::Result ContextVk::handleDirtyDefaultAttribs(const gl::Context *context, ...@@ -339,7 +339,7 @@ angle::Result ContextVk::handleDirtyDefaultAttribs(const gl::Context *context,
} }
angle::Result ContextVk::handleDirtyPipeline(const gl::Context *context, angle::Result ContextVk::handleDirtyPipeline(const gl::Context *context,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
if (!mCurrentPipeline) if (!mCurrentPipeline)
{ {
...@@ -377,7 +377,7 @@ angle::Result ContextVk::handleDirtyPipeline(const gl::Context *context, ...@@ -377,7 +377,7 @@ angle::Result ContextVk::handleDirtyPipeline(const gl::Context *context,
} }
angle::Result ContextVk::handleDirtyTextures(const gl::Context *context, angle::Result ContextVk::handleDirtyTextures(const gl::Context *context,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
ANGLE_TRY(updateActiveTextures(context)); ANGLE_TRY(updateActiveTextures(context));
...@@ -389,7 +389,7 @@ angle::Result ContextVk::handleDirtyTextures(const gl::Context *context, ...@@ -389,7 +389,7 @@ angle::Result ContextVk::handleDirtyTextures(const gl::Context *context,
} }
angle::Result ContextVk::handleDirtyVertexBuffers(const gl::Context *context, angle::Result ContextVk::handleDirtyVertexBuffers(const gl::Context *context,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
uint32_t maxAttrib = mProgram->getState().getMaxActiveAttribLocation(); uint32_t maxAttrib = mProgram->getState().getMaxActiveAttribLocation();
const gl::AttribArray<VkBuffer> &bufferHandles = mVertexArray->getCurrentArrayBufferHandles(); const gl::AttribArray<VkBuffer> &bufferHandles = mVertexArray->getCurrentArrayBufferHandles();
...@@ -415,7 +415,7 @@ angle::Result ContextVk::handleDirtyVertexBuffers(const gl::Context *context, ...@@ -415,7 +415,7 @@ angle::Result ContextVk::handleDirtyVertexBuffers(const gl::Context *context,
} }
angle::Result ContextVk::handleDirtyIndexBuffer(const gl::Context *context, angle::Result ContextVk::handleDirtyIndexBuffer(const gl::Context *context,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
vk::BufferHelper *elementArrayBuffer = mVertexArray->getCurrentElementArrayBuffer(); vk::BufferHelper *elementArrayBuffer = mVertexArray->getCurrentElementArrayBuffer();
ASSERT(elementArrayBuffer != nullptr); ASSERT(elementArrayBuffer != nullptr);
...@@ -431,7 +431,7 @@ angle::Result ContextVk::handleDirtyIndexBuffer(const gl::Context *context, ...@@ -431,7 +431,7 @@ angle::Result ContextVk::handleDirtyIndexBuffer(const gl::Context *context,
} }
angle::Result ContextVk::handleDirtyDescriptorSets(const gl::Context *context, angle::Result ContextVk::handleDirtyDescriptorSets(const gl::Context *context,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
ANGLE_TRY(mProgram->updateDescriptorSets(this, commandBuffer)); ANGLE_TRY(mProgram->updateDescriptorSets(this, commandBuffer));
...@@ -447,8 +447,8 @@ angle::Result ContextVk::drawArrays(const gl::Context *context, ...@@ -447,8 +447,8 @@ angle::Result ContextVk::drawArrays(const gl::Context *context,
GLint first, GLint first,
GLsizei count) GLsizei count)
{ {
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
uint32_t clampedVertexCount = gl::GetClampedVertexCount<uint32_t>(count); uint32_t clampedVertexCount = gl::GetClampedVertexCount<uint32_t>(count);
if (mode == gl::PrimitiveMode::LineLoop) if (mode == gl::PrimitiveMode::LineLoop)
{ {
...@@ -479,7 +479,7 @@ angle::Result ContextVk::drawArraysInstanced(const gl::Context *context, ...@@ -479,7 +479,7 @@ angle::Result ContextVk::drawArraysInstanced(const gl::Context *context,
return angle::Result::Stop; return angle::Result::Stop;
} }
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(setupDraw(context, mode, first, count, instances, gl::DrawElementsType::InvalidEnum, ANGLE_TRY(setupDraw(context, mode, first, count, instances, gl::DrawElementsType::InvalidEnum,
nullptr, mNonIndexedDirtyBitsMask, &commandBuffer)); nullptr, mNonIndexedDirtyBitsMask, &commandBuffer));
commandBuffer->drawInstanced(gl::GetClampedVertexCount<uint32_t>(count), instances, first); commandBuffer->drawInstanced(gl::GetClampedVertexCount<uint32_t>(count), instances, first);
...@@ -492,7 +492,7 @@ angle::Result ContextVk::drawElements(const gl::Context *context, ...@@ -492,7 +492,7 @@ angle::Result ContextVk::drawElements(const gl::Context *context,
gl::DrawElementsType type, gl::DrawElementsType type,
const void *indices) const void *indices)
{ {
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
if (mode == gl::PrimitiveMode::LineLoop) if (mode == gl::PrimitiveMode::LineLoop)
{ {
ANGLE_TRY(setupLineLoopDraw(context, mode, 0, count, type, indices, &commandBuffer)); ANGLE_TRY(setupLineLoopDraw(context, mode, 0, count, type, indices, &commandBuffer));
...@@ -521,7 +521,7 @@ angle::Result ContextVk::drawElementsInstanced(const gl::Context *context, ...@@ -521,7 +521,7 @@ angle::Result ContextVk::drawElementsInstanced(const gl::Context *context,
return angle::Result::Stop; return angle::Result::Stop;
} }
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(setupIndexedDraw(context, mode, count, instances, type, indices, &commandBuffer)); ANGLE_TRY(setupIndexedDraw(context, mode, count, instances, type, indices, &commandBuffer));
commandBuffer->drawIndexedInstanced(count, instances); commandBuffer->drawIndexedInstanced(count, instances);
return angle::Result::Continue; return angle::Result::Continue;
...@@ -1155,7 +1155,7 @@ VkColorComponentFlags ContextVk::getClearColorMask() const ...@@ -1155,7 +1155,7 @@ VkColorComponentFlags ContextVk::getClearColorMask() const
} }
angle::Result ContextVk::handleDirtyDriverUniforms(const gl::Context *context, angle::Result ContextVk::handleDirtyDriverUniforms(const gl::Context *context,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
// Release any previously retained buffers. // Release any previously retained buffers.
mDriverUniformsBuffer.releaseRetainedBuffers(mRenderer); mDriverUniformsBuffer.releaseRetainedBuffers(mRenderer);
......
...@@ -226,7 +226,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::CommandBuff ...@@ -226,7 +226,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::CommandBuff
using DirtyBits = angle::BitSet<DIRTY_BIT_MAX>; using DirtyBits = angle::BitSet<DIRTY_BIT_MAX>;
using DirtyBitHandler = angle::Result (ContextVk::*)(const gl::Context *, using DirtyBitHandler = angle::Result (ContextVk::*)(const gl::Context *,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
std::array<DirtyBitHandler, DIRTY_BIT_MAX> mDirtyBitHandlers; std::array<DirtyBitHandler, DIRTY_BIT_MAX> mDirtyBitHandlers;
...@@ -238,21 +238,21 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::CommandBuff ...@@ -238,21 +238,21 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::CommandBuff
gl::DrawElementsType indexTypeOrInvalid, gl::DrawElementsType indexTypeOrInvalid,
const void *indices, const void *indices,
DirtyBits dirtyBitMask, DirtyBits dirtyBitMask,
CommandBufferT **commandBufferOut); vk::CommandBuffer **commandBufferOut);
angle::Result setupIndexedDraw(const gl::Context *context, angle::Result setupIndexedDraw(const gl::Context *context,
gl::PrimitiveMode mode, gl::PrimitiveMode mode,
GLsizei indexCount, GLsizei indexCount,
GLsizei instanceCount, GLsizei instanceCount,
gl::DrawElementsType indexType, gl::DrawElementsType indexType,
const void *indices, const void *indices,
CommandBufferT **commandBufferOut); vk::CommandBuffer **commandBufferOut);
angle::Result setupLineLoopDraw(const gl::Context *context, angle::Result setupLineLoopDraw(const gl::Context *context,
gl::PrimitiveMode mode, gl::PrimitiveMode mode,
GLint firstVertex, GLint firstVertex,
GLsizei vertexOrIndexCount, GLsizei vertexOrIndexCount,
gl::DrawElementsType indexTypeOrInvalid, gl::DrawElementsType indexTypeOrInvalid,
const void *indices, const void *indices,
CommandBufferT **commandBufferOut); vk::CommandBuffer **commandBufferOut);
void updateViewport(FramebufferVk *framebufferVk, void updateViewport(FramebufferVk *framebufferVk,
const gl::Rectangle &viewport, const gl::Rectangle &viewport,
...@@ -273,16 +273,17 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::CommandBuff ...@@ -273,16 +273,17 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::CommandBuff
void invalidateDriverUniforms(); void invalidateDriverUniforms();
angle::Result handleDirtyDefaultAttribs(const gl::Context *context, angle::Result handleDirtyDefaultAttribs(const gl::Context *context,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyPipeline(const gl::Context *context, CommandBufferT *commandBuffer); angle::Result handleDirtyPipeline(const gl::Context *context, vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyTextures(const gl::Context *context, CommandBufferT *commandBuffer); angle::Result handleDirtyTextures(const gl::Context *context, vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyVertexBuffers(const gl::Context *context, angle::Result handleDirtyVertexBuffers(const gl::Context *context,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyIndexBuffer(const gl::Context *context, CommandBufferT *commandBuffer); angle::Result handleDirtyIndexBuffer(const gl::Context *context,
vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyDriverUniforms(const gl::Context *context, angle::Result handleDirtyDriverUniforms(const gl::Context *context,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyDescriptorSets(const gl::Context *context, angle::Result handleDirtyDescriptorSets(const gl::Context *context,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
vk::PipelineHelper *mCurrentPipeline; vk::PipelineHelper *mCurrentPipeline;
gl::PrimitiveMode mCurrentDrawMode; gl::PrimitiveMode mCurrentDrawMode;
......
...@@ -166,7 +166,7 @@ angle::Result FramebufferVk::clear(const gl::Context *context, GLbitfield mask) ...@@ -166,7 +166,7 @@ angle::Result FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
// This command buffer is only started once. // This command buffer is only started once.
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
const gl::FramebufferAttachment *depthAttachment = mState.getDepthAttachment(); const gl::FramebufferAttachment *depthAttachment = mState.getDepthAttachment();
bool clearDepth = (depthAttachment && (mask & GL_DEPTH_BUFFER_BIT) != 0); bool clearDepth = (depthAttachment && (mask & GL_DEPTH_BUFFER_BIT) != 0);
...@@ -424,7 +424,7 @@ angle::Result FramebufferVk::blitWithCopy(ContextVk *contextVk, ...@@ -424,7 +424,7 @@ angle::Result FramebufferVk::blitWithCopy(ContextVk *contextVk,
VkImageAspectFlags aspectMask = VkImageAspectFlags aspectMask =
vk::GetDepthStencilAspectFlagsForCopy(blitDepthBuffer, blitStencilBuffer); vk::GetDepthStencilAspectFlagsForCopy(blitDepthBuffer, blitStencilBuffer);
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mFramebuffer.recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mFramebuffer.recordCommands(contextVk, &commandBuffer));
vk::ImageHelper *writeImage = drawRenderTarget->getImageForWrite(&mFramebuffer); vk::ImageHelper *writeImage = drawRenderTarget->getImageForWrite(&mFramebuffer);
...@@ -509,7 +509,7 @@ angle::Result FramebufferVk::blitWithReadback(ContextVk *contextVk, ...@@ -509,7 +509,7 @@ angle::Result FramebufferVk::blitWithReadback(ContextVk *contextVk,
// Reinitialize the commandBuffer after a read pixels because it calls // Reinitialize the commandBuffer after a read pixels because it calls
// renderer->finish which makes command buffers obsolete. // renderer->finish which makes command buffers obsolete.
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mFramebuffer.recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mFramebuffer.recordCommands(contextVk, &commandBuffer));
// We read the bytes of the image in a buffer, now we have to copy them into the // We read the bytes of the image in a buffer, now we have to copy them into the
...@@ -669,7 +669,7 @@ angle::Result FramebufferVk::blitWithCommand(ContextVk *contextVk, ...@@ -669,7 +669,7 @@ angle::Result FramebufferVk::blitWithCommand(ContextVk *contextVk,
vk::ImageHelper *dstImage = drawRenderTarget->getImageForWrite(&mFramebuffer); vk::ImageHelper *dstImage = drawRenderTarget->getImageForWrite(&mFramebuffer);
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mFramebuffer.recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mFramebuffer.recordCommands(contextVk, &commandBuffer));
const vk::Format &readImageFormat = readRenderTarget->getImageFormat(); const vk::Format &readImageFormat = readRenderTarget->getImageFormat();
...@@ -903,8 +903,8 @@ angle::Result FramebufferVk::clearWithClearAttachments( ...@@ -903,8 +903,8 @@ angle::Result FramebufferVk::clearWithClearAttachments(
// This command can only happen inside a render pass, so obtain one if its already happening // This command can only happen inside a render pass, so obtain one if its already happening
// or create a new one if not. // or create a new one if not.
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
vk::RecordingMode mode = vk::RecordingMode::Start; vk::RecordingMode mode = vk::RecordingMode::Start;
ANGLE_TRY(getCommandBufferForDraw(contextVk, &commandBuffer, &mode)); ANGLE_TRY(getCommandBufferForDraw(contextVk, &commandBuffer, &mode));
// The array layer is offset by the ImageView. So we shouldn't need to set a base array layer. // The array layer is offset by the ImageView. So we shouldn't need to set a base array layer.
...@@ -1032,7 +1032,7 @@ angle::Result FramebufferVk::getSamplePosition(const gl::Context *context, ...@@ -1032,7 +1032,7 @@ angle::Result FramebufferVk::getSamplePosition(const gl::Context *context,
} }
angle::Result FramebufferVk::getCommandBufferForDraw(ContextVk *contextVk, angle::Result FramebufferVk::getCommandBufferForDraw(ContextVk *contextVk,
CommandBufferT **commandBufferOut, vk::CommandBuffer **commandBufferOut,
vk::RecordingMode *modeOut) vk::RecordingMode *modeOut)
{ {
RendererVk *renderer = contextVk->getRenderer(); RendererVk *renderer = contextVk->getRenderer();
...@@ -1048,7 +1048,7 @@ angle::Result FramebufferVk::getCommandBufferForDraw(ContextVk *contextVk, ...@@ -1048,7 +1048,7 @@ angle::Result FramebufferVk::getCommandBufferForDraw(ContextVk *contextVk,
} }
angle::Result FramebufferVk::startNewRenderPass(ContextVk *contextVk, angle::Result FramebufferVk::startNewRenderPass(ContextVk *contextVk,
CommandBufferT **commandBufferOut) vk::CommandBuffer **commandBufferOut)
{ {
vk::Framebuffer *framebuffer = nullptr; vk::Framebuffer *framebuffer = nullptr;
ANGLE_TRY(getFramebuffer(contextVk, &framebuffer)); ANGLE_TRY(getFramebuffer(contextVk, &framebuffer));
...@@ -1056,7 +1056,7 @@ angle::Result FramebufferVk::startNewRenderPass(ContextVk *contextVk, ...@@ -1056,7 +1056,7 @@ angle::Result FramebufferVk::startNewRenderPass(ContextVk *contextVk,
// TODO(jmadill): Proper clear value implementation. http://anglebug.com/2361 // TODO(jmadill): Proper clear value implementation. http://anglebug.com/2361
std::vector<VkClearValue> attachmentClearValues; std::vector<VkClearValue> attachmentClearValues;
CommandBufferT *writeCommands = nullptr; vk::CommandBuffer *writeCommands = nullptr;
ANGLE_TRY(mFramebuffer.recordCommands(contextVk, &writeCommands)); ANGLE_TRY(mFramebuffer.recordCommands(contextVk, &writeCommands));
vk::RenderPassDesc renderPassDesc; vk::RenderPassDesc renderPassDesc;
...@@ -1112,7 +1112,7 @@ angle::Result FramebufferVk::readPixelsImpl(ContextVk *contextVk, ...@@ -1112,7 +1112,7 @@ angle::Result FramebufferVk::readPixelsImpl(ContextVk *contextVk,
ANGLE_TRY(renderTarget->ensureImageInitialized(contextVk)); ANGLE_TRY(renderTarget->ensureImageInitialized(contextVk));
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mFramebuffer.recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mFramebuffer.recordCommands(contextVk, &commandBuffer));
// Note that although we're reading from the image, we need to update the layout below. // Note that although we're reading from the image, we need to update the layout below.
......
...@@ -106,14 +106,14 @@ class FramebufferVk : public FramebufferImpl ...@@ -106,14 +106,14 @@ class FramebufferVk : public FramebufferImpl
RenderTargetVk *getColorReadRenderTarget() const; RenderTargetVk *getColorReadRenderTarget() const;
// This will clear the current write operation if it is complete. // This will clear the current write operation if it is complete.
bool appendToStartedRenderPass(Serial currentQueueSerial, CommandBufferT **commandBufferOut) bool appendToStartedRenderPass(Serial currentQueueSerial, vk::CommandBuffer **commandBufferOut)
{ {
return mFramebuffer.appendToStartedRenderPass(currentQueueSerial, commandBufferOut); return mFramebuffer.appendToStartedRenderPass(currentQueueSerial, commandBufferOut);
} }
vk::FramebufferHelper *getFramebuffer() { return &mFramebuffer; } vk::FramebufferHelper *getFramebuffer() { return &mFramebuffer; }
angle::Result startNewRenderPass(ContextVk *context, CommandBufferT **commandBufferOut); angle::Result startNewRenderPass(ContextVk *context, vk::CommandBuffer **commandBufferOut);
RenderTargetVk *getFirstRenderTarget() const; RenderTargetVk *getFirstRenderTarget() const;
GLint getSamples() const; GLint getSamples() const;
...@@ -127,7 +127,7 @@ class FramebufferVk : public FramebufferImpl ...@@ -127,7 +127,7 @@ class FramebufferVk : public FramebufferImpl
// Helper for appendToStarted/else startNewRenderPass. // Helper for appendToStarted/else startNewRenderPass.
angle::Result getCommandBufferForDraw(ContextVk *contextVk, angle::Result getCommandBufferForDraw(ContextVk *contextVk,
CommandBufferT **commandBufferOut, vk::CommandBuffer **commandBufferOut,
vk::RecordingMode *modeOut); vk::RecordingMode *modeOut);
// The 'in' rectangles must be clipped to the scissor and FBO. The clipping is done in 'blit'. // The 'in' rectangles must be clipped to the scissor and FBO. The clipping is done in 'blit'.
......
...@@ -862,7 +862,7 @@ angle::Result ProgramVk::updateTexturesDescriptorSet(ContextVk *contextVk, ...@@ -862,7 +862,7 @@ angle::Result ProgramVk::updateTexturesDescriptorSet(ContextVk *contextVk,
// Ensure the image is in read-only layout // Ensure the image is in read-only layout
if (image.isLayoutChangeNecessary(vk::ImageLayout::FragmentShaderReadOnly)) if (image.isLayoutChangeNecessary(vk::ImageLayout::FragmentShaderReadOnly))
{ {
CommandBufferT *srcLayoutChange; vk::CommandBuffer *srcLayoutChange;
ANGLE_TRY(image.recordCommands(contextVk, &srcLayoutChange)); ANGLE_TRY(image.recordCommands(contextVk, &srcLayoutChange));
image.changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, image.changeLayout(VK_IMAGE_ASPECT_COLOR_BIT,
...@@ -910,7 +910,8 @@ void ProgramVk::setDefaultUniformBlocksMinSizeForTesting(size_t minSize) ...@@ -910,7 +910,8 @@ void ProgramVk::setDefaultUniformBlocksMinSizeForTesting(size_t minSize)
} }
} }
angle::Result ProgramVk::updateDescriptorSets(ContextVk *contextVk, CommandBufferT *commandBuffer) angle::Result ProgramVk::updateDescriptorSets(ContextVk *contextVk,
vk::CommandBuffer *commandBuffer)
{ {
// Can probably use better dirty bits here. // Can probably use better dirty bits here.
......
...@@ -108,7 +108,7 @@ class ProgramVk : public ProgramImpl ...@@ -108,7 +108,7 @@ class ProgramVk : public ProgramImpl
angle::Result updateTexturesDescriptorSet(ContextVk *contextVk, angle::Result updateTexturesDescriptorSet(ContextVk *contextVk,
vk::FramebufferHelper *framebuffer); vk::FramebufferHelper *framebuffer);
angle::Result updateDescriptorSets(ContextVk *contextVk, CommandBufferT *commandBuffer); angle::Result updateDescriptorSets(ContextVk *contextVk, vk::CommandBuffer *commandBuffer);
// For testing only. // For testing only.
void setDefaultUniformBlocksMinSizeForTesting(size_t minSize); void setDefaultUniformBlocksMinSizeForTesting(size_t minSize);
......
...@@ -53,7 +53,7 @@ void RenderTargetVk::reset() ...@@ -53,7 +53,7 @@ void RenderTargetVk::reset()
} }
void RenderTargetVk::onColorDraw(vk::FramebufferHelper *framebufferVk, void RenderTargetVk::onColorDraw(vk::FramebufferHelper *framebufferVk,
CommandBufferT *commandBuffer, vk::CommandBuffer *commandBuffer,
vk::RenderPassDesc *renderPassDesc) vk::RenderPassDesc *renderPassDesc)
{ {
ASSERT(commandBuffer->valid()); ASSERT(commandBuffer->valid());
...@@ -71,7 +71,7 @@ void RenderTargetVk::onColorDraw(vk::FramebufferHelper *framebufferVk, ...@@ -71,7 +71,7 @@ void RenderTargetVk::onColorDraw(vk::FramebufferHelper *framebufferVk,
} }
void RenderTargetVk::onDepthStencilDraw(vk::FramebufferHelper *framebufferVk, void RenderTargetVk::onDepthStencilDraw(vk::FramebufferHelper *framebufferVk,
CommandBufferT *commandBuffer, vk::CommandBuffer *commandBuffer,
vk::RenderPassDesc *renderPassDesc) vk::RenderPassDesc *renderPassDesc)
{ {
ASSERT(commandBuffer->valid()); ASSERT(commandBuffer->valid());
...@@ -135,7 +135,7 @@ void RenderTargetVk::updateSwapchainImage(vk::ImageHelper *image, vk::ImageView ...@@ -135,7 +135,7 @@ void RenderTargetVk::updateSwapchainImage(vk::ImageHelper *image, vk::ImageView
vk::ImageHelper *RenderTargetVk::getImageForRead(vk::CommandGraphResource *readingResource, vk::ImageHelper *RenderTargetVk::getImageForRead(vk::CommandGraphResource *readingResource,
vk::ImageLayout layout, vk::ImageLayout layout,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
ASSERT(mImage && mImage->valid()); ASSERT(mImage && mImage->valid());
...@@ -145,7 +145,7 @@ vk::ImageHelper *RenderTargetVk::getImageForRead(vk::CommandGraphResource *readi ...@@ -145,7 +145,7 @@ vk::ImageHelper *RenderTargetVk::getImageForRead(vk::CommandGraphResource *readi
// //
// if (mImage->isLayoutChangeNecessary(layout) // if (mImage->isLayoutChangeNecessary(layout)
// { // {
// CommandBufferT *srcLayoutChange; // vk::CommandBuffer *srcLayoutChange;
// ANGLE_TRY(mImage->recordCommands(contextVk, &srcLayoutChange)); // ANGLE_TRY(mImage->recordCommands(contextVk, &srcLayoutChange));
// mImage->changeLayout(mImage->getAspectFlags(), layout, srcLayoutChange); // mImage->changeLayout(mImage->getAspectFlags(), layout, srcLayoutChange);
// } // }
......
...@@ -20,7 +20,6 @@ namespace rx ...@@ -20,7 +20,6 @@ namespace rx
{ {
namespace vk namespace vk
{ {
class CommandBuffer;
struct Format; struct Format;
class FramebufferHelper; class FramebufferHelper;
class ImageHelper; class ImageHelper;
...@@ -53,10 +52,10 @@ class RenderTargetVk final : public FramebufferAttachmentRenderTarget ...@@ -53,10 +52,10 @@ class RenderTargetVk final : public FramebufferAttachmentRenderTarget
// Note: RenderTargets should be called in order, with the depth/stencil onRender last. // Note: RenderTargets should be called in order, with the depth/stencil onRender last.
void onColorDraw(vk::FramebufferHelper *framebufferVk, void onColorDraw(vk::FramebufferHelper *framebufferVk,
CommandBufferT *commandBuffer, vk::CommandBuffer *commandBuffer,
vk::RenderPassDesc *renderPassDesc); vk::RenderPassDesc *renderPassDesc);
void onDepthStencilDraw(vk::FramebufferHelper *framebufferVk, void onDepthStencilDraw(vk::FramebufferHelper *framebufferVk,
CommandBufferT *commandBuffer, vk::CommandBuffer *commandBuffer,
vk::RenderPassDesc *renderPassDesc); vk::RenderPassDesc *renderPassDesc);
vk::ImageHelper &getImage(); vk::ImageHelper &getImage();
...@@ -65,7 +64,7 @@ class RenderTargetVk final : public FramebufferAttachmentRenderTarget ...@@ -65,7 +64,7 @@ class RenderTargetVk final : public FramebufferAttachmentRenderTarget
// getImageForRead will also transition the resource to the given layout. // getImageForRead will also transition the resource to the given layout.
vk::ImageHelper *getImageForRead(vk::CommandGraphResource *readingResource, vk::ImageHelper *getImageForRead(vk::CommandGraphResource *readingResource,
vk::ImageLayout layout, vk::ImageLayout layout,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
vk::ImageHelper *getImageForWrite(vk::CommandGraphResource *writingResource) const; vk::ImageHelper *getImageForWrite(vk::CommandGraphResource *writingResource) const;
vk::ImageView *getDrawImageView() const; vk::ImageView *getDrawImageView() const;
......
...@@ -93,7 +93,7 @@ angle::Result RenderbufferVk::setStorage(const gl::Context *context, ...@@ -93,7 +93,7 @@ angle::Result RenderbufferVk::setStorage(const gl::Context *context,
&mImageView, 0, 1)); &mImageView, 0, 1));
// TODO(jmadill): Fold this into the RenderPass load/store ops. http://anglebug.com/2361 // TODO(jmadill): Fold this into the RenderPass load/store ops. http://anglebug.com/2361
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer));
if (isDepthOrStencilFormat) if (isDepthOrStencilFormat)
...@@ -143,7 +143,7 @@ angle::Result RenderbufferVk::setStorageEGLImageTarget(const gl::Context *contex ...@@ -143,7 +143,7 @@ angle::Result RenderbufferVk::setStorageEGLImageTarget(const gl::Context *contex
uint32_t rendererQueueFamilyIndex = contextVk->getRenderer()->getQueueFamilyIndex(); uint32_t rendererQueueFamilyIndex = contextVk->getRenderer()->getQueueFamilyIndex();
if (mImage->isQueueChangeNeccesary(rendererQueueFamilyIndex)) if (mImage->isQueueChangeNeccesary(rendererQueueFamilyIndex))
{ {
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer));
mImage->changeLayoutAndQueue(aspect, vk::ImageLayout::ColorAttachment, mImage->changeLayoutAndQueue(aspect, vk::ImageLayout::ColorAttachment,
rendererQueueFamilyIndex, commandBuffer); rendererQueueFamilyIndex, commandBuffer);
......
...@@ -1324,7 +1324,7 @@ angle::Result RendererVk::finish(vk::Context *context) ...@@ -1324,7 +1324,7 @@ angle::Result RendererVk::finish(vk::Context *context)
{ {
TRACE_EVENT0("gpu.angle", "RendererVk::finish"); TRACE_EVENT0("gpu.angle", "RendererVk::finish");
vk::Scoped<vk::CommandBuffer> commandBatch(mDevice); vk::Scoped<vk::PrimaryCommandBuffer> commandBatch(mDevice);
ANGLE_TRY(flushCommandGraph(context, &commandBatch.get())); ANGLE_TRY(flushCommandGraph(context, &commandBatch.get()));
angle::FixedVector<VkSemaphore, kMaxWaitSemaphores> waitSemaphores; angle::FixedVector<VkSemaphore, kMaxWaitSemaphores> waitSemaphores;
...@@ -1434,7 +1434,7 @@ angle::Result RendererVk::checkCompletedCommands(vk::Context *context) ...@@ -1434,7 +1434,7 @@ angle::Result RendererVk::checkCompletedCommands(vk::Context *context)
angle::Result RendererVk::submitFrame(vk::Context *context, angle::Result RendererVk::submitFrame(vk::Context *context,
const VkSubmitInfo &submitInfo, const VkSubmitInfo &submitInfo,
vk::CommandBuffer &&commandBuffer) vk::PrimaryCommandBuffer &&commandBuffer)
{ {
TRACE_EVENT0("gpu.angle", "RendererVk::submitFrame"); TRACE_EVENT0("gpu.angle", "RendererVk::submitFrame");
...@@ -1557,7 +1557,8 @@ vk::CommandGraph *RendererVk::getCommandGraph() ...@@ -1557,7 +1557,8 @@ vk::CommandGraph *RendererVk::getCommandGraph()
return &mCommandGraph; return &mCommandGraph;
} }
angle::Result RendererVk::flushCommandGraph(vk::Context *context, vk::CommandBuffer *commandBatch) angle::Result RendererVk::flushCommandGraph(vk::Context *context,
vk::PrimaryCommandBuffer *commandBatch)
{ {
return mCommandGraph.submitCommands(context, mCurrentQueueSerial, &mRenderPassCache, return mCommandGraph.submitCommands(context, mCurrentQueueSerial, &mRenderPassCache,
&mCommandPool, commandBatch); &mCommandPool, commandBatch);
...@@ -1572,7 +1573,7 @@ angle::Result RendererVk::flush(vk::Context *context) ...@@ -1572,7 +1573,7 @@ angle::Result RendererVk::flush(vk::Context *context)
TRACE_EVENT0("gpu.angle", "RendererVk::flush"); TRACE_EVENT0("gpu.angle", "RendererVk::flush");
vk::Scoped<vk::CommandBuffer> commandBatch(mDevice); vk::Scoped<vk::PrimaryCommandBuffer> commandBatch(mDevice);
ANGLE_TRY(flushCommandGraph(context, &commandBatch.get())); ANGLE_TRY(flushCommandGraph(context, &commandBatch.get()));
angle::FixedVector<VkSemaphore, kMaxWaitSemaphores> waitSemaphores; angle::FixedVector<VkSemaphore, kMaxWaitSemaphores> waitSemaphores;
...@@ -1742,8 +1743,8 @@ angle::Result RendererVk::getTimestamp(vk::Context *context, uint64_t *timestamp ...@@ -1742,8 +1743,8 @@ angle::Result RendererVk::getTimestamp(vk::Context *context, uint64_t *timestamp
ANGLE_TRY(timestampQueryPool.get().allocateQuery(context, &timestampQuery)); ANGLE_TRY(timestampQueryPool.get().allocateQuery(context, &timestampQuery));
// Record the command buffer // Record the command buffer
vk::Scoped<vk::CommandBuffer> commandBatch(mDevice); vk::Scoped<vk::PrimaryCommandBuffer> commandBatch(mDevice);
vk::CommandBuffer &commandBuffer = commandBatch.get(); vk::PrimaryCommandBuffer &commandBuffer = commandBatch.get();
VkCommandBufferAllocateInfo commandBufferInfo = {}; VkCommandBufferAllocateInfo commandBufferInfo = {};
commandBufferInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; commandBufferInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
...@@ -1948,8 +1949,8 @@ angle::Result RendererVk::synchronizeCpuGpuTime(vk::Context *context) ...@@ -1948,8 +1949,8 @@ angle::Result RendererVk::synchronizeCpuGpuTime(vk::Context *context)
ANGLE_VK_TRY(context, gpuDone.get().reset(mDevice)); ANGLE_VK_TRY(context, gpuDone.get().reset(mDevice));
// Record the command buffer // Record the command buffer
vk::Scoped<vk::CommandBuffer> commandBatch(mDevice); vk::Scoped<vk::PrimaryCommandBuffer> commandBatch(mDevice);
vk::CommandBuffer &commandBuffer = commandBatch.get(); vk::PrimaryCommandBuffer &commandBuffer = commandBatch.get();
VkCommandBufferAllocateInfo commandBufferInfo = {}; VkCommandBufferAllocateInfo commandBufferInfo = {};
commandBufferInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; commandBufferInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
...@@ -2069,7 +2070,7 @@ angle::Result RendererVk::synchronizeCpuGpuTime(vk::Context *context) ...@@ -2069,7 +2070,7 @@ angle::Result RendererVk::synchronizeCpuGpuTime(vk::Context *context)
} }
angle::Result RendererVk::traceGpuEventImpl(vk::Context *context, angle::Result RendererVk::traceGpuEventImpl(vk::Context *context,
vk::CommandBuffer *commandBuffer, vk::PrimaryCommandBuffer *commandBuffer,
char phase, char phase,
const char *name) const char *name)
{ {
......
...@@ -183,7 +183,7 @@ class RendererVk : angle::NonCopyable ...@@ -183,7 +183,7 @@ class RendererVk : angle::NonCopyable
// The events are queued until the query results are available. Possible values for `phase` // The events are queued until the query results are available. Possible values for `phase`
// are TRACE_EVENT_PHASE_* // are TRACE_EVENT_PHASE_*
ANGLE_INLINE angle::Result traceGpuEvent(vk::Context *context, ANGLE_INLINE angle::Result traceGpuEvent(vk::Context *context,
vk::CommandBuffer *commandBuffer, vk::PrimaryCommandBuffer *commandBuffer,
char phase, char phase,
const char *name) const char *name)
{ {
...@@ -227,16 +227,16 @@ class RendererVk : angle::NonCopyable ...@@ -227,16 +227,16 @@ class RendererVk : angle::NonCopyable
angle::FixedVector<VkPipelineStageFlags, kMaxWaitSemaphores> *waitStageMasks); angle::FixedVector<VkPipelineStageFlags, kMaxWaitSemaphores> *waitStageMasks);
angle::Result submitFrame(vk::Context *context, angle::Result submitFrame(vk::Context *context,
const VkSubmitInfo &submitInfo, const VkSubmitInfo &submitInfo,
vk::CommandBuffer &&commandBuffer); vk::PrimaryCommandBuffer &&commandBuffer);
void freeAllInFlightResources(); void freeAllInFlightResources();
angle::Result flushCommandGraph(vk::Context *context, vk::CommandBuffer *commandBatch); angle::Result flushCommandGraph(vk::Context *context, vk::PrimaryCommandBuffer *commandBatch);
void initFeatures(const ExtensionNameList &extensions); void initFeatures(const ExtensionNameList &extensions);
void initPipelineCacheVkKey(); void initPipelineCacheVkKey();
angle::Result initPipelineCache(DisplayVk *display); angle::Result initPipelineCache(DisplayVk *display);
angle::Result synchronizeCpuGpuTime(vk::Context *context); angle::Result synchronizeCpuGpuTime(vk::Context *context);
angle::Result traceGpuEventImpl(vk::Context *context, angle::Result traceGpuEventImpl(vk::Context *context,
vk::CommandBuffer *commandBuffer, vk::PrimaryCommandBuffer *commandBuffer,
char phase, char phase,
const char *name); const char *name);
angle::Result checkCompletedGpuEvents(vk::Context *context); angle::Result checkCompletedGpuEvents(vk::Context *context);
......
...@@ -14,6 +14,8 @@ namespace rx ...@@ -14,6 +14,8 @@ namespace rx
{ {
namespace vk namespace vk
{ {
namespace priv
{
void SecondaryCommandBuffer::blitImage(const Image &srcImage, void SecondaryCommandBuffer::blitImage(const Image &srcImage,
VkImageLayout srcImageLayout, VkImageLayout srcImageLayout,
const Image &dstImage, const Image &dstImage,
...@@ -610,5 +612,6 @@ void SecondaryCommandBuffer::executeCommands(VkCommandBuffer cmdBuffer) ...@@ -610,5 +612,6 @@ void SecondaryCommandBuffer::executeCommands(VkCommandBuffer cmdBuffer)
} }
} }
} // namespace priv
} // namespace vk } // namespace vk
} // namespace rx } // namespace rx
...@@ -22,6 +22,9 @@ namespace rx ...@@ -22,6 +22,9 @@ namespace rx
namespace vk namespace vk
{ {
namespace priv
{
enum class CommandID : uint16_t enum class CommandID : uint16_t
{ {
// Invalid cmd used to mark end of sequence of commands // Invalid cmd used to mark end of sequence of commands
...@@ -705,6 +708,7 @@ ANGLE_INLINE void SecondaryCommandBuffer::drawIndexedInstanced(uint32_t indexCou ...@@ -705,6 +708,7 @@ ANGLE_INLINE void SecondaryCommandBuffer::drawIndexedInstanced(uint32_t indexCou
paramStruct->instanceCount = instanceCount; paramStruct->instanceCount = instanceCount;
} }
} // namespace priv
} // namespace vk } // namespace vk
} // namespace rx } // namespace rx
......
...@@ -548,7 +548,7 @@ angle::Result WindowSurfaceVk::recreateSwapchain(DisplayVk *displayVk, ...@@ -548,7 +548,7 @@ angle::Result WindowSurfaceVk::recreateSwapchain(DisplayVk *displayVk,
&member.imageView, 0, 1)); &member.imageView, 0, 1));
// Allocate a command buffer for clearing our images to black. // Allocate a command buffer for clearing our images to black.
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(member.image.recordCommands(displayVk, &commandBuffer)); ANGLE_TRY(member.image.recordCommands(displayVk, &commandBuffer));
// Set transfer dest layout, and clear the image to black. // Set transfer dest layout, and clear the image to black.
...@@ -571,7 +571,7 @@ angle::Result WindowSurfaceVk::recreateSwapchain(DisplayVk *displayVk, ...@@ -571,7 +571,7 @@ angle::Result WindowSurfaceVk::recreateSwapchain(DisplayVk *displayVk,
VkClearDepthStencilValue depthStencilClearValue = {1.0f, 0}; VkClearDepthStencilValue depthStencilClearValue = {1.0f, 0};
// Clear the image. // Clear the image.
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mDepthStencilImage.recordCommands(displayVk, &commandBuffer)); ANGLE_TRY(mDepthStencilImage.recordCommands(displayVk, &commandBuffer));
mDepthStencilImage.clearDepthStencil(aspect, aspect, depthStencilClearValue, commandBuffer); mDepthStencilImage.clearDepthStencil(aspect, aspect, depthStencilClearValue, commandBuffer);
...@@ -706,7 +706,7 @@ angle::Result WindowSurfaceVk::present(DisplayVk *displayVk, ...@@ -706,7 +706,7 @@ angle::Result WindowSurfaceVk::present(DisplayVk *displayVk,
SwapchainImage &image = mSwapchainImages[mCurrentSwapchainImageIndex]; SwapchainImage &image = mSwapchainImages[mCurrentSwapchainImageIndex];
CommandBufferT *swapCommands = nullptr; vk::CommandBuffer *swapCommands = nullptr;
ANGLE_TRY(image.image.recordCommands(displayVk, &swapCommands)); ANGLE_TRY(image.image.recordCommands(displayVk, &swapCommands));
image.image.changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::Present, swapCommands); image.image.changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::Present, swapCommands);
......
...@@ -534,7 +534,7 @@ angle::Result TextureVk::copySubImageImplWithTransfer(ContextVk *contextVk, ...@@ -534,7 +534,7 @@ angle::Result TextureVk::copySubImageImplWithTransfer(ContextVk *contextVk,
// Change source layout if necessary // Change source layout if necessary
if (srcImage->isLayoutChangeNecessary(vk::ImageLayout::TransferSrc)) if (srcImage->isLayoutChangeNecessary(vk::ImageLayout::TransferSrc))
{ {
CommandBufferT *srcLayoutChange; vk::CommandBuffer *srcLayoutChange;
ANGLE_TRY(srcImage->recordCommands(contextVk, &srcLayoutChange)); ANGLE_TRY(srcImage->recordCommands(contextVk, &srcLayoutChange));
srcImage->changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::TransferSrc, srcImage->changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::TransferSrc,
srcLayoutChange); srcLayoutChange);
...@@ -552,7 +552,7 @@ angle::Result TextureVk::copySubImageImplWithTransfer(ContextVk *contextVk, ...@@ -552,7 +552,7 @@ angle::Result TextureVk::copySubImageImplWithTransfer(ContextVk *contextVk,
// Make sure any updates to the image are already flushed. // Make sure any updates to the image are already flushed.
ANGLE_TRY(ensureImageInitialized(contextVk)); ANGLE_TRY(ensureImageInitialized(contextVk));
CommandBufferT *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer));
// Change the image layout before the transfer // Change the image layout before the transfer
...@@ -580,7 +580,7 @@ angle::Result TextureVk::copySubImageImplWithTransfer(ContextVk *contextVk, ...@@ -580,7 +580,7 @@ angle::Result TextureVk::copySubImageImplWithTransfer(ContextVk *contextVk,
gl::Extents(sourceArea.width, sourceArea.height, 1), gl::Extents(sourceArea.width, sourceArea.height, 1),
destFormat, kTransferStagingImageFlags, layerCount)); destFormat, kTransferStagingImageFlags, layerCount));
CommandBufferT *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(stagingImage->recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(stagingImage->recordCommands(contextVk, &commandBuffer));
// Change the image layout before the transfer // Change the image layout before the transfer
...@@ -749,7 +749,7 @@ angle::Result TextureVk::setStorage(const gl::Context *context, ...@@ -749,7 +749,7 @@ angle::Result TextureVk::setStorage(const gl::Context *context,
const vk::Format &format = renderer->getFormat(internalFormat); const vk::Format &format = renderer->getFormat(internalFormat);
ANGLE_TRY(ensureImageAllocated(renderer, format)); ANGLE_TRY(ensureImageAllocated(renderer, format));
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer));
if (mImage->valid()) if (mImage->valid())
...@@ -782,7 +782,7 @@ angle::Result TextureVk::setEGLImageTarget(const gl::Context *context, ...@@ -782,7 +782,7 @@ angle::Result TextureVk::setEGLImageTarget(const gl::Context *context,
uint32_t rendererQueueFamilyIndex = renderer->getQueueFamilyIndex(); uint32_t rendererQueueFamilyIndex = renderer->getQueueFamilyIndex();
if (mImage->isQueueChangeNeccesary(rendererQueueFamilyIndex)) if (mImage->isQueueChangeNeccesary(rendererQueueFamilyIndex))
{ {
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer));
mImage->changeLayoutAndQueue(VK_IMAGE_ASPECT_COLOR_BIT, mImage->changeLayoutAndQueue(VK_IMAGE_ASPECT_COLOR_BIT,
vk::ImageLayout::FragmentShaderReadOnly, vk::ImageLayout::FragmentShaderReadOnly,
...@@ -938,7 +938,7 @@ angle::Result TextureVk::copyImageDataToBuffer(ContextVk *contextVk, ...@@ -938,7 +938,7 @@ angle::Result TextureVk::copyImageDataToBuffer(ContextVk *contextVk,
size_t sourceCopyAllocationSize = size_t sourceCopyAllocationSize =
sourceArea.width * sourceArea.height * imageFormat.pixelBytes * layerCount; sourceArea.width * sourceArea.height * imageFormat.pixelBytes * layerCount;
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer));
// Requirement of the copyImageToBuffer, the source image must be in SRC_OPTIMAL layout. // Requirement of the copyImageToBuffer, the source image must be in SRC_OPTIMAL layout.
...@@ -1004,7 +1004,7 @@ angle::Result TextureVk::generateMipmapsWithCPU(const gl::Context *context) ...@@ -1004,7 +1004,7 @@ angle::Result TextureVk::generateMipmapsWithCPU(const gl::Context *context)
sourceRowPitch, imageData + bufferOffset)); sourceRowPitch, imageData + bufferOffset));
} }
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer));
return mImage->flushStagedUpdates(contextVk, getNativeImageLevel(0), getLevelCount(), return mImage->flushStagedUpdates(contextVk, getNativeImageLevel(0), getLevelCount(),
commandBuffer); commandBuffer);
...@@ -1132,7 +1132,7 @@ angle::Result TextureVk::ensureImageInitializedImpl(ContextVk *contextVk, ...@@ -1132,7 +1132,7 @@ angle::Result TextureVk::ensureImageInitializedImpl(ContextVk *contextVk,
{ {
return angle::Result::Continue; return angle::Result::Continue;
} }
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(mImage->recordCommands(contextVk, &commandBuffer));
if (!mImage->valid()) if (!mImage->valid())
...@@ -1290,7 +1290,7 @@ angle::Result TextureVk::initImage(ContextVk *contextVk, ...@@ -1290,7 +1290,7 @@ angle::Result TextureVk::initImage(ContextVk *contextVk,
const vk::Format &format, const vk::Format &format,
const gl::Extents &extents, const gl::Extents &extents,
const uint32_t levelCount, const uint32_t levelCount,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
const RendererVk *renderer = contextVk->getRenderer(); const RendererVk *renderer = contextVk->getRenderer();
const angle::Format &angleFormat = format.textureFormat(); const angle::Format &angleFormat = format.textureFormat();
......
...@@ -253,7 +253,7 @@ class TextureVk : public TextureImpl ...@@ -253,7 +253,7 @@ class TextureVk : public TextureImpl
const vk::Format &format, const vk::Format &format,
const gl::Extents &extents, const gl::Extents &extents,
const uint32_t levelCount, const uint32_t levelCount,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
void releaseImage(RendererVk *renderer); void releaseImage(RendererVk *renderer);
void releaseStagingBuffer(RendererVk *renderer); void releaseStagingBuffer(RendererVk *renderer);
uint32_t getLevelCount() const; uint32_t getLevelCount() const;
......
...@@ -311,7 +311,7 @@ angle::Result UtilsVk::setupProgram(vk::Context *context, ...@@ -311,7 +311,7 @@ angle::Result UtilsVk::setupProgram(vk::Context *context,
const VkDescriptorSet descriptorSet, const VkDescriptorSet descriptorSet,
const void *pushConstants, const void *pushConstants,
size_t pushConstantsSize, size_t pushConstantsSize,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
RendererVk *renderer = context->getRenderer(); RendererVk *renderer = context->getRenderer();
...@@ -373,7 +373,7 @@ angle::Result UtilsVk::clearBuffer(vk::Context *context, ...@@ -373,7 +373,7 @@ angle::Result UtilsVk::clearBuffer(vk::Context *context,
ANGLE_TRY(ensureBufferClearResourcesInitialized(context)); ANGLE_TRY(ensureBufferClearResourcesInitialized(context));
CommandBufferT *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(dest->recordCommands(context, &commandBuffer)); ANGLE_TRY(dest->recordCommands(context, &commandBuffer));
// Tell dest it's being written to. // Tell dest it's being written to.
...@@ -429,7 +429,7 @@ angle::Result UtilsVk::copyBuffer(vk::Context *context, ...@@ -429,7 +429,7 @@ angle::Result UtilsVk::copyBuffer(vk::Context *context,
ANGLE_TRY(ensureBufferCopyResourcesInitialized(context)); ANGLE_TRY(ensureBufferCopyResourcesInitialized(context));
CommandBufferT *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(dest->recordCommands(context, &commandBuffer)); ANGLE_TRY(dest->recordCommands(context, &commandBuffer));
// Tell src we are going to read from it. // Tell src we are going to read from it.
...@@ -498,7 +498,7 @@ angle::Result UtilsVk::convertVertexBuffer(vk::Context *context, ...@@ -498,7 +498,7 @@ angle::Result UtilsVk::convertVertexBuffer(vk::Context *context,
ANGLE_TRY(ensureConvertVertexResourcesInitialized(context)); ANGLE_TRY(ensureConvertVertexResourcesInitialized(context));
CommandBufferT *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(dest->recordCommands(context, &commandBuffer)); ANGLE_TRY(dest->recordCommands(context, &commandBuffer));
// Tell src we are going to read from it. // Tell src we are going to read from it.
...@@ -576,7 +576,7 @@ angle::Result UtilsVk::startRenderPass(ContextVk *contextVk, ...@@ -576,7 +576,7 @@ angle::Result UtilsVk::startRenderPass(ContextVk *contextVk,
const vk::ImageView *imageView, const vk::ImageView *imageView,
const vk::RenderPassDesc &renderPassDesc, const vk::RenderPassDesc &renderPassDesc,
const gl::Rectangle &renderArea, const gl::Rectangle &renderArea,
CommandBufferT **commandBufferOut) vk::CommandBuffer **commandBufferOut)
{ {
RendererVk *renderer = contextVk->getRenderer(); RendererVk *renderer = contextVk->getRenderer();
...@@ -617,7 +617,7 @@ angle::Result UtilsVk::clearImage(ContextVk *contextVk, ...@@ -617,7 +617,7 @@ angle::Result UtilsVk::clearImage(ContextVk *contextVk,
ANGLE_TRY(ensureImageClearResourcesInitialized(contextVk)); ANGLE_TRY(ensureImageClearResourcesInitialized(contextVk));
CommandBufferT *commandBuffer; vk::CommandBuffer *commandBuffer;
if (!framebuffer->appendToStartedRenderPass(renderer->getCurrentQueueSerial(), &commandBuffer)) if (!framebuffer->appendToStartedRenderPass(renderer->getCurrentQueueSerial(), &commandBuffer))
{ {
ANGLE_TRY(framebuffer->startNewRenderPass(contextVk, &commandBuffer)); ANGLE_TRY(framebuffer->startNewRenderPass(contextVk, &commandBuffer));
...@@ -738,20 +738,20 @@ angle::Result UtilsVk::copyImage(ContextVk *contextVk, ...@@ -738,20 +738,20 @@ angle::Result UtilsVk::copyImage(ContextVk *contextVk,
// Change source layout outside render pass // Change source layout outside render pass
if (src->isLayoutChangeNecessary(vk::ImageLayout::FragmentShaderReadOnly)) if (src->isLayoutChangeNecessary(vk::ImageLayout::FragmentShaderReadOnly))
{ {
CommandBufferT *srcLayoutChange; vk::CommandBuffer *srcLayoutChange;
ANGLE_TRY(src->recordCommands(contextVk, &srcLayoutChange)); ANGLE_TRY(src->recordCommands(contextVk, &srcLayoutChange));
src->changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::FragmentShaderReadOnly, src->changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::FragmentShaderReadOnly,
srcLayoutChange); srcLayoutChange);
} }
// Change destination layout outside render pass as well // Change destination layout outside render pass as well
CommandBufferT *destLayoutChange; vk::CommandBuffer *destLayoutChange;
ANGLE_TRY(dest->recordCommands(contextVk, &destLayoutChange)); ANGLE_TRY(dest->recordCommands(contextVk, &destLayoutChange));
dest->changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::ColorAttachment, dest->changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::ColorAttachment,
destLayoutChange); destLayoutChange);
CommandBufferT *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY( ANGLE_TRY(
startRenderPass(contextVk, dest, destView, renderPassDesc, renderArea, &commandBuffer)); startRenderPass(contextVk, dest, destView, renderPassDesc, renderArea, &commandBuffer));
......
...@@ -192,7 +192,7 @@ class UtilsVk : angle::NonCopyable ...@@ -192,7 +192,7 @@ class UtilsVk : angle::NonCopyable
const VkDescriptorSet descriptorSet, const VkDescriptorSet descriptorSet,
const void *pushConstants, const void *pushConstants,
size_t pushConstantsSize, size_t pushConstantsSize,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
// Initializes descriptor set layout, pipeline layout and descriptor pool corresponding to given // Initializes descriptor set layout, pipeline layout and descriptor pool corresponding to given
// function, if not already initialized. Uses setSizes to create the layout. For example, if // function, if not already initialized. Uses setSizes to create the layout. For example, if
...@@ -218,7 +218,7 @@ class UtilsVk : angle::NonCopyable ...@@ -218,7 +218,7 @@ class UtilsVk : angle::NonCopyable
const vk::ImageView *imageView, const vk::ImageView *imageView,
const vk::RenderPassDesc &renderPassDesc, const vk::RenderPassDesc &renderPassDesc,
const gl::Rectangle &renderArea, const gl::Rectangle &renderArea,
CommandBufferT **commandBufferOut); vk::CommandBuffer **commandBufferOut);
angle::PackedEnumMap<Function, vk::DescriptorSetLayoutPointerArray> mDescriptorSetLayouts; angle::PackedEnumMap<Function, vk::DescriptorSetLayoutPointerArray> mDescriptorSetLayouts;
angle::PackedEnumMap<Function, vk::BindingPointer<vk::PipelineLayout>> mPipelineLayouts; angle::PackedEnumMap<Function, vk::BindingPointer<vk::PipelineLayout>> mPipelineLayouts;
......
...@@ -1060,7 +1060,7 @@ void LineLoopHelper::destroy(VkDevice device) ...@@ -1060,7 +1060,7 @@ void LineLoopHelper::destroy(VkDevice device)
} }
// static // static
void LineLoopHelper::Draw(uint32_t count, CommandBufferT *commandBuffer) void LineLoopHelper::Draw(uint32_t count, vk::CommandBuffer *commandBuffer)
{ {
// Our first index is always 0 because that's how we set it up in createIndexBuffer*. // Our first index is always 0 because that's how we set it up in createIndexBuffer*.
// Note: this could theoretically overflow and wrap to zero. // Note: this could theoretically overflow and wrap to zero.
...@@ -1128,7 +1128,7 @@ angle::Result BufferHelper::copyFromBuffer(Context *context, ...@@ -1128,7 +1128,7 @@ angle::Result BufferHelper::copyFromBuffer(Context *context,
const VkBufferCopy &copyRegion) const VkBufferCopy &copyRegion)
{ {
// 'recordCommands' will implicitly stop any reads from using the old buffer data. // 'recordCommands' will implicitly stop any reads from using the old buffer data.
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(recordCommands(context, &commandBuffer)); ANGLE_TRY(recordCommands(context, &commandBuffer));
if (mCurrentReadAccess != 0 || mCurrentWriteAccess != 0) if (mCurrentReadAccess != 0 || mCurrentWriteAccess != 0)
...@@ -1558,7 +1558,7 @@ bool ImageHelper::isLayoutChangeNecessary(ImageLayout newLayout) const ...@@ -1558,7 +1558,7 @@ bool ImageHelper::isLayoutChangeNecessary(ImageLayout newLayout) const
void ImageHelper::changeLayout(VkImageAspectFlags aspectMask, void ImageHelper::changeLayout(VkImageAspectFlags aspectMask,
ImageLayout newLayout, ImageLayout newLayout,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
if (!isLayoutChangeNecessary(newLayout)) if (!isLayoutChangeNecessary(newLayout))
{ {
...@@ -1571,7 +1571,7 @@ void ImageHelper::changeLayout(VkImageAspectFlags aspectMask, ...@@ -1571,7 +1571,7 @@ void ImageHelper::changeLayout(VkImageAspectFlags aspectMask,
void ImageHelper::changeLayoutAndQueue(VkImageAspectFlags aspectMask, void ImageHelper::changeLayoutAndQueue(VkImageAspectFlags aspectMask,
ImageLayout newLayout, ImageLayout newLayout,
uint32_t newQueueFamilyIndex, uint32_t newQueueFamilyIndex,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
ASSERT(isQueueChangeNeccesary(newQueueFamilyIndex)); ASSERT(isQueueChangeNeccesary(newQueueFamilyIndex));
forceChangeLayoutAndQueue(aspectMask, newLayout, newQueueFamilyIndex, commandBuffer); forceChangeLayoutAndQueue(aspectMask, newLayout, newQueueFamilyIndex, commandBuffer);
...@@ -1580,7 +1580,7 @@ void ImageHelper::changeLayoutAndQueue(VkImageAspectFlags aspectMask, ...@@ -1580,7 +1580,7 @@ void ImageHelper::changeLayoutAndQueue(VkImageAspectFlags aspectMask,
void ImageHelper::forceChangeLayoutAndQueue(VkImageAspectFlags aspectMask, void ImageHelper::forceChangeLayoutAndQueue(VkImageAspectFlags aspectMask,
ImageLayout newLayout, ImageLayout newLayout,
uint32_t newQueueFamilyIndex, uint32_t newQueueFamilyIndex,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
const ImageMemoryBarrierData &transitionFrom = kImageMemoryBarrierData[mCurrentLayout]; const ImageMemoryBarrierData &transitionFrom = kImageMemoryBarrierData[mCurrentLayout];
...@@ -1612,7 +1612,7 @@ void ImageHelper::forceChangeLayoutAndQueue(VkImageAspectFlags aspectMask, ...@@ -1612,7 +1612,7 @@ void ImageHelper::forceChangeLayoutAndQueue(VkImageAspectFlags aspectMask,
void ImageHelper::clearColor(const VkClearColorValue &color, void ImageHelper::clearColor(const VkClearColorValue &color,
uint32_t baseMipLevel, uint32_t baseMipLevel,
uint32_t levelCount, uint32_t levelCount,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
clearColorLayer(color, baseMipLevel, levelCount, 0, mLayerCount, commandBuffer); clearColorLayer(color, baseMipLevel, levelCount, 0, mLayerCount, commandBuffer);
} }
...@@ -1622,7 +1622,7 @@ void ImageHelper::clearColorLayer(const VkClearColorValue &color, ...@@ -1622,7 +1622,7 @@ void ImageHelper::clearColorLayer(const VkClearColorValue &color,
uint32_t levelCount, uint32_t levelCount,
uint32_t baseArrayLayer, uint32_t baseArrayLayer,
uint32_t layerCount, uint32_t layerCount,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
ASSERT(valid()); ASSERT(valid());
...@@ -1641,7 +1641,7 @@ void ImageHelper::clearColorLayer(const VkClearColorValue &color, ...@@ -1641,7 +1641,7 @@ void ImageHelper::clearColorLayer(const VkClearColorValue &color,
void ImageHelper::clearDepthStencil(VkImageAspectFlags imageAspectFlags, void ImageHelper::clearDepthStencil(VkImageAspectFlags imageAspectFlags,
VkImageAspectFlags clearAspectFlags, VkImageAspectFlags clearAspectFlags,
const VkClearDepthStencilValue &depthStencil, const VkClearDepthStencilValue &depthStencil,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
ASSERT(valid()); ASSERT(valid());
...@@ -1676,7 +1676,7 @@ void ImageHelper::Copy(ImageHelper *srcImage, ...@@ -1676,7 +1676,7 @@ void ImageHelper::Copy(ImageHelper *srcImage,
const gl::Extents &copySize, const gl::Extents &copySize,
const VkImageSubresourceLayers &srcSubresource, const VkImageSubresourceLayers &srcSubresource,
const VkImageSubresourceLayers &dstSubresource, const VkImageSubresourceLayers &dstSubresource,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
ASSERT(commandBuffer->valid() && srcImage->valid() && dstImage->valid()); ASSERT(commandBuffer->valid() && srcImage->valid() && dstImage->valid());
...@@ -1702,7 +1702,7 @@ void ImageHelper::Copy(ImageHelper *srcImage, ...@@ -1702,7 +1702,7 @@ void ImageHelper::Copy(ImageHelper *srcImage,
angle::Result ImageHelper::generateMipmapsWithBlit(ContextVk *contextVk, GLuint maxLevel) angle::Result ImageHelper::generateMipmapsWithBlit(ContextVk *contextVk, GLuint maxLevel)
{ {
CommandBufferT *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(recordCommands(contextVk, &commandBuffer)); ANGLE_TRY(recordCommands(contextVk, &commandBuffer));
changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, ImageLayout::TransferDst, commandBuffer); changeLayout(VK_IMAGE_ASPECT_COLOR_BIT, ImageLayout::TransferDst, commandBuffer);
...@@ -2060,7 +2060,7 @@ angle::Result ImageHelper::allocateStagingMemory(ContextVk *contextVk, ...@@ -2060,7 +2060,7 @@ angle::Result ImageHelper::allocateStagingMemory(ContextVk *contextVk,
angle::Result ImageHelper::flushStagedUpdates(Context *context, angle::Result ImageHelper::flushStagedUpdates(Context *context,
uint32_t baseLevel, uint32_t baseLevel,
uint32_t levelCount, uint32_t levelCount,
CommandBufferT *commandBuffer) vk::CommandBuffer *commandBuffer)
{ {
if (mSubresourceUpdates.empty()) if (mSubresourceUpdates.empty())
{ {
......
...@@ -379,7 +379,7 @@ class LineLoopHelper final : angle::NonCopyable ...@@ -379,7 +379,7 @@ class LineLoopHelper final : angle::NonCopyable
void release(RendererVk *renderer); void release(RendererVk *renderer);
void destroy(VkDevice device); void destroy(VkDevice device);
static void Draw(uint32_t count, CommandBufferT *commandBuffer); static void Draw(uint32_t count, vk::CommandBuffer *commandBuffer);
private: private:
DynamicBuffer mDynamicIndexBuffer; DynamicBuffer mDynamicIndexBuffer;
...@@ -613,20 +613,19 @@ class ImageHelper final : public CommandGraphResource ...@@ -613,20 +613,19 @@ class ImageHelper final : public CommandGraphResource
void clearColor(const VkClearColorValue &color, void clearColor(const VkClearColorValue &color,
uint32_t baseMipLevel, uint32_t baseMipLevel,
uint32_t levelCount, uint32_t levelCount,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
void clearColorLayer(const VkClearColorValue &color, void clearColorLayer(const VkClearColorValue &color,
uint32_t baseMipLevel, uint32_t baseMipLevel,
uint32_t levelCount, uint32_t levelCount,
uint32_t baseArrayLayer, uint32_t baseArrayLayer,
uint32_t layerCount, uint32_t layerCount,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
void clearDepthStencil(VkImageAspectFlags imageAspectFlags, void clearDepthStencil(VkImageAspectFlags imageAspectFlags,
VkImageAspectFlags clearAspectFlags, VkImageAspectFlags clearAspectFlags,
const VkClearDepthStencilValue &depthStencil, const VkClearDepthStencilValue &depthStencil,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
gl::Extents getSize(const gl::ImageIndex &index) const; gl::Extents getSize(const gl::ImageIndex &index) const;
static void Copy(ImageHelper *srcImage, static void Copy(ImageHelper *srcImage,
...@@ -636,7 +635,7 @@ class ImageHelper final : public CommandGraphResource ...@@ -636,7 +635,7 @@ class ImageHelper final : public CommandGraphResource
const gl::Extents &copySize, const gl::Extents &copySize,
const VkImageSubresourceLayers &srcSubresources, const VkImageSubresourceLayers &srcSubresources,
const VkImageSubresourceLayers &dstSubresources, const VkImageSubresourceLayers &dstSubresources,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result generateMipmapsWithBlit(ContextVk *contextVk, GLuint maxLevel); angle::Result generateMipmapsWithBlit(ContextVk *contextVk, GLuint maxLevel);
...@@ -684,7 +683,7 @@ class ImageHelper final : public CommandGraphResource ...@@ -684,7 +683,7 @@ class ImageHelper final : public CommandGraphResource
angle::Result flushStagedUpdates(Context *context, angle::Result flushStagedUpdates(Context *context,
uint32_t baseLevel, uint32_t baseLevel,
uint32_t levelCount, uint32_t levelCount,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
bool hasStagedUpdates() const; bool hasStagedUpdates() const;
...@@ -695,7 +694,7 @@ class ImageHelper final : public CommandGraphResource ...@@ -695,7 +694,7 @@ class ImageHelper final : public CommandGraphResource
void changeLayout(VkImageAspectFlags aspectMask, void changeLayout(VkImageAspectFlags aspectMask,
ImageLayout newLayout, ImageLayout newLayout,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
bool isQueueChangeNeccesary(uint32_t newQueueFamilyIndex) const bool isQueueChangeNeccesary(uint32_t newQueueFamilyIndex) const
{ {
...@@ -705,13 +704,13 @@ class ImageHelper final : public CommandGraphResource ...@@ -705,13 +704,13 @@ class ImageHelper final : public CommandGraphResource
void changeLayoutAndQueue(VkImageAspectFlags aspectMask, void changeLayoutAndQueue(VkImageAspectFlags aspectMask,
ImageLayout newLayout, ImageLayout newLayout,
uint32_t newQueueFamilyIndex, uint32_t newQueueFamilyIndex,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
private: private:
void forceChangeLayoutAndQueue(VkImageAspectFlags aspectMask, void forceChangeLayoutAndQueue(VkImageAspectFlags aspectMask,
ImageLayout newLayout, ImageLayout newLayout,
uint32_t newQueueFamilyIndex, uint32_t newQueueFamilyIndex,
CommandBufferT *commandBuffer); vk::CommandBuffer *commandBuffer);
struct SubresourceUpdate struct SubresourceUpdate
{ {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "common/debug.h" #include "common/debug.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/Observer.h" #include "libANGLE/Observer.h"
#include "libANGLE/renderer/vulkan/SecondaryCommandBuffer.h"
#include "libANGLE/renderer/vulkan/vk_wrapper.h" #include "libANGLE/renderer/vulkan/vk_wrapper.h"
#define ANGLE_GL_OBJECTS_X(PROC) \ #define ANGLE_GL_OBJECTS_X(PROC) \
...@@ -114,6 +115,14 @@ class Context : angle::NonCopyable ...@@ -114,6 +115,14 @@ class Context : angle::NonCopyable
RendererVk *const mRenderer; RendererVk *const mRenderer;
}; };
#if ANGLE_USE_CUSTOM_VULKAN_CMD_BUFFERS
using CommandBuffer = priv::SecondaryCommandBuffer;
#else
using CommandBuffer = priv::CommandBuffer;
#endif
using PrimaryCommandBuffer = priv::CommandBuffer;
VkImageAspectFlags GetDepthStencilAspectFlags(const angle::Format &format); VkImageAspectFlags GetDepthStencilAspectFlags(const angle::Format &format);
VkImageAspectFlags GetFormatAspectFlags(const angle::Format &format); VkImageAspectFlags GetFormatAspectFlags(const angle::Format &format);
VkImageAspectFlags GetDepthStencilAspectFlagsForCopy(bool copyDepth, bool copyStencil); VkImageAspectFlags GetDepthStencilAspectFlagsForCopy(bool copyDepth, bool copyStencil);
......
...@@ -70,7 +70,6 @@ class WrappedObject : angle::NonCopyable ...@@ -70,7 +70,6 @@ class WrappedObject : angle::NonCopyable
#define ANGLE_HANDLE_TYPES_X(FUNC) \ #define ANGLE_HANDLE_TYPES_X(FUNC) \
FUNC(Buffer) \ FUNC(Buffer) \
FUNC(BufferView) \ FUNC(BufferView) \
FUNC(CommandBuffer) \
FUNC(CommandPool) \ FUNC(CommandPool) \
FUNC(DescriptorPool) \ FUNC(DescriptorPool) \
FUNC(DescriptorSetLayout) \ FUNC(DescriptorSetLayout) \
...@@ -94,6 +93,7 @@ class WrappedObject : angle::NonCopyable ...@@ -94,6 +93,7 @@ class WrappedObject : angle::NonCopyable
enum class HandleType enum class HandleType
{ {
Invalid, Invalid,
CommandBuffer,
ANGLE_HANDLE_TYPES_X(ANGLE_COMMA_SEP_FUNC) ANGLE_HANDLE_TYPES_X(ANGLE_COMMA_SEP_FUNC)
}; };
...@@ -101,6 +101,10 @@ enum class HandleType ...@@ -101,6 +101,10 @@ enum class HandleType
#define ANGLE_PRE_DECLARE_CLASS_FUNC(TYPE) class TYPE; #define ANGLE_PRE_DECLARE_CLASS_FUNC(TYPE) class TYPE;
ANGLE_HANDLE_TYPES_X(ANGLE_PRE_DECLARE_CLASS_FUNC) ANGLE_HANDLE_TYPES_X(ANGLE_PRE_DECLARE_CLASS_FUNC)
namespace priv
{
class CommandBuffer;
} // namespace priv
#undef ANGLE_PRE_DECLARE_CLASS_FUNC #undef ANGLE_PRE_DECLARE_CLASS_FUNC
// Returns the HandleType of a Vk Handle. // Returns the HandleType of a Vk Handle.
...@@ -115,6 +119,11 @@ struct HandleTypeHelper; ...@@ -115,6 +119,11 @@ struct HandleTypeHelper;
}; };
ANGLE_HANDLE_TYPES_X(ANGLE_HANDLE_TYPE_HELPER_FUNC) ANGLE_HANDLE_TYPES_X(ANGLE_HANDLE_TYPE_HELPER_FUNC)
template <>
struct HandleTypeHelper<priv::CommandBuffer>
{
constexpr static HandleType kHandleType = HandleType::CommandBuffer;
};
#undef ANGLE_HANDLE_TYPE_HELPER_FUNC #undef ANGLE_HANDLE_TYPE_HELPER_FUNC
...@@ -142,6 +151,9 @@ class Pipeline final : public WrappedObject<Pipeline, VkPipeline> ...@@ -142,6 +151,9 @@ class Pipeline final : public WrappedObject<Pipeline, VkPipeline>
const PipelineCache &pipelineCacheVk); const PipelineCache &pipelineCacheVk);
}; };
namespace priv
{
// Helper class that wraps a Vulkan command buffer. // Helper class that wraps a Vulkan command buffer.
class CommandBuffer : public WrappedObject<CommandBuffer, VkCommandBuffer> class CommandBuffer : public WrappedObject<CommandBuffer, VkCommandBuffer>
{ {
...@@ -293,6 +305,8 @@ class CommandBuffer : public WrappedObject<CommandBuffer, VkCommandBuffer> ...@@ -293,6 +305,8 @@ class CommandBuffer : public WrappedObject<CommandBuffer, VkCommandBuffer>
void setScissor(uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *scissors); void setScissor(uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *scissors);
}; };
} // namespace priv
class Image final : public WrappedObject<Image, VkImage> class Image final : public WrappedObject<Image, VkImage>
{ {
public: public:
...@@ -518,6 +532,9 @@ ANGLE_INLINE VkResult CommandPool::init(VkDevice device, const VkCommandPoolCrea ...@@ -518,6 +532,9 @@ ANGLE_INLINE VkResult CommandPool::init(VkDevice device, const VkCommandPoolCrea
return vkCreateCommandPool(device, &createInfo, nullptr, &mHandle); return vkCreateCommandPool(device, &createInfo, nullptr, &mHandle);
} }
namespace priv
{
// CommandBuffer implementation. // CommandBuffer implementation.
ANGLE_INLINE VkCommandBuffer CommandBuffer::releaseHandle() ANGLE_INLINE VkCommandBuffer CommandBuffer::releaseHandle()
{ {
...@@ -715,7 +732,7 @@ ANGLE_INLINE void CommandBuffer::bindDescriptorSets(VkPipelineBindPoint bindPoin ...@@ -715,7 +732,7 @@ ANGLE_INLINE void CommandBuffer::bindDescriptorSets(VkPipelineBindPoint bindPoin
} }
ANGLE_INLINE void CommandBuffer::executeCommands(uint32_t commandBufferCount, ANGLE_INLINE void CommandBuffer::executeCommands(uint32_t commandBufferCount,
const vk::CommandBuffer *commandBuffers) const CommandBuffer *commandBuffers)
{ {
ASSERT(valid()); ASSERT(valid());
vkCmdExecuteCommands(mHandle, commandBufferCount, commandBuffers[0].ptr()); vkCmdExecuteCommands(mHandle, commandBufferCount, commandBuffers[0].ptr());
...@@ -896,6 +913,8 @@ ANGLE_INLINE void CommandBuffer::bindVertexBuffers(uint32_t firstBinding, ...@@ -896,6 +913,8 @@ ANGLE_INLINE void CommandBuffer::bindVertexBuffers(uint32_t firstBinding,
vkCmdBindVertexBuffers(mHandle, firstBinding, bindingCount, buffers, offsets); vkCmdBindVertexBuffers(mHandle, firstBinding, bindingCount, buffers, offsets);
} }
} // namespace priv
// Image implementation. // Image implementation.
ANGLE_INLINE void Image::setHandle(VkImage handle) ANGLE_INLINE void Image::setHandle(VkImage handle)
{ {
......
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