Add name parameter to framebuffer::assert_complete for better error reporting
This commit is contained in:
parent
4eef4046cb
commit
1b6bc9a449
2 changed files with 7 additions and 3 deletions
|
|
@ -6,6 +6,8 @@
|
||||||
#include <psemek/gfx/pixel.hpp>
|
#include <psemek/gfx/pixel.hpp>
|
||||||
#include <psemek/gfx/pixmap.hpp>
|
#include <psemek/gfx/pixmap.hpp>
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
namespace psemek::gfx
|
namespace psemek::gfx
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -50,7 +52,7 @@ namespace psemek::gfx
|
||||||
|
|
||||||
GLenum status() const;
|
GLenum status() const;
|
||||||
bool complete() const;
|
bool complete() const;
|
||||||
void assert_complete() const;
|
void assert_complete(std::string_view name = {}) const;
|
||||||
|
|
||||||
template <typename Pixel>
|
template <typename Pixel>
|
||||||
void read_pixels(basic_pixmap<Pixel> & p) const
|
void read_pixels(basic_pixmap<Pixel> & p) const
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include <psemek/gfx/framebuffer.hpp>
|
#include <psemek/gfx/framebuffer.hpp>
|
||||||
|
|
||||||
|
#include <psemek/util/to_string.hpp>
|
||||||
|
|
||||||
namespace psemek::gfx
|
namespace psemek::gfx
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -178,10 +180,10 @@ namespace psemek::gfx
|
||||||
return status() == gl::FRAMEBUFFER_COMPLETE;
|
return status() == gl::FRAMEBUFFER_COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void framebuffer::assert_complete() const
|
void framebuffer::assert_complete(std::string_view name) const
|
||||||
{
|
{
|
||||||
if (auto s = status(); s != gl::FRAMEBUFFER_COMPLETE)
|
if (auto s = status(); s != gl::FRAMEBUFFER_COMPLETE)
|
||||||
throw std::runtime_error("Framebuffer incomplete: " + framebuffer_status_string(s));
|
throw std::runtime_error(util::to_string("Framebuffer ", name, name.empty() ? "" : " ", "incomplete: ", framebuffer_status_string(s)));
|
||||||
}
|
}
|
||||||
|
|
||||||
framebuffer::framebuffer(std::nullptr_t)
|
framebuffer::framebuffer(std::nullptr_t)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue