Map render pass clear masks to OpenGL

This commit is contained in:
2026-06-02 20:19:54 +02:00
parent cc4eaef3e6
commit 9b6c5b0849
5 changed files with 69 additions and 3 deletions

View File

@@ -258,6 +258,7 @@ void maps_framebuffer_blit_parameters(pp::tests::Harness& h)
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::framebuffer_stencil_buffer_mask() == 0x00000400U);
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);
@@ -269,6 +270,41 @@ void maps_framebuffer_blit_parameters(pp::tests::Harness& h)
PP_EXPECT(h, invalid.value == 0U);
}
void maps_render_pass_clear_masks(pp::tests::Harness& h)
{
const auto no_clear = pp::renderer::gl::clear_mask_for_render_pass(pp::renderer::RenderPassDesc {
.clear_color_enabled = false,
.clear_depth_enabled = false,
.clear_stencil_enabled = false,
});
const auto color_only = pp::renderer::gl::clear_mask_for_render_pass(pp::renderer::RenderPassDesc {
.clear_color_enabled = true,
.clear_depth_enabled = false,
.clear_stencil_enabled = false,
});
const auto depth_only = pp::renderer::gl::clear_mask_for_render_pass(pp::renderer::RenderPassDesc {
.clear_color_enabled = false,
.clear_depth_enabled = true,
.clear_stencil_enabled = false,
});
const auto stencil_only = pp::renderer::gl::clear_mask_for_render_pass(pp::renderer::RenderPassDesc {
.clear_color_enabled = false,
.clear_depth_enabled = false,
.clear_stencil_enabled = true,
});
const auto all_buffers = pp::renderer::gl::clear_mask_for_render_pass(pp::renderer::RenderPassDesc {
.clear_color_enabled = true,
.clear_depth_enabled = true,
.clear_stencil_enabled = true,
});
PP_EXPECT(h, no_clear == 0U);
PP_EXPECT(h, color_only == 0x00004000U);
PP_EXPECT(h, depth_only == 0x00000100U);
PP_EXPECT(h, stencil_only == 0x00000400U);
PP_EXPECT(h, all_buffers == 0x00004500U);
}
void maps_renderer_primitive_topologies_to_draw_modes(pp::tests::Harness& h)
{
PP_EXPECT(h, pp::renderer::gl::primitive_mode_for_renderer_topology(
@@ -720,6 +756,7 @@ int main()
harness.run("names_framebuffer_status_codes", names_framebuffer_status_codes);
harness.run("maps_framebuffer_render_target_parameters", maps_framebuffer_render_target_parameters);
harness.run("maps_framebuffer_blit_parameters", maps_framebuffer_blit_parameters);
harness.run("maps_render_pass_clear_masks", maps_render_pass_clear_masks);
harness.run("maps_renderer_primitive_topologies_to_draw_modes", maps_renderer_primitive_topologies_to_draw_modes);
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);