1 | // Copyright (C) 2023 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QSSGRENDERERIMPLSHADERS_P_H |
5 | #define QSSGRENDERERIMPLSHADERS_P_H |
6 | |
7 | #include <QtCore/qbytearray.h> |
8 | |
9 | #include <QtQuick3DRuntimeRender/private/qtquick3druntimerenderglobal_p.h> |
10 | |
11 | #include <QtQuick3DRuntimeRender/private/qssgrhicontext_p.h> |
12 | #include <QtQuick3DRuntimeRender/private/qssgrenderlayer_p.h> |
13 | #include <QtQuick3DRuntimeRender/private/qssgrenderparticles_p.h> |
14 | |
15 | // |
16 | // W A R N I N G |
17 | // ------------- |
18 | // |
19 | // This file is not part of the Qt API. It exists purely as an |
20 | // implementation detail. This header file may change from version to |
21 | // version without notice, or even be removed. |
22 | // |
23 | // We mean it. |
24 | // |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | class QSSGShaderCache; |
29 | |
30 | class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGBuiltInRhiShaderCache |
31 | { |
32 | public: |
33 | explicit QSSGBuiltInRhiShaderCache(QSSGShaderCache &shaderCache) |
34 | : m_shaderCache(shaderCache) {} |
35 | |
36 | void releaseCachedResources(); |
37 | |
38 | enum class LightmapUVRasterizationShaderMode { |
39 | Default, |
40 | Uv, |
41 | UvTangent |
42 | }; |
43 | |
44 | QSSGRhiShaderPipelinePtr getRhiCubemapShadowBlurXShader(); |
45 | QSSGRhiShaderPipelinePtr getRhiCubemapShadowBlurYShader(); |
46 | QSSGRhiShaderPipelinePtr getRhiGridShader(int viewCount); |
47 | QSSGRhiShaderPipelinePtr getRhiOrthographicShadowBlurXShader(); |
48 | QSSGRhiShaderPipelinePtr getRhiOrthographicShadowBlurYShader(); |
49 | QSSGRhiShaderPipelinePtr getRhiSsaoShader(int viewCount); |
50 | QSSGRhiShaderPipelinePtr getRhiSkyBoxCubeShader(int viewCount); |
51 | QSSGRhiShaderPipelinePtr getRhiSkyBoxShader(QSSGRenderLayer::TonemapMode tonemapMode, bool isRGBE, int viewCount); |
52 | QSSGRhiShaderPipelinePtr getRhiSupersampleResolveShader(int viewCount); |
53 | QSSGRhiShaderPipelinePtr getRhiProgressiveAAShader(); |
54 | QSSGRhiShaderPipelinePtr getRhiParticleShader(QSSGRenderParticles::FeatureLevel featureLevel, int viewCount); |
55 | QSSGRhiShaderPipelinePtr getRhiSimpleQuadShader(int viewCount); |
56 | QSSGRhiShaderPipelinePtr getRhiLightmapUVRasterizationShader(LightmapUVRasterizationShaderMode mode); |
57 | QSSGRhiShaderPipelinePtr getRhiLightmapDilateShader(); |
58 | QSSGRhiShaderPipelinePtr getRhiDebugObjectShader(); |
59 | QSSGRhiShaderPipelinePtr getRhiReflectionprobePreFilterShader(); |
60 | QSSGRhiShaderPipelinePtr getRhienvironmentmapPreFilterShader(bool isRGBE); |
61 | QSSGRhiShaderPipelinePtr getRhiEnvironmentmapShader(); |
62 | |
63 | private: |
64 | QSSGShaderCache &m_shaderCache; // We're owned by the shadercache |
65 | |
66 | struct BuiltinShader { |
67 | // The shader refs are non-null if we have attempted to generate the |
68 | // shader. This does not mean we were successul, however. |
69 | QSSGRhiShaderPipelinePtr shaderPipeline; |
70 | int viewCount = 1; |
71 | }; |
72 | |
73 | QSSGRhiShaderPipelinePtr getBuiltinRhiShader(const QByteArray &name, |
74 | BuiltinShader &storage, |
75 | int viewCount = 1); |
76 | |
77 | struct { |
78 | BuiltinShader cubemapShadowBlurXRhiShader; |
79 | BuiltinShader cubemapShadowBlurYRhiShader; |
80 | BuiltinShader gridShader; |
81 | BuiltinShader orthographicShadowBlurXRhiShader; |
82 | BuiltinShader orthographicShadowBlurYRhiShader; |
83 | BuiltinShader ssaoRhiShader; |
84 | BuiltinShader skyBoxRhiShader[QSSGRenderLayer::TonemapModeCount * 2 /* rgbe+hdr */]; |
85 | BuiltinShader skyBoxCubeRhiShader; |
86 | BuiltinShader supersampleResolveRhiShader; |
87 | BuiltinShader progressiveAARhiShader; |
88 | BuiltinShader texturedQuadRhiShader; |
89 | BuiltinShader simpleQuadRhiShader; |
90 | BuiltinShader lightmapUVRasterShader; |
91 | BuiltinShader lightmapUVRasterShader_uv; |
92 | BuiltinShader lightmapUVRasterShader_uv_tangent; |
93 | BuiltinShader lightmapDilateShader; |
94 | BuiltinShader debugObjectShader; |
95 | |
96 | BuiltinShader reflectionprobePreFilterShader; |
97 | BuiltinShader environmentmapPreFilterShader[2]; |
98 | BuiltinShader environmentmapShader; |
99 | |
100 | BuiltinShader particlesNoLightingSimpleRhiShader; |
101 | BuiltinShader particlesNoLightingMappedRhiShader; |
102 | BuiltinShader particlesNoLightingAnimatedRhiShader; |
103 | BuiltinShader particlesVLightingSimpleRhiShader; |
104 | BuiltinShader particlesVLightingMappedRhiShader; |
105 | BuiltinShader particlesVLightingAnimatedRhiShader; |
106 | BuiltinShader lineParticlesRhiShader; |
107 | BuiltinShader lineParticlesMappedRhiShader; |
108 | BuiltinShader lineParticlesAnimatedRhiShader; |
109 | BuiltinShader lineParticlesVLightRhiShader; |
110 | BuiltinShader lineParticlesMappedVLightRhiShader; |
111 | BuiltinShader lineParticlesAnimatedVLightRhiShader; |
112 | } m_cache; |
113 | }; |
114 | |
115 | QT_END_NAMESPACE |
116 | |
117 | #endif // QSSGRENDERERIMPLSHADERS_P_H |
118 | |