@@ -214,11 +214,6 @@ void CommandEncoder::write_buffer(const std::shared_ptr<Buffer> &buffer,
214214 auto device = device_.lock ();
215215 auto allocation = device->allocate_staging (data_size);
216216
217- if (!used_staging_buffer_) {
218- used_staging_buffer_ = true ;
219- device->increment_staging_encoder ();
220- }
221-
222217 void *mapped_ptr = device->map_staging (allocation);
223218 memcpy (mapped_ptr, data, data_size);
224219 device->unmap_staging (allocation);
@@ -255,11 +250,6 @@ void CommandEncoder::read_buffer(const std::shared_ptr<Buffer> &buffer,
255250 auto device = device_.lock ();
256251 auto allocation = device->allocate_staging (data_size);
257252
258- if (!used_staging_buffer_) {
259- used_staging_buffer_ = true ;
260- device->increment_staging_encoder ();
261- }
262-
263253 Command cmd{};
264254 cmd.type = CommandType::WriteBuffer;
265255
@@ -298,11 +288,6 @@ void CommandEncoder::write_texture(const std::shared_ptr<Texture> &texture, Rect
298288 auto device = device_.lock ();
299289 auto allocation = device->allocate_staging (data_size);
300290
301- if (!used_staging_buffer_) {
302- used_staging_buffer_ = true ;
303- device->increment_staging_encoder ();
304- }
305-
306291 void *mapped_ptr = device->map_staging (allocation);
307292 memcpy (mapped_ptr, src, data_size);
308293 device->unmap_staging (allocation);
@@ -340,11 +325,6 @@ void CommandEncoder::read_texture(const std::shared_ptr<Texture> &texture, RectI
340325 auto device = device_.lock ();
341326 auto allocation = device->allocate_staging (data_size);
342327
343- if (!used_staging_buffer_) {
344- used_staging_buffer_ = true ;
345- device->increment_staging_encoder ();
346- }
347-
348328 Command cmd{};
349329 cmd.type = CommandType::ReadTexture;
350330
@@ -376,12 +356,6 @@ void CommandEncoder::invoke_callbacks() {
376356
377357 callbacks_.clear ();
378358 temp_buffers_.clear ();
379-
380- if (used_staging_buffer_) {
381- if (auto device = device_.lock ()) {
382- device_.lock ()->decrement_staging_encoder ();
383- }
384- }
385359}
386360
387361} // namespace Pathfinder
0 commit comments