Move Windows WGL context attributes to renderer gl

This commit is contained in:
2026-06-02 09:32:27 +02:00
parent c22f2e7fa2
commit acd8ef6658
6 changed files with 88 additions and 24 deletions

View File

@@ -114,6 +114,21 @@ constexpr std::uint32_t gl_stream_read = 0x88E1U;
constexpr std::uint32_t gl_map_read_bit = 0x0001U;
constexpr std::uint8_t gl_boolean_false = 0U;
constexpr std::uint8_t gl_boolean_true = 1U;
constexpr std::int32_t wgl_draw_to_window_arb = 0x2001;
constexpr std::int32_t wgl_acceleration_arb = 0x2003;
constexpr std::int32_t wgl_support_opengl_arb = 0x2010;
constexpr std::int32_t wgl_double_buffer_arb = 0x2011;
constexpr std::int32_t wgl_pixel_type_arb = 0x2013;
constexpr std::int32_t wgl_color_bits_arb = 0x2014;
constexpr std::int32_t wgl_depth_bits_arb = 0x2022;
constexpr std::int32_t wgl_full_acceleration_arb = 0x2027;
constexpr std::int32_t wgl_type_rgba_arb = 0x202B;
constexpr std::int32_t wgl_context_major_version_arb = 0x2091;
constexpr std::int32_t wgl_context_minor_version_arb = 0x2092;
constexpr std::int32_t wgl_context_flags_arb = 0x2094;
constexpr std::int32_t wgl_context_forward_compatible_bit_arb = 0x0002;
constexpr std::int32_t wgl_context_profile_mask_arb = 0x9126;
constexpr std::int32_t wgl_context_core_profile_bit_arb = 0x00000001;
[[nodiscard]] bool contains(std::string_view text, std::string_view needle) noexcept
{
@@ -741,4 +756,27 @@ std::uint32_t sampler_border_color_parameter_name() noexcept
return gl_texture_border_color;
}
OpenGlWindowsWglContextConfig windows_wgl_core_context_3_3_config() noexcept
{
return {
.context_attributes = {
wgl_context_major_version_arb, 3,
wgl_context_minor_version_arb, 3,
wgl_context_flags_arb, wgl_context_forward_compatible_bit_arb,
wgl_context_profile_mask_arb, wgl_context_core_profile_bit_arb,
0,
},
.pixel_format_attributes = {
wgl_draw_to_window_arb, static_cast<std::int32_t>(gl_boolean_true),
wgl_support_opengl_arb, static_cast<std::int32_t>(gl_boolean_true),
wgl_double_buffer_arb, static_cast<std::int32_t>(gl_boolean_true),
wgl_acceleration_arb, wgl_full_acceleration_arb,
wgl_pixel_type_arb, wgl_type_rgba_arb,
wgl_color_bits_arb, 24,
wgl_depth_bits_arb, 16,
0,
},
};
}
}