![]() |
Qt 6.x
The Qt SDK
|
\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 const 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 5712 of file qrhi.cpp.
References BufferLoad.
Referenced by QRhiMetal::setShaderResources().
|
static |
Definition at line 5747 of file qrhi.cpp.
References BufferLoad, and Q_ASSERT.
|
static |
Definition at line 5852 of file qrhi.cpp.
References BufferLoadStore.
|
static |
Definition at line 5887 of file qrhi.cpp.
References BufferLoadStore, and Q_ASSERT.
|
static |
Definition at line 5782 of file qrhi.cpp.
References BufferStore.
|
static |
Definition at line 5817 of file qrhi.cpp.
References BufferStore, and Q_ASSERT.
|
static |
Definition at line 5609 of file qrhi.cpp.
References ImageLoad.
|
static |
Definition at line 5679 of file qrhi.cpp.
References ImageLoadStore.
|
static |
Definition at line 5644 of file qrhi.cpp.
References 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 5266 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 5406 of file qrhi.cpp.
References 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 5452 of file qrhi.cpp.
References 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 5575 of file qrhi.cpp.
References 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 5499 of file qrhi.cpp.
References Texture.
|
static |
Definition at line 5530 of file qrhi.cpp.
References i, QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE, Q_ASSERT, and Texture.
|
static |
Definition at line 5292 of file qrhi.cpp.
References UniformBuffer.
Referenced by TextureCopy::TextureCopy(), main(), QVideoWindowPrivate::updateSubtitle(), updateTextures(), and QVideoWindowPrivate::updateTextures().
|
static |
Definition at line 5329 of file qrhi.cpp.
References Q_ASSERT, and UniformBuffer.
|
static |
{offset + size} cannot exceed the size of buf.Definition at line 5366 of file qrhi.cpp.
References 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 5911 of file qrhi.cpp.
References QRhiShaderResourceBinding::Data::binding, QRhiShaderResourceBinding::Data::UniformBufferData::buf, QRhiShaderResourceBinding::Data::StorageBufferData::buf, BufferLoad, BufferLoadStore, BufferStore, QRhiShaderResourceBinding::Data::TextureAndOrSamplerData::count, db, i, ImageLoad, ImageLoadStore, ImageStore, QRhiShaderResourceBinding::Data::StorageImageData::level, QRhiShaderResourceBinding::Data::UniformBufferData::maybeSize, QRhiShaderResourceBinding::Data::StorageBufferData::maybeSize, QRhiShaderResourceBinding::Data::UniformBufferData::offset, QRhiShaderResourceBinding::Data::StorageBufferData::offset, SampledTexture, Sampler, QRhiShaderResourceBinding::TextureAndSampler::sampler, QRhiShaderResourceBinding::Data::sbuf, QRhiImplementation::shaderResourceBindingData(), QRhiShaderResourceBinding::Data::simage, QRhiShaderResourceBinding::Data::stage, QRhiShaderResourceBinding::Data::stex, QRhiShaderResourceBinding::TextureAndSampler::tex, QRhiShaderResourceBinding::Data::StorageImageData::tex, QRhiShaderResourceBinding::Data::TextureAndOrSamplerData::texSamplers, Texture, QRhiShaderResourceBinding::Data::type, QRhiShaderResourceBinding::Data::u, QRhiShaderResourceBinding::Data::ubuf, and UniformBuffer.
|
related |
Definition at line 6001 of file qrhi.cpp.
References BufferLoad, BufferLoadStore, BufferStore, d, hash, ImageLoad, ImageLoadStore, ImageStore, SampledTexture, Sampler, seed, QRhiImplementation::shaderResourceBindingData(), Texture, and UniformBuffer.
|
friend |
|
static |
Definition at line 538 of file qrhi.h.
Referenced by QRhiShaderResourceBindings::QRhiShaderResourceBindings().