Renderer: Working compute implementation

This commit is contained in:
SirLynix
2022-12-25 16:08:35 +01:00
committed by Jérôme Leclercq
parent 4605eed0da
commit fe8715f1fb
31 changed files with 615 additions and 167 deletions

View File

@@ -227,6 +227,7 @@ namespace Nz
{
case PipelineStage::TopOfPipe: return VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
case PipelineStage::ColorOutput: return VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
case PipelineStage::ComputeShader: return VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
case PipelineStage::DrawIndirect: return VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT;
case PipelineStage::FragmentShader: return VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
case PipelineStage::FragmentTestsEarly: return VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT;
@@ -444,6 +445,7 @@ namespace Nz
case TextureLayout::ColorOutput: return VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
case TextureLayout::DepthStencilReadOnly: return VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
case TextureLayout::DepthStencilReadWrite: return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
case TextureLayout::General: return VK_IMAGE_LAYOUT_GENERAL;
case TextureLayout::Present: return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
case TextureLayout::TransferSource: return VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
case TextureLayout::TransferDestination: return VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;

View File

@@ -28,10 +28,12 @@ namespace Nz
void BeginRenderPass(const Framebuffer& framebuffer, const RenderPass& renderPass, const Recti& renderRect, const ClearValues* clearValues, std::size_t clearValueCount) override;
void BindComputePipeline(const ComputePipeline& pipeline) override;
void BindComputeShaderBinding(UInt32 set, const ShaderBinding& binding) override;
void BindComputeShaderBinding(const RenderPipelineLayout& pipelineLayout, UInt32 set, const ShaderBinding& binding) override;
void BindIndexBuffer(const RenderBuffer& indexBuffer, IndexType indexType, UInt64 offset = 0) override;
void BindRenderPipeline(const RenderPipeline& pipeline) override;
void BindShaderBinding(UInt32 set, const ShaderBinding& binding) override;
void BindShaderBinding(const RenderPipelineLayout& pipelineLayout, UInt32 set, const ShaderBinding& binding) override;
void BindRenderShaderBinding(UInt32 set, const ShaderBinding& binding) override;
void BindRenderShaderBinding(const RenderPipelineLayout& pipelineLayout, UInt32 set, const ShaderBinding& binding) override;
void BindVertexBuffer(UInt32 binding, const RenderBuffer& vertexBuffer, UInt64 offset = 0) override;
void BlitTexture(const Texture& fromTexture, const Boxui& fromBox, TextureLayout fromLayout, const Texture& toTexture, const Boxui& toBox, TextureLayout toLayout, SamplerFilter filter) override;

View File

@@ -16,7 +16,7 @@
namespace Nz
{
class NAZARA_VULKANRENDERER_API VulkanTexture : public Texture
class NAZARA_VULKANRENDERER_API VulkanTexture final : public Texture
{
public:
VulkanTexture(Vk::Device& device, const TextureInfo& textureInfo);
@@ -28,14 +28,15 @@ namespace Nz
bool Copy(const Texture& source, const Boxui& srcBox, const Vector3ui& dstPos) override;
std::shared_ptr<Texture> CreateView(const TextureViewInfo& viewInfo) override;
PixelFormat GetFormat() const override;
inline PixelFormat GetFormat() const override;
inline VkImage GetImage() const;
inline VkImageView GetImageView() const;
UInt8 GetLevelCount() const override;
VulkanTexture* GetParentTexture() const override;
Vector3ui GetSize(UInt8 level = 0) const override;
inline UInt8 GetLevelCount() const override;
inline VulkanTexture* GetParentTexture() const override;
inline Vector3ui GetSize(UInt8 level = 0) const override;
inline const VkImageSubresourceRange& GetSubresourceRange() const;
ImageType GetType() const override;
inline const TextureInfo& GetTextureInfo() const override;
inline ImageType GetType() const override;
using Texture::Update;
bool Update(const void* ptr, const Boxui& box, unsigned int srcWidth, unsigned int srcHeight, UInt8 level) override;

View File

@@ -7,6 +7,11 @@
namespace Nz
{
inline PixelFormat VulkanTexture::GetFormat() const
{
return m_textureInfo.pixelFormat;
}
inline VkImage VulkanTexture::GetImage() const
{
return m_image;
@@ -17,10 +22,35 @@ namespace Nz
return m_imageView;
}
inline UInt8 VulkanTexture::GetLevelCount() const
{
return m_textureInfo.levelCount;
}
inline VulkanTexture* VulkanTexture::GetParentTexture() const
{
return m_parentTexture.get();
}
inline Vector3ui VulkanTexture::GetSize(UInt8 level) const
{
return Vector3ui(GetLevelSize(m_textureInfo.width, level), GetLevelSize(m_textureInfo.height, level), GetLevelSize(m_textureInfo.depth, level));
}
inline const VkImageSubresourceRange& VulkanTexture::GetSubresourceRange() const
{
return m_imageRange;
}
inline const TextureInfo& VulkanTexture::GetTextureInfo() const
{
return m_textureInfo;
}
inline ImageType VulkanTexture::GetType() const
{
return m_textureInfo.type;
}
}
#include <Nazara/VulkanRenderer/DebugOff.hpp>