#include <msp/gl/extensions/arb_direct_state_access.h>
#include <msp/gl/extensions/arb_texture_swizzle.h>
#include <msp/gl/extensions/ext_framebuffer_object.h>
+#include <msp/gl/extensions/khr_debug.h>
#include <msp/io/memory.h>
#include "bindable.h"
#include "error.h"
glCreateTextures(target, 1, &id);
else
glGenTextures(1, &id);
+
+#ifdef DEBUG
+ if(!debug_name.empty() && KHR_debug)
+ glObjectLabel(GL_TEXTURE, id, debug_name.size(), debug_name.c_str());
+#endif
}
void Texture::set_format(PixelFormat fmt)
}
}
+void Texture::set_debug_name(const string &name)
+{
+#ifdef DEBUG
+ debug_name = name;
+ if(id && KHR_debug)
+ glObjectLabel(GL_TEXTURE, id, name.size(), name.c_str());
+#else
+ (void)name;
+#endif
+}
+
Texture::Loader::Loader(Texture &t):
DataFile::CollectionObjectLoader<Texture>(t, 0)
void Texture::Loader::image_data(const string &data)
{
+ if(obj.manager)
+ {
+ obj.set_manager(0);
+ if(!obj.id)
+ obj.generate_id();
+ }
+
Graphics::Image img;
IO::Memory mem(data.data(), data.size());
img.load_io(mem);