Map renderer color write masks to OpenGL

This commit is contained in:
2026-06-02 20:15:56 +02:00
parent 77c2a68cc5
commit cc4eaef3e6
5 changed files with 48 additions and 4 deletions

View File

@@ -803,6 +803,16 @@ std::uint8_t color_write_enabled() noexcept
return gl_boolean_true;
}
OpenGlColorWriteMask color_write_mask_for_renderer_blend_state(pp::renderer::BlendState state) noexcept
{
return OpenGlColorWriteMask {
.r = state.write_r ? gl_boolean_true : gl_boolean_false,
.g = state.write_g ? gl_boolean_true : gl_boolean_false,
.b = state.write_b ? gl_boolean_true : gl_boolean_false,
.a = state.write_a ? gl_boolean_true : gl_boolean_false,
};
}
std::uint32_t linear_texture_filter() noexcept
{
return gl_linear;

View File

@@ -39,6 +39,13 @@ struct OpenGlEnumMapping {
bool supported = false;
};
struct OpenGlColorWriteMask {
std::uint8_t r = 0;
std::uint8_t g = 0;
std::uint8_t b = 0;
std::uint8_t a = 0;
};
struct OpenGlReadbackFormat {
std::uint32_t pixel_format = 0;
std::uint32_t component_type = 0;
@@ -155,6 +162,8 @@ struct OpenGlWindowsWglContextConfig {
[[nodiscard]] std::uint32_t rgba32f_internal_format() noexcept;
[[nodiscard]] std::uint8_t color_write_disabled() noexcept;
[[nodiscard]] std::uint8_t color_write_enabled() noexcept;
[[nodiscard]] OpenGlColorWriteMask color_write_mask_for_renderer_blend_state(
pp::renderer::BlendState state) noexcept;
[[nodiscard]] std::uint32_t linear_texture_filter() noexcept;
[[nodiscard]] std::uint32_t linear_mipmap_linear_texture_filter() noexcept;
[[nodiscard]] std::uint32_t nearest_texture_filter() noexcept;