Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qssgrhicontext.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QSSGRHICONTEXT_H
7#define QSSGRHICONTEXT_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is part of the QtQuick3D API, with limited compatibility guarantees.
14// Usage of this API may make your code source and binary incompatible with
15// future versions of Qt.
16//
17
18#include <QtCore/qstack.h>
19#include <rhi/qrhi.h>
20
21#include <QtQuick3DRuntimeRender/qtquick3druntimerenderexports.h>
22
24
25class QSSGRhiContextPrivate;
26class QSSGRhiShaderPipeline;
27
29{
30public:
31 enum class Flag : quint32
32 {
38 };
39 Q_DECLARE_FLAGS(Flags, Flag)
40
48 int depthBias = 0;
49 int samples = 1;
51 int viewCount = 1;
53 float lineWidth = 1.0f;
57 bool userSetCullMode = false; // set by PipelineStateOverride; not part of the pipeline cache key
58
59private:
62 struct InputAssemblerState
63 {
64 enum InputSemantic {
65 PositionSemantic, // attr_pos
66 NormalSemantic, // attr_norm
67 TexCoord0Semantic, // attr_uv0
68 TexCoord1Semantic, // attr_uv1
69 TangentSemantic, // attr_textan
70 BinormalSemantic, // attr_binormal
71 ColorSemantic, // attr_color
72 MaxTargetSemantic = ColorSemantic,
73 JointSemantic, // attr_joints
74 WeightSemantic, // attr_weights
75 TexCoordLightmapSemantic // attr_lightmapuv
76 };
77
78 QRhiVertexInputLayout inputLayout;
79 QVarLengthArray<InputSemantic, 8> inputs;
80 QRhiGraphicsPipeline::Topology topology;
81 std::array<quint8, MaxTargetSemantic + 1> targetOffsets = { UINT8_MAX, UINT8_MAX, UINT8_MAX, UINT8_MAX,
82 UINT8_MAX, UINT8_MAX, UINT8_MAX };
83 quint8 targetCount = 0;
84 } ia;
85
86 // for internal use
87 const QSSGRhiShaderPipeline *shaderPipeline = nullptr;
88};
89
99
100class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRhiContext
101{
102 Q_DISABLE_COPY(QSSGRhiContext)
103public:
104 explicit QSSGRhiContext(QRhi *rhi);
105 ~QSSGRhiContext();
106
107 QRhi *rhi() const;
108 bool isValid() const;
109
111 QRhiCommandBuffer *commandBuffer() const;
113 int mainPassSampleCount() const;
114 int mainPassViewCount() const;
115
116 QRhiSampler *sampler(const QSSGRhiSamplerDescription &samplerDescription);
117 void checkAndAdjustForNPoT(QRhiTexture *texture, QSSGRhiSamplerDescription *samplerDescription);
118 QRhiTexture *dummyTexture(QRhiTexture::Flags flags, QRhiResourceUpdateBatch *rub,
119 const QSize &size = QSize(64, 64), const QColor &fillColor = Qt::black,
120 int arraySize = 0);
121
123
124private:
125 Q_DECLARE_PRIVATE(QSSGRhiContext)
126 std::unique_ptr<QSSGRhiContextPrivate> d_ptr;
127};
128
129QT_END_NAMESPACE
130
131#endif
virtual bool isValid() const
\inmodule QtQuick3D
int mainPassSampleCount() const
Returns the sample count used in the main render pass.
int mainPassViewCount() const
Returns the multiview count used in the main render pass.
QRhiCommandBuffer * commandBuffer() const
QRhiTexture * dummyTexture(QRhiTexture::Flags flags, QRhiResourceUpdateBatch *rub, const QSize &size=QSize(64, 64), const QColor &fillColor=Qt::black, int arraySize=0)
void checkAndAdjustForNPoT(QRhiTexture *texture, QSSGRhiSamplerDescription *samplerDescription)
Adjusts samplerDescription's tiling and filtering modes based on the pixel size of texture.
QRhiCommandBuffer::BeginPassFlags commonPassFlags() const
QRhiSampler * sampler(const QSSGRhiSamplerDescription &samplerDescription)
QRhiRenderTarget * renderTarget() const
QRhiRenderPassDescriptor * mainRenderPassDescriptor() const
Flag
\variable QSSGRhiGraphicsPipelineState::samples
std::array< QRhiGraphicsPipeline::TargetBlend, 8 > targetBlend
Combined button and popup list for selecting options.
\variable QSSGRhiGraphicsPipelineState::depthFunc
QRhiSampler::AddressMode hTiling
QRhiSampler::Filter minFilter
QRhiSampler::Filter magFilter
QRhiSampler::AddressMode vTiling
QRhiSampler::Filter mipmap
QRhiSampler::AddressMode zTiling