|
The Vish Visualization Shell 0.3
Vish
|
Implements functionality related to an OpenGL buffer object. More...
#include <ocean/GLvish/GLBuffer.hpp>
Public Member Functions | |
| void * | map_wo (size_t offset=0, size_t length=0) const override |
| Recommended creation and usage pattern for a short-lived CPU staging buffer. | |
Implements functionality related to an OpenGL buffer object.
|
overridevirtual |
Recommended creation and usage pattern for a short-lived CPU staging buffer.
This document describes the optimal OpenGL flags and workflow for a staging buffer used exclusively as an intermediate upload source. The staging buffer is mapped once, written once, unmapped immediately, and subsequently used as the source of a GPU-side copy operation into a device-local buffer.
A staging buffer serves as a CPU-visible temporary storage region. Data is written into the staging buffer by the CPU and then transferred into a non-mappable, device-local buffer using glCopyNamedBufferSubData(). The staging buffer itself is not used for rendering and is not accessed by the GPU outside of the copy operation.
For a staging buffer that is mapped only once and unmapped before any GPU access, the recommended storage flags are:
These flags permit CPU write access and impose no additional residency or synchronization requirements. Persistent or coherent mapping flags are not required because the buffer is not kept mapped across frames and does not require GPU-visible coherence while mapped.
The corresponding mapping flags should match the storage flags:
No additional mapping flags are necessary. In particular:
GL_MAP_PERSISTENT_BIT is unnecessary because the buffer is not kept persistently mapped.GL_MAP_COHERENT_BIT is unnecessary because the buffer is unmapped before the GPU copy operation, eliminating the need for CPU/GPU coherence.GL_MAP_INVALIDATE_RANGE_BIT and GL_MAP_INVALIDATE_BUFFER_BIT have no effect because the buffer is not remapped repeatedly.GL_MAP_UNSYNCHRONIZED_BIT is unnecessary because the buffer is unmapped before any GPU access, preventing synchronization hazards.glNamedBufferStorage() with GL_MAP_WRITE_BIT.glMapNamedBufferRange() with GL_MAP_WRITE_BIT.GL_MAP_WRITE_BIT for both storage and mapping.Implements Wizt::RenderBasin::Buffer.