}
void Texture2D::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned lv)
+{
+ set_storage(fmt, wd, ht, lv);
+ allocate();
+}
+
+void Texture2D::set_storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned lv)
{
if(width>0)
{
n_levels = count_levels(max(width, height));
if(lv>0)
n_levels = min(n_levels, lv);
-
- allocate();
}
void Texture2D::image(unsigned level, const void *data)
void Texture2D::Loader::storage(PixelFormat fmt, unsigned w, unsigned h)
{
- obj.storage(fmt, w, h);
+ storage_levels(fmt, w, h, 0);
}
void Texture2D::Loader::storage_levels(PixelFormat fmt, unsigned w, unsigned h, unsigned l)
{
- obj.storage(fmt, w, h, l);
+ obj.set_storage(fmt, w, h, l);
+ if(!obj.manager)
+ obj.allocate();
}
{
unsigned w = image.get_width();
unsigned h = image.get_height();
- texture.storage(pixelformat_from_image(image, texture.use_srgb_format), w, h);
+ texture.set_storage(pixelformat_from_image(image, texture.use_srgb_format), w, h, 0);
}
+ texture.allocate();
transfer = texture.sub_image_async(0, 0, 0, texture.width, texture.height);
}
else if(phase==2)
cannot be changed once set. */
void storage(PixelFormat, unsigned wd, unsigned ht, unsigned lv = 0);
+private:
+ void set_storage(PixelFormat, unsigned, unsigned, unsigned);
+
+public:
void image(unsigned level, const void *) override;
/** Replaces a rectangular region of the texture. Allocated storage must