Add ComputeParticlesTest

Renderer: Add a way to execute commands on the device
This commit is contained in:
SirLynix
2023-01-04 17:57:26 +01:00
committed by Jérôme Leclercq
parent 9e7b98a017
commit e34ba8c05d
13 changed files with 736 additions and 4 deletions

View File

@@ -32,6 +32,8 @@ namespace Nz
std::shared_ptr<GL::Context> CreateContext(GL::ContextParams params) const;
std::shared_ptr<GL::Context> CreateContext(GL::ContextParams params, WindowHandle handle) const;
void Execute(const FunctionRef<void(CommandBufferBuilder& builder)>& callback, QueueType queueType) override;
const RenderDeviceInfo& GetDeviceInfo() const override;
const RenderDeviceFeatures& GetEnabledFeatures() const override;
inline const GL::Context& GetReferenceContext() const;
@@ -57,6 +59,8 @@ namespace Nz
inline void NotifySamplerDestruction(GLuint sampler) const;
inline void NotifyTextureDestruction(GLuint texture) const;
void WaitForIdle() override;
OpenGLDevice& operator=(const OpenGLDevice&) = delete;
OpenGLDevice& operator=(OpenGLDevice&&) = delete; ///TODO?

View File

@@ -99,6 +99,7 @@ typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERPROC) (GLuint shader, const GLch
cb(glEnable, PFNGLENABLEPROC) \
cb(glEnableVertexAttribArray, PFNGLENABLEVERTEXATTRIBARRAYPROC) \
cb(glEndQuery, PFNGLENDQUERYPROC) \
cb(glFinish, PFNGLFINISHPROC) \
cb(glFlush, PFNGLFLUSHPROC) \
cb(glFramebufferRenderbuffer, PFNGLFRAMEBUFFERRENDERBUFFERPROC) \
cb(glFramebufferTexture2D, PFNGLFRAMEBUFFERTEXTURE2DPROC) \

View File

@@ -22,6 +22,7 @@
#include <Nazara/Renderer/Texture.hpp>
#include <Nazara/Renderer/TextureSampler.hpp>
#include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utils/FunctionRef.hpp>
#include <NZSL/ShaderWriter.hpp>
#include <NZSL/Ast/Module.hpp>
#include <memory>
@@ -29,6 +30,7 @@
namespace Nz
{
class CommandBufferBuilder;
class CommandPool;
class ShaderModule;
@@ -38,6 +40,8 @@ namespace Nz
RenderDevice() = default;
virtual ~RenderDevice();
virtual void Execute(const FunctionRef<void(CommandBufferBuilder& builder)>& callback, QueueType queueType) = 0;
virtual const RenderDeviceInfo& GetDeviceInfo() const = 0;
virtual const RenderDeviceFeatures& GetEnabledFeatures() const = 0;
@@ -58,6 +62,8 @@ namespace Nz
virtual bool IsTextureFormatSupported(PixelFormat format, TextureUsage usage) const = 0;
virtual void WaitForIdle() = 0;
static void ValidateFeatures(const RenderDeviceFeatures& supportedFeatures, RenderDeviceFeatures& enabledFeatures);
};
}

View File

@@ -23,6 +23,8 @@ namespace Nz
VulkanDevice(VulkanDevice&&) = delete; ///TODO?
~VulkanDevice();
void Execute(const FunctionRef<void(CommandBufferBuilder& builder)>& callback, QueueType queueType) override;
const RenderDeviceInfo& GetDeviceInfo() const override;
const RenderDeviceFeatures& GetEnabledFeatures() const override;
@@ -42,6 +44,8 @@ namespace Nz
bool IsTextureFormatSupported(PixelFormat format, TextureUsage usage) const override;
void WaitForIdle() override;
VulkanDevice& operator=(const VulkanDevice&) = delete;
VulkanDevice& operator=(VulkanDevice&&) = delete; ///TODO?

View File

@@ -122,8 +122,9 @@ namespace Nz::Vk
public:
using AutoFree::AutoFree;
operator VkCommandBuffer() const { return Get(); }
};
operator VkCommandBuffer() const { return Get(); }
};
}
}
#include <Nazara/VulkanRenderer/Wrapper/CommandBuffer.inl>