![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtGui More...
#include <qrhi.h>
Public Types | |
enum | UpdateFlag { BindingsAreSorted = 0x01 } |
![]() | |
enum | Type { Buffer , Texture , Sampler , RenderBuffer , RenderPassDescriptor , SwapChainRenderTarget , TextureRenderTarget , ShaderResourceBindings , GraphicsPipeline , SwapChain , ComputePipeline , CommandBuffer } |
Specifies type of the resource. More... | |
Public Member Functions | |
QRhiResource::Type | resourceType () const override |
void | setBindings (std::initializer_list< QRhiShaderResourceBinding > list) |
Sets the list of bindings. | |
template<typename InputIterator > | |
void | setBindings (InputIterator first, InputIterator last) |
Sets the list of bindings from the iterators first and last. | |
const QRhiShaderResourceBinding * | cbeginBindings () const |
const QRhiShaderResourceBinding * | cendBindings () const |
const QRhiShaderResourceBinding * | bindingAt (qsizetype index) const |
qsizetype | bindingCount () const |
bool | isLayoutCompatible (const QRhiShaderResourceBindings *other) const |
QVector< quint32 > | serializedLayoutDescription () const |
virtual bool | create ()=0 |
virtual void | updateResources (UpdateFlags flags={})=0 |
![]() | |
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 |
Protected Member Functions | |
QRhiShaderResourceBindings (QRhiImplementation *rhi) | |
![]() | |
QRhiResource (QRhiImplementation *rhi) | |
Protected Attributes | |
QVarLengthArray< QRhiShaderResourceBinding, BINDING_PREALLOC > | m_bindings |
size_t | m_layoutDescHash = 0 |
QVector< quint32 > | m_layoutDesc |
![]() | |
QRhiImplementation * | m_rhi = nullptr |
quint64 | m_id |
QByteArray | m_objectName |
Static Protected Attributes | |
static const int | BINDING_PREALLOC = 12 |
Friends | |
class | QRhiImplementation |
Q_GUI_EXPORT QDebug | operator<< (QDebug, const QRhiShaderResourceBindings &) |
\inmodule QtGui
Encapsulates resources for making buffer, texture, sampler resources visible to shaders.
A QRhiShaderResourceBindings is a collection of QRhiShaderResourceBinding objects, each of which describe a single binding.
Take a fragment shader with the following interface:
\badcode layout(std140, binding = 0) uniform buf { mat4 mvp; int flip; } ubuf;
layout(binding = 1) uniform sampler2D tex;
To make resources visible to the shader, the following QRhiShaderResourceBindings could be created and then passed to QRhiGraphicsPipeline::setShaderResourceBindings():
This assumes that ubuf
is a QRhiBuffer, texture
is a QRhiTexture, while sampler is a QRhiSampler. The example also assumes that the uniform block is present in the vertex shader as well so the same buffer is made visible to the vertex stage too.
|
protected |
Definition at line 5079 of file qrhi.cpp.
References BINDING_PREALLOC, QRhiShaderResourceBinding::LAYOUT_DESC_ENTRIES_PER_BINDING, and m_layoutDesc.
|
inline |
|
inline |
|
inline |
Definition at line 1201 of file qrhi.h.
Referenced by QRhiImplementation::sanityCheckShaderResourceBindings().
|
inline |
Definition at line 1202 of file qrhi.h.
Referenced by QRhiImplementation::sanityCheckShaderResourceBindings().
|
pure virtual |
Implemented in QD3D11ShaderResourceBindings, QGles2ShaderResourceBindings, QMetalShaderResourceBindings, QNullShaderResourceBindings, and QVkShaderResourceBindings.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), renderToKTXFileInternal(), and QSSGRhiContext::srb().
bool QRhiShaderResourceBindings::isLayoutCompatible | ( | const QRhiShaderResourceBindings * | other | ) | const |
true
if the layout is compatible with other. The layout does not include the actual resource (such as, buffer or texture) and related parameters (such as, offset or size). It does include the binding point, pipeline stage, and resource type, however. The number and order of the bindings must also match in order to be compatible.When there is a QRhiGraphicsPipeline created with this QRhiShaderResourceBindings, and the function returns true
, other can then safely be passed to QRhiCommandBuffer::setShaderResources(), and so be used with the pipeline in place of this QRhiShaderResourceBindings.
Definition at line 5114 of file qrhi.cpp.
References m_layoutDesc, m_layoutDescHash, and other().
|
overridevirtual |
Implements QRhiResource.
Definition at line 5088 of file qrhi.cpp.
References QRhiResource::ShaderResourceBindings.
Given two objects srb1
and srb2
, if the data returned from this function is identical, then {srb1->isLayoutCompatible(srb2)}, and vice versa hold true as well.
Definition at line 1208 of file qrhi.h.
Referenced by QSGBatchRenderer::GraphicsPipelineStateKey::create(), QSSGComputePipelineStateKey::create(), and QSSGGraphicsPipelineStateKey::create().
|
inline |
|
inline |
Sets the list of bindings.
Definition at line 1194 of file qrhi.h.
References list.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), renderToKTXFileInternal(), and QSSGRhiContext::srb().
|
pure virtual |
|
friend |
|
friend |
|
staticprotected |
Definition at line 1220 of file qrhi.h.
Referenced by QRhiShaderResourceBindings().
|
protected |
Definition at line 1222 of file qrhi.h.
Referenced by QRhiGles2::bindShaderResources(), QD3D11ShaderResourceBindings::create(), QGles2ShaderResourceBindings::create(), QMetalShaderResourceBindings::create(), QVkShaderResourceBindings::create(), QRhiGles2::dispatch(), QRhiVulkan::dispatch(), QRhiGles2::setShaderResources(), QRhiImplementation::updateLayoutDesc(), QD3D11ShaderResourceBindings::updateResources(), QMetalShaderResourceBindings::updateResources(), and QVkShaderResourceBindings::updateResources().
Definition at line 1227 of file qrhi.h.
Referenced by QRhiShaderResourceBindings(), isLayoutCompatible(), and QRhiImplementation::updateLayoutDesc().
|
protected |
Definition at line 1223 of file qrhi.h.
Referenced by isLayoutCompatible(), and QRhiImplementation::updateLayoutDesc().