![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h 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 , ShadingRateMap } |
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 |
Creates the corresponding resource binding set. | |
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 dbg, const QRhiShaderResourceBindings &srb) |
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
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 |
|
inline |
|
inline |
|
inline |
|
inline |
|
pure virtual |
Creates the corresponding resource binding set.
Depending on the underlying graphics API, this may involve creating native graphics resources, and therefore it should not be assumed that this is a cheap operation.
If create() has been called before with no corresponding destroy(), then destroy() is called implicitly first.
true
when successful, false
when failed. Regardless of the return value, calling destroy() is always safe. Implemented in QD3D11ShaderResourceBindings, QGles2ShaderResourceBindings, QMetalShaderResourceBindings, QNullShaderResourceBindings, and QVkShaderResourceBindings.
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.
|
overridevirtual |
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.
|
inline |
|
inline |
|
pure virtual |
|
friend |
|
friend |
|
staticconstexprprotected |
|
protected |
|
protected |