]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/opengl/texture2d_backend.h
Add an asynchronous version of Texture2D::sub_image
[libs/gl.git] / source / backends / opengl / texture2d_backend.h
index 595c51f51ea38e76233f1617f37ea4398095a190..5de1079537daf16dd08248ca1d3712844223913d 100644 (file)
@@ -11,6 +11,20 @@ class Buffer;
 class OpenGLTexture2D: public Texture
 {
 protected:
+       class AsyncTransfer: public NonCopyable
+       {
+       protected:
+               Buffer *pixel_buffer = 0;
+
+               AsyncTransfer() = default;
+               AsyncTransfer(AsyncTransfer &&);
+               AsyncTransfer &operator=(AsyncTransfer &&);
+               ~AsyncTransfer();
+
+               void *allocate();
+               void finalize();
+       };
+
        class AsyncLoader;
 
        OpenGLTexture2D();
@@ -19,8 +33,10 @@ protected:
        void sub_image(unsigned, int, int, unsigned, unsigned, const void *);
        void sub_image(unsigned, int, int, unsigned, unsigned, const Buffer &, unsigned);
 
-       Resource::AsyncLoader *create_async_loader(IO::Seekable &);
-       void unload();
+public:
+       virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = 0);
+       virtual std::size_t get_data_size() const;
+       virtual void unload();
 };
 
 using Texture2DBackend = OpenGLTexture2D;