Move OpenGL texture upload mapping
This commit is contained in:
@@ -4,6 +4,12 @@ namespace pp::renderer::gl {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr std::uint32_t gl_unsigned_byte = 0x1401U;
|
||||
constexpr std::uint32_t gl_float = 0x1406U;
|
||||
constexpr std::uint32_t gl_half_float = 0x140BU;
|
||||
constexpr std::uint32_t gl_rgba32f = 0x8814U;
|
||||
constexpr std::uint32_t gl_rgba16f = 0x881AU;
|
||||
|
||||
[[nodiscard]] bool contains(std::string_view text, std::string_view needle) noexcept
|
||||
{
|
||||
return text.find(needle) != std::string_view::npos;
|
||||
@@ -50,4 +56,16 @@ OpenGlCapabilities detect_opengl_capabilities(
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
std::uint32_t texture_upload_type_for_internal_format(std::uint32_t internal_format) noexcept
|
||||
{
|
||||
switch (internal_format) {
|
||||
case gl_rgba32f:
|
||||
return gl_float;
|
||||
case gl_rgba16f:
|
||||
return gl_half_float;
|
||||
default:
|
||||
return gl_unsigned_byte;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user