]> git.tdb.fi Git - libs/gl.git/commitdiff
Add a function in Renderer to upload data to a buffer
authorMikko Rasa <tdb@tdb.fi>
Tue, 18 Jul 2023 08:29:55 +0000 (11:29 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 18 Jul 2023 08:31:37 +0000 (11:31 +0300)
This accounts for the current frame in flight if necessary.

source/render/renderer.cpp
source/render/renderer.h

index 299cdb17d829fdc205172ab5a3ebb06dcc8de2a8..0e3a770ad1de8826803eb7dfe24feba35800a013 100644 (file)
@@ -334,6 +334,12 @@ void Renderer::resolve_multisample()
        commands.resolve_multisample();
 }
 
+void Renderer::upload_data(Buffer &buffer, size_t off, size_t sz, const void *d)
+{
+       unsigned frame = frame_number%buffer.get_multiplicity();
+       buffer.sub_data(frame*buffer.get_size()+off, sz, d);
+}
+
 void Renderer::begin_query(const QueryPool &pool, unsigned index)
 {
        commands.begin_query(pool, index);
index e670cafa880dc18e67796cc04ccc28eb5637f996..3ba5e64d2cd4a532afb229c5a6472ab4b7c83f81 100644 (file)
@@ -247,6 +247,8 @@ public:
        their corresponding resolve attachments. */
        void resolve_multisample();
 
+       void upload_data(Buffer &, std::size_t, std::size_t, const void *);
+
        void begin_query(const QueryPool &, unsigned);
        void end_query(const QueryPool &, unsigned);