56 lines
2.0 KiB
C++
56 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <span>
|
|
#include <string_view>
|
|
|
|
namespace pp::renderer::gl {
|
|
|
|
struct OpenGlRuntime {
|
|
bool desktop_gl = false;
|
|
bool gles = false;
|
|
bool web = false;
|
|
};
|
|
|
|
struct OpenGlCapabilities {
|
|
bool framebuffer_fetch = false;
|
|
bool map_buffer_alignment = false;
|
|
bool float32_textures = false;
|
|
bool float32_linear = false;
|
|
bool float16_textures = false;
|
|
};
|
|
|
|
struct OpenGlPixelFormat {
|
|
std::uint32_t internal_format = 0;
|
|
std::uint32_t pixel_format = 0;
|
|
std::uint32_t channel_count = 0;
|
|
};
|
|
|
|
struct OpenGlTextureParameter {
|
|
std::uint32_t name = 0;
|
|
std::uint32_t value = 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]] const char* framebuffer_status_name(std::uint32_t status) noexcept;
|
|
[[nodiscard]] std::uint32_t index_type_for_index_size(std::uint32_t index_size_bytes) noexcept;
|
|
[[nodiscard]] std::uint32_t primitive_mode_for_fill_count(std::uint32_t vertex_or_index_count) noexcept;
|
|
[[nodiscard]] std::uint32_t primitive_mode_for_stroke_count(std::uint32_t vertex_or_index_count) noexcept;
|
|
[[nodiscard]] std::span<const std::uint32_t> panopainter_cube_face_texture_targets() noexcept;
|
|
[[nodiscard]] std::uint32_t cube_face_texture_target(std::uint32_t face_index) noexcept;
|
|
[[nodiscard]] std::span<const OpenGlTextureParameter> default_render_target_texture_parameters() noexcept;
|
|
[[nodiscard]] std::array<OpenGlTextureParameter, 5> sampler_parameters_for_filter_wrap(
|
|
std::uint32_t filter,
|
|
std::uint32_t wrap) noexcept;
|
|
[[nodiscard]] std::array<OpenGlTextureParameter, 2> sampler_filter_parameters(
|
|
std::uint32_t filter_min,
|
|
std::uint32_t filter_mag) noexcept;
|
|
|
|
}
|