Added PerFrameTransferHelper for streaming and async readback.#86
Conversation
| uint32_t offset; | ||
| std::span<std::byte const> src; | ||
|
|
||
| bool done() const { return transferHelper && src.size() == 0; } |
There was a problem hiding this comment.
warning: implicit conversion 'const PerFrameTransferHelper *' -> 'bool' [readability-implicit-bool-conversion]
| bool done() const { return transferHelper && src.size() == 0; } | |
| bool done() const { return (transferHelper != nullptr) && src.size() == 0; } |
| uint32_t offset; | ||
| std::span<std::byte const> src; | ||
|
|
||
| bool done() const { return transferHelper && src.size() == 0; } |
There was a problem hiding this comment.
warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
| bool done() const { return transferHelper && src.size() == 0; } | |
| bool done() const { return transferHelper && src.empty(); } |
Additional context
/usr/include/c++/13/span:262: method 'span'::empty() defined here
empty() const noexcept
^| size_t nextIssueSlot; | ||
| std::span<std::byte> dst; | ||
|
|
||
| bool done() const { return transferHelper && dst.size() == 0; } |
There was a problem hiding this comment.
warning: implicit conversion 'const PerFrameTransferHelper *' -> 'bool' [readability-implicit-bool-conversion]
| bool done() const { return transferHelper && dst.size() == 0; } | |
| bool done() const { return (transferHelper != nullptr) && dst.size() == 0; } |
| size_t nextIssueSlot; | ||
| std::span<std::byte> dst; | ||
|
|
||
| bool done() const { return transferHelper && dst.size() == 0; } |
There was a problem hiding this comment.
warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
| bool done() const { return transferHelper && dst.size() == 0; } | |
| bool done() const { return transferHelper && dst.empty(); } |
Additional context
/usr/include/c++/13/span:262: method 'span'::empty() defined here
empty() const noexcept
^| vk::Offset3D offset; | ||
| std::span<std::byte const> src; | ||
|
|
||
| bool done() const { return transferHelper && src.size() == 0; } |
There was a problem hiding this comment.
warning: implicit conversion 'const PerFrameTransferHelper *' -> 'bool' [readability-implicit-bool-conversion]
| bool done() const { return transferHelper && src.size() == 0; } | |
| bool done() const { return (transferHelper != nullptr) && src.size() == 0; } |
| vk::Offset3D offset; | ||
| std::span<std::byte const> src; | ||
|
|
||
| bool done() const { return transferHelper && src.size() == 0; } |
There was a problem hiding this comment.
warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
| bool done() const { return transferHelper && src.size() == 0; } | |
| bool done() const { return transferHelper && src.empty(); } |
Additional context
/usr/include/c++/13/span:262: method 'span'::empty() defined here
empty() const noexcept
^|
|
||
| void finish(); | ||
|
|
||
| operator bool() const { return self != nullptr; } |
There was a problem hiding this comment.
warning: 'operator bool' must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
| operator bool() const { return self != nullptr; } | |
| explicit operator bool() const { return self != nullptr; } |
|
|
||
| void finish(); | ||
|
|
||
| operator bool() const { return self != nullptr; } |
There was a problem hiding this comment.
warning: 'operator bool' must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
| operator bool() const { return self != nullptr; } | |
| explicit operator bool() const { return self != nullptr; } |
|
|
||
| void finish(); | ||
|
|
||
| operator bool() const { return self != nullptr; } |
There was a problem hiding this comment.
warning: 'operator bool' must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
| operator bool() const { return self != nullptr; } | |
| explicit operator bool() const { return self != nullptr; } |
|
|
||
| void PerFrameTransferHelper::UploadProcessor::finish() | ||
| { | ||
| if (!self) |
There was a problem hiding this comment.
warning: implicit conversion 'PerFrameTransferHelper *' -> 'bool' [readability-implicit-bool-conversion]
| if (!self) | |
| if (self == nullptr) |
|
|
||
| void PerFrameTransferHelper::FrameProcessor::finish() | ||
| { | ||
| if (!self) |
There was a problem hiding this comment.
warning: implicit conversion 'PerFrameTransferHelper *' -> 'bool' [readability-implicit-bool-conversion]
| if (!self) | |
| if (self == nullptr) |
| } | ||
| } | ||
|
|
||
| if (state.dst.size() == 0) |
There was a problem hiding this comment.
warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
| if (state.dst.size() == 0) | |
| if (state.dst.empty()) |
Additional context
/usr/include/c++/13/span:262: method 'span'::empty() defined here
empty() const noexcept
^|
А я всегда говорил, нормально делай — нормально будет! 👍 |
|
А я всегда говорил, нормально делай — нормально будет! 👍 |
|
А я всегда говорил, нормально делай — нормально будет! 👍 |
|
А я всегда говорил, нормально делай — нормально будет! 👍 |
|
А я всегда говорил, нормально делай — нормально будет! 👍 |
Added a new class etna::PerFrameTransferHelper for handling upload and readback inside the application loop.
Has a sync API for uploads and an async API for uploads and readbacks. Operates with one staging buffer for both, so through a combination of splitting the interface into multiple "classes" and runtime checks ensures all readback is processed before upload. Handles asynchronous operations by giving the user a state struct and having the user call methods on this struct.
Usage example: