Move readback format mapping to renderer gl
This commit is contained in:
@@ -123,6 +123,32 @@ OpenGlPixelFormat texture_format_for_channel_count(std::uint32_t channel_count)
|
||||
}
|
||||
}
|
||||
|
||||
OpenGlReadbackFormat rgba8_readback_format() noexcept
|
||||
{
|
||||
return OpenGlReadbackFormat {
|
||||
.pixel_format = gl_rgba,
|
||||
.component_type = gl_unsigned_byte,
|
||||
.bytes_per_pixel = 4U,
|
||||
};
|
||||
}
|
||||
|
||||
OpenGlReadbackFormat rgba32f_readback_format() noexcept
|
||||
{
|
||||
return OpenGlReadbackFormat {
|
||||
.pixel_format = gl_rgba,
|
||||
.component_type = gl_float,
|
||||
.bytes_per_pixel = 16U,
|
||||
};
|
||||
}
|
||||
|
||||
std::uint64_t readback_byte_count(
|
||||
OpenGlReadbackFormat format,
|
||||
std::uint32_t width,
|
||||
std::uint32_t height) noexcept
|
||||
{
|
||||
return static_cast<std::uint64_t>(width) * height * format.bytes_per_pixel;
|
||||
}
|
||||
|
||||
const char* framebuffer_status_name(std::uint32_t status) noexcept
|
||||
{
|
||||
switch (status) {
|
||||
|
||||
@@ -32,12 +32,24 @@ struct OpenGlTextureParameter {
|
||||
std::uint32_t value = 0;
|
||||
};
|
||||
|
||||
struct OpenGlReadbackFormat {
|
||||
std::uint32_t pixel_format = 0;
|
||||
std::uint32_t component_type = 0;
|
||||
std::uint32_t bytes_per_pixel = 0;
|
||||
};
|
||||
|
||||
[[nodiscard]] OpenGlCapabilities detect_opengl_capabilities(
|
||||
std::span<const std::string_view> extensions,
|
||||
OpenGlRuntime runtime) noexcept;
|
||||
|
||||
[[nodiscard]] std::uint32_t texture_upload_type_for_internal_format(std::uint32_t internal_format) noexcept;
|
||||
[[nodiscard]] OpenGlPixelFormat texture_format_for_channel_count(std::uint32_t channel_count) noexcept;
|
||||
[[nodiscard]] OpenGlReadbackFormat rgba8_readback_format() noexcept;
|
||||
[[nodiscard]] OpenGlReadbackFormat rgba32f_readback_format() noexcept;
|
||||
[[nodiscard]] std::uint64_t readback_byte_count(
|
||||
OpenGlReadbackFormat format,
|
||||
std::uint32_t width,
|
||||
std::uint32_t height) noexcept;
|
||||
[[nodiscard]] const char* framebuffer_status_name(std::uint32_t status) noexcept;
|
||||
[[nodiscard]] std::uint32_t framebuffer_color_buffer_mask() noexcept;
|
||||
[[nodiscard]] std::uint32_t framebuffer_blit_filter(bool linear) noexcept;
|
||||
|
||||
Reference in New Issue
Block a user