Map renderer viewport and scissor to OpenGL

This commit is contained in:
2026-06-02 20:29:30 +02:00
parent 728116da8f
commit 2f8f12a8fd
5 changed files with 92 additions and 7 deletions

View File

@@ -669,6 +669,18 @@ std::uint32_t viewport_query() noexcept
return gl_viewport;
}
OpenGlViewportRect viewport_for_renderer_viewport(pp::renderer::Viewport viewport) noexcept
{
return OpenGlViewportRect {
.x = viewport.x,
.y = viewport.y,
.width = static_cast<std::int32_t>(viewport.width),
.height = static_cast<std::int32_t>(viewport.height),
.min_depth = viewport.min_depth,
.max_depth = viewport.max_depth,
};
}
std::uint32_t color_clear_value_query() noexcept
{
return gl_color_clear_value;
@@ -749,6 +761,17 @@ std::uint32_t scissor_test_state() noexcept
return gl_scissor_test;
}
OpenGlScissorRect scissor_rect_for_renderer_scissor(pp::renderer::ScissorRect scissor) noexcept
{
return OpenGlScissorRect {
.enabled = scissor.enabled ? gl_boolean_true : gl_boolean_false,
.x = scissor.x,
.y = scissor.y,
.width = static_cast<std::int32_t>(scissor.width),
.height = static_cast<std::int32_t>(scissor.height),
};
}
std::uint32_t program_point_size_state() noexcept
{
return gl_program_point_size;