]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/texture2d.cpp
Fix reflection of image types from Spir-V modules
[libs/gl.git] / source / core / texture2d.cpp
index 3c3579c1d131137f89ab49b57dd565f15a3ed544..c9aab79a9cf16c5a2488af530f9d081a3e148547 100644 (file)
@@ -38,11 +38,11 @@ void Texture2D::image(unsigned level, const void *data)
        return sub_image(level, 0, 0, size.x, size.y, data);
 }
 
-void Texture2D::sub_image(unsigned level, int x, int y, unsigned wd, unsigned ht, const void *data)
+void Texture2D::sub_image(unsigned level, unsigned x, unsigned y, unsigned wd, unsigned ht, const void *data)
 {
        if(width==0 || height==0)
                throw invalid_operation("Texture2D::sub_image");
-       if(level>=levels)
+       if(level>=levels || x>width || x+wd>width || y>height || y+ht>height)
                throw out_of_range("Texture2D::sub_image");
 
        Texture2DBackend::sub_image(level, x, y, wd, ht, data);
@@ -74,16 +74,6 @@ LinAl::Vector<unsigned, 2> Texture2D::get_level_size(unsigned level) const
        return LinAl::Vector<unsigned, 2>(w, h);
 }
 
-Resource::AsyncLoader *Texture2D::load(IO::Seekable &io, const Resources *)
-{
-       return create_async_loader(io);
-}
-
-uint64_t Texture2D::get_data_size() const
-{
-       return id ? width*height*get_pixel_size(format) : 0;
-}
-
 
 Texture2D::Loader::Loader(Texture2D &t):
        DataFile::DerivedObjectLoader<Texture2D, Texture::Loader>(t)
@@ -99,18 +89,10 @@ Texture2D::Loader::Loader(Texture2D &t, Collection &c):
 
 void Texture2D::Loader::init()
 {
-       add("raw_data", &Loader::raw_data);
        add("storage", &Loader::storage);
        add("storage", &Loader::storage_levels);
 }
 
-void Texture2D::Loader::raw_data(const string &data)
-{
-       if(obj.manager)
-               obj.set_manager(0);
-       obj.image(0, data.data());
-}
-
 void Texture2D::Loader::storage(PixelFormat fmt, unsigned w, unsigned h)
 {
        obj.storage(fmt, w, h);