void Texture3D::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned dp, unsigned lv)
{
if(width>0)
- throw invalid_operation("Texture3D::storage");
+ {
+ if(fmt!=format || wd!=width || ht!=height || dp!=depth || (lv && lv!=levels))
+ throw incompatible_data("Texture3D::storage");
+ return;
+ }
if(wd==0 || ht==0 || dp==0)
throw invalid_argument("Texture3D::storage");
h = w;
PixelFormat fmt = pixelformat_from_image(img);
- if(width==0)
- storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w, h, d, lv);
- else if(w!=width || h!=height || d!=depth)
- throw incompatible_data("Texture3D::load_image");
+ storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w, h, d, lv);
PixelStore pstore = PixelStore::from_image(img);
BindRestore _bind_ps(pstore);