Renderer: Add support for device-enabled features (anisotropic filtering)

This commit is contained in:
Jérôme Leclercq
2021-06-05 19:51:48 +02:00
parent 0411271851
commit 86097b331b
14 changed files with 104 additions and 120 deletions

View File

@@ -119,12 +119,12 @@ namespace Nz
m_commands.emplace_back(EndDebugRegionData{});
}
inline std::size_t Nz::OpenGLCommandBuffer::GetBindingIndex() const
inline std::size_t OpenGLCommandBuffer::GetBindingIndex() const
{
return m_bindingIndex;
}
inline std::size_t Nz::OpenGLCommandBuffer::GetPoolIndex() const
inline std::size_t OpenGLCommandBuffer::GetPoolIndex() const
{
return m_poolIndex;
}

View File

@@ -25,7 +25,7 @@ namespace Nz
std::unique_ptr<RenderSurface> CreateRenderSurfaceImpl() override;
std::unique_ptr<RenderWindowImpl> CreateRenderWindowImpl(RenderWindow& owner) override;
std::shared_ptr<RenderDevice> InstanciateRenderDevice(std::size_t deviceIndex) override;
std::shared_ptr<RenderDevice> InstanciateRenderDevice(std::size_t deviceIndex, const RenderDeviceFeatures& enabledFeatures) override;
RenderAPI QueryAPI() const override;
std::string QueryAPIString() const override;

View File

@@ -13,6 +13,11 @@
namespace Nz
{
struct RenderDeviceFeatures
{
bool anisotropicFiltering = false;
};
struct RenderDeviceLimits
{
UInt64 minUniformBufferOffsetAlignment;
@@ -20,6 +25,7 @@ namespace Nz
struct RenderDeviceInfo
{
RenderDeviceFeatures features;
RenderDeviceLimits limits;
RenderDeviceType type;
std::string name;

View File

@@ -34,7 +34,7 @@ namespace Nz
inline RendererImpl* GetRendererImpl();
std::shared_ptr<RenderDevice> InstanciateRenderDevice(std::size_t deviceIndex);
std::shared_ptr<RenderDevice> InstanciateRenderDevice(std::size_t deviceIndex, const RenderDeviceFeatures& enabledFeatures = {});
RenderAPI QueryAPI() const;
std::string QueryAPIString() const;

View File

@@ -37,7 +37,7 @@ namespace Nz
virtual std::unique_ptr<RenderSurface> CreateRenderSurfaceImpl() = 0;
virtual std::unique_ptr<RenderWindowImpl> CreateRenderWindowImpl(RenderWindow& owner) = 0;
virtual std::shared_ptr<RenderDevice> InstanciateRenderDevice(std::size_t deviceIndex) = 0;
virtual std::shared_ptr<RenderDevice> InstanciateRenderDevice(std::size_t deviceIndex, const RenderDeviceFeatures& enabledFeatures) = 0;
virtual RenderAPI QueryAPI() const = 0;
virtual std::string QueryAPIString() const = 0;

View File

@@ -38,9 +38,9 @@ namespace Nz
static RenderDeviceInfo BuildRenderDeviceInfo(const Vk::PhysicalDevice& physDevice);
static std::shared_ptr<VulkanDevice> CreateDevice(const Vk::PhysicalDevice& deviceInfo);
static std::shared_ptr<VulkanDevice> CreateDevice(const Vk::PhysicalDevice& deviceInfo, const Vk::Surface& surface, UInt32* graphicsFamilyIndex, UInt32* presentableFamilyIndex, UInt32* transferFamilyIndex);
static std::shared_ptr<VulkanDevice> CreateDevice(const Vk::PhysicalDevice& deviceInfo, const QueueFamily* queueFamilies, std::size_t queueFamilyCount);
static std::shared_ptr<VulkanDevice> CreateDevice(const Vk::PhysicalDevice& deviceInfo, const RenderDeviceFeatures& enabledFeatures);
static std::shared_ptr<VulkanDevice> CreateDevice(const Vk::PhysicalDevice& deviceInfo, const RenderDeviceFeatures& enabledFeatures, const Vk::Surface& surface, UInt32* graphicsFamilyIndex, UInt32* presentableFamilyIndex, UInt32* transferFamilyIndex);
static std::shared_ptr<VulkanDevice> CreateDevice(const Vk::PhysicalDevice& deviceInfo, const RenderDeviceFeatures& enabledFeatures, const QueueFamily* queueFamilies, std::size_t queueFamilyCount);
static Vk::Instance& GetInstance();
@@ -51,13 +51,9 @@ namespace Nz
static bool IsInitialized();
static std::shared_ptr<VulkanDevice> SelectDevice(const Vk::PhysicalDevice& deviceInfo);
static std::shared_ptr<VulkanDevice> SelectDevice(const Vk::PhysicalDevice& deviceInfo, const Vk::Surface& surface, UInt32* graphicsFamilyIndex, UInt32* presentableFamilyIndex, UInt32* transferFamilyIndex);
static void Uninitialize();
private:
static std::vector<std::shared_ptr<VulkanDevice>> s_devices;
static std::vector<Vk::PhysicalDevice> s_physDevices;
static Vk::Instance s_instance;
static ParameterList s_initializationParameters;

View File

@@ -28,7 +28,7 @@ namespace Nz
std::unique_ptr<RenderSurface> CreateRenderSurfaceImpl() override;
std::unique_ptr<RenderWindowImpl> CreateRenderWindowImpl(RenderWindow& owner) override;
std::shared_ptr<RenderDevice> InstanciateRenderDevice(std::size_t deviceIndex) override;
std::shared_ptr<RenderDevice> InstanciateRenderDevice(std::size_t deviceIndex, const RenderDeviceFeatures& enabledFeatures) override;
RenderAPI QueryAPI() const override;
std::string QueryAPIString() const override;