From c9ee47a79b4c04c1a02127f9d4d2421b7fa68059 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Fri, 16 Oct 2020 07:40:41 +0300 Subject: [PATCH] Add depth & depth-stencil pixel formats --- libs/gfx/include/psemek/gfx/pixel.hpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/libs/gfx/include/psemek/gfx/pixel.hpp b/libs/gfx/include/psemek/gfx/pixel.hpp index e6ab0620..1557aea1 100644 --- a/libs/gfx/include/psemek/gfx/pixel.hpp +++ b/libs/gfx/include/psemek/gfx/pixel.hpp @@ -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 struct pixel_traits; @@ -81,4 +92,20 @@ namespace psemek::gfx static constexpr GLenum type = gl::FLOAT; }; + template <> + struct pixel_traits + { + 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 + { + static constexpr GLenum internal_format = gl::DEPTH24_STENCIL8; + static constexpr GLenum format = gl::DEPTH_STENCIL; + static constexpr GLenum type = gl::UNSIGNED_BYTE; + }; + }