Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
\inmodule QtGui More...
#include <qrhi.h>
Public Types | |
enum | UpdateFlag { BindingsAreSorted = 0x01 } |
Public Types inherited from QRhiResource | |
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 |
Public Member Functions inherited from QRhiResource | |
virtual | ~QRhiResource () |
Destructor. | |
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) | |
Protected Member Functions inherited from QRhiResource | |
QRhiResource (QRhiImplementation *rhi) | |
Protected Attributes | |
QVarLengthArray< QRhiShaderResourceBinding, BINDING_PREALLOC > | m_bindings |
size_t | m_layoutDescHash = 0 |
QVector< quint32 > | m_layoutDesc |
Protected Attributes inherited from QRhiResource | |
QRhiImplementation * | m_rhi = nullptr |
quint64 | m_id |
QByteArray | m_objectName |
Static Protected Attributes | |
static constexpr 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 5313 of file qrhi.cpp.
References BINDING_PREALLOC, QRhiShaderResourceBinding::LAYOUT_DESC_ENTRIES_PER_BINDING, and m_layoutDesc.
|
inline |
|
inline |
|
inline |
Definition at line 1225 of file qrhi.h.
Referenced by QRhiImplementation::sanityCheckShaderResourceBindings().
|
inline |
Definition at line 1226 of file qrhi.h.
Referenced by QRhiImplementation::sanityCheckShaderResourceBindings().
|
pure virtual |
Implemented in QD3D11ShaderResourceBindings, QGles2ShaderResourceBindings, QMetalShaderResourceBindings, QNullShaderResourceBindings, and QVkShaderResourceBindings.
Referenced by QSSGRhiContextPrivate::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 5348 of file qrhi.cpp.
References m_layoutDesc, m_layoutDescHash, and other().
|
overridevirtual |
Implements QRhiResource.
Definition at line 5322 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 1232 of file qrhi.h.
Referenced by QSGBatchRenderer::GraphicsPipelineStateKey::create(), QSSGComputePipelineStateKey::create(), and QSSGGraphicsPipelineStateKey::create().
|
inline |
|
inline |
Sets the list of bindings.
Definition at line 1218 of file qrhi.h.
References list.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), and QSSGRhiContextPrivate::srb().
|
pure virtual |
|
friend |
|
friend |
|
staticconstexprprotected |
Definition at line 1244 of file qrhi.h.
Referenced by QRhiShaderResourceBindings().
|
protected |
Definition at line 1246 of file qrhi.h.
Referenced by QD3D11ShaderResourceBindings::create(), QGles2ShaderResourceBindings::create(), QMetalShaderResourceBindings::create(), QVkShaderResourceBindings::create(), QRhiImplementation::updateLayoutDesc(), QD3D11ShaderResourceBindings::updateResources(), QMetalShaderResourceBindings::updateResources(), and QVkShaderResourceBindings::updateResources().
Definition at line 1251 of file qrhi.h.
Referenced by QRhiShaderResourceBindings(), isLayoutCompatible(), and QRhiImplementation::updateLayoutDesc().
|
protected |
Definition at line 1247 of file qrhi.h.
Referenced by isLayoutCompatible(), and QRhiImplementation::updateLayoutDesc().