Add basic surface handling to RenderDriver and WindowDriver

This will likely require significant rework but it will do for now. A
considerations worth thinking about:

- What happends when the WindowDriver destroys a window, what happens to
  the corresponding surface?
This commit is contained in:
2025-04-10 16:59:59 +10:00
parent 536a1e8773
commit 6e1393ce64
6 changed files with 95 additions and 23 deletions

View File

@@ -7,7 +7,6 @@
#pragma once
#include <nova/api.h>
#include <nova/platform/window_driver.h>
#include <nova/render/render_api.h>
#include <nova/render/render_device.h>
#include <nova/types.h>
@@ -15,6 +14,11 @@
#include <string>
namespace Nova {
using WindowID = uptr;
using SurfaceID = uptr;
class WindowDriver;
class NOVA_API RenderDriver {
public:
static RenderDriver* create(RenderAPI api, WindowDriver* window_driver = nullptr);
@@ -28,5 +32,14 @@ namespace Nova {
[[nodiscard]] virtual u32 get_device_count() const = 0;
[[nodiscard]] virtual const RenderDevice& get_device(u32 index) const = 0;
virtual void select_device(u32 index) = 0;
[[nodiscard]] virtual SurfaceID create_surface(WindowID window) = 0;
virtual void destroy_surface(SurfaceID surface) = 0;
// TODO: get_surface_size
// TODO: get_surface_mode
// TODO: get_surface_state
// TODO: set_surface_size
// TODO: set_surface_mode
// TODO: set_surface_state
};
} // namespace Nova