Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qssgrhicustommaterialsystem_p.h
Go to the documentation of this file.
1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2019 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5#ifndef QSSG_RHI_CUSTOM_MATERIAL_SYSTEM_H
6#define QSSG_RHI_CUSTOM_MATERIAL_SYSTEM_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuick3DRuntimeRender/qtquick3druntimerenderglobal.h>
20#include <QtQuick3DRuntimeRender/private/qssgrendershaderlibrarymanager_p.h>
21#include <QtQuick3DRuntimeRender/private/qssgrenderableobjects_p.h>
22#include <QtQuick3DRuntimeRender/private/qssgrendercustommaterial_p.h>
23#include <QtQuick3DRuntimeRender/private/qssgrendershaderkeys_p.h>
24#include <QtQuick3DRuntimeRender/private/qssgshadermapkey_p.h>
25#include <QtCore/qhash.h>
26#include <QtGui/QMatrix4x4>
27
29
31struct QSSGRenderSubset;
32struct QSSGRenderModel;
35struct QSSGRenderLayer;
36struct QSSGRenderLight;
37struct QSSGRenderCamera;
39class QRhiTexture;
40
41
42class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGCustomMaterialSystem
43{
44 Q_DISABLE_COPY(QSSGCustomMaterialSystem)
45 typedef QPair<QByteArray, QByteArray> TStrStrPair;
46 typedef QHash<QSSGShaderMapKey, QSSGRhiShaderPipelinePtr> TShaderMap;
47
49 TShaderMap shaderMap;
50
51 void setShaderResources(char *ubufData,
52 const QSSGRenderCustomMaterial &inMaterial,
53 const QByteArray &inPropertyName,
54 const QVariant &propertyValue,
55 QSSGRenderShaderValue::Type inPropertyType,
56 QSSGRhiShaderPipeline &shaderPipeline);
57
58public:
61
62 void setRenderContextInterface(QSSGRenderContextInterface *inContext);
63
64 void releaseCachedResources();
65
66 // Returns true if the material is dirty and thus will produce a different render result
67 // than previously. This effects things like progressive AA.
68 bool prepareForRender(const QSSGRenderModel &inModel,
69 const QSSGRenderSubset &inSubset,
70 QSSGRenderCustomMaterial &inMaterial);
71
72 QSSGRhiShaderPipelinePtr shadersForCustomMaterial(QSSGRhiGraphicsPipelineState *ps,
73 const QSSGRenderCustomMaterial &material,
74 QSSGSubsetRenderable &renderable,
75 const QSSGShaderDefaultMaterialKeyProperties &defaultMaterialShaderKeyProperties,
76 const QSSGShaderFeatures &featureSet);
77
78 void updateUniformsForCustomMaterial(QSSGRhiShaderPipeline &shaderPipeline,
79 QSSGRhiContext *rhiCtx,
80 const QSSGLayerRenderData &inData,
81 char *ubufData,
83 const QSSGRenderCustomMaterial &material,
84 QSSGSubsetRenderable &renderable,
85 const QSSGRenderCameraList &cameras,
86 const QVector2D *depthAdjust,
87 const QMatrix4x4 *alteredModelViewProjection);
88
89 void rhiPrepareRenderable(QSSGRhiGraphicsPipelineState *ps,
90 QSSGPassKey passKey,
91 QSSGSubsetRenderable &renderable,
92 const QSSGShaderFeatures &featureSet,
93 const QSSGRenderCustomMaterial &material,
94 const QSSGLayerRenderData &layerData,
95 QRhiRenderPassDescriptor *renderPassDescriptor,
96 int samples,
97 int viewCount,
98 QSSGRenderCamera *camera = nullptr,
100 QMatrix4x4 *modelViewProjection = nullptr,
101 QSSGReflectionMapEntry *entry = nullptr);
102 void applyRhiShaderPropertyValues(char *ubufData,
103 const QSSGRenderCustomMaterial &inMaterial,
104 QSSGRhiShaderPipeline &shaderPipeline);
105 void rhiRenderRenderable(QSSGRhiContext *rhiCtx,
106 QSSGSubsetRenderable &renderable,
107 bool *needsSetViewport,
110};
111
113
114#endif
\inmodule QtCore
Definition qbytearray.h:57
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtGui
Definition qrhi.h:1142
\inmodule QtGui
Definition qrhi.h:895
\inmodule QtQuick3D
\inmodule QtCore
Definition qvariant.h:65
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
QCamera * camera
Definition camera.cpp:19
else opt state
[0]
Combined button and popup list for selecting options.
static void * context
GLsizei samples
GLuint entry
QSSGRenderTextureCubeFace
constexpr QSSGRenderTextureCubeFace QSSGRenderTextureCubeFaceNone
std::shared_ptr< QSSGRhiShaderPipeline > QSSGRhiShaderPipelinePtr