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
qssgrenderskymaterial.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6#include <QtQuick3DRuntimeRender/private/qssgrenderskymaterial_p.h>
7#include <QtQuick3DRuntimeRender/private/qssgrendererimplshaders_p.h>
8#include <QtQuick3DRuntimeRender/private/qssgrhieffectsystem_p.h>
9#include <QtQuick3DRuntimeRender/private/qssgshadermaterialadapter_p.h>
10
11#include <QtCore/qbitarray.h>
12#include <QtCore/qhash.h>
13#include <QtCore/qspan.h>
14#include <QtGui/qvector4d.h>
15#include <rhi/qshaderbaker.h>
16
17#include <algorithm>
18
19using namespace Qt::StringLiterals;
20
22
23static const char *vertexShaderStr = R"(
24void main()
25{
26 vec4 qt_vertPosition = vec4(attr_pos, 1.0);
27 qt_eyeDir = qt_vertPosition.xyz;
28 gl_Position = qt_projectionMatrix * qt_viewMatrix * vec4(qt_eyeDir, 1.0);
29}
30
31)";
32
33// Screen-space variant: the sky shader is evaluated directly on a fullscreen quad
34// for the visible background (no cubemap round-trip). The per-pixel world-space view
35// direction is reconstructed exactly like skybox.vert: inverse-project the NDC position
36// into view space, then rotate into world space. qt_viewMatrix here carries the combined
37// orientation * world-rotation (translation-free), so a single matrix suffices.
38static const char *vertexShaderStrScreen = R"(
39void main()
40{
41 gl_Position = vec4(attr_pos, 1.0);
42#if QSHADER_VIEW_COUNT >= 2
43 vec3 qt_unprojected = (qt_inverseProjection[gl_ViewIndex] * gl_Position).xyz;
44 qt_eyeDir = (qt_viewMatrix[gl_ViewIndex] * vec4(qt_unprojected, 0.0)).xyz;
45#else
46 vec3 qt_unprojected = (qt_inverseProjection * gl_Position).xyz;
47 qt_eyeDir = (qt_viewMatrix * vec4(qt_unprojected, 0.0)).xyz;
48#endif
49 gl_Position.y *= qt_adjustY;
50}
51
52)";
53
54static const char *mainFragmentSnippet = R"(
55
56void main()
57{
58 qt_customMain();
59}
60
61)";
62
63// Screen-space (background) fragment main: the user shader writes linear HDR into
64// FRAGCOLOR, so we apply exposure + tonemapping here, exactly as skybox.frag does when
65// it samples the IBL cube. qt_exposure / qt_tonemap are no-ops unless a tonemapping
66// feature is compiled in (TonemapMode::None/Custom -> passthrough), matching the skybox.
67static const char *mainFragmentSnippetScreen = R"(
68
69void main()
70{
71 qt_customMain();
72 FRAGCOLOR = vec4(qt_tonemap(qt_exposure(FRAGCOLOR.rgb, qt_skyExposure)), 1.0);
73}
74
75)";
76
77static const char *debugFragStr = R"(
78// Helper: outer square border of a face
79float line(vec2 uv, float width)
80{
81 vec2 d = abs(uv - 0.5);
82 return step(max(d.x, d.y), 0.5) - step(max(d.x, d.y), 0.5 - width);
83}
84
85// Simple plus/minus symbol
86float drawPlus(vec2 uv)
87{
88 float h = step(abs(uv.y - 0.5), 0.05) * step(abs(uv.x - 0.5), 0.2);
89 float v = step(abs(uv.x - 0.5), 0.05) * step(abs(uv.y - 0.5), 0.2);
90 return max(h, v);
91}
92
93float drawMinus(vec2 uv)
94{
95 return step(abs(uv.y - 0.5), 0.05) * step(abs(uv.x - 0.5), 0.2);
96}
97
98void MAIN()
99{
100 vec3 d = normalize(qt_eyeDir);
101 vec3 ad = abs(d);
102
103 vec2 uv;
104 vec3 faceColor;
105 float label = 0.0;
106
107 // Determine dominant axis (cubemap face)
108 if (ad.x > ad.y && ad.x > ad.z)
109 {
110 uv = d.zy / ad.x * 0.5 + 0.5;
111 if (d.x > 0.0)
112 {
113 faceColor = vec3(1.0, 0.0, 0.0); // +X red
114 label = drawPlus(uv);
115 }
116 else
117 {
118 faceColor = vec3(0.5, 0.0, 0.0); // -X dark red
119 label = drawMinus(uv);
120 }
121 }
122 else if (ad.y > ad.x && ad.y > ad.z)
123 {
124 uv = d.xz / ad.y * 0.5 + 0.5;
125 if (d.y > 0.0)
126 {
127 faceColor = vec3(0.0, 1.0, 0.0); // +Y green
128 label = drawPlus(uv);
129 }
130 else
131 {
132 faceColor = vec3(0.0, 0.5, 0.0); // -Y dark green
133 label = drawMinus(uv);
134 }
135 }
136 else
137 {
138 uv = d.xy / ad.z * 0.5 + 0.5;
139 if (d.z > 0.0)
140 {
141 faceColor = vec3(0.0, 0.0, 1.0); // +Z blue
142 label = drawPlus(uv);
143 }
144 else
145 {
146 faceColor = vec3(0.0, 0.0, 0.5); // -Z dark blue
147 label = drawMinus(uv);
148 }
149 }
150
151 // Outer border
152 float border = line(uv, 0.02);
153
154 // Combine
155 vec3 color = faceColor;
156 color = mix(color, vec3(1.0), border); // white border
157 color = mix(color, vec3(1.0), label); // white + or - label
158
159 FRAGCOLOR = vec4(color, 1.0);
160}
161)";
162
163QSSGRenderSkyMaterial::QSSGRenderSkyMaterial()
164 : QSSGRenderGraphObject(QSSGRenderGraphObject::Type::SkyMaterial, FlagT(Flags::HasGraphicsResources))
165{
166}
167
168QSSGRenderSkyMaterial::~QSSGRenderSkyMaterial() = default;
169
170// Returns false if any custom-property texture is not ready yet (compilation must wait
171// until next frame, since the GLSL sampler type depends on the actual texture: textures
172// not created yet are assumed to be sampler2DArray, which could cause compile failures).
173static bool skyShaderTexturesReady(const QList<QSSGBaseTypeProperty> &propertyUniforms, QSSGBufferManager &bufferManager)
174{
175 for (const auto &u : std::as_const(propertyUniforms)) {
176 if (u.shaderDataType == QSSGRenderShaderValue::Texture) {
177 // A null image has nothing to wait for, its sampler gets a dummy texture.
178 QSSGRenderImage *image = u.value.value<QSSGRenderImage *>();
179 if (image && !bufferManager.loadRenderImage(image).m_texture)
180 return false;
181 }
182 }
183 return true;
184}
185
186// Appends the user shader's custom-property texture bindings to an SRB list. Shared by the
187// cube (updateUniforms) and screen-space (updateBackgroundUniforms) paths.
188static void appendCustomTextureBindings(QSSGRhiShaderPipeline *pipeline,
189 QSSGRhiShaderResourceBindingList &bindings,
190 QSSGRhiContext *rhiCtx,
191 QRhiResourceUpdateBatch *rub)
192{
193 int maxSamplerBinding = -1;
194 QVector<QShaderDescription::InOutVariable> samplerVars =
195 pipeline->fragmentStage()->shader().description().combinedImageSamplers();
196 for (const QShaderDescription::InOutVariable &var :
197 pipeline->vertexStage()->shader().description().combinedImageSamplers()) {
198 auto it = std::find_if(samplerVars.cbegin(), samplerVars.cend(), [&var](const QShaderDescription::InOutVariable &v) {
199 return var.binding == v.binding;
200 });
201 if (it == samplerVars.cend())
202 samplerVars.append(var);
203 }
204 for (const QShaderDescription::InOutVariable &var : std::as_const(samplerVars))
205 maxSamplerBinding = qMax(maxSamplerBinding, var.binding);
206
207 if (maxSamplerBinding < 0)
208 return;
209
210 QBitArray samplerBindingsSpecified(maxSamplerBinding + 1);
211 const int customTexCount = pipeline->extraTextureCount();
212 for (int i = 0; i < customTexCount; ++i) {
213 const QSSGRhiTexture &t(pipeline->extraTextureAt(i));
214 const int samplerBinding = pipeline->bindingForTexture(t.name);
215 if (samplerBinding >= 0) {
216 samplerBindingsSpecified.setBit(samplerBinding);
217 QRhiSampler *sampler = rhiCtx->sampler(t.samplerDesc);
218 bindings.addTexture(samplerBinding, QRhiShaderResourceBinding::FragmentStage, t.texture, sampler);
219 }
220 }
221
222 // Samplers without a texture, such as a null Texture property, get a dummy
223 // texture of the type they are declared with.
224 QRhiSampler *dummySampler = nullptr;
225 for (const QShaderDescription::InOutVariable &var : std::as_const(samplerVars)) {
226 if (samplerBindingsSpecified.testBit(var.binding))
227 continue;
228 if (!dummySampler) {
229 dummySampler = rhiCtx->sampler({ QRhiSampler::Nearest, QRhiSampler::Nearest, QRhiSampler::None,
230 QRhiSampler::ClampToEdge, QRhiSampler::ClampToEdge, QRhiSampler::Repeat });
231 }
232 bindings.addTexture(var.binding, QRhiShaderResourceBinding::FragmentStage,
233 QSSGRhiHelpers::dummyTextureForSampler(rhiCtx, var.type, rub), dummySampler);
234 }
235}
236
237// Compiles a sky pipeline from the shared user fragment shader and a given vertex
238// variant. The user fragment is identical for the cube (IBL) and screen (background)
239// paths since it only reads qt_eyeDir; the stages differ in the vertex code and uniforms
240// and in the fragment main snippet (the screen path tonemaps the linear output for
241// display). cacheKeyTag keeps the variants from aliasing in the shader cache.
242QSSGRhiShaderPipelinePtr QSSGRenderSkyMaterial::buildPipeline(const QSSGRenderContextInterface &sgContext,
243 QByteArray vertexShader,
244 const QSSGShaderCustomMaterialAdapter::StringPairList &vertexViewDependentUniforms,
245 const QSSGShaderCustomMaterialAdapter::StringPairList &vertexUniforms,
246 const QByteArray &fragmentMainSnippet,
247 const QSSGShaderCustomMaterialAdapter::StringPairList &fragmentUniforms,
248 const QSSGShaderFeatures &features,
249 int viewCount,
250 const QByteArray &cacheKeyTag)
251{
252 const bool multiViewCompatible = viewCount >= 2;
253
254 QByteArray fragmentShader = (!fragmentShaderSource.isEmpty() ? fragmentShaderSource : QByteArray(debugFragStr)) + fragmentMainSnippet;
255
256 QSSGShaderCustomMaterialAdapter::StringPairList propertyBaseUniforms;
257 for (const auto &u : std::as_const(propertyUniforms))
258 propertyBaseUniforms.append({ u.typeName, u.name });
259
260 QSSGShaderCustomMaterialAdapter::StringPairList inputOutputs;
261 inputOutputs.append({ "vec3", "qt_eyeDir"_ba });
262
263 {
264 QSSGShaderCustomMaterialAdapter::StringPairList vertexBaseUniforms = propertyBaseUniforms;
265 vertexBaseUniforms.append(vertexUniforms.constData(), vertexUniforms.size());
266
267 QSSGShaderCustomMaterialAdapter::ShaderCodeAndMetaData result;
268 QByteArray buf;
269 QByteArrayList metadata;
270 QSSGShaderCustomMaterialAdapter::CustomShaderPrepWorkData scratch;
271 QSSGShaderCustomMaterialAdapter::beginPrepareCustomShader(&scratch, &result, vertexShader, QSSGShaderCache::ShaderType::Vertex, multiViewCompatible);
272 QSSGShaderCustomMaterialAdapter::finishPrepareCustomShader(&buf,
273 scratch,
274 result,
275 QSSGShaderCache::ShaderType::Vertex,
276 multiViewCompatible,
277 vertexBaseUniforms,
278 metadata,
279 { },
280 inputOutputs,
281 { },
282 vertexViewDependentUniforms);
283 vertexShader = result.first;
284 vertexShader.append(buf);
285 }
286
287 {
288 // Fragment uniforms (e.g. qt_skyExposure) are view-independent.
289 QSSGShaderCustomMaterialAdapter::StringPairList fragmentBaseUniforms = propertyBaseUniforms;
290 fragmentBaseUniforms.append(fragmentUniforms.constData(), fragmentUniforms.size());
291
292 QSSGShaderCustomMaterialAdapter::ShaderCodeAndMetaData result;
293 QByteArray buf;
294 QByteArrayList metadata;
295 QSSGShaderCustomMaterialAdapter::CustomShaderPrepWorkData scratch;
296 QSSGShaderCustomMaterialAdapter::beginPrepareCustomShader(&scratch, &result, fragmentShader, QSSGShaderCache::ShaderType::Fragment, multiViewCompatible);
297 QSSGShaderCustomMaterialAdapter::finishPrepareCustomShader(&buf,
298 scratch,
299 result,
300 QSSGShaderCache::ShaderType::Fragment,
301 multiViewCompatible,
302 fragmentBaseUniforms,
303 metadata,
304 inputOutputs,
305 { },
306 { },
307 { });
308 fragmentShader = result.first;
309 fragmentShader.append(buf);
310 }
311
312 auto generator = sgContext.shaderProgramGenerator().get();
313 auto shaderLib = sgContext.shaderLibraryManager().get();
314 auto shaderCache = sgContext.shaderCache().get();
315
316 generator->beginProgram();
317 auto vertex = generator->getStage(QSSGShaderGeneratorStage::Vertex);
318 vertex->addIncoming("attr_pos"_ba, "vec3"_ba);
319 vertex->append(vertexShader);
320
321 auto fragment = generator->getStage(QSSGShaderGeneratorStage::Fragment);
322 fragment->addInclude("tonemapping.glsllib"_ba);
323 fragment->append(fragmentShader);
324
325 const QByteArray key = shaderPathKey + cacheKeyTag + ':'
326 + QCryptographicHash::hash(QByteArray(vertexShader + fragmentShader), QCryptographicHash::Algorithm::Sha1).toHex();
327 return generator->compileGeneratedRhiShader(key, features, *shaderLib, *shaderCache, QSSGRhiShaderPipeline::UsedWithoutIa, { }, viewCount, false);
328}
329
330QSSGRhiShaderPipelinePtr QSSGRenderSkyMaterial::ensurePipeline(const QSSGRenderContextInterface &sgContext)
331{
332 if (iblPassPipeline && !isFragmentShaderDirty)
333 return iblPassPipeline;
334
335 if (!skyShaderTexturesReady(propertyUniforms, *sgContext.bufferManager().get()))
336 return nullptr;
337
338 QSSGShaderCustomMaterialAdapter::StringPairList vertexViewDependentUniforms;
339 vertexViewDependentUniforms.append({ "mat4"_ba, "qt_projectionMatrix"_ba });
340 vertexViewDependentUniforms.append({ "mat4"_ba, "qt_viewMatrix"_ba });
341
342 // The cube render stores linear radiance for IBL, so no tonemapping is applied
343 // (AcesTonemapping is set only to satisfy the tonemapping.glsllib include; the cube
344 // fragment never calls qt_tonemap).
345 QSSGShaderFeatures features;
346 features.set(QSSGShaderFeatures::Feature::AcesTonemapping, true);
347
348 iblPassPipeline = buildPipeline(sgContext, vertexShaderStr, vertexViewDependentUniforms, { }, mainFragmentSnippet, { }, features, 1, QByteArrayLiteral(":cube"));
349
350 isFragmentShaderDirty = false;
351
352 return iblPassPipeline;
353}
354
355QSSGRhiShaderPipelinePtr QSSGRenderSkyMaterial::ensureBackgroundPipeline(const QSSGRenderContextInterface &sgContext,
356 const QSSGShaderFeatures &tonemapFeatures,
357 quint32 tonemapKey,
358 int viewCount)
359{
360 if (backgroundPipeline && !isBackgroundShaderDirty && m_backgroundTonemapKey == tonemapKey
361 && m_backgroundViewCount == viewCount) {
362 return backgroundPipeline;
363 }
364
365 if (!skyShaderTexturesReady(propertyUniforms, *sgContext.bufferManager().get()))
366 return nullptr;
367
368 QSSGShaderCustomMaterialAdapter::StringPairList vertexViewDependentUniforms;
369 vertexViewDependentUniforms.append({ "mat4"_ba, "qt_inverseProjection"_ba });
370 vertexViewDependentUniforms.append({ "mat4"_ba, "qt_viewMatrix"_ba });
371
372 QSSGShaderCustomMaterialAdapter::StringPairList vertexUniforms;
373 vertexUniforms.append({ "float"_ba, "qt_adjustY"_ba });
374
375 QSSGShaderCustomMaterialAdapter::StringPairList fragmentUniforms;
376 fragmentUniforms.append({ "float"_ba, "qt_skyExposure"_ba });
377
378 backgroundPipeline = buildPipeline(sgContext, vertexShaderStrScreen, vertexViewDependentUniforms, vertexUniforms,
379 mainFragmentSnippetScreen, fragmentUniforms, tonemapFeatures, viewCount,
380 QByteArrayLiteral(":screen:") + QByteArray::number(tonemapKey)
381 + ':' + QByteArray::number(viewCount));
382
383 m_backgroundTonemapKey = tonemapKey;
384 m_backgroundViewCount = viewCount;
385 isBackgroundShaderDirty = false;
386
387 return backgroundPipeline;
388}
389
390quint32 QSSGRenderSkyMaterial::updateUniforms(const QSSGRenderContextInterface &sgContext,
391 QSSGPassKey passKey,
392 const QMatrix4x4 &mvp,
393 const QVarLengthArray<QMatrix4x4, 6> views,
394 QRhiResourceUpdateBatch *rub)
395{
396 constexpr int cMatrixSize = 64;
397
398 if (!iblPassPipeline)
399 return 0;
400
401 QSSGRhiContext *rhiCtx = sgContext.rhiContext().get();
402 QSSGRhiContextPrivate *rhiCtxD = QSSGRhiContextPrivate::get(rhiCtx);
403 // Keyed on the driving pass (the layer's sky material pass) and the
404 // material; the material must be the key's resource so that
405 // cleanupDrawCallDataForResource() finds the entry when it is destroyed.
406 QSSGRhiDrawCallData *dcd = &rhiCtxD->drawCallData({ passKey, nullptr, this, nullptr, 0 });
407
408 const int uniformStride = rhiCtx->rhi()->ubufAligned(iblPassPipeline->ub0Size());
409 const int totalBufferSize = uniformStride * 6;
410
411 if (!dcd->ubuf) {
412 dcd->ubuf = rhiCtx->rhi()->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, totalBufferSize);
413 dcd->ubuf->create();
414 }
415
416 char *ubufData = dcd->ubuf->beginFullDynamicBufferUpdateForCurrentFrame();
417 auto bufferManager = sgContext.bufferManager().get();
418
419 iblPassPipeline->resetExtraTextures();
420
421 for (const auto &u : std::as_const(propertyUniforms))
422 iblPassPipeline->setShaderResources(ubufData, *bufferManager, u.name, u.value, u.shaderDataType);
423
424 // same for all faces
425 iblPassPipeline->setShaderResources(ubufData, *bufferManager, "qt_projectionMatrix"_ba, mvp, QSSGRenderShaderValue::Type::Matrix4x4);
426 iblPassPipeline->setShaderResources(ubufData, *bufferManager, "qt_viewMatrix"_ba, views[0], QSSGRenderShaderValue::Type::Matrix4x4);
427
428 // Kinda hacky way of filling out all the views
429 // Copy first properties then clone these six times (each face)
430 // view matrix is the only unique property per face
431 const int viewMatrixOffset = iblPassPipeline->offsetOfUniform("qt_viewMatrix"_ba);
432
433 Q_ASSERT(ubufData != nullptr);
434 Q_ASSERT(totalBufferSize >= 6 * uniformStride); // buffer must hold all 6 faces
435 Q_ASSERT(uniformStride >= cMatrixSize); // view matrix fits
436 Q_ASSERT(viewMatrixOffset >= 0);
437 Q_ASSERT(viewMatrixOffset + cMatrixSize <= uniformStride);
438
439 auto buffer = QSpan<char>(ubufData, totalBufferSize);
440 auto firstFace = buffer.first(uniformStride);
441
442 for (int face = 1; face < 6; ++face) {
443 auto dst = buffer.sliced(face * uniformStride, uniformStride);
444
445 // Copy the entire first face block
446 std::copy(firstFace.begin(), firstFace.end(), dst.begin());
447
448 // Copy only the per-face view matrix
449 std::copy_n(reinterpret_cast<const char *>(views[face].constData()), cMatrixSize, dst.data() + viewMatrixOffset);
450 }
451 dcd->ubuf->endFullDynamicBufferUpdateForCurrentFrame();
452
453 rhiCtxD->releaseCachedSrb(bindings);
454 bindings = QSSGRhiShaderResourceBindingList();
455 bindings.addUniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, dcd->ubuf, 0, uniformStride, true);
456 appendCustomTextureBindings(iblPassPipeline.get(), bindings, rhiCtx, rub);
457
458 return uniformStride;
459}
460
461void QSSGRenderSkyMaterial::updateBackgroundUniforms(const QSSGRenderContextInterface &sgContext,
462 QSSGPassKey passKey,
463 const QVarLengthArray<QMatrix4x4, 2> &inverseProjections,
464 const QVarLengthArray<QMatrix4x4, 2> &viewRotations,
465 float adjustY,
466 float exposure,
467 QRhiResourceUpdateBatch *rub)
468{
469 if (!backgroundPipeline)
470 return;
471
472 QSSGRhiContext *rhiCtx = sgContext.rhiContext().get();
473 QSSGRhiContextPrivate *rhiCtxD = QSSGRhiContextPrivate::get(rhiCtx);
474 // Keyed on the driving pass (the layer's background pass) and the
475 // material; the material must be the key's resource so that
476 // cleanupDrawCallDataForResource() finds the entry when it is destroyed.
477 QSSGRhiDrawCallData *dcd = &rhiCtxD->drawCallData({ passKey, nullptr, this, nullptr, 0 });
478
479 const int bufferSize = rhiCtx->rhi()->ubufAligned(backgroundPipeline->ub0Size());
480
481 if (!dcd->ubuf) {
482 dcd->ubuf = rhiCtx->rhi()->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, bufferSize);
483 dcd->ubuf->create();
484 } else if (int(dcd->ubuf->size()) != bufferSize) {
485 // Resize in place. A new buffer would leave the srbs cached for the old one
486 // behind, as the cache only releases those when the draw call data goes away.
487 dcd->ubuf->setSize(bufferSize);
488 dcd->ubuf->create();
489 }
490
491 char *ubufData = dcd->ubuf->beginFullDynamicBufferUpdateForCurrentFrame();
492 auto bufferManager = sgContext.bufferManager().get();
493
494 backgroundPipeline->resetExtraTextures();
495
496 for (const auto &u : std::as_const(propertyUniforms))
497 backgroundPipeline->setShaderResources(ubufData, *bufferManager, u.name, u.value, u.shaderDataType);
498
499 backgroundPipeline->setShaderResources(ubufData, *bufferManager, "qt_adjustY"_ba, adjustY, QSSGRenderShaderValue::Type::Float);
500 backgroundPipeline->setShaderResources(ubufData, *bufferManager, "qt_skyExposure"_ba, exposure, QSSGRenderShaderValue::Type::Float);
501
502 constexpr int matSize = 64;
503 const int invProjOffset = backgroundPipeline->offsetOfUniform("qt_inverseProjection"_ba);
504 const int viewMatOffset = backgroundPipeline->offsetOfUniform("qt_viewMatrix"_ba);
505 const int viewCount = int(inverseProjections.size());
506 for (int v = 0; v < viewCount; ++v) {
507 if (invProjOffset >= 0)
508 std::copy_n(reinterpret_cast<const char *>(inverseProjections[v].constData()), matSize, ubufData + invProjOffset + v * matSize);
509 if (viewMatOffset >= 0)
510 std::copy_n(reinterpret_cast<const char *>(viewRotations[v].constData()), matSize, ubufData + viewMatOffset + v * matSize);
511 }
512
513 dcd->ubuf->endFullDynamicBufferUpdateForCurrentFrame();
514
515 rhiCtxD->releaseCachedSrb(backgroundBindings);
516 backgroundBindings = QSSGRhiShaderResourceBindingList();
517 backgroundBindings.addUniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, dcd->ubuf);
518 appendCustomTextureBindings(backgroundPipeline.get(), backgroundBindings, rhiCtx, rub);
519}
520
521QT_END_NAMESPACE
static const char * mainFragmentSnippetScreen
static const char * mainFragmentSnippet
static QT_BEGIN_NAMESPACE const char * vertexShaderStr
static void appendCustomTextureBindings(QSSGRhiShaderPipeline *pipeline, QSSGRhiShaderResourceBindingList &bindings, QSSGRhiContext *rhiCtx, QRhiResourceUpdateBatch *rub)
static const char * vertexShaderStrScreen
static bool skyShaderTexturesReady(const QList< QSSGBaseTypeProperty > &propertyUniforms, QSSGBufferManager &bufferManager)
static const char * debugFragStr