Map renderer texture formats to OpenGL

This commit is contained in:
2026-06-02 18:14:40 +02:00
parent 8c99454bf5
commit dc03491b0d
5 changed files with 75 additions and 2 deletions

View File

@@ -40,6 +40,13 @@ struct OpenGlReadbackFormat {
std::uint32_t bytes_per_pixel = 0;
};
struct OpenGlRendererTextureFormat {
std::uint32_t internal_format = 0;
std::uint32_t pixel_format = 0;
std::uint32_t component_type = 0;
std::uint32_t bytes_per_pixel = 0;
};
struct OpenGlWindowsWglContextConfig {
std::array<std::int32_t, 9> context_attributes {};
std::array<std::int32_t, 15> pixel_format_attributes {};
@@ -59,6 +66,8 @@ struct OpenGlWindowsWglContextConfig {
[[nodiscard]] std::uint32_t unsigned_byte_component_type() noexcept;
[[nodiscard]] std::uint32_t rgba_pixel_format() noexcept;
[[nodiscard]] OpenGlPixelFormat texture_format_for_channel_count(std::uint32_t channel_count) noexcept;
[[nodiscard]] OpenGlRendererTextureFormat texture_format_for_renderer_format(
pp::renderer::TextureFormat format) noexcept;
[[nodiscard]] OpenGlReadbackFormat rgba8_readback_format() noexcept;
[[nodiscard]] OpenGlReadbackFormat rgba32f_readback_format() noexcept;
[[nodiscard]] std::uint64_t readback_byte_count(