From ee43a5b30df5a38496e94d3e2da5714ce151cae2 Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Thu, 19 Nov 2026 18:37:02 +0200 Subject: [PATCH] render: make the retained factory member protected in base classes The concrete renderer objects (e.g. the Vulkan texture_2d, vertex_buffer, index_buffer and the shader classes) previously kept a redundant copy of the shared factory reference in a private ctx_ref member, because the factory member retained by the base classes (ruis::render::texture_2d, vertex_buffer, index_buffer and the shader base classes) was private. Make those retained factory members protected so the derived classes can access them directly and drop the redundant ctx_ref members. --- src/ruis/render/index_buffer.hpp | 2 +- src/ruis/render/shaders/coloring_shader.hpp | 2 +- src/ruis/render/shaders/coloring_texturing_shader.hpp | 2 +- src/ruis/render/shaders/shader.hpp | 2 +- src/ruis/render/shaders/texturing_shader.hpp | 2 +- src/ruis/render/texture_2d.hpp | 1 + src/ruis/render/texture_cube.hpp | 2 +- src/ruis/render/texture_depth.hpp | 2 +- src/ruis/render/texture_stencil.hpp | 2 +- src/ruis/render/vertex_array.hpp | 1 + src/ruis/render/vertex_buffer.hpp | 1 + 11 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/ruis/render/index_buffer.hpp b/src/ruis/render/index_buffer.hpp index 6d497259e..72effd5df 100644 --- a/src/ruis/render/index_buffer.hpp +++ b/src/ruis/render/index_buffer.hpp @@ -29,9 +29,9 @@ class factory; class index_buffer { +protected: const utki::shared_ref factory; -protected: index_buffer(utki::shared_ref factory) : factory(std::move(factory)) {} diff --git a/src/ruis/render/shaders/coloring_shader.hpp b/src/ruis/render/shaders/coloring_shader.hpp index c67fa2a3d..b827f8494 100644 --- a/src/ruis/render/shaders/coloring_shader.hpp +++ b/src/ruis/render/shaders/coloring_shader.hpp @@ -33,9 +33,9 @@ class factory; class coloring_shader { +protected: const utki::shared_ref factory; -protected: coloring_shader(utki::shared_ref factory) : factory(std::move(factory)) {} diff --git a/src/ruis/render/shaders/coloring_texturing_shader.hpp b/src/ruis/render/shaders/coloring_texturing_shader.hpp index 3edb76078..53979407b 100644 --- a/src/ruis/render/shaders/coloring_texturing_shader.hpp +++ b/src/ruis/render/shaders/coloring_texturing_shader.hpp @@ -34,9 +34,9 @@ class factory; class coloring_texturing_shader { +protected: const utki::shared_ref factory; -protected: coloring_texturing_shader(utki::shared_ref factory) : factory(std::move(factory)) {} diff --git a/src/ruis/render/shaders/shader.hpp b/src/ruis/render/shaders/shader.hpp index 8b143bb37..4e7d3a67a 100644 --- a/src/ruis/render/shaders/shader.hpp +++ b/src/ruis/render/shaders/shader.hpp @@ -31,9 +31,9 @@ class factory; class shader { +protected: const utki::shared_ref factory; -protected: shader(utki::shared_ref factory) : factory(std::move(factory)) {} diff --git a/src/ruis/render/shaders/texturing_shader.hpp b/src/ruis/render/shaders/texturing_shader.hpp index 39a8b55fd..64e37fb15 100644 --- a/src/ruis/render/shaders/texturing_shader.hpp +++ b/src/ruis/render/shaders/texturing_shader.hpp @@ -30,9 +30,9 @@ class factory; class texturing_shader { +protected: const utki::shared_ref factory; -protected: texturing_shader(utki::shared_ref factory) : factory(std::move(factory)) {} diff --git a/src/ruis/render/texture_2d.hpp b/src/ruis/render/texture_2d.hpp index 8b10b7781..664e2b866 100644 --- a/src/ruis/render/texture_2d.hpp +++ b/src/ruis/render/texture_2d.hpp @@ -32,6 +32,7 @@ class factory; class texture_2d : public rasterimage::dimensioned { +protected: const utki::shared_ref factory; public: diff --git a/src/ruis/render/texture_cube.hpp b/src/ruis/render/texture_cube.hpp index 9dbeb3c38..a3ecb8d3e 100644 --- a/src/ruis/render/texture_cube.hpp +++ b/src/ruis/render/texture_cube.hpp @@ -29,9 +29,9 @@ class factory; class texture_cube { +protected: const utki::shared_ref factory; -protected: texture_cube(utki::shared_ref factory) : factory(std::move(factory)) {} diff --git a/src/ruis/render/texture_depth.hpp b/src/ruis/render/texture_depth.hpp index ed460aa7d..6ea7fcb1b 100644 --- a/src/ruis/render/texture_depth.hpp +++ b/src/ruis/render/texture_depth.hpp @@ -30,9 +30,9 @@ class factory; class texture_depth : public rasterimage::dimensioned { +protected: const utki::shared_ref factory; -protected: texture_depth( utki::shared_ref factory, // r4::vector2 dims diff --git a/src/ruis/render/texture_stencil.hpp b/src/ruis/render/texture_stencil.hpp index 7c3605095..a168a9317 100644 --- a/src/ruis/render/texture_stencil.hpp +++ b/src/ruis/render/texture_stencil.hpp @@ -30,9 +30,9 @@ class factory; class texture_stencil : public rasterimage::dimensioned { +protected: const utki::shared_ref factory; -protected: texture_stencil( utki::shared_ref factory, // r4::vector2 dims diff --git a/src/ruis/render/vertex_array.hpp b/src/ruis/render/vertex_array.hpp index 1fb5f878f..e1554e1ca 100644 --- a/src/ruis/render/vertex_array.hpp +++ b/src/ruis/render/vertex_array.hpp @@ -35,6 +35,7 @@ class factory; class vertex_array { +protected: const utki::shared_ref factory; public: diff --git a/src/ruis/render/vertex_buffer.hpp b/src/ruis/render/vertex_buffer.hpp index 0fa7b7b37..f5321f136 100644 --- a/src/ruis/render/vertex_buffer.hpp +++ b/src/ruis/render/vertex_buffer.hpp @@ -31,6 +31,7 @@ class factory; class vertex_buffer { +protected: const utki::shared_ref factory; public: