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
angle::Result getOutsideRenderPassCommandBuffer(vk::CommandBuffer **commandBufferOut)
{
if (!mRenderPassCommands.empty())
{
ANGLE_TRY(endRenderPass());
}
ANGLE_TRY(endRenderPass());
*commandBufferOut = &mOutsideRenderPassCommands.getCommandBuffer();
return angle::Result::Continue;
}
......@@ -773,7 +770,8 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
angle::Result updateActiveTextures(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_INLINE void invalidateCurrentGraphicsPipeline()
......@@ -833,10 +831,12 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
// Common parts of the common dirty bit handlers.
angle::Result handleDirtyTexturesImpl(const gl::Context *context,
vk::CommandBuffer *commandBuffer,
vk::CommandGraphResource *recorder);
vk::CommandGraphResource *recorder,
CommandBufferHelper *commandBufferHelper);
angle::Result handleDirtyShaderResourcesImpl(const gl::Context *context,
vk::CommandBuffer *commandBuffer,
vk::CommandGraphResource *recorder);
vk::CommandGraphResource *recorder,
CommandBufferHelper *commandBufferHelper);
void handleDirtyDriverUniformsBindingImpl(vk::CommandBuffer *commandBuffer,
VkPipelineBindPoint bindPoint,
const DriverUniformsDescriptorSet &driverUniforms);
......@@ -857,7 +857,7 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
angle::Result submitFrame(const VkSubmitInfo &submitInfo,
vk::PrimaryCommandBuffer &&commandBuffer);
angle::Result flushCommandGraph(vk::PrimaryCommandBuffer *commandBatch);
void memoryBarrierImpl(GLbitfield barriers, VkPipelineStageFlags stageMask);
angle::Result memoryBarrierImpl(GLbitfield barriers, VkPipelineStageFlags stageMask);
angle::Result synchronizeCpuGpuTime();
angle::Result traceGpuEventImpl(vk::PrimaryCommandBuffer *commandBuffer,
......
......@@ -1325,7 +1325,7 @@ void ProgramVk::updateDefaultUniformsDescriptorSet(ContextVk *contextVk)
void ProgramVk::updateBuffersDescriptorSet(ContextVk *contextVk,
vk::ResourceUseList *resourceUseList,
RenderPassCommandBuffer *renderPassCommands,
CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder,
const std::vector<gl::InterfaceBlock> &blocks,
VkDescriptorType descriptorType)
......@@ -1408,12 +1408,12 @@ void ProgramVk::updateBuffersDescriptorSet(ContextVk *contextVk,
{
// We set the SHADER_READ_BIT to be conservative.
VkAccessFlags accessFlags = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
renderPassCommands->bufferWrite(resourceUseList, accessFlags, &bufferHelper);
commandBufferHelper->bufferWrite(resourceUseList, accessFlags, &bufferHelper);
}
else
{
renderPassCommands->bufferRead(resourceUseList, VK_ACCESS_UNIFORM_READ_BIT,
&bufferHelper);
commandBufferHelper->bufferRead(resourceUseList, VK_ACCESS_UNIFORM_READ_BIT,
&bufferHelper);
}
}
......@@ -1426,6 +1426,8 @@ void ProgramVk::updateBuffersDescriptorSet(ContextVk *contextVk,
}
void ProgramVk::updateAtomicCounterBuffersDescriptorSet(ContextVk *contextVk,
vk::ResourceUseList *resourceUseList,
CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder)
{
const gl::State &glState = contextVk->getState();
......@@ -1480,7 +1482,9 @@ void ProgramVk::updateAtomicCounterBuffersDescriptorSet(ContextVk *contextVk,
}
else
{
UNIMPLEMENTED();
commandBufferHelper->bufferWrite(resourceUseList,
VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
&bufferHelper);
}
writtenBindings.set(binding);
......@@ -1593,16 +1597,17 @@ angle::Result ProgramVk::updateImagesDescriptorSet(ContextVk *contextVk,
angle::Result ProgramVk::updateShaderResourcesDescriptorSet(
ContextVk *contextVk,
vk::ResourceUseList *resourceUseList,
RenderPassCommandBuffer *renderPassCommands,
CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder)
{
ANGLE_TRY(allocateDescriptorSet(contextVk, kShaderResourceDescriptorSetIndex));
updateBuffersDescriptorSet(contextVk, resourceUseList, renderPassCommands, recorder,
updateBuffersDescriptorSet(contextVk, resourceUseList, commandBufferHelper, recorder,
mState.getUniformBlocks(), VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
updateBuffersDescriptorSet(contextVk, resourceUseList, renderPassCommands, recorder,
updateBuffersDescriptorSet(contextVk, resourceUseList, commandBufferHelper, recorder,
mState.getShaderStorageBlocks(), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
updateAtomicCounterBuffersDescriptorSet(contextVk, recorder);
updateAtomicCounterBuffersDescriptorSet(contextVk, resourceUseList, commandBufferHelper,
recorder);
return updateImagesDescriptorSet(contextVk, recorder);
}
......
......@@ -110,7 +110,7 @@ class ProgramVk : public ProgramImpl
angle::Result updateTexturesDescriptorSet(ContextVk *contextVk);
angle::Result updateShaderResourcesDescriptorSet(ContextVk *contextVk,
vk::ResourceUseList *resourceUseList,
RenderPassCommandBuffer *renderPassCommands,
CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder);
angle::Result updateTransformFeedbackDescriptorSet(ContextVk *contextVk,
vk::FramebufferHelper *framebuffer);
......@@ -191,11 +191,13 @@ class ProgramVk : public ProgramImpl
void updateTransformFeedbackDescriptorSetImpl(ContextVk *contextVk);
void updateBuffersDescriptorSet(ContextVk *contextVk,
vk::ResourceUseList *resourceUseList,
RenderPassCommandBuffer *renderPassCommands,
CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder,
const std::vector<gl::InterfaceBlock> &blocks,
VkDescriptorType descriptorType);
void updateAtomicCounterBuffersDescriptorSet(ContextVk *contextVk,
vk::ResourceUseList *resourceUseList,
CommandBufferHelper *commandBufferHelper,
vk::CommandGraphResource *recorder);
angle::Result updateImagesDescriptorSet(ContextVk *contextVk,
vk::CommandGraphResource *recorder);
......
......@@ -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())
{
// Create a new node for the image and add a global memory barrier for the staging buffers.
......
......@@ -124,8 +124,9 @@ struct CombinedPrintToStringParamName
ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES(), ES3_VULKAN(), ES3_VULKAN_SWIFTSHADER(), \
WithNoCommandGraph(ES3_VULKAN())
#define ANGLE_ALL_TEST_PLATFORMS_ES31 \
ES31_D3D11(), ES31_OPENGL(), ES31_OPENGLES(), ES31_VULKAN(), ES31_VULKAN_SWIFTSHADER()
#define ANGLE_ALL_TEST_PLATFORMS_ES31 \
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()
......
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