X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fbufferable.h;h=b2b25765af2ef67b88c3c9e91bb7e785ee97b1b5;hb=6d2e2a0bb28496a8c25b441009bdd2a1a1e72d81;hp=b430b726277c657fac569fb334bf5c69f624409e;hpb=97818e67b2543a6075c13e6bf22c296757b975e5;p=libs%2Fgl.git diff --git a/source/core/bufferable.h b/source/core/bufferable.h index b430b726..b2b25765 100644 --- a/source/core/bufferable.h +++ b/source/core/bufferable.h @@ -41,7 +41,7 @@ private: Bufferable *next_in_buffer = 0; Bufferable *prev_in_buffer = 0; mutable bool location_dirty = false; - mutable bool dirty = false; + mutable uint8_t dirty = 0; protected: Bufferable() = default; @@ -60,14 +60,14 @@ public: /** Returns the total amount of storage required by this object and others in the same chain, including any padding required by object alignment. */ - std::size_t get_required_buffer_size() const; + std::size_t get_required_buffer_size(bool = false) const; /** Uploads new data into the buffer if necessary. */ - void refresh() const { if(dirty) upload_data(0); } + void refresh(unsigned f) const { if(dirty) upload_data(f, 0); } /** Returns an object which can be used to upload data to the buffer using mapped memory. If data is not dirty, returns null. */ - AsyncUpdater *refresh_async() const { return dirty ? new AsyncUpdater(*this) : 0; } + AsyncUpdater *refresh_async() const { return dirty ? create_async_updater() : 0; } private: void unlink_from_buffer(); @@ -103,7 +103,9 @@ public: private: /** Uploads data to the buffer. Receives pointer to mapped buffer memory as parameter, or null to use the buffer upload interface. */ - void upload_data(char *) const; + void upload_data(unsigned, char *) const; + + AsyncUpdater *create_async_updater() const; }; } // namespace GL