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
58private:
61 struct InputAssemblerState
62 {
63 enum InputSemantic {
64 PositionSemantic, // attr_pos
65 NormalSemantic, // attr_norm
66 TexCoord0Semantic, // attr_uv0
67 TexCoord1Semantic, // attr_uv1
68 TangentSemantic, // attr_textan
69 BinormalSemantic, // attr_binormal
70 ColorSemantic, // attr_color
71 MaxTargetSemantic = ColorSemantic,
72 JointSemantic, // attr_joints
73 WeightSemantic, // attr_weights
74 TexCoordLightmapSemantic // attr_lightmapuv
75 };
76
77 QRhiVertexInputLayout inputLayout;
78 QVarLengthArray<InputSemantic, 8> inputs;
79 QRhiGraphicsPipeline::Topology topology;
80 std::array<quint8, MaxTargetSemantic + 1> targetOffsets = { UINT8_MAX, UINT8_MAX, UINT8_MAX, UINT8_MAX,
81 UINT8_MAX, UINT8_MAX, UINT8_MAX };
82 quint8 targetCount = 0;
83 } ia;
84
85 // for internal use
86 const QSSGRhiShaderPipeline *shaderPipeline = nullptr;
87};
88
98
99class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRhiContext
100{
101 Q_DISABLE_COPY(QSSGRhiContext)
102public:
103 explicit QSSGRhiContext(QRhi *rhi);
104 ~QSSGRhiContext();
105
106 QRhi *rhi() const;
107 bool isValid() const;
108
110 QRhiCommandBuffer *commandBuffer() const;
112 int mainPassSampleCount() const;
113 int mainPassViewCount() const;
114
115 QRhiSampler *sampler(const QSSGRhiSamplerDescription &samplerDescription);
116 void checkAndAdjustForNPoT(QRhiTexture *texture, QSSGRhiSamplerDescription *samplerDescription);
117 QRhiTexture *dummyTexture(QRhiTexture::Flags flags, QRhiResourceUpdateBatch *rub,
118 const QSize &size = QSize(64, 64), const QColor &fillColor = Qt::black,
119 int arraySize = 0);
120
122
123private:
124 Q_DECLARE_PRIVATE(QSSGRhiContext)
125 std::unique_ptr<QSSGRhiContextPrivate> d_ptr;
126};
127
128QT_END_NAMESPACE
129
130#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