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
4#ifndef QSSGRHICONTEXT_H
5#define QSSGRHICONTEXT_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the QtQuick3D API, with limited compatibility guarantees.
12// Usage of this API may make your code source and binary incompatible with
13// future versions of Qt.
14//
15
16#include <QtCore/qstack.h>
17#include <rhi/qrhi.h>
18
19#include <QtQuick3DRuntimeRender/qtquick3druntimerenderexports.h>
20
22
23class QSSGRhiContextPrivate;
24class QSSGRhiShaderPipeline;
25
27{
28public:
29 enum class Flag : quint32
30 {
36 };
37 Q_DECLARE_FLAGS(Flags, Flag)
38
46 int depthBias = 0;
47 int samples = 1;
49 int viewCount = 1;
51 float lineWidth = 1.0f;
55
56private:
59 struct InputAssemblerState
60 {
61 enum InputSemantic {
62 PositionSemantic, // attr_pos
63 NormalSemantic, // attr_norm
64 TexCoord0Semantic, // attr_uv0
65 TexCoord1Semantic, // attr_uv1
66 TangentSemantic, // attr_textan
67 BinormalSemantic, // attr_binormal
68 ColorSemantic, // attr_color
69 MaxTargetSemantic = ColorSemantic,
70 JointSemantic, // attr_joints
71 WeightSemantic, // attr_weights
72 TexCoordLightmapSemantic // attr_lightmapuv
73 };
74
75 QRhiVertexInputLayout inputLayout;
76 QVarLengthArray<InputSemantic, 8> inputs;
77 QRhiGraphicsPipeline::Topology topology;
78 std::array<quint8, MaxTargetSemantic + 1> targetOffsets = { UINT8_MAX, UINT8_MAX, UINT8_MAX, UINT8_MAX,
79 UINT8_MAX, UINT8_MAX, UINT8_MAX };
80 quint8 targetCount = 0;
81 } ia;
82
83 // for internal use
84 const QSSGRhiShaderPipeline *shaderPipeline = nullptr;
85};
86
96
97class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRhiContext
98{
99 Q_DISABLE_COPY(QSSGRhiContext)
100public:
101 explicit QSSGRhiContext(QRhi *rhi);
102 ~QSSGRhiContext();
103
104 QRhi *rhi() const;
105 bool isValid() const;
106
108 QRhiCommandBuffer *commandBuffer() const;
110 int mainPassSampleCount() const;
111 int mainPassViewCount() const;
112
113 QRhiSampler *sampler(const QSSGRhiSamplerDescription &samplerDescription);
114 void checkAndAdjustForNPoT(QRhiTexture *texture, QSSGRhiSamplerDescription *samplerDescription);
115 QRhiTexture *dummyTexture(QRhiTexture::Flags flags, QRhiResourceUpdateBatch *rub,
116 const QSize &size = QSize(64, 64), const QColor &fillColor = Qt::black,
117 int arraySize = 0);
118
120
121private:
122 Q_DECLARE_PRIVATE(QSSGRhiContext)
123 std::unique_ptr<QSSGRhiContextPrivate> d_ptr;
124};
125
126QT_END_NAMESPACE
127
128#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
\variable QSSGRhiGraphicsPipelineState::depthFunc
QRhiSampler::AddressMode hTiling
QRhiSampler::Filter minFilter
QRhiSampler::Filter magFilter
QRhiSampler::AddressMode vTiling
QRhiSampler::Filter mipmap
QRhiSampler::AddressMode zTiling