public:
AsyncLoader(Texture2D &, IO::Seekable &);
+ ~AsyncLoader();
virtual bool needs_sync() const;
virtual bool process();
PixelStore pstore = PixelStore::from_image(img);
BindRestore _bind_ps(pstore);
- image(0, from_buffer ? 0 : img.get_data());
+ image(0, from_buffer ? 0 : img.get_pixels());
}
unsigned Texture2D::get_n_levels() const
phase(0)
{ }
+Texture2D::AsyncLoader::~AsyncLoader()
+{
+ if(mapped_address)
+ pixel_buffer.unmap();
+}
+
bool Texture2D::AsyncLoader::needs_sync() const
{
return phase%2;
}
else if(phase==2)
{
- const char *data = reinterpret_cast<const char *>(image.get_data());
+ const char *data = reinterpret_cast<const char *>(image.get_pixels());
copy(data, data+n_bytes, mapped_address);
}
else if(phase==3)
{
Bind _bind_buf(pixel_buffer, PIXEL_UNPACK_BUFFER);
+ mapped_address = 0;
if(!pixel_buffer.unmap())
{
phase = 1;