Add renderer backend feature reporting
This commit is contained in:
@@ -654,6 +654,16 @@ const char* RecordingRenderDevice::backend_name() const noexcept
|
||||
return "recording";
|
||||
}
|
||||
|
||||
RenderDeviceFeatures RecordingRenderDevice::features() const noexcept
|
||||
{
|
||||
return RenderDeviceFeatures {
|
||||
.explicit_texture_transitions = true,
|
||||
.texture_copy = true,
|
||||
.render_target_blit = true,
|
||||
.frame_capture = true,
|
||||
};
|
||||
}
|
||||
|
||||
pp::foundation::Result<std::unique_ptr<ITexture2D>> RecordingRenderDevice::create_texture(
|
||||
TextureDesc desc) noexcept
|
||||
{
|
||||
|
||||
@@ -199,6 +199,7 @@ public:
|
||||
RecordingRenderDevice() noexcept;
|
||||
|
||||
[[nodiscard]] const char* backend_name() const noexcept override;
|
||||
[[nodiscard]] RenderDeviceFeatures features() const noexcept override;
|
||||
[[nodiscard]] pp::foundation::Result<std::unique_ptr<ITexture2D>> create_texture(
|
||||
TextureDesc desc) noexcept override;
|
||||
[[nodiscard]] pp::foundation::Result<std::unique_ptr<IRenderTarget>> create_render_target(
|
||||
|
||||
@@ -226,6 +226,16 @@ struct ShaderProgramDesc {
|
||||
ShaderStageSource fragment;
|
||||
};
|
||||
|
||||
struct RenderDeviceFeatures {
|
||||
bool framebuffer_fetch = false;
|
||||
bool explicit_texture_transitions = false;
|
||||
bool texture_copy = false;
|
||||
bool render_target_blit = false;
|
||||
bool frame_capture = false;
|
||||
bool float16_render_targets = false;
|
||||
bool float32_render_targets = false;
|
||||
};
|
||||
|
||||
class ITexture2D {
|
||||
public:
|
||||
virtual ~ITexture2D() = default;
|
||||
@@ -321,6 +331,7 @@ class IRenderDevice {
|
||||
public:
|
||||
virtual ~IRenderDevice() = default;
|
||||
[[nodiscard]] virtual const char* backend_name() const noexcept = 0;
|
||||
[[nodiscard]] virtual RenderDeviceFeatures features() const noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Result<std::unique_ptr<ITexture2D>> create_texture(
|
||||
TextureDesc desc) noexcept = 0;
|
||||
[[nodiscard]] virtual pp::foundation::Result<std::unique_ptr<IRenderTarget>> create_render_target(
|
||||
|
||||
@@ -176,6 +176,18 @@ OpenGlCapabilities detect_opengl_capabilities(
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
pp::renderer::RenderDeviceFeatures render_device_features(OpenGlCapabilities capabilities) noexcept
|
||||
{
|
||||
return pp::renderer::RenderDeviceFeatures {
|
||||
.framebuffer_fetch = capabilities.framebuffer_fetch,
|
||||
.texture_copy = true,
|
||||
.render_target_blit = true,
|
||||
.frame_capture = true,
|
||||
.float16_render_targets = capabilities.float16_textures,
|
||||
.float32_render_targets = capabilities.float32_textures,
|
||||
};
|
||||
}
|
||||
|
||||
std::uint32_t extension_count_query() noexcept
|
||||
{
|
||||
return gl_num_extensions;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "renderer_api/renderer_api.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <span>
|
||||
@@ -46,6 +48,8 @@ struct OpenGlWindowsWglContextConfig {
|
||||
[[nodiscard]] OpenGlCapabilities detect_opengl_capabilities(
|
||||
std::span<const std::string_view> extensions,
|
||||
OpenGlRuntime runtime) noexcept;
|
||||
[[nodiscard]] pp::renderer::RenderDeviceFeatures render_device_features(
|
||||
OpenGlCapabilities capabilities) noexcept;
|
||||
|
||||
[[nodiscard]] std::uint32_t extension_count_query() noexcept;
|
||||
[[nodiscard]] std::uint32_t extension_string_name() noexcept;
|
||||
|
||||
Reference in New Issue
Block a user