4#ifndef QSSGRHICONTEXT_P_H
5#define QSSGRHICONTEXT_P_H
18#include <QtGui/rhi/qrhi.h>
20#include <QtQuick3DRuntimeRender/qtquick3druntimerenderexports.h>
21#include <QtQuick3DUtils/private/qssgrenderbasetypes_p.h>
22#include <ssg/qssgrhicontext.h>
26struct QSSGRenderLayer;
27struct QSSGRenderInstanceTable;
28struct QSSGRenderModel;
30class QSSGRenderGraphObject;
39using QSSGRhiInputAssemblerState = QSSGRhiInputAssemblerStatePrivate::InputAssemblerState;
43 static void setShaderPipeline(QSSGRhiGraphicsPipelineState &ps,
const QSSGRhiShaderPipeline *pipeline)
45 ps.shaderPipeline = pipeline;
50 return ps.shaderPipeline;
60 case QSSGRenderTextureFilterOp::Nearest:
61 return QRhiSampler::Nearest;
62 case QSSGRenderTextureFilterOp::Linear:
63 return QRhiSampler::Linear;
64 case QSSGRenderTextureFilterOp::None:
65 return QRhiSampler::Linear;
68 Q_UNREACHABLE_RETURN(QRhiSampler::Linear);
74 case QSSGRenderTextureCoordOp::Repeat:
75 return QRhiSampler::Repeat;
76 case QSSGRenderTextureCoordOp::MirroredRepeat:
77 return QRhiSampler::Mirror;
78 case QSSGRenderTextureCoordOp::ClampToEdge:
79 return QRhiSampler::ClampToEdge;
80 case QSSGRenderTextureCoordOp::Unknown:
81 return QRhiSampler::ClampToEdge;
84 Q_UNREACHABLE_RETURN(QRhiSampler::ClampToEdge);
89 switch (cullFaceMode) {
90 case QSSGCullFaceMode::Back:
91 return QRhiGraphicsPipeline::Back;
92 case QSSGCullFaceMode::Front:
93 return QRhiGraphicsPipeline::Front;
94 case QSSGCullFaceMode::Disabled:
95 return QRhiGraphicsPipeline::None;
96 case QSSGCullFaceMode::FrontAndBack:
97 qWarning(
"FrontAndBack cull mode not supported");
98 return QRhiGraphicsPipeline::None;
99 case QSSGCullFaceMode::Unknown:
100 return QRhiGraphicsPipeline::None;
103 Q_UNREACHABLE_RETURN(QRhiGraphicsPipeline::None);
110void bakeVertexInputLocations(QSSGRhiInputAssemblerState *ia,
const QSSGRhiShaderPipeline &shaders,
int instanceBufferBinding = 0);
114inline bool operator==(
const QSSGRhiGraphicsPipelineState &a,
const QSSGRhiGraphicsPipelineState &b) Q_DECL_NOTHROW
116 const auto &ia_a = QSSGRhiInputAssemblerStatePrivate::get(a);
117 const auto &ia_b = QSSGRhiInputAssemblerStatePrivate::get(b);
118 const auto compareTargetBlend = [](
const std::array<QRhiGraphicsPipeline::TargetBlend, 8> &a,
119 const std::array<QRhiGraphicsPipeline::TargetBlend, 8> &b,
120 const int count) ->
bool {
121 for (
int i = 0; i < count; i++) {
122 if (a[i].colorWrite != b[i].colorWrite
123 || a[i].srcColor != b[i].srcColor
124 || a[i].dstColor != b[i].dstColor
125 || a[i].opColor != b[i].opColor
126 || a[i].srcAlpha != b[i].srcAlpha
127 || a[i].dstAlpha != b[i].dstAlpha
128 || a[i].opAlpha != b[i].opAlpha) {
134 return QSSGRhiGraphicsPipelineStatePrivate::getShaderPipeline(a) == QSSGRhiGraphicsPipelineStatePrivate::getShaderPipeline(b)
135 && a.samples == b.samples
136 && a.flags == b.flags
137 && a.stencilRef == b.stencilRef
138 && (std::memcmp(&a.stencilOpFrontState, &b.stencilOpFrontState,
sizeof(QRhiGraphicsPipeline::StencilOpState)) == 0)
139 && a.stencilWriteMask == b.stencilWriteMask
140 && a.depthFunc == b.depthFunc
141 && a.cullMode == b.cullMode
142 && a.depthBias == b.depthBias
143 && a.slopeScaledDepthBias == b.slopeScaledDepthBias
144 && a.viewport == b.viewport
145 && a.scissor == b.scissor
146 && ia_a.topology == ia_b.topology
147 && ia_a.inputLayout == ia_b.inputLayout
148 && a.colorAttachmentCount == b.colorAttachmentCount
149 && compareTargetBlend(a.targetBlend, b.targetBlend, a.colorAttachmentCount)
150 && a.lineWidth == b.lineWidth
151 && a.polygonMode == b.polygonMode
152 && a.viewCount == b.viewCount;
155inline bool operator!=(
const QSSGRhiGraphicsPipelineState &a,
const QSSGRhiGraphicsPipelineState &b) Q_DECL_NOTHROW
160inline size_t qHash(
const QSSGRhiGraphicsPipelineState &s, size_t seed) Q_DECL_NOTHROW
163 return qHash(QSSGRhiGraphicsPipelineStatePrivate::getShaderPipeline(s), seed)
166 ^ qHash(s.targetBlend[0].dstColor)
169 ^ qHash(s.colorAttachmentCount)
171 ^ qHash(s.polygonMode)
172 ^ qHashBits(&s.stencilOpFrontState,
sizeof(QRhiGraphicsPipeline::StencilOpState))
174 ^ (s.stencilRef << 6)
175 ^ (s.stencilWriteMask << 7);
186struct QSSGRhiDrawCallDataKey
188 const void *cid =
nullptr;
189 const void *model =
nullptr;
190 const void *entry =
nullptr;
191 quintptr entryIdx = 0;
196 Q_DISABLE_COPY(QSSGRhiBuffer)
198 QSSGRhiBuffer(QSSGRhiContext &context,
199 QRhiBuffer::Type type,
200 QRhiBuffer::UsageFlags usageMask,
203 QRhiCommandBuffer::IndexFormat indexFormat = QRhiCommandBuffer::IndexUInt16);
205 virtual ~QSSGRhiBuffer();
210 const quint32 sz = quint32(m_buffer->size());
211 Q_ASSERT((sz % m_stride) == 0);
212 return sz / m_stride;
217 QSSGRhiContext &m_context;
218 QRhiBuffer *m_buffer =
nullptr;
220 QRhiCommandBuffer::IndexFormat m_indexFormat;
230 bool maybeExists =
true;
231 friend class QSSGRhiShaderPipeline;
243 bool maybeExists =
true;
244 friend class QSSGRhiShaderPipeline;
247using QSSGRhiBufferPtr = std::shared_ptr<QSSGRhiBuffer>;
249inline bool operator==(
const QSSGRhiSamplerDescription &a,
const QSSGRhiSamplerDescription &b) Q_DECL_NOTHROW
251 return a.hTiling == b.hTiling && a.vTiling == b.vTiling && a.zTiling == b.zTiling
252 && a.minFilter == b.minFilter && a.magFilter == b.magFilter
253 && a.mipmap == b.mipmap;
256inline bool operator!=(
const QSSGRhiSamplerDescription &a,
const QSSGRhiSamplerDescription &b) Q_DECL_NOTHROW
264 QRhiTexture *texture =
nullptr;
265 QSSGRhiSamplerDescription samplerDesc;
284#define QSSG_MAX_NUM_LIGHTS 16
285#define QSSG_MAX_NUM_DIRECTIONAL_LIGHTS 4
286#define QSSG_REDUCED_MAX_NUM_LIGHTS 8
287#define QSSG_REDUCED_MAX_NUM_DIRECTIONAL_LIGHTS 2
359 Q_DISABLE_COPY(QSSGRhiShaderPipeline)
361 explicit QSSGRhiShaderPipeline(QSSGRhiContext &context) : m_context(context) { }
363 QSSGRhiContext &context()
const {
return m_context; }
364 bool isNull()
const {
return m_stages.isEmpty(); }
372 Q_DECLARE_FLAGS(StageFlags, StageFlag)
374 void addStage(
const QRhiShaderStage &stage, StageFlags flags = {});
379 for (
const QRhiShaderStage &s : m_stages) {
380 if (s.type() == QRhiShaderStage::Vertex)
386 for (
const QRhiShaderStage &s : m_stages) {
387 if (s.type() == QRhiShaderStage::Fragment)
454 } commonUniformIndices;
469 void setUniformValue(
char *ubufData,
const char *name,
const QVariant &value, QSSGRenderShaderValue::Type type);
470 void setUniform(
char *ubufData,
const char *name,
const void *data, size_t size,
int *storeIndex =
nullptr, UniformFlags flags = {});
471 void setUniformArray(
char *ubufData,
const char *name,
const void *data, size_t itemCount, QSSGRenderShaderValue::Type type,
int *storeIndex =
nullptr);
484 m_lightProbeTexture = texture; m_lightProbeHorzTile = hTile; m_lightProbeVertTile = vTile;
489 return {m_lightProbeHorzTile, m_lightProbeVertTile};
523 QSSGRhiContext &m_context;
524 QVarLengthArray<QRhiShaderStage, 2> m_stages;
526 int m_ub0NextUBufOffset = 0;
527 QHash<QByteArray, QShaderDescription::BlockVariable> m_ub0;
528 QHash<QSSGRhiInputAssemblerState::InputSemantic, QShaderDescription::InOutVariable> m_vertexInputs;
529 QHash<QByteArray, QShaderDescription::InOutVariable> m_combinedImageSamplers;
532 QVarLengthArray<QSSGRhiShaderUniform, 32> m_uniforms;
533 QVarLengthArray<QSSGRhiShaderUniformArray, 8> m_uniformArrays;
534 QHash<QByteArray, size_t> m_uniformIndex;
537 bool m_lightsEnabled =
false;
540 QRhiTexture *m_shadowMapAtlasTexture =
nullptr;
541 QRhiTexture *m_lightProbeTexture =
nullptr;
542 QSSGRenderTextureCoordOp m_lightProbeHorzTile = QSSGRenderTextureCoordOp::ClampToEdge;
543 QSSGRenderTextureCoordOp m_lightProbeVertTile = QSSGRenderTextureCoordOp::ClampToEdge;
544 QRhiTexture *m_screenTexture =
nullptr;
545 QRhiTexture *m_depthTexture =
nullptr;
546 QRhiTexture *m_normalTexture =
nullptr;
547 QRhiTexture *m_ssaoTexture =
nullptr;
548 QRhiTexture *m_lightmapTexture =
nullptr;
549 QVarLengthArray<QSSGRhiTexture, 8> m_extraTextures;
552Q_DECLARE_OPERATORS_FOR_FLAGS(QSSGRhiShaderPipeline::StageFlags)
553Q_DECLARE_OPERATORS_FOR_FLAGS(QSSGRhiShaderPipeline::UniformFlags)
555using QSSGRhiShaderPipelinePtr = std::shared_ptr<QSSGRhiShaderPipeline>;
560 static const int MAX_SIZE = 32;
564 QRhiShaderResourceBinding v[MAX_SIZE];
566 void clear() { p = 0; h = 0; }
568 QSSGRhiShaderResourceBindingList() { }
570 QSSGRhiShaderResourceBindingList(
const QSSGRhiShaderResourceBindingList &other)
574 for (
int i = 0; i < p; ++i)
578 QSSGRhiShaderResourceBindingList &operator=(
const QSSGRhiShaderResourceBindingList &other) Q_DECL_NOTHROW
580 if (
this != &other) {
583 for (
int i = 0; i < p; ++i)
589 void addUniformBuffer(
int binding, QRhiShaderResourceBinding::StageFlags stage, QRhiBuffer *buf,
int offset = 0 ,
int size = 0);
590 void addTexture(
int binding, QRhiShaderResourceBinding::StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler);
593inline bool operator==(
const QSSGRhiShaderResourceBindingList &a,
const QSSGRhiShaderResourceBindingList &b) Q_DECL_NOTHROW
599 for (
int i = 0; i < a.p; ++i) {
600 if (a.v[i] != b.v[i])
606inline bool operator!=(
const QSSGRhiShaderResourceBindingList &a,
const QSSGRhiShaderResourceBindingList &b) Q_DECL_NOTHROW
611inline size_t qHash(
const QSSGRhiShaderResourceBindingList &bl, size_t seed) Q_DECL_NOTHROW
616struct QSSGRhiDrawCallData
618 QRhiBuffer *ubuf =
nullptr;
619 QRhiShaderResourceBindings *srb =
nullptr;
620 QSSGRhiShaderResourceBindingList bindings;
621 QRhiGraphicsPipeline *pipeline =
nullptr;
622 size_t renderTargetDescriptionHash = 0;
623 QVector<quint32> renderTargetDescription;
624 QSSGRhiGraphicsPipelineState ps;
642 bool isValid()
const {
return texture && rpDesc && rt; }
697 const QRhiShaderResourceBindings *srb)
699 const QVector<quint32> srbDesc = srb->serializedLayoutDescription();
700 return { shader, srbDesc, { qHash(srbDesc) } };
704inline bool operator==(
const QSSGComputePipelineStateKey &a,
const QSSGComputePipelineStateKey &b) Q_DECL_NOTHROW
706 return a.shader == b.shader && a.srbLayoutDescription == b.srbLayoutDescription;
709inline bool operator!=(
const QSSGComputePipelineStateKey &a,
const QSSGComputePipelineStateKey &b) Q_DECL_NOTHROW
714inline size_t qHash(
const QSSGComputePipelineStateKey &k, size_t seed = 0) Q_DECL_NOTHROW
716 return qHash(k.shader, seed) ^ k.extra.srbLayoutDescriptionHash;
719struct QSSGRhiDummyTextureKey
721 QRhiTexture::Flags flags;
727inline size_t qHash(
const QSSGRhiDummyTextureKey &k, size_t seed) Q_DECL_NOTHROW
729 return qHash(k.flags, seed)
730 ^ qHash(k.size.width() ^ k.size.height() ^ k.color.red() ^ k.color.green()
731 ^ k.color.blue() ^ k.color.alpha() ^ k.arraySize);
734inline bool operator==(
const QSSGRhiDummyTextureKey &a,
const QSSGRhiDummyTextureKey &b) Q_DECL_NOTHROW
736 return a.flags == b.flags && a.size == b.size && a.color == b.color && a.arraySize == b.arraySize;
739inline bool operator!=(
const QSSGRhiDummyTextureKey &a,
const QSSGRhiDummyTextureKey &b) Q_DECL_NOTHROW
744class QSSGGraphicsPipelineStateKey
747 QSSGRhiGraphicsPipelineState state;
748 QVector<quint32> renderTargetDescription;
749 QVector<quint32> srbLayoutDescription;
751 size_t renderTargetDescriptionHash;
752 size_t srbLayoutDescriptionHash;
754 static QSSGGraphicsPipelineStateKey create(
const QSSGRhiGraphicsPipelineState &state,
755 const QRhiRenderPassDescriptor *rpDesc,
756 const QRhiShaderResourceBindings *srb)
758 const QVector<quint32> rtDesc = rpDesc->serializedFormat();
759 const QVector<quint32> srbDesc = srb->serializedLayoutDescription();
760 return { state, rtDesc, srbDesc, { qHash(rtDesc), qHash(srbDesc) } };
764inline bool operator==(
const QSSGGraphicsPipelineStateKey &a,
const QSSGGraphicsPipelineStateKey &b) Q_DECL_NOTHROW
766 return a.state == b.state
767 && a.renderTargetDescription == b.renderTargetDescription
768 && a.srbLayoutDescription == b.srbLayoutDescription;
771inline bool operator!=(
const QSSGGraphicsPipelineStateKey &a,
const QSSGGraphicsPipelineStateKey &b) Q_DECL_NOTHROW
776inline size_t qHash(
const QSSGGraphicsPipelineStateKey &k, size_t seed) Q_DECL_NOTHROW
778 return qHash(k.state, seed)
779 ^ k.extra.renderTargetDescriptionHash
780 ^ k.extra.srbLayoutDescriptionHash;
783#define QSSGRHICTX_STAT(ctx, f)
784 for (bool qssgrhictxlog_enabled = QSSGRhiContextStats::get(*ctx).isEnabled(); qssgrhictxlog_enabled; qssgrhictxlog_enabled = false)
785 QSSGRhiContextStats::get(*ctx).f
787class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRhiContextStats
790 [[nodiscard]]
static QSSGRhiContextStats &get(QSSGRhiContext &rhiCtx);
791 [[nodiscard]]
static const QSSGRhiContextStats &get(
const QSSGRhiContext &rhiCtx);
794 quint64 callCount = 0;
795 quint64 vertexOrIndexCount = 0;
797 struct InstancedDrawInfo {
798 quint64 callCount = 0;
799 quint64 vertexOrIndexCount = 0;
800 quint64 instanceCount = 0;
802 struct RenderPassInfo {
805 DrawInfo indexedDraws;
807 InstancedDrawInfo instancedIndexedDraws;
808 InstancedDrawInfo instancedDraws;
810 struct PerLayerInfo {
813 externalRenderPass.rtName = QByteArrayLiteral(
"Qt Quick");
818 QVector<RenderPassInfo> renderPasses;
823 RenderPassInfo externalRenderPass;
825 int currentRenderPassIndex = -1;
828 quint64 meshDataSize = 0;
829 quint64 imageDataSize = 0;
830 qint64 materialGenerationTime = 0;
831 qint64 effectGenerationTime = 0;
834 QHash<QSSGRenderLayer *, PerLayerInfo> perLayerInfo;
835 GlobalInfo globalInfo;
837 QSSGRhiContextStats(QSSGRhiContext &context)
855 static bool profilingEnabled();
856 static bool rendererDebugEnabled();
858 bool isEnabled()
const;
859 void drawIndexed(quint32 indexCount, quint32 instanceCount);
860 void draw(quint32 vertexCount, quint32 instanceCount);
862 void meshDataSizeChanges(quint64 newSize)
864 globalInfo.meshDataSize = newSize;
867 void imageDataSizeChanges(quint64 newSize)
869 globalInfo.imageDataSize = newSize;
872 void registerMaterialShaderGenerationTime(qint64 ms)
874 globalInfo.materialGenerationTime += ms;
877 void registerEffectShaderGenerationTime(qint64 ms)
879 globalInfo.effectGenerationTime += ms;
882 static quint64 totalDrawCallCountForPass(
const QSSGRhiContextStats::RenderPassInfo &pass)
884 return pass.draws.callCount
885 + pass.indexedDraws.callCount
886 + pass.instancedDraws.callCount
887 + pass.instancedIndexedDraws.callCount;
890 static quint64 totalVertexCountForPass(
const QSSGRhiContextStats::RenderPassInfo &pass)
892 return pass.draws.vertexOrIndexCount
893 + pass.indexedDraws.vertexOrIndexCount
894 + pass.instancedDraws.vertexOrIndexCount
895 + pass.instancedIndexedDraws.vertexOrIndexCount;
898 void start(QSSGRenderLayer *layer);
899 void stop(QSSGRenderLayer *layer);
900 void beginRenderPass(QRhiTextureRenderTarget *rt);
901 void endRenderPass();
902 void printRenderPass(
const RenderPassInfo &rp);
903 void cleanupLayerInfo(QSSGRenderLayer *layer);
905 QSSGRhiContext *rhiCtx;
906 QSSGRenderLayer *layerKey =
nullptr;
907 QSet<QSSGRenderLayer *> dynamicDataSources;
912 Q_DECLARE_PUBLIC(QSSGRhiContext)
914 explicit QSSGRhiContextPrivate(QSSGRhiContext &rhiCtx, QRhi *rhi_)
921 using Textures = QSet<QRhiTexture *>;
922 using Meshes = QSet<QSSGRenderMesh *>;
924 [[nodiscard]]
static QSSGRhiContextPrivate *get(QSSGRhiContext *q) {
return q->d_ptr.get(); }
925 [[nodiscard]]
static const QSSGRhiContextPrivate *get(
const QSSGRhiContext *q) {
return q->d_ptr.get(); }
927 [[nodiscard]]
static bool shaderDebuggingEnabled();
928 [[nodiscard]]
static bool editorMode();
930 void setMainRenderPassDescriptor(QRhiRenderPassDescriptor *rpDesc);
931 void setCommandBuffer(QRhiCommandBuffer *cb);
932 void setRenderTarget(QRhiRenderTarget *rt);
933 void setMainPassSampleCount(
int samples);
934 void setMainPassViewCount(
int viewCount);
936 void releaseCachedResources();
938 void registerTexture(QRhiTexture *texture);
939 void releaseTexture(QRhiTexture *texture);
941 void registerMesh(QSSGRenderMesh *mesh);
942 void releaseMesh(QSSGRenderMesh *mesh);
944 QRhiShaderResourceBindings *srb(
const QSSGRhiShaderResourceBindingList &bindings);
945 void releaseCachedSrb(QSSGRhiShaderResourceBindingList &bindings);
947 QRhiGraphicsPipeline *pipeline(
const QSSGRhiGraphicsPipelineState &ps,
948 QRhiRenderPassDescriptor *rpDesc,
949 QRhiShaderResourceBindings *srb);
951 QRhiGraphicsPipeline *pipeline(
const QSSGGraphicsPipelineStateKey &key,
952 QRhiRenderPassDescriptor *rpDesc,
953 QRhiShaderResourceBindings *srb);
955 QRhiComputePipeline *computePipeline(
const QShader &shader,
956 QRhiShaderResourceBindings *srb);
958 QRhiComputePipeline *computePipeline(
const QSSGComputePipelineStateKey &key,
959 QRhiShaderResourceBindings *srb);
961 QSSGRhiDrawCallData &drawCallData(
const QSSGRhiDrawCallDataKey &key);
962 void releaseDrawCallData(QSSGRhiDrawCallData &dcd);
963 void cleanupDrawCallData(
const QSSGRenderModel *model);
965 QSSGRhiInstanceBufferData &instanceBufferData(QSSGRenderInstanceTable *instanceTable);
966 void releaseInstanceBuffer(QSSGRenderInstanceTable *instanceTable);
968 QSSGRhiInstanceBufferData &instanceBufferData(
const QSSGRenderModel *model);
970 QSSGRhiParticleData &particleData(
const QSSGRenderGraphObject *particlesOrModel);
972 QSSGRhiContext *q_ptr =
nullptr;
973 QRhi *m_rhi =
nullptr;
975 QRhiRenderPassDescriptor *m_mainRpDesc =
nullptr;
976 QRhiCommandBuffer *m_cb =
nullptr;
977 QRhiRenderTarget *m_rt =
nullptr;
980 int m_mainSamples = 1;
981 int m_mainViewCount = 1;
983 QVector<QPair<QSSGRhiSamplerDescription, QRhiSampler*>> m_samplers;
985 QHash<QSSGRhiDrawCallDataKey, QSSGRhiDrawCallData> m_drawCallData;
986 QHash<QSSGRhiShaderResourceBindingList, QRhiShaderResourceBindings *> m_srbCache;
987 QHash<QSSGGraphicsPipelineStateKey, QRhiGraphicsPipeline *> m_pipelines;
988 QHash<QSSGComputePipelineStateKey, QRhiComputePipeline *> m_computePipelines;
989 QHash<QSSGRhiDummyTextureKey, QRhiTexture *> m_dummyTextures;
990 QHash<QSSGRenderInstanceTable *, QSSGRhiInstanceBufferData> m_instanceBuffers;
991 QHash<
const QSSGRenderModel *, QSSGRhiInstanceBufferData> m_instanceBuffersLod;
992 QHash<
const QSSGRenderGraphObject *, QSSGRhiParticleData> m_particleData;
993 QSSGRhiContextStats m_stats;
996inline bool operator==(
const QSSGRhiDrawCallDataKey &a,
const QSSGRhiDrawCallDataKey &b)
noexcept
998 return a.cid == b.cid && a.model == b.model && a.entry == b.entry && a.entryIdx == b.entryIdx;
1001inline bool operator!=(
const QSSGRhiDrawCallDataKey &a,
const QSSGRhiDrawCallDataKey &b)
noexcept
1006inline size_t qHash(
const QSSGRhiDrawCallDataKey &k, size_t seed = 0)
noexcept
1008 return qHash(quintptr(k.cid)
1011 ^ quintptr(k.entryIdx), seed);
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
friend bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are different, otherwise returns false.
static QSSGComputePipelineStateKey create(const QShader &shader, const QRhiShaderResourceBindings *srb)
size_t srbLayoutDescriptionHash
QVector< quint32 > srbLayoutDescription
QRhiBuffer * buffer() const
QRhiCommandBuffer::IndexFormat indexFormat() const
quint32 numVertices() const
void setUniformValue(char *ubufData, const char *name, const QVariant &value, QSSGRenderShaderValue::Type type)
const QRhiShaderStage * cendStages() const
QRhiTexture * ssaoTexture() const
const QHash< QSSGRhiInputAssemblerState::InputSemantic, QShaderDescription::InOutVariable > & vertexInputs() const
QRhiTexture * lightProbeTexture() const
QRhiTexture * shadowMapAtlasTexture() const
void resetExtraTextures()
QPair< QSSGRenderTextureCoordOp, QSSGRenderTextureCoordOp > lightProbeTiling() const
void setLightProbeTexture(QRhiTexture *texture, QSSGRenderTextureCoordOp hTile=QSSGRenderTextureCoordOp::ClampToEdge, QSSGRenderTextureCoordOp vTile=QSSGRenderTextureCoordOp::ClampToEdge)
void setLightmapTexture(QRhiTexture *texture)
InstanceLocations instanceBufferLocations() const
void setDepthTexture(QRhiTexture *texture)
bool isLightingEnabled() const
void addStage(const QRhiShaderStage &stage, StageFlags flags={})
QRhiTexture * screenTexture() const
void ensureUniformBuffer(QRhiBuffer **ubuf)
const QRhiShaderStage * cbeginStages() const
const QRhiShaderStage * fragmentStage() const
QRhiTexture * depthTexture() const
void addExtraTexture(const QSSGRhiTexture &t)
int ub0LightDataOffset() const
void setLightsEnabled(bool enable)
QSSGShaderDirectionalLightsUniformData & directionalLightsUniformData()
int offsetOfUniform(const QByteArray &name)
int bindingForTexture(const char *name, int hint=-1)
void ensureCombinedUniformBuffer(QRhiBuffer **ubuf)
void setScreenTexture(QRhiTexture *texture)
void setUniformArray(char *ubufData, const char *name, const void *data, size_t itemCount, QSSGRenderShaderValue::Type type, int *storeIndex=nullptr)
QRhiTexture * normalTexture() const
int extraTextureCount() const
int ub0DirectionalLightDataOffset() const
const QRhiShaderStage * vertexStage() const
QSSGShaderLightsUniformData & lightsUniformData()
void setShadowMapAtlasTexture(QRhiTexture *texture)
void setUniform(char *ubufData, const char *name, const void *data, size_t size, int *storeIndex=nullptr, UniformFlags flags={})
QRhiTexture * lightmapTexture() const
void setNormalTexture(QRhiTexture *texture)
void setSsaoTexture(QRhiTexture *texture)
const QSSGRhiTexture & extraTextureAt(int index) const
QRhiVertexInputAttribute::Format toVertexInputFormat(QSSGRenderComponentType compType, quint32 numComps)
QRhiGraphicsPipeline::CullMode toCullMode(QSSGCullFaceMode cullFaceMode)
QRhiGraphicsPipeline::Topology toTopology(QSSGRenderDrawMode drawMode)
void bakeVertexInputLocations(QSSGRhiInputAssemblerState *ia, const QSSGRhiShaderPipeline &shaders, int instanceBufferBinding)
QRhiSampler::Filter toRhi(QSSGRenderTextureFilterOp op)
Q_TRACE_POINT(qtcore, QCoreApplication_postEvent_exit)
Q_TRACE_POINT(qtquick3d, QSSG_renderFrame_entry, int width, int height)
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept
static QString getUBMemberSizeWarning(QLatin1StringView name, qsizetype correctedSize, qsizetype requestedSize)
#define QSSG_MAX_NUM_LIGHTS
#define QSSG_MAX_NUM_DIRECTIONAL_LIGHTS
QSSGRhiSamplerBindingHints
static constexpr const QSSGRhiShaderPipeline * getShaderPipeline(const QSSGRhiGraphicsPipelineState &ps)
static void setShaderPipeline(QSSGRhiGraphicsPipelineState &ps, const QSSGRhiShaderPipeline *pipeline)
QList< QSSGRhiSortData > sortData
QVector3D sortedCameraDirection
QList< QSSGRhiSortData > sortData
QRhiTextureRenderTarget * rt
QRhiTexture * depthTexture
QRhiRenderPassDescriptor * rpDesc
QRhiRenderBuffer * depthStencil
float atlasLocations[4][4]
float dimensionsInverted[4][4]
float constantAttenuation
float quadraticAttenuation