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

@@ -106,6 +106,7 @@ constexpr std::uint32_t gl_framebuffer_undefined = 0x8219U;
constexpr std::uint32_t gl_framebuffer_incomplete_multisample = 0x8D56U;
constexpr std::uint32_t gl_color_buffer_bit = 0x00004000U;
constexpr std::uint32_t gl_depth_buffer_bit = 0x00000100U;
constexpr std::uint32_t gl_stencil_buffer_bit = 0x00000400U;
constexpr std::uint32_t gl_color_writemask = 0x0C23U;
constexpr std::uint32_t gl_texture_cube_map = 0x8513U;
constexpr std::uint32_t gl_texture_cube_map_positive_x = 0x8515U;
@@ -465,6 +466,29 @@ std::uint32_t framebuffer_depth_buffer_mask() noexcept
return gl_depth_buffer_bit;
}
std::uint32_t framebuffer_stencil_buffer_mask() noexcept
{
return gl_stencil_buffer_bit;
}
std::uint32_t clear_mask_for_render_pass(pp::renderer::RenderPassDesc desc) noexcept
{
std::uint32_t mask = 0U;
if (desc.clear_color_enabled) {
mask |= gl_color_buffer_bit;
}
if (desc.clear_depth_enabled) {
mask |= gl_depth_buffer_bit;
}
if (desc.clear_stencil_enabled) {
mask |= gl_stencil_buffer_bit;
}
return mask;
}
std::uint32_t color_write_mask_query() noexcept
{
return gl_color_writemask;