Renderer: Expose present mode and allow to query/set it

This commit is contained in:
SirLynix
2023-08-13 18:16:03 +02:00
parent 28d69ab552
commit e8620894f7
21 changed files with 420 additions and 43 deletions

View File

@@ -109,6 +109,24 @@ namespace Nz
using PipelineStageFlags = Flags<PipelineStage>;
enum class PresentMode
{
Immediate,
Mailbox,
RelaxedVerticalSync,
VerticalSync,
Max = VerticalSync
};
template<>
struct EnumAsFlags<PresentMode>
{
static constexpr PresentMode max = PresentMode::Max;
};
using PresentModeFlags = Flags<PresentMode>;
enum class QueueType
{
Compute,

View File

@@ -32,8 +32,13 @@ namespace Nz
virtual std::shared_ptr<CommandPool> CreateCommandPool(QueueType queueType) = 0;
virtual PresentMode GetPresentMode() const = 0;
virtual PresentModeFlags GetSupportedPresentModes() const = 0;
virtual void NotifyResize(const Vector2ui& newSize) = 0;
virtual void SetPresentMode(PresentMode presentMode) = 0;
virtual TransientResources& Transient() = 0;
protected:

View File

@@ -8,6 +8,7 @@
#define NAZARA_RENDERER_SWAPCHAINPARAMETERS_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Utility/PixelFormat.hpp>
#include <vector>
@@ -15,8 +16,8 @@ namespace Nz
{
struct SwapchainParameters
{
std::vector<PixelFormat> depthFormats = {Nz::PixelFormat::Depth24Stencil8, Nz::PixelFormat::Depth32FStencil8, Nz::PixelFormat::Depth16Stencil8, Nz::PixelFormat::Depth32F, Nz::PixelFormat::Depth24}; //< By order of preference
bool verticalSync = false;
std::vector<PixelFormat> depthFormats = { Nz::PixelFormat::Depth24Stencil8, Nz::PixelFormat::Depth32FStencil8, Nz::PixelFormat::Depth16Stencil8, Nz::PixelFormat::Depth32F, Nz::PixelFormat::Depth24 }; //< By order of preference
std::vector<PresentMode> presentMode = { PresentMode::Mailbox, PresentMode::Immediate, PresentMode::RelaxedVerticalSync, PresentMode::VerticalSync }; //< By order of preference
};
}