Add support for stencil buffer on Vulkan and D3D11/D3D12

This commit is contained in:
Wojtek Figat
2024-02-01 14:47:17 +01:00
parent 7fd6c43f84
commit 8488a8d387
15 changed files with 268 additions and 263 deletions

View File

@@ -40,41 +40,25 @@ class DescriptorSetLayoutVulkan;
/// </summary>
struct PipelineBarrierVulkan
{
public:
VkPipelineStageFlags SourceStage = 0;
VkPipelineStageFlags DestStage = 0;
Array<VkImageMemoryBarrier, FixedAllocation<VK_BARRIER_BUFFER_SIZE>> ImageBarriers;
Array<VkBufferMemoryBarrier, FixedAllocation<VK_BARRIER_BUFFER_SIZE>> BufferBarriers;
#if VK_ENABLE_BARRIERS_DEBUG
Array<GPUTextureViewVulkan*, FixedAllocation<VK_BARRIER_BUFFER_SIZE>> ImageBarriersDebug;
Array<GPUTextureViewVulkan*, FixedAllocation<VK_BARRIER_BUFFER_SIZE>> ImageBarriersDebug;
#endif
public:
inline void Reset()
{
SourceStage = 0;
DestStage = 0;
ImageBarriers.Clear();
BufferBarriers.Clear();
#if VK_ENABLE_BARRIERS_DEBUG
ImageBarriersDebug.Clear();
#endif
}
void AddImageBarrier(VkImage image, const VkImageSubresourceRange& range, VkImageLayout srcLayout, VkImageLayout dstLayout, GPUTextureViewVulkan* handle);
void AddBufferBarrier(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, VkAccessFlags srcAccess, VkAccessFlags dstAccess);
inline bool IsFull() const
FORCE_INLINE bool IsFull() const
{
return ImageBarriers.Count() == VK_BARRIER_BUFFER_SIZE || BufferBarriers.Count() == VK_BARRIER_BUFFER_SIZE;
}
inline bool HasBarrier() const
FORCE_INLINE bool HasBarrier() const
{
return ImageBarriers.Count() + BufferBarriers.Count() != 0;
}
void Execute(CmdBufferVulkan* cmdBuffer);
void Execute(const CmdBufferVulkan* cmdBuffer);
};
/// <summary>
@@ -136,7 +120,7 @@ public:
return _cmdBufferManager;
}
void AddImageBarrier(VkImage image, VkImageLayout srcLayout, VkImageLayout dstLayout, VkImageSubresourceRange& subresourceRange, GPUTextureViewVulkan* handle);
void AddImageBarrier(VkImage image, VkImageLayout srcLayout, VkImageLayout dstLayout, const VkImageSubresourceRange& subresourceRange, GPUTextureViewVulkan* handle);
void AddImageBarrier(GPUTextureViewVulkan* handle, VkImageLayout dstLayout);
void AddImageBarrier(GPUTextureVulkan* texture, int32 mipSlice, int32 arraySlice, VkImageLayout dstLayout);
void AddImageBarrier(GPUTextureVulkan* texture, VkImageLayout dstLayout);
@@ -153,7 +137,6 @@ public:
private:
void UpdateDescriptorSets(const struct SpirvShaderDescriptorInfo& descriptorInfo, class DescriptorSetWriterVulkan& dsWriter, bool& needsWrite);
void UpdateDescriptorSets(GPUPipelineStateVulkan* pipelineState);
void UpdateDescriptorSets(ComputePipelineStateVulkan* pipelineState);
void OnDrawCall();