Add depth & depth-stencil pixel formats

This commit is contained in:
Nikita Lisitsa 2020-10-16 07:40:41 +03:00
parent 2898e2a2c3
commit c9ee47a79b

View file

@ -6,6 +6,17 @@
namespace psemek::gfx
{
struct depth24_pixel
{
std::uint8_t depth[3];
};
struct depth24_stencil8_pixel
{
std::uint8_t depth[3];
std::uint8_t stencil;
};
template <typename Pixel>
struct pixel_traits;
@ -81,4 +92,20 @@ namespace psemek::gfx
static constexpr GLenum type = gl::FLOAT;
};
template <>
struct pixel_traits<depth24_pixel>
{
static constexpr GLenum internal_format = gl::DEPTH_COMPONENT24;
static constexpr GLenum format = gl::DEPTH_COMPONENT;
static constexpr GLenum type = gl::UNSIGNED_BYTE;
};
template <>
struct pixel_traits<depth24_stencil8_pixel>
{
static constexpr GLenum internal_format = gl::DEPTH24_STENCIL8;
static constexpr GLenum format = gl::DEPTH_STENCIL;
static constexpr GLenum type = gl::UNSIGNED_BYTE;
};
}