Commit 9a6c28bc by Alexis Hetu Committed by Alexis Hétu

Implement pipeline barrier as noop

Because of existing synchronization mechanisms in SwiftShader, pipeline barriers can be noop for now. If we do remove those synchronization mechanisms, there's also a simple way of implementing pipeline barriers, which is commented on here. Bug b/118619338 Change-Id: If82d275c46f234e5549018115c9f19f21e2c09b2 Reviewed-on: https://swiftshader-review.googlesource.com/c/22708Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com>
parent f8374cf0
...@@ -143,6 +143,27 @@ private: ...@@ -143,6 +143,27 @@ private:
const VkBufferImageCopy region; const VkBufferImageCopy region;
}; };
struct PipelineBarrier : public CommandBuffer::Command
{
PipelineBarrier()
{
}
void play(CommandBuffer* commandBuffer)
{
// This can currently be a noop. The sw::Surface locking/unlocking mechanism used by the renderer already takes care of
// making sure the read/writes always happen in order. Eventually, if we remove this synchronization mechanism, we can
// have a very simple implementation that simply calls sw::Renderer::sync(), since the driver is free to move the source
// stage towards the bottom of the pipe and the target stage towards the top, so a full pipeline sync is spec compliant.
// Right now all buffers are read-only in drawcalls but a similar mechanism will be required once we support SSBOs.
// Also note that this would be a good moment to update cube map borders or decompress compressed textures, if necessary.
}
private:
};
CommandBuffer::CommandBuffer(VkCommandBufferLevel pLevel) : level(pLevel) CommandBuffer::CommandBuffer(VkCommandBufferLevel pLevel) : level(pLevel)
{ {
// FIXME (b/119409619): replace this vector by an allocator so we can control all memory allocations // FIXME (b/119409619): replace this vector by an allocator so we can control all memory allocations
...@@ -242,7 +263,7 @@ void CommandBuffer::pipelineBarrier(VkPipelineStageFlags srcStageMask, VkPipelin ...@@ -242,7 +263,7 @@ void CommandBuffer::pipelineBarrier(VkPipelineStageFlags srcStageMask, VkPipelin
uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers,
uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers) uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers)
{ {
UNIMPLEMENTED(); commands->push_back(std::make_unique<PipelineBarrier>());
} }
void CommandBuffer::bindPipeline(VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) void CommandBuffer::bindPipeline(VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
......
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