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>
Classes | |
struct | Data |
struct | TextureAndSampler |
Public Types | |
enum | Type { UniformBuffer , SampledTexture , Texture , Sampler , ImageLoad , ImageStore , ImageLoadStore , BufferLoad , BufferStore , BufferLoadStore } |
Specifies type of the shader resource bound to a binding point. More... | |
enum | StageFlag { VertexStage = 1 << 0 , TessellationControlStage = 1 << 1 , TessellationEvaluationStage = 1 << 2 , GeometryStage = 1 << 3 , FragmentStage = 1 << 4 , ComputeStage = 1 << 5 } |
Flag values to indicate which stages the shader resource is visible in. More... | |
Public Member Functions | |
QRhiShaderResourceBinding ()=default | |
bool | isLayoutCompatible (const QRhiShaderResourceBinding &other) const |
Static Public Attributes | |
static constexpr int | LAYOUT_DESC_ENTRIES_PER_BINDING = 4 |
Friends | |
class | QRhiImplementation |
Related Symbols | |
(Note that these are not member symbols.) | |
bool | operator== (const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept |
bool | operator!= (const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept |
size_t | qHash (const QRhiShaderResourceBinding &b, size_t seed) noexcept |
\inmodule QtGui
Describes the shader resource for a single binding point.
A QRhiShaderResourceBinding cannot be constructed directly. Instead, use the static functions such as uniformBuffer() or sampledTexture() to get an instance.
Flag values to indicate which stages the shader resource is visible in.
\value VertexStage Vertex stage \value TessellationControlStage Tessellation control (hull shader) stage \value TessellationEvaluationStage Tessellation evaluation (domain shader) stage \value FragmentStage Fragment (pixel shader) stage \value ComputeStage Compute stage \value GeometryStage Geometry stage
Enumerator | |
---|---|
VertexStage | |
TessellationControlStage | |
TessellationEvaluationStage | |
GeometryStage | |
FragmentStage | |
ComputeStage |
Specifies type of the shader resource bound to a binding point.
\value UniformBuffer Uniform buffer
\value SampledTexture Combined image sampler (a texture and sampler pair). Even when the shading language associated with the underlying 3D API has no support for this concept (e.g. D3D and HLSL), this is still supported because the shader translation layer takes care of the appropriate translation and remapping of binding points or shader registers.
\value Texture Texture (separate)
\value Sampler Sampler (separate)
\value ImageLoad Image load (with GLSL this maps to doing imageLoad() on a single level - and either one or all layers - of a texture exposed to the shader as an image object)
\value ImageStore Image store (with GLSL this maps to doing imageStore() or imageAtomic*() on a single level - and either one or all layers - of a texture exposed to the shader as an image object)
\value ImageLoadStore Image load and store
\value BufferLoad Storage buffer store (with GLSL this maps to reading from a shader storage buffer)
\value BufferStore Storage buffer store (with GLSL this maps to writing to a shader storage buffer)
\value BufferLoadStore Storage buffer load and store
Enumerator | |
---|---|
UniformBuffer | |
SampledTexture | |
Texture | |
Sampler | |
ImageLoad | |
ImageStore | |
ImageLoadStore | |
BufferLoad | |
BufferStore | |
BufferLoadStore |
|
default |
|
static |
Definition at line 5946 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, and BufferLoad.
Referenced by QRhiMetal::setShaderResources().
|
static |
Definition at line 5981 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, BufferLoad, and Q_ASSERT.
|
static |
Definition at line 6086 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, and BufferLoadStore.
|
static |
Definition at line 6121 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, BufferLoadStore, and Q_ASSERT.
|
static |
Definition at line 6016 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, and BufferStore.
|
static |
Definition at line 6051 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, BufferStore, and Q_ASSERT.
|
static |
Definition at line 5843 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, and ImageLoad.
|
static |
Definition at line 5913 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, and ImageLoadStore.
|
static |
Definition at line 5878 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, and ImageStore.
bool QRhiShaderResourceBinding::isLayoutCompatible | ( | const QRhiShaderResourceBinding & | 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).For example, a
and b
below are not equal, but are compatible layout-wise:
Definition at line 5500 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::arraySize(), QRhiShaderResourceBinding::Data::binding, other(), QRhiShaderResourceBinding::Data::stage, and QRhiShaderResourceBinding::Data::type.
|
static |
count
of 1.Definition at line 5640 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, and SampledTexture.
Referenced by TextureCopy::TextureCopy(), QSSGRenderReflectionMap::addReflectionMapEntry(), renderToKTXFileInternal(), QVideoWindowPrivate::updateSubtitle(), updateTextures(), and QVideoWindowPrivate::updateTextures().
|
static |
This function is relevant when arrays of combined image samplers are involved. For example, in GLSL {layout(binding = 5) uniform sampler2D shadowMaps[8];} declares an array of combined image samplers. The application is then expected provide a QRhiShaderResourceBinding for binding point 5, set up by calling this function with count set to 8 and a valid texture and sampler for each element of the array.
Definition at line 5686 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, i, QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE, Q_ASSERT, and SampledTexture.
|
static |
Arrays of separate samplers are not supported.
This creates a binding for a separate sampler object, whereas sampledTexture() is suitable for combined image samplers. In Vulkan-compatible GLSL code separate samplers are declared as sampler
as opposed to sampler2D:
{layout(binding = 2) uniform sampler samp;}
With both a texture2D
and sampler
present, they can be used together to sample the texture: {fragColor = texture(sampler2D(tex, samp),
texcoord);}.
Definition at line 5809 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, and Sampler.
|
inlinestatic |
|
static |
count
of 1.This creates a binding for a separate texture (image) object, whereas sampledTexture() is suitable for combined image samplers. In Vulkan-compatible GLSL code separate textures are declared as texture2D
as opposed to sampler2D:
{layout(binding = 1) uniform texture2D tex;}
Definition at line 5733 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, and Texture.
|
static |
Definition at line 5764 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, i, QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE, Q_ASSERT, and Texture.
|
static |
Definition at line 5526 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, and UniformBuffer.
Referenced by TextureCopy::TextureCopy(), ExampleRhiWidget::initialize(), ExampleRhiItemRenderer::initialize(), main(), QVideoWindowPrivate::updateSubtitle(), updateTextures(), and QVideoWindowPrivate::updateTextures().
|
static |
Definition at line 5563 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, Q_ASSERT, and UniformBuffer.
|
static |
{offset + size} cannot exceed the size of buf.Definition at line 5600 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, Q_ASSERT, and UniformBuffer.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), and renderToKTXFileInternal().
|
related |
false
if all the bindings in the two QRhiShaderResourceBinding objects a and b are equal; otherwise returns true
.
|
related |
true
if the contents of the two QRhiShaderResourceBinding objects a and b are equal. This includes the resources (buffer, texture) and related parameters (offset, size) as well. To only compare layouts (binding point, pipeline stage, resource type), use \l{QRhiShaderResourceBinding::isLayoutCompatible()}{isLayoutCompatible()} instead. Definition at line 6145 of file qrhi.cpp.
References BufferLoad, BufferLoadStore, BufferStore, db, i, ImageLoad, ImageLoadStore, ImageStore, SampledTexture, Sampler, QRhiImplementation::shaderResourceBindingData(), Texture, and UniformBuffer.
|
related |
Definition at line 6235 of file qrhi.cpp.
References BufferLoad, BufferLoadStore, BufferStore, d, hash, ImageLoad, ImageLoadStore, ImageStore, SampledTexture, Sampler, seed, QRhiImplementation::shaderResourceBindingData(), Texture, and UniformBuffer.
|
friend |
|
staticconstexpr |
Definition at line 546 of file qrhi.h.
Referenced by QRhiShaderResourceBindings::QRhiShaderResourceBindings().