diff options
| author | hachem <im@hachem.wtf> | 2026-08-23 17:41:31 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-23 17:41:31 +0200 |
| commit | 441a29433023fb2c687be786107f764ad4ca9cb4 (patch) | |
| tree | 5347ca398f960e0b9f5afbf03a80412710159e9f /src/rendering/rhi.h | |
| parent | a76180aaf4e38a1623a93586800e0f3e54d58c1b (diff) | |
fix: generalize render targets and window seams
Diffstat (limited to 'src/rendering/rhi.h')
| -rw-r--r-- | src/rendering/rhi.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/rendering/rhi.h b/src/rendering/rhi.h index 1a61420..7684aa0 100644 --- a/src/rendering/rhi.h +++ b/src/rendering/rhi.h @@ -11,11 +11,26 @@ namespace Donut::RHI { enum class Format { + None, + Swapchain, RGBA8, RGBA16F, D32, }; + struct RenderTargetFormat + { + Format color = Format::RGBA8; + Format depth = Format::None; + }; + + struct NativeWindow + { + void* glfw_handle = nullptr; + int width = 0; + int height = 0; + }; + enum class BufferType { Vertex, Index, Uniform }; enum class Topology { Triangles, Lines }; enum class CullMode { None, Back, Front }; @@ -53,8 +68,7 @@ namespace Donut::RHI bool depth_test = false; bool depth_write = false; CompareOp depth_op = CompareOp::Less; - Format color_format = Format::RGBA8; - bool has_depth = false; + RenderTargetFormat target; }; class CommandList @@ -83,7 +97,7 @@ namespace Donut::RHI public: virtual ~Device() = default; - virtual auto init(void* glfwWindow, int width, int height) -> bool = 0; + virtual auto init(const NativeWindow& window) -> bool = 0; virtual auto shutdown() -> void = 0; virtual auto resize(int width, int height) -> void = 0; virtual auto wait_idle() -> void = 0; @@ -91,7 +105,7 @@ namespace Donut::RHI virtual auto create_buffer(BufferType type, size_t size, const void* data = nullptr) -> Ref<Buffer> = 0; virtual auto create_texture(int width, int height, Format format, Filter filter, const void* data = nullptr) -> Ref<Texture> = 0; virtual auto create_cubemap_from_hdri(const std::string& equirect_path) -> Ref<Texture> = 0; - virtual auto create_render_target(int width, int height, Format color, bool with_depth, + virtual auto create_render_target(int width, int height, Format color, Format depth = Format::None, Filter sample_filter = Filter::Linear, int mip_levels = 1) -> Ref<RenderTarget> = 0; virtual auto create_pipeline(const PipelineDesc& desc) -> Ref<Pipeline> = 0; |
