![]() |
Qt 6.x
The Qt SDK
|
#include <qrhigles2_p.h>
Classes | |
struct | UsageState |
Public Types | |
enum | Access { AccessNone , AccessVertex , AccessIndex , AccessUniform , AccessStorageRead , AccessStorageWrite , AccessStorageReadWrite , AccessUpdate } |
![]() | |
enum | Type { Immutable , Static , Dynamic } |
Specifies storage type of buffer resource. More... | |
enum | UsageFlag { VertexBuffer = 1 << 0 , IndexBuffer = 1 << 1 , UniformBuffer = 1 << 2 , StorageBuffer = 1 << 3 } |
Flag values to specify how the buffer is going to be used. More... | |
![]() | |
enum | Type { Buffer , Texture , Sampler , RenderBuffer , RenderPassDescriptor , SwapChainRenderTarget , TextureRenderTarget , ShaderResourceBindings , GraphicsPipeline , SwapChain , ComputePipeline , CommandBuffer } |
Specifies type of the resource. More... | |
Public Member Functions | |
QGles2Buffer (QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size) | |
~QGles2Buffer () | |
void | destroy () override |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
bool | create () override |
Creates the corresponding native graphics resources. | |
QRhiBuffer::NativeBuffer | nativeBuffer () override |
char * | beginFullDynamicBufferUpdateForCurrentFrame () override |
void | endFullDynamicBufferUpdateForCurrentFrame () override |
To be called when the entire contents of the buffer data has been updated in the memory block returned from beginFullDynamicBufferUpdateForCurrentFrame(). | |
![]() | |
QRhiResource::Type | resourceType () const override |
Type | type () const |
void | setType (Type t) |
Sets the buffer's type to t. | |
UsageFlags | usage () const |
void | setUsage (UsageFlags u) |
Sets the buffer's usage flags to u. | |
quint32 | size () const |
void | setSize (quint32 sz) |
Sets the size of the buffer in bytes. | |
virtual bool | create ()=0 |
Creates the corresponding native graphics resources. | |
virtual NativeBuffer | nativeBuffer () |
virtual char * | beginFullDynamicBufferUpdateForCurrentFrame () |
virtual void | endFullDynamicBufferUpdateForCurrentFrame () |
To be called when the entire contents of the buffer data has been updated in the memory block returned from beginFullDynamicBufferUpdateForCurrentFrame(). | |
![]() | |
virtual | ~QRhiResource () |
Destructor. | |
virtual Type | resourceType () const =0 |
virtual void | destroy ()=0 |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
void | deleteLater () |
When called without a frame being recorded, this function is equivalent to deleting the object. | |
QByteArray | name () const |
void | setName (const QByteArray &name) |
Sets a name for the object. | |
quint64 | globalResourceId () const |
QRhi * | rhi () const |
Public Attributes | |
quint32 | nonZeroSize = 0 |
GLuint | buffer = 0 |
GLenum | targetForDataOps |
QByteArray | data |
UsageState | usageState |
Friends | |
class | QRhiGles2 |
Additional Inherited Members | |
![]() | |
QRhiBuffer (QRhiImplementation *rhi, Type type_, UsageFlags usage_, quint32 size_) | |
\variable QRhiBuffer::NativeBuffer::objects | |
![]() | |
QRhiResource (QRhiImplementation *rhi) | |
![]() | |
Type | m_type |
UsageFlags | m_usage |
quint32 | m_size |
![]() | |
QRhiImplementation * | m_rhi = nullptr |
quint64 | m_id |
QByteArray | m_objectName |
Definition at line 31 of file qrhigles2_p.h.
enum QGles2Buffer::Access |
Enumerator | |
---|---|
AccessNone | |
AccessVertex | |
AccessIndex | |
AccessUniform | |
AccessStorageRead | |
AccessStorageWrite | |
AccessStorageReadWrite | |
AccessUpdate |
Definition at line 45 of file qrhigles2_p.h.
QGles2Buffer::QGles2Buffer | ( | QRhiImplementation * | rhi, |
Type | type, | ||
UsageFlags | usage, | ||
quint32 | size | ||
) |
Definition at line 4977 of file qrhigles2.cpp.
QGles2Buffer::~QGles2Buffer | ( | ) |
Definition at line 4982 of file qrhigles2.cpp.
References destroy().
|
overridevirtual |
This is a shortcut for medium-to-large dynamic uniform buffers that have their entire contents (or at least all regions that are read by the shaders in the current frame) changed {in every frame} and the QRhiResourceUpdateBatch-based update mechanism is seen too heavy due to the amount of data copying involved.
The call to this function must be eventually followed by a call to endFullDynamicUniformBufferUpdateForCurrentFrame(), before recording any render or compute pass that relies on this buffer.
Reimplemented from QRhiBuffer.
Definition at line 5051 of file qrhigles2.cpp.
References QRhiBuffer::Dynamic, GL_MAP_READ_BIT, GL_MAP_WRITE_BIT, QRhiBuffer::m_type, QRhiBuffer::m_usage, nonZeroSize, Q_ASSERT, QRHI_RES_RHI, targetForDataOps, and QRhiBuffer::UniformBuffer.
|
overridevirtual |
Creates the corresponding native graphics resources.
If there are already resources present due to an earlier create() with no corresponding destroy(), then destroy() is called implicitly first.
true
when successful, false
when a graphics operation failed. Regardless of the return value, calling destroy() is always safe. Implements QRhiBuffer.
Definition at line 5006 of file qrhigles2.cpp.
References QGles2Buffer::UsageState::access, AccessNone, destroy(), QRhiBuffer::Dynamic, GL_ARRAY_BUFFER, GL_DYNAMIC_DRAW, GL_ELEMENT_ARRAY_BUFFER, GL_SHADER_STORAGE_BUFFER, GL_STATIC_DRAW, QRhiBuffer::IndexBuffer, QRhiBuffer::m_size, QRhiBuffer::m_type, QRhiBuffer::m_usage, nonZeroSize, QRHI_RES_RHI, qWarning, QRhiBuffer::StorageBuffer, targetForDataOps, QRhiBuffer::UniformBuffer, and usageState.
|
overridevirtual |
Releases (or requests deferred releasing of) the underlying native graphics resources.
Safe to call multiple times, subsequent invocations will be a no-op then.
Once destroy() is called, the QRhiResource instance can be reused, by calling create()
again. That will then result in creating new native graphics resources underneath.
The QRhiResource destructor also performs the same task, so calling this function is not necessary before deleting a QRhiResource.
Implements QRhiResource.
Definition at line 4987 of file qrhigles2.cpp.
References buffer, QRhiGles2::DeferredReleaseEntry::Buffer, e, and QRHI_RES_RHI.
Referenced by ~QGles2Buffer(), and create().
|
overridevirtual |
To be called when the entire contents of the buffer data has been updated in the memory block returned from beginFullDynamicBufferUpdateForCurrentFrame().
Reimplemented from QRhiBuffer.
Definition at line 5069 of file qrhigles2.cpp.
References QRhiBuffer::m_usage, nonZeroSize, QRHI_RES_RHI, targetForDataOps, and QRhiBuffer::UniformBuffer.
|
overridevirtual |
A QRhiBuffer may be backed by multiple native buffer objects, depending on the type() and the QRhi backend in use. When this is the case, all of them are returned in the objects array in the returned struct, with slotCount specifying the number of native buffer objects. While \l{QRhi::beginFrame()}{recording a frame}, QRhi::currentFrameSlot() can be used to determine which of the native buffers QRhi is using for operations that read or write from this QRhiBuffer within the frame being recorded.
In some cases a QRhiBuffer will not be backed by a native buffer object at all. In this case slotCount will be set to 0 and no valid native objects are returned. This is not an error, and is perfectly valid when a given backend does not use native buffers for QRhiBuffers with certain types or usages.
Reimplemented from QRhiBuffer.
Definition at line 5043 of file qrhigles2.cpp.
References QRhiBuffer::m_usage, and QRhiBuffer::UniformBuffer.
|
friend |
Definition at line 59 of file qrhigles2_p.h.
GLuint QGles2Buffer::buffer = 0 |
Definition at line 42 of file qrhigles2_p.h.
Referenced by QRhiGles2::bindShaderResources(), destroy(), QRhiGles2::enqueueResourceUpdates(), and QRhiGles2::setVertexInput().
QByteArray QGles2Buffer::data |
Definition at line 44 of file qrhigles2_p.h.
Referenced by QRhiGles2::bindShaderResources(), and QRhiGles2::enqueueResourceUpdates().
quint32 QGles2Buffer::nonZeroSize = 0 |
Definition at line 41 of file qrhigles2_p.h.
Referenced by beginFullDynamicBufferUpdateForCurrentFrame(), create(), and endFullDynamicBufferUpdateForCurrentFrame().
GLenum QGles2Buffer::targetForDataOps |
Definition at line 43 of file qrhigles2_p.h.
Referenced by beginFullDynamicBufferUpdateForCurrentFrame(), create(), endFullDynamicBufferUpdateForCurrentFrame(), and QRhiGles2::enqueueResourceUpdates().
UsageState QGles2Buffer::usageState |
Definition at line 58 of file qrhigles2_p.h.
Referenced by create(), QRhiGles2::trackedBufferBarrier(), and QRhiGles2::trackedRegisterBuffer().