From 36fea6b870fe3ea8f467061d1e29e2b8973fd57c Mon Sep 17 00:00:00 2001 From: omigamedev Date: Tue, 2 Jun 2026 06:22:41 +0200 Subject: [PATCH] Move sampler border parameter to renderer gl --- docs/modernization/build-inventory.md | 11 ++++++----- docs/modernization/roadmap.md | 9 +++++---- src/renderer_gl/opengl_capabilities.cpp | 6 ++++++ src/renderer_gl/opengl_capabilities.h | 1 + src/texture.cpp | 5 ++++- tests/renderer_gl/capabilities_tests.cpp | 2 ++ 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/docs/modernization/build-inventory.md b/docs/modernization/build-inventory.md index 898fda3..7f92a27 100644 --- a/docs/modernization/build-inventory.md +++ b/docs/modernization/build-inventory.md @@ -135,11 +135,12 @@ Known local toolchain state: used by `RTT::create`. It also validates Shape index-type and fill/stroke primitive-mode mapping used by the legacy mesh draw path, plus the PanoPainter cube-face to OpenGL texture-target mapping used by `TextureCube`. - It also owns and validates sampler wrap S/T/R plus min/mag filter parameter - ordering used by legacy `Sampler`. The PanoPainter shader attribute binding - catalog used by legacy `Shader` creation also lives here. It also owns the - PanoPainter shader uniform catalog and legacy hash mapping used by `Shader` - active-uniform discovery and the uniform uniqueness check. + It also owns and validates sampler wrap S/T/R, min/mag filter, and desktop + border-color parameter mapping used by legacy `Sampler`. The PanoPainter + shader attribute binding catalog used by legacy `Shader` creation also lives + here. It also owns the PanoPainter shader uniform catalog and legacy hash + mapping used by `Shader` active-uniform discovery and the uniform uniqueness + check. - `windows-msvc-vcpkg-headless` validates manifest install/configure/build/test for the current headless component matrix; see DEBT-0007 for remaining app and platform triplet migration. diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index b353fdb..65b4f7a 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -396,9 +396,9 @@ decisions used by legacy `Shape` drawing and the PanoPainter cube-face to OpenGL texture-target mapping used by `TextureCube` also live in `pp_renderer_gl`. The legacy app delegates extension, upload-format, framebuffer diagnostic, render-target texture parameter, mesh draw-mode, and -cube-face texture-target interpretation to that backend library. Sampler wrap -and min/mag filter parameter mapping for legacy `Sampler` also lives in -`pp_renderer_gl`. The PanoPainter shader attribute +cube-face texture-target interpretation to that backend library. Sampler wrap, +min/mag filter, and desktop border-color parameter mapping for legacy +`Sampler` also lives in `pp_renderer_gl`. The PanoPainter shader attribute binding catalog also lives in `pp_renderer_gl` and is consumed by legacy `Shader` creation. Shader uniform hashing, catalog validation, active-uniform mapping, and the legacy uniform uniqueness check now delegate to @@ -648,7 +648,8 @@ Results: mode mapping, PanoPainter cube-face texture-target order, and the linear clamp-to-edge render-target texture parameter set used by `RTT::create`. Sampler parameter validation covers wrap S/T/R plus min/mag filter ordering - used by legacy `Sampler::set` and `Sampler::set_filter`. + used by legacy `Sampler::set` and `Sampler::set_filter`, plus the desktop + border-color parameter name used by `Sampler::set_border`. Shader attribute binding catalog validation covers the current `pos`, `uvs`, `uvs2`, `col`, and `nor` bindings and rejects empty, unnamed, null-name, and duplicate-name catalogs while preserving legacy shared locations. Shader diff --git a/src/renderer_gl/opengl_capabilities.cpp b/src/renderer_gl/opengl_capabilities.cpp index 54cdf9c..fe01ef9 100644 --- a/src/renderer_gl/opengl_capabilities.cpp +++ b/src/renderer_gl/opengl_capabilities.cpp @@ -44,6 +44,7 @@ constexpr std::uint32_t gl_texture_min_filter = 0x2801U; constexpr std::uint32_t gl_texture_wrap_s = 0x2802U; constexpr std::uint32_t gl_texture_wrap_t = 0x2803U; constexpr std::uint32_t gl_texture_wrap_r = 0x8072U; +constexpr std::uint32_t gl_texture_border_color = 0x1004U; constexpr std::uint32_t gl_clamp_to_edge = 0x812FU; [[nodiscard]] bool contains(std::string_view text, std::string_view needle) noexcept @@ -237,4 +238,9 @@ std::array sampler_filter_parameters( }; } +std::uint32_t sampler_border_color_parameter_name() noexcept +{ + return gl_texture_border_color; +} + } diff --git a/src/renderer_gl/opengl_capabilities.h b/src/renderer_gl/opengl_capabilities.h index 88af056..4e2ffb1 100644 --- a/src/renderer_gl/opengl_capabilities.h +++ b/src/renderer_gl/opengl_capabilities.h @@ -51,5 +51,6 @@ struct OpenGlTextureParameter { [[nodiscard]] std::array sampler_filter_parameters( std::uint32_t filter_min, std::uint32_t filter_mag) noexcept; +[[nodiscard]] std::uint32_t sampler_border_color_parameter_name() noexcept; } diff --git a/src/texture.cpp b/src/texture.cpp index 6dc9e5b..f9015bc 100644 --- a/src/texture.cpp +++ b/src/texture.cpp @@ -332,7 +332,10 @@ void Sampler::set_border(glm::vec4 rgba) App::I->render_task([this, rgba] { #if USE_SAMPLER && !defined(__GLES__) - glSamplerParameterfv(id, GL_TEXTURE_BORDER_COLOR, glm::value_ptr(rgba)); + glSamplerParameterfv( + id, + static_cast(pp::renderer::gl::sampler_border_color_parameter_name()), + glm::value_ptr(rgba)); #endif // USE_SAMPLER }); } diff --git a/tests/renderer_gl/capabilities_tests.cpp b/tests/renderer_gl/capabilities_tests.cpp index 70acd1e..419b1f9 100644 --- a/tests/renderer_gl/capabilities_tests.cpp +++ b/tests/renderer_gl/capabilities_tests.cpp @@ -211,6 +211,8 @@ void maps_sampler_parameters(pp::tests::Harness& h) PP_EXPECT(h, filters[0].value == 0x2600U); PP_EXPECT(h, filters[1].name == 0x2800U); PP_EXPECT(h, filters[1].value == 0x2601U); + + PP_EXPECT(h, pp::renderer::gl::sampler_border_color_parameter_name() == 0x1004U); } void exposes_shader_attribute_binding_catalog(pp::tests::Harness& h)