Map renderer blit filters to OpenGL
This commit is contained in:
@@ -195,7 +195,8 @@ Known local toolchain state:
|
||||
tokens used by `Texture2D`, plus cube-map binding and allocation face targets
|
||||
used by `TextureCube`. It also owns and
|
||||
validates framebuffer blit color mask and linear/nearest filters used by
|
||||
`RTT::resize` and `RTT::copy`, plus the default linear clamp-to-edge
|
||||
`RTT::resize` and `RTT::copy`, renderer API blit-filter to OpenGL token
|
||||
mapping, plus the default linear clamp-to-edge
|
||||
render-target texture parameters, texture/renderbuffer targets, depth format,
|
||||
framebuffer targets, binding queries, attachment points, and completion
|
||||
status used by `RTT::create` and framebuffer bind/restore paths, plus RTT
|
||||
|
||||
@@ -449,7 +449,8 @@ face targets, RGBA allocation format, and unsigned-byte component type also
|
||||
delegate to `pp_renderer_gl`. RGBA8/RGBA32F readback formats, checked byte-count math, and PBO
|
||||
pixel-buffer target/usage/access tokens used by `RTT` and `PBO` readbacks now
|
||||
live in `pp_renderer_gl`. The framebuffer blit color mask and linear/nearest
|
||||
filter tokens used by `RTT::resize` and `RTT::copy`, plus the default
|
||||
filter tokens used by `RTT::resize` and `RTT::copy`, renderer API blit-filter
|
||||
to OpenGL token mapping, plus the default
|
||||
render-target texture parameters, texture/renderbuffer targets, depth format,
|
||||
framebuffer targets, binding queries, attachment points, and completion status
|
||||
used by `RTT::create` and framebuffer bind/restore paths, also live in
|
||||
|
||||
@@ -475,6 +475,18 @@ std::uint32_t framebuffer_blit_filter(bool linear) noexcept
|
||||
return linear ? gl_linear : gl_nearest;
|
||||
}
|
||||
|
||||
OpenGlEnumMapping blit_filter_for_renderer_filter(pp::renderer::BlitFilter filter) noexcept
|
||||
{
|
||||
switch (filter) {
|
||||
case pp::renderer::BlitFilter::nearest:
|
||||
return OpenGlEnumMapping { .value = gl_nearest, .supported = true };
|
||||
case pp::renderer::BlitFilter::linear:
|
||||
return OpenGlEnumMapping { .value = gl_linear, .supported = true };
|
||||
default:
|
||||
return OpenGlEnumMapping {};
|
||||
}
|
||||
}
|
||||
|
||||
std::uint32_t primitive_mode_for_renderer_topology(pp::renderer::PrimitiveTopology topology) noexcept
|
||||
{
|
||||
switch (topology) {
|
||||
|
||||
@@ -100,6 +100,8 @@ struct OpenGlWindowsWglContextConfig {
|
||||
[[nodiscard]] std::uint32_t framebuffer_depth_buffer_mask() noexcept;
|
||||
[[nodiscard]] std::uint32_t color_write_mask_query() noexcept;
|
||||
[[nodiscard]] std::uint32_t framebuffer_blit_filter(bool linear) noexcept;
|
||||
[[nodiscard]] OpenGlEnumMapping blit_filter_for_renderer_filter(
|
||||
pp::renderer::BlitFilter filter) noexcept;
|
||||
[[nodiscard]] std::uint32_t primitive_mode_for_renderer_topology(
|
||||
pp::renderer::PrimitiveTopology topology) noexcept;
|
||||
[[nodiscard]] std::uint32_t index_type_for_index_size(std::uint32_t index_size_bytes) noexcept;
|
||||
|
||||
@@ -251,11 +251,22 @@ void maps_framebuffer_render_target_parameters(pp::tests::Harness& h)
|
||||
|
||||
void maps_framebuffer_blit_parameters(pp::tests::Harness& h)
|
||||
{
|
||||
const auto nearest = pp::renderer::gl::blit_filter_for_renderer_filter(pp::renderer::BlitFilter::nearest);
|
||||
const auto linear = pp::renderer::gl::blit_filter_for_renderer_filter(pp::renderer::BlitFilter::linear);
|
||||
const auto invalid = pp::renderer::gl::blit_filter_for_renderer_filter(
|
||||
static_cast<pp::renderer::BlitFilter>(255U));
|
||||
|
||||
PP_EXPECT(h, pp::renderer::gl::framebuffer_color_buffer_mask() == 0x00004000U);
|
||||
PP_EXPECT(h, pp::renderer::gl::framebuffer_depth_buffer_mask() == 0x00000100U);
|
||||
PP_EXPECT(h, pp::renderer::gl::color_write_mask_query() == 0x0C23U);
|
||||
PP_EXPECT(h, pp::renderer::gl::framebuffer_blit_filter(true) == 0x2601U);
|
||||
PP_EXPECT(h, pp::renderer::gl::framebuffer_blit_filter(false) == 0x2600U);
|
||||
PP_EXPECT(h, nearest.supported);
|
||||
PP_EXPECT(h, nearest.value == 0x2600U);
|
||||
PP_EXPECT(h, linear.supported);
|
||||
PP_EXPECT(h, linear.value == 0x2601U);
|
||||
PP_EXPECT(h, !invalid.supported);
|
||||
PP_EXPECT(h, invalid.value == 0U);
|
||||
}
|
||||
|
||||
void maps_renderer_primitive_topologies_to_draw_modes(pp::tests::Harness& h)
|
||||
|
||||
Reference in New Issue
Block a user