Route paint UI clear state through GL backend
This commit is contained in:
@@ -481,6 +481,18 @@ pp::foundation::Status clear_opengl_render_target(
|
||||
return pp::foundation::Status::success();
|
||||
}
|
||||
|
||||
pp::foundation::Status apply_opengl_clear_color(
|
||||
std::array<float, 4> color,
|
||||
OpenGlClearColorDispatch dispatch) noexcept
|
||||
{
|
||||
if (dispatch.clear_color == nullptr) {
|
||||
return pp::foundation::Status::invalid_argument("OpenGL clear-color dispatch callback must not be null");
|
||||
}
|
||||
|
||||
dispatch.clear_color(color[0], color[1], color[2], color[3]);
|
||||
return pp::foundation::Status::success();
|
||||
}
|
||||
|
||||
pp::foundation::Status clear_opengl_color_buffer_with_write_mask(
|
||||
OpenGlColorMaskedClear clear,
|
||||
OpenGlColorMaskedClearDispatch dispatch) noexcept
|
||||
@@ -539,6 +551,37 @@ pp::foundation::Status apply_opengl_viewport(
|
||||
return pp::foundation::Status::success();
|
||||
}
|
||||
|
||||
pp::foundation::Result<OpenGlViewportRect> query_opengl_viewport(
|
||||
OpenGlViewportQueryDispatch dispatch) noexcept
|
||||
{
|
||||
if (dispatch.get_integer == nullptr) {
|
||||
return pp::foundation::Result<OpenGlViewportRect>::failure(
|
||||
pp::foundation::Status::invalid_argument("OpenGL viewport query dispatch callback must not be null"));
|
||||
}
|
||||
|
||||
std::array<std::int32_t, 4> viewport {};
|
||||
dispatch.get_integer(viewport_query(), viewport.data());
|
||||
return pp::foundation::Result<OpenGlViewportRect>::success(OpenGlViewportRect {
|
||||
.x = viewport[0],
|
||||
.y = viewport[1],
|
||||
.width = viewport[2],
|
||||
.height = viewport[3],
|
||||
});
|
||||
}
|
||||
|
||||
pp::foundation::Result<std::array<float, 4>> query_opengl_clear_color(
|
||||
OpenGlClearColorQueryDispatch dispatch) noexcept
|
||||
{
|
||||
if (dispatch.get_float == nullptr) {
|
||||
return pp::foundation::Result<std::array<float, 4>>::failure(
|
||||
pp::foundation::Status::invalid_argument("OpenGL clear-color query dispatch callback must not be null"));
|
||||
}
|
||||
|
||||
std::array<float, 4> color {};
|
||||
dispatch.get_float(color_clear_value_query(), color.data());
|
||||
return pp::foundation::Result<std::array<float, 4>>::success(color);
|
||||
}
|
||||
|
||||
pp::foundation::Status apply_opengl_scissor_rect(
|
||||
OpenGlScissorRect scissor,
|
||||
OpenGlScissorDispatch dispatch) noexcept
|
||||
|
||||
@@ -564,10 +564,22 @@ struct OpenGlClearDispatch {
|
||||
OpenGlClearFn clear = nullptr;
|
||||
};
|
||||
|
||||
struct OpenGlClearColorDispatch {
|
||||
OpenGlClearColorFn clear_color = nullptr;
|
||||
};
|
||||
|
||||
struct OpenGlActiveTextureDispatch {
|
||||
OpenGlActiveTextureFn active_texture = nullptr;
|
||||
};
|
||||
|
||||
struct OpenGlViewportQueryDispatch {
|
||||
OpenGlGetIntegerFn get_integer = nullptr;
|
||||
};
|
||||
|
||||
struct OpenGlClearColorQueryDispatch {
|
||||
OpenGlGetFloatFn get_float = nullptr;
|
||||
};
|
||||
|
||||
struct OpenGlColorMaskedClearDispatch {
|
||||
OpenGlGetBooleanFn get_boolean = nullptr;
|
||||
OpenGlColorMaskFn color_mask = nullptr;
|
||||
@@ -884,6 +896,9 @@ struct OpenGlMeshDeleteDispatch {
|
||||
[[nodiscard]] pp::foundation::Status clear_opengl_render_target(
|
||||
OpenGlDefaultClear clear,
|
||||
OpenGlClearDispatch dispatch) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status apply_opengl_clear_color(
|
||||
std::array<float, 4> color,
|
||||
OpenGlClearColorDispatch dispatch) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status clear_opengl_color_buffer_with_write_mask(
|
||||
OpenGlColorMaskedClear clear,
|
||||
OpenGlColorMaskedClearDispatch dispatch) noexcept;
|
||||
@@ -896,6 +911,10 @@ struct OpenGlMeshDeleteDispatch {
|
||||
[[nodiscard]] pp::foundation::Status apply_opengl_viewport(
|
||||
OpenGlViewportRect viewport,
|
||||
OpenGlViewportDispatch dispatch) noexcept;
|
||||
[[nodiscard]] pp::foundation::Result<OpenGlViewportRect> query_opengl_viewport(
|
||||
OpenGlViewportQueryDispatch dispatch) noexcept;
|
||||
[[nodiscard]] pp::foundation::Result<std::array<float, 4>> query_opengl_clear_color(
|
||||
OpenGlClearColorQueryDispatch dispatch) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status apply_opengl_scissor_rect(
|
||||
OpenGlScissorRect scissor,
|
||||
OpenGlScissorDispatch dispatch) noexcept;
|
||||
|
||||
Reference in New Issue
Block a user