Commit 316c6065 by Jamie Madill Committed by Commit Bot

Vulkan: Call GraphResource instead of GraphNode.

We don't need to use the CommandGraphNode class directly. This CL consolidates our code so we never call the GraphNodes class directly. Instead we call operations on GraphResource. This should simplify the interaction with APIs from the various graph and dependency management classes in the Vulkan back-end. A new concept of 'starting' vs 'appending' commands is introduced. Appending tries to avoid starting new command buffers when possible. Should not change how the graphs are constructed, and mostly be a refactoring change. There may be minor behaviour changes to some commands. Bug: angleproject:2539 Change-Id: Ia971e5cacb1164b9b3b22fa4a0a55b954d81f10e Reviewed-on: https://chromium-review.googlesource.com/1052068 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarFrank Henigman <fjhenigman@chromium.org>
parent b26ab825
...@@ -57,9 +57,7 @@ CommandGraphResource::CommandGraphResource() : mCurrentWritingNode(nullptr) ...@@ -57,9 +57,7 @@ CommandGraphResource::CommandGraphResource() : mCurrentWritingNode(nullptr)
{ {
} }
CommandGraphResource::~CommandGraphResource() CommandGraphResource::~CommandGraphResource() = default;
{
}
void CommandGraphResource::updateQueueSerial(Serial queueSerial) void CommandGraphResource::updateQueueSerial(Serial queueSerial)
{ {
...@@ -83,18 +81,19 @@ bool CommandGraphResource::hasChildlessWritingNode() const ...@@ -83,18 +81,19 @@ bool CommandGraphResource::hasChildlessWritingNode() const
return (mCurrentWritingNode != nullptr && !mCurrentWritingNode->hasChildren()); return (mCurrentWritingNode != nullptr && !mCurrentWritingNode->hasChildren());
} }
CommandGraphNode *CommandGraphResource::getCurrentWritingNode()
{
return mCurrentWritingNode;
}
CommandGraphNode *CommandGraphResource::getNewWritingNode(RendererVk *renderer) CommandGraphNode *CommandGraphResource::getNewWritingNode(RendererVk *renderer)
{ {
CommandGraphNode *newCommands = renderer->allocateCommandNode(); CommandGraphNode *newCommands = renderer->allocateCommandNode();
onWriteResource(newCommands, renderer->getCurrentQueueSerial()); onWriteImpl(newCommands, renderer->getCurrentQueueSerial());
return newCommands; return newCommands;
} }
bool CommandGraphResource::hasStartedWriteResource() const
{
return hasChildlessWritingNode() &&
mCurrentWritingNode->getOutsideRenderPassCommands()->valid();
}
Error CommandGraphResource::beginWriteResource(RendererVk *renderer, Error CommandGraphResource::beginWriteResource(RendererVk *renderer,
CommandBuffer **commandBufferOut) CommandBuffer **commandBufferOut)
{ {
...@@ -106,9 +105,75 @@ Error CommandGraphResource::beginWriteResource(RendererVk *renderer, ...@@ -106,9 +105,75 @@ Error CommandGraphResource::beginWriteResource(RendererVk *renderer,
return NoError(); return NoError();
} }
void CommandGraphResource::onWriteResource(CommandGraphNode *writingNode, Serial serial) Error CommandGraphResource::appendWriteResource(RendererVk *renderer,
CommandBuffer **commandBufferOut)
{ {
updateQueueSerial(serial); if (!hasChildlessWritingNode())
{
return beginWriteResource(renderer, commandBufferOut);
}
CommandBuffer *outsideRenderPassCommands = mCurrentWritingNode->getOutsideRenderPassCommands();
if (!outsideRenderPassCommands->valid())
{
ANGLE_TRY(mCurrentWritingNode->beginOutsideRenderPassRecording(
renderer->getDevice(), renderer->getCommandPool(), commandBufferOut));
}
else
{
*commandBufferOut = outsideRenderPassCommands;
}
return NoError();
}
void CommandGraphResource::appendToRenderPass(class CommandBuffer **commandBufferOut) const
{
ASSERT(hasStartedRenderPass());
*commandBufferOut = mCurrentWritingNode->getInsideRenderPassCommands();
}
bool CommandGraphResource::hasStartedRenderPass() const
{
return hasChildlessWritingNode() && mCurrentWritingNode->getInsideRenderPassCommands()->valid();
}
const gl::Rectangle &CommandGraphResource::getRenderPassRenderArea() const
{
ASSERT(hasStartedRenderPass());
return mCurrentWritingNode->getRenderPassRenderArea();
}
Error CommandGraphResource::beginRenderPass(RendererVk *renderer,
const Framebuffer &framebuffer,
const gl::Rectangle &renderArea,
const RenderPassDesc &renderPassDesc,
const std::vector<VkClearValue> &clearValues,
CommandBuffer **commandBufferOut) const
{
// Hard-code RenderPass to clear the first render target to the current clear value.
// TODO(jmadill): Proper clear value implementation. http://anglebug.com/2361
mCurrentWritingNode->storeRenderPassInfo(framebuffer, renderArea, renderPassDesc, clearValues);
return mCurrentWritingNode->beginInsideRenderPassRecording(renderer, commandBufferOut);
}
void CommandGraphResource::onResourceChanged(RendererVk *renderer)
{
getNewWritingNode(renderer);
}
void CommandGraphResource::addWriteDependency(CommandGraphResource *writingResource)
{
CommandGraphNode *writingNode = writingResource->mCurrentWritingNode;
ASSERT(writingNode);
onWriteImpl(writingNode, writingResource->getQueueSerial());
}
void CommandGraphResource::onWriteImpl(CommandGraphNode *writingNode, Serial currentSerial)
{
updateQueueSerial(currentSerial);
// Make sure any open reads and writes finish before we execute 'writingNode'. // Make sure any open reads and writes finish before we execute 'writingNode'.
if (!mCurrentReadingNodes.empty()) if (!mCurrentReadingNodes.empty())
...@@ -125,14 +190,15 @@ void CommandGraphResource::onWriteResource(CommandGraphNode *writingNode, Serial ...@@ -125,14 +190,15 @@ void CommandGraphResource::onWriteResource(CommandGraphNode *writingNode, Serial
mCurrentWritingNode = writingNode; mCurrentWritingNode = writingNode;
} }
void CommandGraphResource::onReadResource(CommandGraphNode *readingNode, Serial serial) void CommandGraphResource::addReadDependency(CommandGraphResource *readingResource)
{ {
updateQueueSerial(serial); updateQueueSerial(readingResource->getQueueSerial());
CommandGraphNode *readingNode = readingResource->mCurrentWritingNode;
ASSERT(readingNode);
if (hasChildlessWritingNode()) if (hasChildlessWritingNode())
{ {
ASSERT(mStoredQueueSerial == serial);
// Ensure 'readingNode' happens after the current writing node. // Ensure 'readingNode' happens after the current writing node.
CommandGraphNode::SetHappensBeforeDependency(mCurrentWritingNode, readingNode); CommandGraphNode::SetHappensBeforeDependency(mCurrentWritingNode, readingNode);
} }
...@@ -158,7 +224,8 @@ bool CommandGraphResource::checkResourceInUseAndRefreshDeps(RendererVk *renderer ...@@ -158,7 +224,8 @@ bool CommandGraphResource::checkResourceInUseAndRefreshDeps(RendererVk *renderer
// CommandGraphNode implementation. // CommandGraphNode implementation.
CommandGraphNode::CommandGraphNode() : mHasChildren(false), mVisitedState(VisitedState::Unvisited) CommandGraphNode::CommandGraphNode()
: mRenderPassClearValues{}, mHasChildren(false), mVisitedState(VisitedState::Unvisited)
{ {
} }
...@@ -370,9 +437,7 @@ const gl::Rectangle &CommandGraphNode::getRenderPassRenderArea() const ...@@ -370,9 +437,7 @@ const gl::Rectangle &CommandGraphNode::getRenderPassRenderArea() const
} }
// CommandGraph implementation. // CommandGraph implementation.
CommandGraph::CommandGraph() CommandGraph::CommandGraph() = default;
{
}
CommandGraph::~CommandGraph() CommandGraph::~CommandGraph()
{ {
......
...@@ -33,29 +33,58 @@ class CommandGraphResource ...@@ -33,29 +33,58 @@ class CommandGraphResource
void updateQueueSerial(Serial queueSerial); void updateQueueSerial(Serial queueSerial);
Serial getQueueSerial() const; Serial getQueueSerial() const;
// Returns true if this node has a current writing node with no children.
bool hasChildlessWritingNode() const;
// Returns the active write node.
CommandGraphNode *getCurrentWritingNode();
// Allocates a new write node and calls onWriteResource internally.
CommandGraphNode *getNewWritingNode(RendererVk *renderer);
// 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.
Error beginWriteResource(RendererVk *renderer, CommandBuffer **commandBufferOut); Error beginWriteResource(RendererVk *renderer, CommandBuffer **commandBufferOut);
// Sets up dependency relations. 'writingNode' will modify 'this' ResourceVk. // Check if we have started writing outside a RenderPass.
void onWriteResource(CommandGraphNode *writingNode, Serial serial); bool hasStartedWriteResource() const;
// Starts rendering to an existing command buffer for the resource.
// The started command buffer will render outside of a RenderPass.
// Calls beginWriteResource if we have not yet started writing.
Error appendWriteResource(RendererVk *renderer, CommandBuffer **commandBufferOut);
// Begins a command buffer on the current graph node for in-RenderPass rendering.
// Currently only called from FramebufferVk::getCommandBufferForDraw.
Error beginRenderPass(RendererVk *renderer,
const Framebuffer &framebuffer,
const gl::Rectangle &renderArea,
const RenderPassDesc &renderPassDesc,
const std::vector<VkClearValue> &clearValues,
CommandBuffer **commandBufferOut) const;
// Checks if we're in a RenderPass.
bool hasStartedRenderPass() const;
// Sets up dependency relations. 'readingNode' will read from 'this' ResourceVk. // Returns a started command buffer if we've already called beginRenderPass.
void onReadResource(CommandGraphNode *readingNode, Serial serial); void appendToRenderPass(CommandBuffer **commandBufferOut) const;
// Accessor for RenderPass RenderArea.
const gl::Rectangle &getRenderPassRenderArea() const;
// Called when 'this' object changes, but we'd like to start a new command buffer later.
void onResourceChanged(RendererVk *renderer);
// Sets up dependency relations. 'this' resource is the resource being written to.
void addWriteDependency(CommandGraphResource *writingResource);
// Sets up dependency relations. 'this' resource is the resource being read.
void addReadDependency(CommandGraphResource *readingResource);
// Returns false if the resource is not in use, and clears any current read/write nodes. // Returns false if the resource is not in use, and clears any current read/write nodes.
// TODO(jmadill): Remove this. http://anglebug.com/2539
bool checkResourceInUseAndRefreshDeps(RendererVk *renderer); bool checkResourceInUseAndRefreshDeps(RendererVk *renderer);
private: private:
void onWriteImpl(CommandGraphNode *writingNode, Serial currentSerial);
// Returns true if this node has a current writing node with no children.
bool hasChildlessWritingNode() const;
// Allocates a new write node and calls onWriteResource internally.
CommandGraphNode *getNewWritingNode(RendererVk *renderer);
Serial mStoredQueueSerial; Serial mStoredQueueSerial;
std::vector<CommandGraphNode *> mCurrentReadingNodes; std::vector<CommandGraphNode *> mCurrentReadingNodes;
CommandGraphNode *mCurrentWritingNode; CommandGraphNode *mCurrentWritingNode;
......
...@@ -17,11 +17,8 @@ ...@@ -17,11 +17,8 @@
#include "libANGLE/renderer/vulkan/BufferVk.h" #include "libANGLE/renderer/vulkan/BufferVk.h"
#include "libANGLE/renderer/vulkan/CommandGraph.h" #include "libANGLE/renderer/vulkan/CommandGraph.h"
#include "libANGLE/renderer/vulkan/CompilerVk.h" #include "libANGLE/renderer/vulkan/CompilerVk.h"
#include "libANGLE/renderer/vulkan/ContextVk.h"
#include "libANGLE/renderer/vulkan/DeviceVk.h"
#include "libANGLE/renderer/vulkan/FenceNVVk.h" #include "libANGLE/renderer/vulkan/FenceNVVk.h"
#include "libANGLE/renderer/vulkan/FramebufferVk.h" #include "libANGLE/renderer/vulkan/FramebufferVk.h"
#include "libANGLE/renderer/vulkan/ImageVk.h"
#include "libANGLE/renderer/vulkan/ProgramPipelineVk.h" #include "libANGLE/renderer/vulkan/ProgramPipelineVk.h"
#include "libANGLE/renderer/vulkan/ProgramVk.h" #include "libANGLE/renderer/vulkan/ProgramVk.h"
#include "libANGLE/renderer/vulkan/QueryVk.h" #include "libANGLE/renderer/vulkan/QueryVk.h"
...@@ -33,7 +30,6 @@ ...@@ -33,7 +30,6 @@
#include "libANGLE/renderer/vulkan/TextureVk.h" #include "libANGLE/renderer/vulkan/TextureVk.h"
#include "libANGLE/renderer/vulkan/TransformFeedbackVk.h" #include "libANGLE/renderer/vulkan/TransformFeedbackVk.h"
#include "libANGLE/renderer/vulkan/VertexArrayVk.h" #include "libANGLE/renderer/vulkan/VertexArrayVk.h"
#include "libANGLE/renderer/vulkan/vk_format_utils.h"
namespace rx namespace rx
{ {
...@@ -139,8 +135,8 @@ gl::Error ContextVk::initPipeline() ...@@ -139,8 +135,8 @@ gl::Error ContextVk::initPipeline()
gl::Error ContextVk::setupDraw(const gl::Context *context, gl::Error ContextVk::setupDraw(const gl::Context *context,
const gl::DrawCallParams &drawCallParams, const gl::DrawCallParams &drawCallParams,
vk::CommandGraphNode **drawNodeOut, vk::CommandBuffer **commandBufferOut,
bool *newCommandBufferOut) bool *shouldApplyVertexArrayOut)
{ {
if (drawCallParams.mode() != mCurrentDrawMode) if (drawCallParams.mode() != mCurrentDrawMode)
{ {
...@@ -156,26 +152,22 @@ gl::Error ContextVk::setupDraw(const gl::Context *context, ...@@ -156,26 +152,22 @@ gl::Error ContextVk::setupDraw(const gl::Context *context,
const auto &state = mState.getState(); const auto &state = mState.getState();
const gl::Program *programGL = state.getProgram(); const gl::Program *programGL = state.getProgram();
ProgramVk *programVk = vk::GetImpl(programGL); ProgramVk *programVk = vk::GetImpl(programGL);
const auto *drawFBO = state.getDrawFramebuffer(); const gl::Framebuffer *framebuffer = state.getDrawFramebuffer();
FramebufferVk *vkFBO = vk::GetImpl(drawFBO); FramebufferVk *framebufferVk = vk::GetImpl(framebuffer);
Serial queueSerial = mRenderer->getCurrentQueueSerial(); Serial queueSerial = mRenderer->getCurrentQueueSerial();
vk::CommandGraphNode *graphNode = nullptr; vk::RecordingMode mode = vk::RecordingMode::Start;
ANGLE_TRY(vkFBO->getCommandGraphNodeForDraw(this, &graphNode)); ANGLE_TRY(framebufferVk->getCommandBufferForDraw(this, commandBufferOut, &mode));
vk::CommandBuffer *commandBuffer = nullptr;
if (!graphNode->getInsideRenderPassCommands()->valid()) if (mode == vk::RecordingMode::Start)
{ {
mTexturesDirty = true; mTexturesDirty = true;
*newCommandBufferOut = true; *shouldApplyVertexArrayOut = true;
ANGLE_TRY(graphNode->beginInsideRenderPassRecording(mRenderer, &commandBuffer));
} }
else else
{ {
*newCommandBufferOut = mVertexArrayBindingHasChanged; *shouldApplyVertexArrayOut = mVertexArrayBindingHasChanged;
mVertexArrayBindingHasChanged = false; mVertexArrayBindingHasChanged = false;
commandBuffer = graphNode->getInsideRenderPassCommands();
} }
// Ensure any writes to the textures are flushed before we read from them. // Ensure any writes to the textures are flushed before we read from them.
...@@ -202,11 +194,11 @@ gl::Error ContextVk::setupDraw(const gl::Context *context, ...@@ -202,11 +194,11 @@ gl::Error ContextVk::setupDraw(const gl::Context *context,
TextureVk *textureVk = vk::GetImpl(texture); TextureVk *textureVk = vk::GetImpl(texture);
ANGLE_TRY(textureVk->ensureImageInitialized(mRenderer)); ANGLE_TRY(textureVk->ensureImageInitialized(mRenderer));
textureVk->onReadResource(graphNode, mRenderer->getCurrentQueueSerial()); textureVk->addReadDependency(framebufferVk);
} }
} }
commandBuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mCurrentPipeline->get()); (*commandBufferOut)->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mCurrentPipeline->get());
// Update the queue serial for the pipeline object. // Update the queue serial for the pipeline object.
ASSERT(mCurrentPipeline && mCurrentPipeline->valid()); ASSERT(mCurrentPipeline && mCurrentPipeline->valid());
...@@ -225,13 +217,13 @@ gl::Error ContextVk::setupDraw(const gl::Context *context, ...@@ -225,13 +217,13 @@ gl::Error ContextVk::setupDraw(const gl::Context *context,
ASSERT(!descriptorSets.empty()); ASSERT(!descriptorSets.empty());
const vk::PipelineLayout &pipelineLayout = mRenderer->getGraphicsPipelineLayout(); const vk::PipelineLayout &pipelineLayout = mRenderer->getGraphicsPipelineLayout();
commandBuffer->bindDescriptorSets( (*commandBufferOut)
VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, usedRange.low(), usedRange.length(), ->bindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, usedRange.low(),
&descriptorSets[usedRange.low()], programVk->getDynamicOffsetsCount(), usedRange.length(), &descriptorSets[usedRange.low()],
programVk->getDynamicOffsets()); programVk->getDynamicOffsetsCount(),
programVk->getDynamicOffsets());
} }
*drawNodeOut = graphNode;
return gl::NoError(); return gl::NoError();
} }
...@@ -242,13 +234,14 @@ gl::Error ContextVk::drawArrays(const gl::Context *context, ...@@ -242,13 +234,14 @@ gl::Error ContextVk::drawArrays(const gl::Context *context,
{ {
const gl::DrawCallParams &drawCallParams = context->getParams<gl::DrawCallParams>(); const gl::DrawCallParams &drawCallParams = context->getParams<gl::DrawCallParams>();
vk::CommandGraphNode *drawNode = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
bool newCommands = false; bool shouldApplyVertexArray = false;
ANGLE_TRY(setupDraw(context, drawCallParams, &drawNode, &newCommands)); ANGLE_TRY(setupDraw(context, drawCallParams, &commandBuffer, &shouldApplyVertexArray));
const gl::VertexArray *vertexArray = context->getGLState().getVertexArray(); const gl::VertexArray *vertexArray = context->getGLState().getVertexArray();
VertexArrayVk *vertexArrayVk = vk::GetImpl(vertexArray); VertexArrayVk *vertexArrayVk = vk::GetImpl(vertexArray);
ANGLE_TRY(vertexArrayVk->drawArrays(context, mRenderer, drawCallParams, drawNode, newCommands)); ANGLE_TRY(vertexArrayVk->drawArrays(context, mRenderer, drawCallParams, commandBuffer,
shouldApplyVertexArray));
return gl::NoError(); return gl::NoError();
} }
...@@ -271,14 +264,14 @@ gl::Error ContextVk::drawElements(const gl::Context *context, ...@@ -271,14 +264,14 @@ gl::Error ContextVk::drawElements(const gl::Context *context,
{ {
const gl::DrawCallParams &drawCallParams = context->getParams<gl::DrawCallParams>(); const gl::DrawCallParams &drawCallParams = context->getParams<gl::DrawCallParams>();
vk::CommandGraphNode *drawNode = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
bool newCommands = false; bool shouldApplyVertexArray = false;
ANGLE_TRY(setupDraw(context, drawCallParams, &drawNode, &newCommands)); ANGLE_TRY(setupDraw(context, drawCallParams, &commandBuffer, &shouldApplyVertexArray));
gl::VertexArray *vao = mState.getState().getVertexArray(); gl::VertexArray *vao = mState.getState().getVertexArray();
VertexArrayVk *vertexArrayVk = vk::GetImpl(vao); VertexArrayVk *vertexArrayVk = vk::GetImpl(vao);
ANGLE_TRY( ANGLE_TRY(vertexArrayVk->drawElements(context, mRenderer, drawCallParams, commandBuffer,
vertexArrayVk->drawElements(context, mRenderer, drawCallParams, drawNode, newCommands)); shouldApplyVertexArray));
return gl::NoError(); return gl::NoError();
} }
......
...@@ -168,8 +168,8 @@ class ContextVk : public ContextImpl ...@@ -168,8 +168,8 @@ class ContextVk : public ContextImpl
gl::Error initPipeline(); gl::Error initPipeline();
gl::Error setupDraw(const gl::Context *context, gl::Error setupDraw(const gl::Context *context,
const gl::DrawCallParams &drawCallParams, const gl::DrawCallParams &drawCallParams,
vk::CommandGraphNode **drawNodeOut, vk::CommandBuffer **commandBufferOut,
bool *newCommandBufferOut); bool *shouldApplyVertexArrayOut);
void updateScissor(const gl::State &glState); void updateScissor(const gl::State &glState);
......
...@@ -88,7 +88,9 @@ class FramebufferVk : public FramebufferImpl, public vk::CommandGraphResource ...@@ -88,7 +88,9 @@ class FramebufferVk : public FramebufferImpl, public vk::CommandGraphResource
GLfloat *xy) const override; GLfloat *xy) const override;
const vk::RenderPassDesc &getRenderPassDesc(); const vk::RenderPassDesc &getRenderPassDesc();
gl::Error getCommandGraphNodeForDraw(ContextVk *contextVk, vk::CommandGraphNode **nodeOut); gl::Error getCommandBufferForDraw(ContextVk *contextVk,
vk::CommandBuffer **commandBufferOut,
vk::RecordingMode *modeOut);
// Internal helper function for readPixels operations. // Internal helper function for readPixels operations.
gl::Error readPixelsImpl(const gl::Context *context, gl::Error readPixelsImpl(const gl::Context *context,
......
...@@ -26,30 +26,31 @@ RenderTargetVk::~RenderTargetVk() ...@@ -26,30 +26,31 @@ RenderTargetVk::~RenderTargetVk()
{ {
} }
void RenderTargetVk::onColorDraw(Serial currentSerial, void RenderTargetVk::onColorDraw(vk::CommandGraphResource *framebufferVk,
vk::CommandGraphNode *writingNode, vk::CommandBuffer *commandBuffer,
vk::RenderPassDesc *renderPassDesc) vk::RenderPassDesc *renderPassDesc)
{ {
ASSERT(writingNode->getOutsideRenderPassCommands()->valid()); ASSERT(commandBuffer->valid());
ASSERT(!mImage->getFormat().textureFormat().hasDepthOrStencilBits());
// Store the attachment info in the renderPassDesc. // Store the attachment info in the renderPassDesc.
renderPassDesc->packColorAttachment(*mImage); renderPassDesc->packColorAttachment(*mImage);
// TODO(jmadill): Use automatic layout transition. http://anglebug.com/2361 // TODO(jmadill): Use automatic layout transition. http://anglebug.com/2361
mImage->changeLayoutWithStages( mImage->changeLayoutWithStages(VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
writingNode->getOutsideRenderPassCommands()); VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, commandBuffer);
// Set up dependencies between the new graph node and other current nodes in the resource. // Set up dependencies between the RT resource and the Framebuffer.
mResource->onWriteResource(writingNode, currentSerial); mResource->addWriteDependency(framebufferVk);
} }
void RenderTargetVk::onDepthStencilDraw(Serial currentSerial, void RenderTargetVk::onDepthStencilDraw(vk::CommandGraphResource *framebufferVk,
vk::CommandGraphNode *writingNode, vk::CommandBuffer *commandBuffer,
vk::RenderPassDesc *renderPassDesc) vk::RenderPassDesc *renderPassDesc)
{ {
ASSERT(writingNode->getOutsideRenderPassCommands()->valid()); ASSERT(commandBuffer->valid());
ASSERT(mImage->getFormat().textureFormat().hasDepthOrStencilBits()); ASSERT(mImage->getFormat().textureFormat().hasDepthOrStencilBits());
// Store the attachment info in the renderPassDesc. // Store the attachment info in the renderPassDesc.
...@@ -62,11 +63,10 @@ void RenderTargetVk::onDepthStencilDraw(Serial currentSerial, ...@@ -62,11 +63,10 @@ void RenderTargetVk::onDepthStencilDraw(Serial currentSerial,
mImage->changeLayoutWithStages(aspectFlags, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, mImage->changeLayoutWithStages(aspectFlags, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, commandBuffer);
writingNode->getOutsideRenderPassCommands());
// Set up dependencies between the new graph node and other current nodes in the resource. // Set up dependencies between the RT resource and the Framebuffer.
mResource->onWriteResource(writingNode, currentSerial); mResource->addWriteDependency(framebufferVk);
} }
const vk::ImageHelper &RenderTargetVk::getImage() const const vk::ImageHelper &RenderTargetVk::getImage() const
...@@ -106,10 +106,10 @@ void RenderTargetVk::updateSwapchainImage(vk::ImageHelper *image, vk::ImageView ...@@ -106,10 +106,10 @@ void RenderTargetVk::updateSwapchainImage(vk::ImageHelper *image, vk::ImageView
} }
vk::ImageHelper *RenderTargetVk::getImageForWrite(Serial currentSerial, vk::ImageHelper *RenderTargetVk::getImageForWrite(Serial currentSerial,
vk::CommandGraphNode *writingNode) const vk::CommandGraphResource *writingResource) const
{ {
ASSERT(mImage && mImage->valid()); ASSERT(mImage && mImage->valid());
mResource->onWriteResource(writingNode, currentSerial); mResource->addWriteDependency(writingResource);
return mImage; return mImage;
} }
......
...@@ -19,6 +19,7 @@ namespace rx ...@@ -19,6 +19,7 @@ namespace rx
{ {
namespace vk namespace vk
{ {
class CommandBuffer;
class CommandGraphNode; class CommandGraphNode;
class CommandGraphResource; class CommandGraphResource;
struct Format; struct Format;
...@@ -39,17 +40,17 @@ class RenderTargetVk final : public FramebufferAttachmentRenderTarget ...@@ -39,17 +40,17 @@ class RenderTargetVk final : public FramebufferAttachmentRenderTarget
~RenderTargetVk(); ~RenderTargetVk();
// 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(Serial currentSerial, void onColorDraw(vk::CommandGraphResource *framebufferVk,
vk::CommandGraphNode *writingNode, vk::CommandBuffer *commandBuffer,
vk::RenderPassDesc *renderPassDesc); vk::RenderPassDesc *renderPassDesc);
void onDepthStencilDraw(Serial currentSerial, void onDepthStencilDraw(vk::CommandGraphResource *framebufferVk,
vk::CommandGraphNode *writingNode, vk::CommandBuffer *commandBuffer,
vk::RenderPassDesc *renderPassDesc); vk::RenderPassDesc *renderPassDesc);
const vk::ImageHelper &getImage() const; const vk::ImageHelper &getImage() const;
vk::ImageHelper *getImageForWrite(Serial currentSerial, vk::ImageHelper *getImageForWrite(Serial currentSerial,
vk::CommandGraphNode *writingNode) const; vk::CommandGraphResource *writingResource) const;
vk::ImageView *getImageView() const; vk::ImageView *getImageView() const;
vk::CommandGraphResource *getResource() const; vk::CommandGraphResource *getResource() const;
......
...@@ -342,7 +342,7 @@ gl::Error TextureVk::setImage(const gl::Context *context, ...@@ -342,7 +342,7 @@ gl::Error TextureVk::setImage(const gl::Context *context,
} }
// Create a new graph node to store image initialization commands. // Create a new graph node to store image initialization commands.
getNewWritingNode(renderer); onResourceChanged(renderer);
// Handle initial data. // Handle initial data.
if (pixels) if (pixels)
...@@ -369,7 +369,7 @@ gl::Error TextureVk::setSubImage(const gl::Context *context, ...@@ -369,7 +369,7 @@ gl::Error TextureVk::setSubImage(const gl::Context *context,
gl::Offset(area.x, area.y, area.z), formatInfo, unpack, type, pixels)); gl::Offset(area.x, area.y, area.z), formatInfo, unpack, type, pixels));
// Create a new graph node to store image initialization commands. // Create a new graph node to store image initialization commands.
getNewWritingNode(contextVk->getRenderer()); onResourceChanged(contextVk->getRenderer());
return gl::NoError(); return gl::NoError();
} }
...@@ -442,7 +442,7 @@ gl::Error TextureVk::copySubImageImpl(const gl::Context *context, ...@@ -442,7 +442,7 @@ gl::Error TextureVk::copySubImageImpl(const gl::Context *context,
destOffset.y + sourceArea.y - sourceArea.y, 0); destOffset.y + sourceArea.y - sourceArea.y, 0);
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
RendererVk *renderer = contextVk->getRenderer();
FramebufferVk *framebufferVk = vk::GetImpl(source); FramebufferVk *framebufferVk = vk::GetImpl(source);
// For now, favor conformance. We do a CPU readback that does the conversion, and then stage the // For now, favor conformance. We do a CPU readback that does the conversion, and then stage the
...@@ -454,30 +454,16 @@ gl::Error TextureVk::copySubImageImpl(const gl::Context *context, ...@@ -454,30 +454,16 @@ gl::Error TextureVk::copySubImageImpl(const gl::Context *context,
gl::Extents(clippedSourceArea.width, clippedSourceArea.height, 1), internalFormat, gl::Extents(clippedSourceArea.width, clippedSourceArea.height, 1), internalFormat,
framebufferVk)); framebufferVk));
vk::CommandGraphNode *writingNode = getNewWritingNode(contextVk->getRenderer()); onResourceChanged(renderer);
framebufferVk->onReadResource(writingNode, contextVk->getRenderer()->getCurrentQueueSerial()); framebufferVk->addReadDependency(this);
return gl::NoError(); return gl::NoError();
} }
vk::Error TextureVk::getCommandBufferForWrite(RendererVk *renderer, vk::Error TextureVk::getCommandBufferForWrite(RendererVk *renderer,
vk::CommandBuffer **outCommandBuffer) vk::CommandBuffer **commandBufferOut)
{ {
const VkDevice device = renderer->getDevice();
updateQueueSerial(renderer->getCurrentQueueSerial()); updateQueueSerial(renderer->getCurrentQueueSerial());
if (!hasChildlessWritingNode()) ANGLE_TRY(beginWriteResource(renderer, commandBufferOut));
{
beginWriteResource(renderer, outCommandBuffer);
}
else
{
vk::CommandGraphNode *node = getCurrentWritingNode();
*outCommandBuffer = node->getOutsideRenderPassCommands();
if (!(*outCommandBuffer)->valid())
{
ANGLE_TRY(node->beginOutsideRenderPassRecording(device, renderer->getCommandPool(),
outCommandBuffer));
}
}
return vk::NoError(); return vk::NoError();
} }
......
...@@ -171,7 +171,7 @@ class TextureVk : public TextureImpl, public vk::CommandGraphResource ...@@ -171,7 +171,7 @@ class TextureVk : public TextureImpl, public vk::CommandGraphResource
const uint32_t levelCount, const uint32_t levelCount,
vk::CommandBuffer *commandBuffer); vk::CommandBuffer *commandBuffer);
void releaseImage(const gl::Context *context, RendererVk *renderer); void releaseImage(const gl::Context *context, RendererVk *renderer);
vk::Error getCommandBufferForWrite(RendererVk *renderer, vk::CommandBuffer **outCommandBuffer); vk::Error getCommandBufferForWrite(RendererVk *renderer, vk::CommandBuffer **commandBufferOut);
uint32_t getLevelCount() const; uint32_t getLevelCount() const;
vk::ImageHelper mImage; vk::ImageHelper mImage;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "libANGLE/renderer/vulkan/BufferVk.h" #include "libANGLE/renderer/vulkan/BufferVk.h"
#include "libANGLE/renderer/vulkan/CommandGraph.h" #include "libANGLE/renderer/vulkan/CommandGraph.h"
#include "libANGLE/renderer/vulkan/ContextVk.h" #include "libANGLE/renderer/vulkan/ContextVk.h"
#include "libANGLE/renderer/vulkan/FramebufferVk.h"
#include "libANGLE/renderer/vulkan/RendererVk.h" #include "libANGLE/renderer/vulkan/RendererVk.h"
#include "libANGLE/renderer/vulkan/vk_format_utils.h" #include "libANGLE/renderer/vulkan/vk_format_utils.h"
...@@ -269,7 +270,7 @@ const gl::AttribArray<VkDeviceSize> &VertexArrayVk::getCurrentArrayBufferOffsets ...@@ -269,7 +270,7 @@ const gl::AttribArray<VkDeviceSize> &VertexArrayVk::getCurrentArrayBufferOffsets
return mCurrentArrayBufferOffsets; return mCurrentArrayBufferOffsets;
} }
void VertexArrayVk::updateArrayBufferReadDependencies(vk::CommandGraphNode *readingNode, void VertexArrayVk::updateArrayBufferReadDependencies(vk::CommandGraphResource *drawFramebuffer,
const gl::AttributesMask &activeAttribsMask, const gl::AttributesMask &activeAttribsMask,
Serial serial) Serial serial)
{ {
...@@ -277,17 +278,18 @@ void VertexArrayVk::updateArrayBufferReadDependencies(vk::CommandGraphNode *read ...@@ -277,17 +278,18 @@ void VertexArrayVk::updateArrayBufferReadDependencies(vk::CommandGraphNode *read
for (size_t attribIndex : activeAttribsMask) for (size_t attribIndex : activeAttribsMask)
{ {
if (mCurrentArrayBufferResources[attribIndex]) if (mCurrentArrayBufferResources[attribIndex])
mCurrentArrayBufferResources[attribIndex]->onReadResource(readingNode, serial); mCurrentArrayBufferResources[attribIndex]->addReadDependency(drawFramebuffer);
} }
} }
void VertexArrayVk::updateElementArrayBufferReadDependency(vk::CommandGraphNode *readingNode, void VertexArrayVk::updateElementArrayBufferReadDependency(
Serial serial) vk::CommandGraphResource *drawFramebuffer,
Serial serial)
{ {
// Handle the bound element array buffer. // Handle the bound element array buffer.
if (mCurrentElementArrayBufferResource) if (mCurrentElementArrayBufferResource)
{ {
mCurrentElementArrayBufferResource->onReadResource(readingNode, serial); mCurrentElementArrayBufferResource->addReadDependency(drawFramebuffer);
} }
} }
...@@ -350,13 +352,12 @@ void VertexArrayVk::updatePackedInputInfo(uint32_t attribIndex, ...@@ -350,13 +352,12 @@ void VertexArrayVk::updatePackedInputInfo(uint32_t attribIndex,
gl::Error VertexArrayVk::drawArrays(const gl::Context *context, gl::Error VertexArrayVk::drawArrays(const gl::Context *context,
RendererVk *renderer, RendererVk *renderer,
const gl::DrawCallParams &drawCallParams, const gl::DrawCallParams &drawCallParams,
vk::CommandGraphNode *drawNode, vk::CommandBuffer *commandBuffer,
bool newCommandBuffer) bool newCommandBuffer)
{ {
vk::CommandBuffer *commandBuffer = drawNode->getInsideRenderPassCommands();
ASSERT(commandBuffer->valid()); ASSERT(commandBuffer->valid());
ANGLE_TRY(onDraw(context, renderer, drawCallParams, drawNode, newCommandBuffer)); ANGLE_TRY(onDraw(context, renderer, drawCallParams, commandBuffer, newCommandBuffer));
// Note: Vertex indexes can be arbitrarily large. // Note: Vertex indexes can be arbitrarily large.
uint32_t clampedVertexCount = drawCallParams.getClampedVertexCount<uint32_t>(); uint32_t clampedVertexCount = drawCallParams.getClampedVertexCount<uint32_t>();
...@@ -392,15 +393,15 @@ gl::Error VertexArrayVk::drawArrays(const gl::Context *context, ...@@ -392,15 +393,15 @@ gl::Error VertexArrayVk::drawArrays(const gl::Context *context,
gl::Error VertexArrayVk::drawElements(const gl::Context *context, gl::Error VertexArrayVk::drawElements(const gl::Context *context,
RendererVk *renderer, RendererVk *renderer,
const gl::DrawCallParams &drawCallParams, const gl::DrawCallParams &drawCallParams,
vk::CommandGraphNode *drawNode, vk::CommandBuffer *commandBuffer,
bool newCommandBuffer) bool newCommandBuffer)
{ {
vk::CommandBuffer *commandBuffer = drawNode->getInsideRenderPassCommands();
ASSERT(commandBuffer->valid()); ASSERT(commandBuffer->valid());
if (drawCallParams.mode() != gl::PrimitiveMode::LineLoop) if (drawCallParams.mode() != gl::PrimitiveMode::LineLoop)
{ {
ANGLE_TRY(onIndexedDraw(context, renderer, drawCallParams, drawNode, newCommandBuffer)); ANGLE_TRY(
onIndexedDraw(context, renderer, drawCallParams, commandBuffer, newCommandBuffer));
commandBuffer->drawIndexed(drawCallParams.indexCount(), 1, 0, 0, 0); commandBuffer->drawIndexed(drawCallParams.indexCount(), 1, 0, 0, 0);
return gl::NoError(); return gl::NoError();
} }
...@@ -428,7 +429,7 @@ gl::Error VertexArrayVk::drawElements(const gl::Context *context, ...@@ -428,7 +429,7 @@ gl::Error VertexArrayVk::drawElements(const gl::Context *context,
} }
} }
ANGLE_TRY(onIndexedDraw(context, renderer, drawCallParams, drawNode, newCommandBuffer)); ANGLE_TRY(onIndexedDraw(context, renderer, drawCallParams, commandBuffer, newCommandBuffer));
vk::LineLoopHelper::Draw(drawCallParams.indexCount(), commandBuffer); vk::LineLoopHelper::Draw(drawCallParams.indexCount(), commandBuffer);
return gl::NoError(); return gl::NoError();
...@@ -437,7 +438,7 @@ gl::Error VertexArrayVk::drawElements(const gl::Context *context, ...@@ -437,7 +438,7 @@ gl::Error VertexArrayVk::drawElements(const gl::Context *context,
gl::Error VertexArrayVk::onDraw(const gl::Context *context, gl::Error VertexArrayVk::onDraw(const gl::Context *context,
RendererVk *renderer, RendererVk *renderer,
const gl::DrawCallParams &drawCallParams, const gl::DrawCallParams &drawCallParams,
vk::CommandGraphNode *drawNode, vk::CommandBuffer *commandBuffer,
bool newCommandBuffer) bool newCommandBuffer)
{ {
const gl::State &state = context->getGLState(); const gl::State &state = context->getGLState();
...@@ -453,7 +454,6 @@ gl::Error VertexArrayVk::onDraw(const gl::Context *context, ...@@ -453,7 +454,6 @@ gl::Error VertexArrayVk::onDraw(const gl::Context *context,
{ {
ANGLE_TRY(drawCallParams.ensureIndexRangeResolved(context)); ANGLE_TRY(drawCallParams.ensureIndexRangeResolved(context));
ANGLE_TRY(streamVertexData(renderer, attribsToStream, drawCallParams)); ANGLE_TRY(streamVertexData(renderer, attribsToStream, drawCallParams));
vk::CommandBuffer *commandBuffer = drawNode->getInsideRenderPassCommands();
commandBuffer->bindVertexBuffers(0, maxAttrib, mCurrentArrayBufferHandles.data(), commandBuffer->bindVertexBuffers(0, maxAttrib, mCurrentArrayBufferHandles.data(),
mCurrentArrayBufferOffsets.data()); mCurrentArrayBufferOffsets.data());
} }
...@@ -462,10 +462,11 @@ gl::Error VertexArrayVk::onDraw(const gl::Context *context, ...@@ -462,10 +462,11 @@ gl::Error VertexArrayVk::onDraw(const gl::Context *context,
{ {
if (maxAttrib > 0) if (maxAttrib > 0)
{ {
vk::CommandBuffer *commandBuffer = drawNode->getInsideRenderPassCommands();
commandBuffer->bindVertexBuffers(0, maxAttrib, mCurrentArrayBufferHandles.data(), commandBuffer->bindVertexBuffers(0, maxAttrib, mCurrentArrayBufferHandles.data(),
mCurrentArrayBufferOffsets.data()); mCurrentArrayBufferOffsets.data());
updateArrayBufferReadDependencies(drawNode, activeAttribs,
vk::CommandGraphResource *drawFramebuffer = vk::GetImpl(state.getDrawFramebuffer());
updateArrayBufferReadDependencies(drawFramebuffer, activeAttribs,
renderer->getCurrentQueueSerial()); renderer->getCurrentQueueSerial());
} }
...@@ -486,17 +487,16 @@ gl::Error VertexArrayVk::onDraw(const gl::Context *context, ...@@ -486,17 +487,16 @@ gl::Error VertexArrayVk::onDraw(const gl::Context *context,
gl::Error VertexArrayVk::onIndexedDraw(const gl::Context *context, gl::Error VertexArrayVk::onIndexedDraw(const gl::Context *context,
RendererVk *renderer, RendererVk *renderer,
const gl::DrawCallParams &drawCallParams, const gl::DrawCallParams &drawCallParams,
vk::CommandGraphNode *drawNode, vk::CommandBuffer *commandBuffer,
bool newCommandBuffer) bool newCommandBuffer)
{ {
ANGLE_TRY(onDraw(context, renderer, drawCallParams, drawNode, newCommandBuffer)); ANGLE_TRY(onDraw(context, renderer, drawCallParams, commandBuffer, newCommandBuffer));
if (!mState.getElementArrayBuffer().get() && if (!mState.getElementArrayBuffer().get() &&
drawCallParams.mode() != gl::PrimitiveMode::LineLoop) drawCallParams.mode() != gl::PrimitiveMode::LineLoop)
{ {
ANGLE_TRY(drawCallParams.ensureIndexRangeResolved(context)); ANGLE_TRY(drawCallParams.ensureIndexRangeResolved(context));
ANGLE_TRY(streamIndexData(renderer, drawCallParams)); ANGLE_TRY(streamIndexData(renderer, drawCallParams));
vk::CommandBuffer *commandBuffer = drawNode->getInsideRenderPassCommands();
commandBuffer->bindIndexBuffer(mCurrentElementArrayBufferHandle, commandBuffer->bindIndexBuffer(mCurrentElementArrayBufferHandle,
mCurrentElementArrayBufferOffset, mCurrentElementArrayBufferOffset,
gl_vk::GetIndexType(drawCallParams.type())); gl_vk::GetIndexType(drawCallParams.type()));
...@@ -511,11 +511,13 @@ gl::Error VertexArrayVk::onIndexedDraw(const gl::Context *context, ...@@ -511,11 +511,13 @@ gl::Error VertexArrayVk::onIndexedDraw(const gl::Context *context,
<< "Unsigned byte translation is not implemented for indices in a buffer object"; << "Unsigned byte translation is not implemented for indices in a buffer object";
} }
vk::CommandBuffer *commandBuffer = drawNode->getInsideRenderPassCommands();
commandBuffer->bindIndexBuffer(mCurrentElementArrayBufferHandle, commandBuffer->bindIndexBuffer(mCurrentElementArrayBufferHandle,
mCurrentElementArrayBufferOffset, mCurrentElementArrayBufferOffset,
gl_vk::GetIndexType(drawCallParams.type())); gl_vk::GetIndexType(drawCallParams.type()));
updateElementArrayBufferReadDependency(drawNode, renderer->getCurrentQueueSerial());
const gl::State &glState = context->getGLState();
vk::CommandGraphResource *drawFramebuffer = vk::GetImpl(glState.getDrawFramebuffer());
updateElementArrayBufferReadDependency(drawFramebuffer, renderer->getCurrentQueueSerial());
mIndexBufferDirty = false; mIndexBufferDirty = false;
// If we've had a drawArrays call with a line loop before, we want to make sure this is // If we've had a drawArrays call with a line loop before, we want to make sure this is
......
...@@ -45,7 +45,7 @@ class VertexArrayVk : public VertexArrayImpl ...@@ -45,7 +45,7 @@ class VertexArrayVk : public VertexArrayImpl
const gl::AttribArray<VkBuffer> &getCurrentArrayBufferHandles() const; const gl::AttribArray<VkBuffer> &getCurrentArrayBufferHandles() const;
const gl::AttribArray<VkDeviceSize> &getCurrentArrayBufferOffsets() const; const gl::AttribArray<VkDeviceSize> &getCurrentArrayBufferOffsets() const;
void updateDrawDependencies(vk::CommandGraphNode *readingNode, void updateDrawDependencies(vk::CommandGraphResource *drawFramebuffer,
const gl::AttributesMask &activeAttribsMask, const gl::AttributesMask &activeAttribsMask,
vk::CommandGraphResource *elementArrayBufferOverride, vk::CommandGraphResource *elementArrayBufferOverride,
Serial serial, Serial serial,
...@@ -57,13 +57,13 @@ class VertexArrayVk : public VertexArrayImpl ...@@ -57,13 +57,13 @@ class VertexArrayVk : public VertexArrayImpl
gl::Error drawArrays(const gl::Context *context, gl::Error drawArrays(const gl::Context *context,
RendererVk *renderer, RendererVk *renderer,
const gl::DrawCallParams &drawCallParams, const gl::DrawCallParams &drawCallParams,
vk::CommandGraphNode *drawNode, vk::CommandBuffer *commandBuffer,
bool newCommandBuffer); bool shouldApplyVertexArray);
gl::Error drawElements(const gl::Context *context, gl::Error drawElements(const gl::Context *context,
RendererVk *renderer, RendererVk *renderer,
const gl::DrawCallParams &drawCallParams, const gl::DrawCallParams &drawCallParams,
vk::CommandGraphNode *drawNode, vk::CommandBuffer *commandBuffer,
bool newCommandBuffer); bool shouldApplyVertexArray);
private: private:
// This will update any dirty packed input descriptions, regardless if they're used by the // This will update any dirty packed input descriptions, regardless if they're used by the
...@@ -76,11 +76,12 @@ class VertexArrayVk : public VertexArrayImpl ...@@ -76,11 +76,12 @@ class VertexArrayVk : public VertexArrayImpl
const gl::VertexBinding &binding, const gl::VertexBinding &binding,
const gl::VertexAttribute &attrib); const gl::VertexAttribute &attrib);
void updateArrayBufferReadDependencies(vk::CommandGraphNode *drawNode, void updateArrayBufferReadDependencies(vk::CommandGraphResource *drawFramebuffer,
const gl::AttributesMask &activeAttribsMask, const gl::AttributesMask &activeAttribsMask,
Serial serial); Serial serial);
void updateElementArrayBufferReadDependency(vk::CommandGraphNode *drawNode, Serial serial); void updateElementArrayBufferReadDependency(vk::CommandGraphResource *drawFramebuffer,
Serial serial);
gl::Error streamVertexData(RendererVk *renderer, gl::Error streamVertexData(RendererVk *renderer,
const gl::AttributesMask &attribsToStream, const gl::AttributesMask &attribsToStream,
...@@ -91,12 +92,12 @@ class VertexArrayVk : public VertexArrayImpl ...@@ -91,12 +92,12 @@ class VertexArrayVk : public VertexArrayImpl
gl::Error onDraw(const gl::Context *context, gl::Error onDraw(const gl::Context *context,
RendererVk *renderer, RendererVk *renderer,
const gl::DrawCallParams &drawCallParams, const gl::DrawCallParams &drawCallParams,
vk::CommandGraphNode *drawNode, vk::CommandBuffer *commandBuffer,
bool newCommandBuffer); bool newCommandBuffer);
gl::Error onIndexedDraw(const gl::Context *context, gl::Error onIndexedDraw(const gl::Context *context,
RendererVk *renderer, RendererVk *renderer,
const gl::DrawCallParams &drawCallParams, const gl::DrawCallParams &drawCallParams,
vk::CommandGraphNode *drawNode, vk::CommandBuffer *commandBuffer,
bool newCommandBuffer); bool newCommandBuffer);
void syncDirtyAttrib(const gl::VertexAttribute &attrib, void syncDirtyAttrib(const gl::VertexAttribute &attrib,
......
...@@ -448,8 +448,7 @@ gl::Error LineLoopHelper::getIndexBufferForElementArrayBuffer(RendererVk *render ...@@ -448,8 +448,7 @@ gl::Error LineLoopHelper::getIndexBufferForElementArrayBuffer(RendererVk *render
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
beginWriteResource(renderer, &commandBuffer); beginWriteResource(renderer, &commandBuffer);
Serial currentSerial = renderer->getCurrentQueueSerial(); elementArrayBufferVk->addReadDependency(this);
elementArrayBufferVk->onReadResource(getCurrentWritingNode(), currentSerial);
commandBuffer->copyBuffer(elementArrayBufferVk->getVkBuffer().getHandle(), *bufferHandleOut, 2, commandBuffer->copyBuffer(elementArrayBufferVk->getVkBuffer().getHandle(), *bufferHandleOut, 2,
copies.data()); copies.data());
......
...@@ -682,6 +682,12 @@ template <typename T> ...@@ -682,6 +682,12 @@ template <typename T>
using ShaderMap = angle::PackedEnumMap<ShaderType, T>; using ShaderMap = angle::PackedEnumMap<ShaderType, T>;
using AllShaderTypes = angle::AllEnums<vk::ShaderType>; using AllShaderTypes = angle::AllEnums<vk::ShaderType>;
enum class RecordingMode
{
Start,
Append,
};
} // namespace vk } // namespace vk
namespace gl_vk namespace gl_vk
......
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