From 8742482311b86bb705d93336805ab26881e96070 Mon Sep 17 00:00:00 2001 From: hachem Date: Sun, 23 Aug 2026 17:41:31 +0200 Subject: [fix]: generalize render targets and window seams --- src/platform/opengl/opengl_device.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/platform/opengl') diff --git a/src/platform/opengl/opengl_device.cpp b/src/platform/opengl/opengl_device.cpp index 3d45d24..c4332fa 100644 --- a/src/platform/opengl/opengl_device.cpp +++ b/src/platform/opengl/opengl_device.cpp @@ -205,17 +205,17 @@ namespace Donut::RHI class GLDevice : public Device { public: - auto init(void* window, int width, int height) -> bool override + auto init(const NativeWindow& window) -> bool override { - m_window = window; - glfwMakeContextCurrent(static_cast(window)); + m_window = window.glfw_handle; + glfwMakeContextCurrent(static_cast(m_window)); if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { DONUT_ERROR("GL RHI: GLAD load failed"); return false; } - m_width = width; m_height = height; + m_width = window.width; m_height = window.height; const char* name = (const char*)glGetString(GL_RENDERER); m_name = name ? name : "OpenGL"; glGenVertexArrays(1, &m_vao); glBindVertexArray(m_vao); // GL core needs one bound VAO m_cmds = create_scope(m_vao); - DONUT_INFO("GL RHI device: {} ({}x{})", m_name, width, height); + DONUT_INFO("GL RHI device: {} ({}x{})", m_name, m_width, m_height); return true; } auto shutdown() -> void override @@ -235,8 +235,8 @@ namespace Donut::RHI HDRIManager::get().set_current_hdri(path); return create_ref(HDRIManager::get().get_current_hdri()); } - auto create_render_target(int w, int h, Format color, bool depth, Filter fl, int /*mips*/) -> Ref override - { return create_ref(w, h, color, depth, fl); } + auto create_render_target(int w, int h, Format color, Format depth, Filter fl, int /*mips*/) -> Ref override + { return create_ref(w, h, color, depth != Format::None, fl); } auto create_pipeline(const PipelineDesc& d) -> Ref override { return create_ref(d); } -- cgit v1.3