Move render target texture parameters to renderer gl

This commit is contained in:
2026-06-01 18:11:44 +02:00
parent 7d80afce2f
commit f1e2743d58
6 changed files with 69 additions and 21 deletions

View File

@@ -130,13 +130,15 @@ Known local toolchain state:
upload-type mapping used by legacy `Texture2D` and `RTT` creation. It also
validates image channel-count to OpenGL texture format mapping, including
invalid channel counts rejected by `Texture2D::create(Image)`, and
framebuffer status naming used by `RTT` diagnostics. 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`. 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.
framebuffer status naming used by `RTT` diagnostics. It also owns and
validates the default linear clamp-to-edge render-target texture parameters
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`.
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.

View File

@@ -390,11 +390,13 @@ OpenGL capability detection for framebuffer fetch, map-buffer alignment, and
float texture support. It also owns the OpenGL texture upload-type mapping used
by legacy `Texture2D` and `RTT` creation, plus image channel-count to texture
format mapping for `Texture2D` image uploads and framebuffer status naming for
`RTT` diagnostics. Mesh index-type and primitive-mode 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, mesh draw-mode, and cube-face
texture-target interpretation to that backend library. The PanoPainter shader attribute
`RTT` diagnostics. The default render-target texture parameters used by
`RTT::create` also live in `pp_renderer_gl`. Mesh index-type and primitive-mode
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. 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
@@ -641,11 +643,12 @@ Results:
WebGL exclusion behavior, upload types for RGBA8/RGBA16F/RGBA32F internal
formats, image channel-count format mapping including invalid counts, and
framebuffer status names, plus Shape index-type and fill/stroke primitive
mode mapping and PanoPainter cube-face texture-target order. 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 uniform catalog
validation covers the 43 legacy uniform
mode mapping, PanoPainter cube-face texture-target order, and the linear
clamp-to-edge render-target texture parameter set used by `RTT::create`.
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
uniform catalog validation covers the 43 legacy uniform
names used by `Shader`, preserves the legacy hash ids, and rejects empty,
unnamed, null-name, mismatched-hash, and duplicate-name catalogs.
- PowerShell analyze automation returns JSON summaries and includes the shader

View File

@@ -38,6 +38,12 @@ constexpr std::uint32_t gl_texture_cube_map_positive_y = 0x8517U;
constexpr std::uint32_t gl_texture_cube_map_negative_y = 0x8518U;
constexpr std::uint32_t gl_texture_cube_map_positive_z = 0x8519U;
constexpr std::uint32_t gl_texture_cube_map_negative_z = 0x851AU;
constexpr std::uint32_t gl_linear = 0x2601U;
constexpr std::uint32_t gl_texture_mag_filter = 0x2800U;
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_clamp_to_edge = 0x812FU;
[[nodiscard]] bool contains(std::string_view text, std::string_view needle) noexcept
{
@@ -195,4 +201,16 @@ std::uint32_t cube_face_texture_target(std::uint32_t face_index) noexcept
return targets[face_index];
}
std::span<const OpenGlTextureParameter> default_render_target_texture_parameters() noexcept
{
static constexpr std::array<OpenGlTextureParameter, 4> parameters {
OpenGlTextureParameter { .name = gl_texture_mag_filter, .value = gl_linear },
OpenGlTextureParameter { .name = gl_texture_min_filter, .value = gl_linear },
OpenGlTextureParameter { .name = gl_texture_wrap_s, .value = gl_clamp_to_edge },
OpenGlTextureParameter { .name = gl_texture_wrap_t, .value = gl_clamp_to_edge },
};
return parameters;
}
}

View File

@@ -26,6 +26,11 @@ struct OpenGlPixelFormat {
std::uint32_t channel_count = 0;
};
struct OpenGlTextureParameter {
std::uint32_t name = 0;
std::uint32_t value = 0;
};
[[nodiscard]] OpenGlCapabilities detect_opengl_capabilities(
std::span<const std::string_view> extensions,
OpenGlRuntime runtime) noexcept;
@@ -38,5 +43,6 @@ struct OpenGlPixelFormat {
[[nodiscard]] std::uint32_t primitive_mode_for_stroke_count(std::uint32_t vertex_or_index_count) noexcept;
[[nodiscard]] std::span<const std::uint32_t> panopainter_cube_face_texture_targets() noexcept;
[[nodiscard]] std::uint32_t cube_face_texture_target(std::uint32_t face_index) noexcept;
[[nodiscard]] std::span<const OpenGlTextureParameter> default_render_target_texture_parameters() noexcept;
}

View File

@@ -213,10 +213,13 @@ bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format,
glBindTexture(GL_TEXTURE_2D, texID);
if (tex == -1)
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, GL_RGBA, ifmt, 0);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
for (const auto parameter : pp::renderer::gl::default_render_target_texture_parameters())
{
glTexParameterf(
GL_TEXTURE_2D,
static_cast<GLenum>(parameter.name),
static_cast<GLfloat>(parameter.value));
}
glBindTexture(GL_TEXTURE_2D, 0);
// Create a renderbuffer object to store depth info

View File

@@ -174,6 +174,21 @@ void maps_panopainter_cube_faces_to_texture_targets(pp::tests::Harness& h)
PP_EXPECT(h, pp::renderer::gl::cube_face_texture_target(6U) == 0U);
}
void exposes_default_render_target_texture_parameters(pp::tests::Harness& h)
{
const auto parameters = pp::renderer::gl::default_render_target_texture_parameters();
PP_EXPECT(h, parameters.size() == 4U);
PP_EXPECT(h, parameters[0].name == 0x2800U);
PP_EXPECT(h, parameters[0].value == 0x2601U);
PP_EXPECT(h, parameters[1].name == 0x2801U);
PP_EXPECT(h, parameters[1].value == 0x2601U);
PP_EXPECT(h, parameters[2].name == 0x2802U);
PP_EXPECT(h, parameters[2].value == 0x812FU);
PP_EXPECT(h, parameters[3].name == 0x2803U);
PP_EXPECT(h, parameters[3].value == 0x812FU);
}
void exposes_shader_attribute_binding_catalog(pp::tests::Harness& h)
{
const auto bindings = pp::renderer::gl::panopainter_shader_attribute_bindings();
@@ -277,6 +292,7 @@ int main()
harness.run("names_framebuffer_status_codes", names_framebuffer_status_codes);
harness.run("maps_shape_index_and_primitive_modes", maps_shape_index_and_primitive_modes);
harness.run("maps_panopainter_cube_faces_to_texture_targets", maps_panopainter_cube_faces_to_texture_targets);
harness.run("exposes_default_render_target_texture_parameters", exposes_default_render_target_texture_parameters);
harness.run("exposes_shader_attribute_binding_catalog", exposes_shader_attribute_binding_catalog);
harness.run("rejects_invalid_shader_attribute_binding_catalogs", rejects_invalid_shader_attribute_binding_catalogs);
harness.run("exposes_shader_uniform_catalog", exposes_shader_uniform_catalog);