Share grid GL dispatch adapters

This commit is contained in:
2026-06-05 13:53:51 +02:00
parent 03b999e60f
commit 745a5898da
5 changed files with 64 additions and 108 deletions

View File

@@ -33,6 +33,11 @@ inline void clear_opengl_buffer(std::uint32_t mask) noexcept
glClear(static_cast<GLbitfield>(mask));
}
inline void set_opengl_color_mask(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a) noexcept
{
glColorMask(r, g, b, a);
}
inline void set_opengl_clear_color(float r, float g, float b, float a) noexcept
{
glClearColor(r, g, b, a);
@@ -222,6 +227,38 @@ inline void apply_scissor_rect(
LOG("%s scissor dispatch failed because: %s", context, status.message);
}
inline void clear_depth_buffer(const char* context)
{
const auto status = pp::renderer::gl::clear_opengl_buffers(
pp::renderer::gl::framebuffer_depth_buffer_mask(),
pp::renderer::gl::OpenGlBufferClearDispatch {
.clear = clear_opengl_buffer,
});
if (!status.ok())
LOG("%s depth clear dispatch failed because: %s", context, status.message);
}
inline void set_color_write_mask(
std::uint8_t r,
std::uint8_t g,
std::uint8_t b,
std::uint8_t a,
const char* context)
{
const auto status = pp::renderer::gl::apply_opengl_color_write_mask(
pp::renderer::gl::OpenGlColorWriteMask {
.r = r,
.g = g,
.b = b,
.a = a,
},
pp::renderer::gl::OpenGlColorWriteMaskDispatch {
.color_mask = set_opengl_color_mask,
});
if (!status.ok())
LOG("%s color mask dispatch failed because: %s", context, status.message);
}
inline void read_framebuffer_rgba8_pixel(
std::uint32_t framebuffer,
std::int32_t x,