Commit 3b82506a by Jamie Madill Committed by Commit Bot

Vulkan: Command graph linearization (Step 5).

Implements ES 3.1 support. Bug: angleproject:4029 Change-Id: I3c08602cf4ec64621bfdb40cd40d142b666e6edf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2046052 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com>
parent 72e9f4d7
...@@ -591,10 +591,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO ...@@ -591,10 +591,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
angle::Result getOutsideRenderPassCommandBuffer(vk::CommandBuffer **commandBufferOut) angle::Result getOutsideRenderPassCommandBuffer(vk::CommandBuffer **commandBufferOut)
{ {
if (!mRenderPassCommands.empty())
{
ANGLE_TRY(endRenderPass()); ANGLE_TRY(endRenderPass());
}
*commandBufferOut = &mOutsideRenderPassCommands.getCommandBuffer(); *commandBufferOut = &mOutsideRenderPassCommands.getCommandBuffer();
return angle::Result::Continue; return angle::Result::Continue;
} }
...@@ -773,7 +770,8 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO ...@@ -773,7 +770,8 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
angle::Result updateActiveTextures(const gl::Context *context); angle::Result updateActiveTextures(const gl::Context *context);
angle::Result updateActiveImages(const gl::Context *context, angle::Result updateActiveImages(const gl::Context *context,
vk::CommandGraphResource *recorder); vk::CommandGraphResource *recorder,
CommandBufferHelper *commandBufferHelper);
angle::Result updateDefaultAttribute(size_t attribIndex); angle::Result updateDefaultAttribute(size_t attribIndex);
ANGLE_INLINE void invalidateCurrentGraphicsPipeline() ANGLE_INLINE void invalidateCurrentGraphicsPipeline()
...@@ -833,10 +831,12 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO ...@@ -833,10 +831,12 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
// Common parts of the common dirty bit handlers. // Common parts of the common dirty bit handlers.
angle::Result handleDirtyTexturesImpl(const gl::Context *context, angle::Result handleDirtyTexturesImpl(const gl::Context *context,
vk::CommandBuffer *commandBuffer, vk::CommandBuffer *commandBuffer,
vk::CommandGraphResource *recorder); vk::CommandGraphResource *recorder,
CommandBufferHelper *commandBufferHelper);
angle::Result handleDirtyShaderResourcesImpl(const gl::Context *context, angle::Result handleDirtyShaderResourcesImpl(const gl::Context *context,
vk::CommandBuffer *commandBuffer, vk::CommandBuffer *commandBuffer,
vk::CommandGraphResource *recorder); vk::CommandGraphResource *recorder,
CommandBufferHelper *commandBufferHelper);
void handleDirtyDriverUniformsBindingImpl(vk::CommandBuffer *commandBuffer, void handleDirtyDriverUniformsBindingImpl(vk::CommandBuffer *commandBuffer,
VkPipelineBindPoint bindPoint, VkPipelineBindPoint bindPoint,
const DriverUniformsDescriptorSet &driverUniforms); const DriverUniformsDescriptorSet &driverUniforms);
...@@ -857,7 +857,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO ...@@ -857,7 +857,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
angle::Result submitFrame(const VkSubmitInfo &submitInfo, angle::Result submitFrame(const VkSubmitInfo &submitInfo,
vk::PrimaryCommandBuffer &&commandBuffer); vk::PrimaryCommandBuffer &&commandBuffer);
angle::Result flushCommandGraph(vk::PrimaryCommandBuffer *commandBatch); angle::Result flushCommandGraph(vk::PrimaryCommandBuffer *commandBatch);
void memoryBarrierImpl(GLbitfield barriers, VkPipelineStageFlags stageMask); angle::Result memoryBarrierImpl(GLbitfield barriers, VkPipelineStageFlags stageMask);
angle::Result synchronizeCpuGpuTime(); angle::Result synchronizeCpuGpuTime();
angle::Result traceGpuEventImpl(vk::PrimaryCommandBuffer *commandBuffer, angle::Result traceGpuEventImpl(vk::PrimaryCommandBuffer *commandBuffer,
......
...@@ -1325,7 +1325,7 @@ void ProgramVk::updateDefaultUniformsDescriptorSet(ContextVk *contextVk) ...@@ -1325,7 +1325,7 @@ void ProgramVk::updateDefaultUniformsDescriptorSet(ContextVk *contextVk)
void ProgramVk::updateBuffersDescriptorSet(ContextVk *contextVk, void ProgramVk::updateBuffersDescriptorSet(ContextVk *contextVk,
vk::ResourceUseList *resourceUseList, vk::ResourceUseList *resourceUseList,
RenderPassCommandBuffer *renderPassCommands, CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder, vk::CommandGraphResource *recorder,
const std::vector<gl::InterfaceBlock> &blocks, const std::vector<gl::InterfaceBlock> &blocks,
VkDescriptorType descriptorType) VkDescriptorType descriptorType)
...@@ -1408,11 +1408,11 @@ void ProgramVk::updateBuffersDescriptorSet(ContextVk *contextVk, ...@@ -1408,11 +1408,11 @@ void ProgramVk::updateBuffersDescriptorSet(ContextVk *contextVk,
{ {
// We set the SHADER_READ_BIT to be conservative. // We set the SHADER_READ_BIT to be conservative.
VkAccessFlags accessFlags = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; VkAccessFlags accessFlags = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
renderPassCommands->bufferWrite(resourceUseList, accessFlags, &bufferHelper); commandBufferHelper->bufferWrite(resourceUseList, accessFlags, &bufferHelper);
} }
else else
{ {
renderPassCommands->bufferRead(resourceUseList, VK_ACCESS_UNIFORM_READ_BIT, commandBufferHelper->bufferRead(resourceUseList, VK_ACCESS_UNIFORM_READ_BIT,
&bufferHelper); &bufferHelper);
} }
} }
...@@ -1426,6 +1426,8 @@ void ProgramVk::updateBuffersDescriptorSet(ContextVk *contextVk, ...@@ -1426,6 +1426,8 @@ void ProgramVk::updateBuffersDescriptorSet(ContextVk *contextVk,
} }
void ProgramVk::updateAtomicCounterBuffersDescriptorSet(ContextVk *contextVk, void ProgramVk::updateAtomicCounterBuffersDescriptorSet(ContextVk *contextVk,
vk::ResourceUseList *resourceUseList,
CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder) vk::CommandGraphResource *recorder)
{ {
const gl::State &glState = contextVk->getState(); const gl::State &glState = contextVk->getState();
...@@ -1480,7 +1482,9 @@ void ProgramVk::updateAtomicCounterBuffersDescriptorSet(ContextVk *contextVk, ...@@ -1480,7 +1482,9 @@ void ProgramVk::updateAtomicCounterBuffersDescriptorSet(ContextVk *contextVk,
} }
else else
{ {
UNIMPLEMENTED(); commandBufferHelper->bufferWrite(resourceUseList,
VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
&bufferHelper);
} }
writtenBindings.set(binding); writtenBindings.set(binding);
...@@ -1593,16 +1597,17 @@ angle::Result ProgramVk::updateImagesDescriptorSet(ContextVk *contextVk, ...@@ -1593,16 +1597,17 @@ angle::Result ProgramVk::updateImagesDescriptorSet(ContextVk *contextVk,
angle::Result ProgramVk::updateShaderResourcesDescriptorSet( angle::Result ProgramVk::updateShaderResourcesDescriptorSet(
ContextVk *contextVk, ContextVk *contextVk,
vk::ResourceUseList *resourceUseList, vk::ResourceUseList *resourceUseList,
RenderPassCommandBuffer *renderPassCommands, CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder) vk::CommandGraphResource *recorder)
{ {
ANGLE_TRY(allocateDescriptorSet(contextVk, kShaderResourceDescriptorSetIndex)); ANGLE_TRY(allocateDescriptorSet(contextVk, kShaderResourceDescriptorSetIndex));
updateBuffersDescriptorSet(contextVk, resourceUseList, renderPassCommands, recorder, updateBuffersDescriptorSet(contextVk, resourceUseList, commandBufferHelper, recorder,
mState.getUniformBlocks(), VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER); mState.getUniformBlocks(), VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
updateBuffersDescriptorSet(contextVk, resourceUseList, renderPassCommands, recorder, updateBuffersDescriptorSet(contextVk, resourceUseList, commandBufferHelper, recorder,
mState.getShaderStorageBlocks(), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER); mState.getShaderStorageBlocks(), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
updateAtomicCounterBuffersDescriptorSet(contextVk, recorder); updateAtomicCounterBuffersDescriptorSet(contextVk, resourceUseList, commandBufferHelper,
recorder);
return updateImagesDescriptorSet(contextVk, recorder); return updateImagesDescriptorSet(contextVk, recorder);
} }
......
...@@ -110,7 +110,7 @@ class ProgramVk : public ProgramImpl ...@@ -110,7 +110,7 @@ class ProgramVk : public ProgramImpl
angle::Result updateTexturesDescriptorSet(ContextVk *contextVk); angle::Result updateTexturesDescriptorSet(ContextVk *contextVk);
angle::Result updateShaderResourcesDescriptorSet(ContextVk *contextVk, angle::Result updateShaderResourcesDescriptorSet(ContextVk *contextVk,
vk::ResourceUseList *resourceUseList, vk::ResourceUseList *resourceUseList,
RenderPassCommandBuffer *renderPassCommands, CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder); vk::CommandGraphResource *recorder);
angle::Result updateTransformFeedbackDescriptorSet(ContextVk *contextVk, angle::Result updateTransformFeedbackDescriptorSet(ContextVk *contextVk,
vk::FramebufferHelper *framebuffer); vk::FramebufferHelper *framebuffer);
...@@ -191,11 +191,13 @@ class ProgramVk : public ProgramImpl ...@@ -191,11 +191,13 @@ class ProgramVk : public ProgramImpl
void updateTransformFeedbackDescriptorSetImpl(ContextVk *contextVk); void updateTransformFeedbackDescriptorSetImpl(ContextVk *contextVk);
void updateBuffersDescriptorSet(ContextVk *contextVk, void updateBuffersDescriptorSet(ContextVk *contextVk,
vk::ResourceUseList *resourceUseList, vk::ResourceUseList *resourceUseList,
RenderPassCommandBuffer *renderPassCommands, CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder, vk::CommandGraphResource *recorder,
const std::vector<gl::InterfaceBlock> &blocks, const std::vector<gl::InterfaceBlock> &blocks,
VkDescriptorType descriptorType); VkDescriptorType descriptorType);
void updateAtomicCounterBuffersDescriptorSet(ContextVk *contextVk, void updateAtomicCounterBuffersDescriptorSet(ContextVk *contextVk,
vk::ResourceUseList *resourceUseList,
CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder); vk::CommandGraphResource *recorder);
angle::Result updateImagesDescriptorSet(ContextVk *contextVk, angle::Result updateImagesDescriptorSet(ContextVk *contextVk,
vk::CommandGraphResource *recorder); vk::CommandGraphResource *recorder);
......
...@@ -1389,6 +1389,8 @@ angle::Result TextureVk::changeLevels(ContextVk *contextVk, ...@@ -1389,6 +1389,8 @@ angle::Result TextureVk::changeLevels(ContextVk *contextVk,
} }
} }
// This global barrier is no longer needed without the command graph as barriers are correctly
// inserted using the normal command APIs.
if (contextVk->commandGraphEnabled()) if (contextVk->commandGraphEnabled())
{ {
// Create a new node for the image and add a global memory barrier for the staging buffers. // Create a new node for the image and add a global memory barrier for the staging buffers.
......
...@@ -125,7 +125,8 @@ struct CombinedPrintToStringParamName ...@@ -125,7 +125,8 @@ struct CombinedPrintToStringParamName
WithNoCommandGraph(ES3_VULKAN()) WithNoCommandGraph(ES3_VULKAN())
#define ANGLE_ALL_TEST_PLATFORMS_ES31 \ #define ANGLE_ALL_TEST_PLATFORMS_ES31 \
ES31_D3D11(), ES31_OPENGL(), ES31_OPENGLES(), ES31_VULKAN(), ES31_VULKAN_SWIFTSHADER() ES31_D3D11(), ES31_OPENGL(), ES31_OPENGLES(), ES31_VULKAN(), ES31_VULKAN_SWIFTSHADER(), \
WithNoCommandGraph(ES31_VULKAN())
#define ANGLE_ALL_TEST_PLATFORMS_NULL ES2_NULL(), ES3_NULL(), ES31_NULL() #define ANGLE_ALL_TEST_PLATFORMS_NULL ES2_NULL(), ES3_NULL(), ES31_NULL()
......
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