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
qrhi.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QRHI_H
5#define QRHI_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the RHI 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 <QtGui/qtguiglobal.h>
17#include <QtCore/qsize.h>
18#include <QtCore/qlist.h>
19#include <QtCore/qvarlengtharray.h>
20#include <QtCore/qthread.h>
21#include <QtGui/qmatrix4x4.h>
22#include <QtGui/qcolor.h>
23#include <QtGui/qimage.h>
24#include <functional>
25#include <array>
26
27#include <rhi/qshader.h>
28
30
31class QWindow;
32class QRhi;
34class QRhiBuffer;
36class QRhiTexture;
37class QRhiSampler;
41class QRhiSwapChain;
42
44{
45public:
48
49 float depthClearValue() const { return m_d; }
50 void setDepthClearValue(float d) { m_d = d; }
51
52 quint32 stencilClearValue() const { return m_s; }
54
55private:
56 float m_d = 1.0f;
57 quint32 m_s = 0;
58
60 {
61 return a.m_d == b.m_d && a.m_s == b.m_s;
62 }
63
65 {
66 return !(a == b);
67 }
68
69 friend size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed = 0) noexcept
70 {
72 seed = hash(seed, v.m_d);
73 seed = hash(seed, v.m_s);
74 return seed;
75 }
76};
77
79
80#ifndef QT_NO_DEBUG_STREAM
82#endif
83
84class Q_GUI_EXPORT QRhiViewport
85{
86public:
87 QRhiViewport() = default;
88 QRhiViewport(float x, float y, float w, float h, float minDepth = 0.0f, float maxDepth = 1.0f);
89
90 std::array<float, 4> viewport() const { return m_rect; }
91 void setViewport(float x, float y, float w, float h) {
92 m_rect[0] = x; m_rect[1] = y; m_rect[2] = w; m_rect[3] = h;
93 }
94
95 float minDepth() const { return m_minDepth; }
96 void setMinDepth(float minDepth) { m_minDepth = minDepth; }
97
98 float maxDepth() const { return m_maxDepth; }
99 void setMaxDepth(float maxDepth) { m_maxDepth = maxDepth; }
100
101private:
102 std::array<float, 4> m_rect { { 0.0f, 0.0f, 0.0f, 0.0f } };
103 float m_minDepth = 0.0f;
104 float m_maxDepth = 1.0f;
105
106 friend bool operator==(const QRhiViewport &a, const QRhiViewport &b) noexcept
107 {
108 return a.m_rect == b.m_rect
109 && a.m_minDepth == b.m_minDepth
110 && a.m_maxDepth == b.m_maxDepth;
111 }
112
113 friend bool operator!=(const QRhiViewport &a, const QRhiViewport &b) noexcept
114 {
115 return !(a == b);
116 }
117
118 friend size_t qHash(const QRhiViewport &v, size_t seed = 0) noexcept
119 {
121 seed = hash(seed, v.m_rect[0]);
122 seed = hash(seed, v.m_rect[1]);
123 seed = hash(seed, v.m_rect[2]);
124 seed = hash(seed, v.m_rect[3]);
125 seed = hash(seed, v.m_minDepth);
126 seed = hash(seed, v.m_maxDepth);
127 return seed;
128 }
129};
130
132
133#ifndef QT_NO_DEBUG_STREAM
134Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiViewport &);
135#endif
136
137class Q_GUI_EXPORT QRhiScissor
138{
139public:
140 QRhiScissor() = default;
141 QRhiScissor(int x, int y, int w, int h);
142
143 std::array<int, 4> scissor() const { return m_rect; }
144 void setScissor(int x, int y, int w, int h) {
145 m_rect[0] = x; m_rect[1] = y; m_rect[2] = w; m_rect[3] = h;
146 }
147
148private:
149 std::array<int, 4> m_rect { { 0, 0, 0, 0 } };
150
151 friend bool operator==(const QRhiScissor &a, const QRhiScissor &b) noexcept
152 {
153 return a.m_rect == b.m_rect;
154 }
155
156 friend bool operator!=(const QRhiScissor &a, const QRhiScissor &b) noexcept
157 {
158 return !(a == b);
159 }
160
161 friend size_t qHash(const QRhiScissor &v, size_t seed = 0) noexcept
162 {
164 seed = hash(seed, v.m_rect[0]);
165 seed = hash(seed, v.m_rect[1]);
166 seed = hash(seed, v.m_rect[2]);
167 seed = hash(seed, v.m_rect[3]);
168 return seed;
169 }
170};
171
173
174#ifndef QT_NO_DEBUG_STREAM
175Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiScissor &);
176#endif
177
178class Q_GUI_EXPORT QRhiVertexInputBinding
179{
180public:
183 PerInstance
184 };
185
187 QRhiVertexInputBinding(quint32 stride, Classification cls = PerVertex, quint32 stepRate = 1);
188
189 quint32 stride() const { return m_stride; }
190 void setStride(quint32 s) { m_stride = s; }
191
192 Classification classification() const { return m_classification; }
193 void setClassification(Classification c) { m_classification = c; }
194
195 quint32 instanceStepRate() const { return m_instanceStepRate; }
196 void setInstanceStepRate(quint32 rate) { m_instanceStepRate = rate; }
197
198private:
199 quint32 m_stride = 0;
200 Classification m_classification = PerVertex;
201 quint32 m_instanceStepRate = 1;
202
203 friend bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept
204 {
205 return a.m_stride == b.m_stride
206 && a.m_classification == b.m_classification
207 && a.m_instanceStepRate == b.m_instanceStepRate;
208 }
209
210 friend bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept
211 {
212 return !(a == b);
213 }
214
215 friend size_t qHash(const QRhiVertexInputBinding &v, size_t seed = 0) noexcept
216 {
218 seed = hash(seed, v.m_stride);
219 seed = hash(seed, v.m_classification);
220 seed = hash(seed, v.m_instanceStepRate);
221 return seed;
222 }
223};
224
226
227#ifndef QT_NO_DEBUG_STREAM
228Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputBinding &);
229#endif
230
231class Q_GUI_EXPORT QRhiVertexInputAttribute
232{
233public:
263
265 QRhiVertexInputAttribute(int binding, int location, Format format, quint32 offset, int matrixSlice = -1);
266
267 int binding() const { return m_binding; }
268 void setBinding(int b) { m_binding = b; }
269
270 int location() const { return m_location; }
271 void setLocation(int loc) { m_location = loc; }
272
273 Format format() const { return m_format; }
274 void setFormat(Format f) { m_format = f; }
275
276 quint32 offset() const { return m_offset; }
277 void setOffset(quint32 ofs) { m_offset = ofs; }
278
279 int matrixSlice() const { return m_matrixSlice; }
280 void setMatrixSlice(int slice) { m_matrixSlice = slice; }
281
282private:
283 int m_binding = 0;
284 int m_location = 0;
285 Format m_format = Float4;
286 quint32 m_offset = 0;
287 int m_matrixSlice = -1;
288
290 {
291 return a.m_binding == b.m_binding
292 && a.m_location == b.m_location
293 && a.m_format == b.m_format
294 && a.m_offset == b.m_offset;
295 // matrixSlice excluded intentionally
296 }
297
299 {
300 return !(a == b);
301 }
302
303 friend size_t qHash(const QRhiVertexInputAttribute &v, size_t seed = 0) noexcept
304 {
306 seed = hash(seed, v.m_binding);
307 seed = hash(seed, v.m_location);
308 seed = hash(seed, v.m_format);
309 seed = hash(seed, v.m_offset);
310 return seed;
311 }
312};
313
315
316#ifndef QT_NO_DEBUG_STREAM
317Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputAttribute &);
318#endif
319
320class Q_GUI_EXPORT QRhiVertexInputLayout
321{
322public:
324
325 void setBindings(std::initializer_list<QRhiVertexInputBinding> list) { m_bindings = list; }
326 template<typename InputIterator>
327 void setBindings(InputIterator first, InputIterator last)
328 {
329 m_bindings.clear();
330 std::copy(first, last, std::back_inserter(m_bindings));
331 }
332 const QRhiVertexInputBinding *cbeginBindings() const { return m_bindings.cbegin(); }
333 const QRhiVertexInputBinding *cendBindings() const { return m_bindings.cend(); }
334 const QRhiVertexInputBinding *bindingAt(qsizetype index) const { return &m_bindings.at(index); }
335 qsizetype bindingCount() const { return m_bindings.count(); }
336
337 void setAttributes(std::initializer_list<QRhiVertexInputAttribute> list) { m_attributes = list; }
338 template<typename InputIterator>
339 void setAttributes(InputIterator first, InputIterator last)
340 {
341 m_attributes.clear();
342 std::copy(first, last, std::back_inserter(m_attributes));
343 }
344 const QRhiVertexInputAttribute *cbeginAttributes() const { return m_attributes.cbegin(); }
345 const QRhiVertexInputAttribute *cendAttributes() const { return m_attributes.cend(); }
346 const QRhiVertexInputAttribute *attributeAt(qsizetype index) const { return &m_attributes.at(index); }
347 qsizetype attributeCount() const { return m_attributes.count(); }
348
349private:
350 QVarLengthArray<QRhiVertexInputBinding, 8> m_bindings;
351 QVarLengthArray<QRhiVertexInputAttribute, 8> m_attributes;
352
353 friend bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept
354 {
355 return a.m_bindings == b.m_bindings && a.m_attributes == b.m_attributes;
356 }
357
358 friend bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept
359 {
360 return !(a == b);
361 }
362
363 friend size_t qHash(const QRhiVertexInputLayout &v, size_t seed = 0) noexcept
364 {
366 seed = hash(seed, v.m_bindings);
367 seed = hash(seed, v.m_attributes);
368 return seed;
369 }
370
371 friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &);
372};
373
374#ifndef QT_NO_DEBUG_STREAM
375Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &);
376#endif
377
378class Q_GUI_EXPORT QRhiShaderStage
379{
380public:
389
390 QRhiShaderStage() = default;
393
394 Type type() const { return m_type; }
395 void setType(Type t) { m_type = t; }
396
397 QShader shader() const { return m_shader; }
398 void setShader(const QShader &s) { m_shader = s; }
399
400 QShader::Variant shaderVariant() const { return m_shaderVariant; }
401 void setShaderVariant(QShader::Variant v) { m_shaderVariant = v; }
402
403private:
404 Type m_type = Vertex;
405 QShader m_shader;
407
408 friend bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept
409 {
410 return a.m_type == b.m_type
411 && a.m_shader == b.m_shader
412 && a.m_shaderVariant == b.m_shaderVariant;
413 }
414
415 friend bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept
416 {
417 return !(a == b);
418 }
419
420 friend size_t qHash(const QRhiShaderStage &v, size_t seed = 0) noexcept
421 {
423 seed = hash(seed, v.m_type);
424 seed = hash(seed, v.m_shader);
425 seed = hash(seed, v.m_shaderVariant);
426 return seed;
427 }
428};
429
431
432#ifndef QT_NO_DEBUG_STREAM
433Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderStage &);
434#endif
435
437
439{
440public:
453
455 VertexStage = 1 << 0,
456 TessellationControlStage = 1 << 1,
457 TessellationEvaluationStage = 1 << 2,
458 GeometryStage = 1 << 3,
459 FragmentStage = 1 << 4,
460 ComputeStage = 1 << 5
461 };
462 Q_DECLARE_FLAGS(StageFlags, StageFlag)
463
465
466 bool isLayoutCompatible(const QRhiShaderResourceBinding &other) const;
467
468 static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf);
469 static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size);
470 static QRhiShaderResourceBinding uniformBufferWithDynamicOffset(int binding, StageFlags stage, QRhiBuffer *buf, quint32 size);
471
472 static QRhiShaderResourceBinding sampledTexture(int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler);
473
478 static QRhiShaderResourceBinding sampledTextures(int binding, StageFlags stage, int count, const TextureAndSampler *texSamplers);
479
480 static QRhiShaderResourceBinding texture(int binding, StageFlags stage, QRhiTexture *tex);
481 static QRhiShaderResourceBinding textures(int binding, StageFlags stage, int count, QRhiTexture **tex);
482 static QRhiShaderResourceBinding sampler(int binding, StageFlags stage, QRhiSampler *sampler);
483
484 static QRhiShaderResourceBinding imageLoad(int binding, StageFlags stage, QRhiTexture *tex, int level);
485 static QRhiShaderResourceBinding imageStore(int binding, StageFlags stage, QRhiTexture *tex, int level);
486 static QRhiShaderResourceBinding imageLoadStore(int binding, StageFlags stage, QRhiTexture *tex, int level);
487
488 static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf);
489 static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size);
490 static QRhiShaderResourceBinding bufferStore(int binding, StageFlags stage, QRhiBuffer *buf);
491 static QRhiShaderResourceBinding bufferStore(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size);
492 static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf);
493 static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size);
494
495 struct Data
496 {
498 QRhiShaderResourceBinding::StageFlags stage;
506 static constexpr int MAX_TEX_SAMPLER_ARRAY_SIZE = 16;
508 int count;
509 TextureAndSampler texSamplers[MAX_TEX_SAMPLER_ARRAY_SIZE];
510 };
520 union {
525 } u;
526
527 int arraySize() const
528 {
530 ? u.stex.count
531 : 1;
532 }
533
534 template<typename Output>
535 Output serialize(Output dst) const
536 {
537 // must write out exactly LAYOUT_DESC_ENTRIES_PER_BINDING elements here
538 *dst++ = quint32(binding);
539 *dst++ = quint32(stage);
540 *dst++ = quint32(type);
541 *dst++ = quint32(arraySize());
542 return dst;
543 }
544 };
545
546 static constexpr int LAYOUT_DESC_ENTRIES_PER_BINDING = 4;
547
548 template<typename Output>
550 const QRhiShaderResourceBinding *last,
551 Output dst)
552 {
553 while (first != last) {
554 dst = first->d.serialize(dst);
555 ++first;
556 }
557 }
558
559private:
560 Data d;
561 friend class QRhiImplementation;
562};
563
564Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiShaderResourceBinding::StageFlags)
565
567
568Q_GUI_EXPORT bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept;
569Q_GUI_EXPORT bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept;
570Q_GUI_EXPORT size_t qHash(const QRhiShaderResourceBinding &b, size_t seed = 0) noexcept;
571#ifndef QT_NO_DEBUG_STREAM
573#endif
574
575class Q_GUI_EXPORT QRhiColorAttachment
576{
577public:
581
582 QRhiTexture *texture() const { return m_texture; }
583 void setTexture(QRhiTexture *tex) { m_texture = tex; }
584
585 QRhiRenderBuffer *renderBuffer() const { return m_renderBuffer; }
586 void setRenderBuffer(QRhiRenderBuffer *rb) { m_renderBuffer = rb; }
587
588 int layer() const { return m_layer; }
589 void setLayer(int layer) { m_layer = layer; }
590
591 int level() const { return m_level; }
592 void setLevel(int level) { m_level = level; }
593
594 QRhiTexture *resolveTexture() const { return m_resolveTexture; }
595 void setResolveTexture(QRhiTexture *tex) { m_resolveTexture = tex; }
596
597 int resolveLayer() const { return m_resolveLayer; }
598 void setResolveLayer(int layer) { m_resolveLayer = layer; }
599
600 int resolveLevel() const { return m_resolveLevel; }
601 void setResolveLevel(int level) { m_resolveLevel = level; }
602
603 int multiViewCount() const { return m_multiViewCount; }
604 void setMultiViewCount(int count) { m_multiViewCount = count; }
605
606private:
607 QRhiTexture *m_texture = nullptr;
608 QRhiRenderBuffer *m_renderBuffer = nullptr;
609 int m_layer = 0;
610 int m_level = 0;
611 QRhiTexture *m_resolveTexture = nullptr;
612 int m_resolveLayer = 0;
613 int m_resolveLevel = 0;
614 int m_multiViewCount = 0;
615};
616
618
620{
621public:
624 QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment, QRhiRenderBuffer *depthStencilBuffer);
625 QRhiTextureRenderTargetDescription(const QRhiColorAttachment &colorAttachment, QRhiTexture *depthTexture);
626
627 void setColorAttachments(std::initializer_list<QRhiColorAttachment> list) { m_colorAttachments = list; }
628 template<typename InputIterator>
629 void setColorAttachments(InputIterator first, InputIterator last)
630 {
631 m_colorAttachments.clear();
632 std::copy(first, last, std::back_inserter(m_colorAttachments));
633 }
634 const QRhiColorAttachment *cbeginColorAttachments() const { return m_colorAttachments.cbegin(); }
635 const QRhiColorAttachment *cendColorAttachments() const { return m_colorAttachments.cend(); }
636 const QRhiColorAttachment *colorAttachmentAt(qsizetype index) const { return &m_colorAttachments.at(index); }
637 qsizetype colorAttachmentCount() const { return m_colorAttachments.count(); }
638
639 QRhiRenderBuffer *depthStencilBuffer() const { return m_depthStencilBuffer; }
640 void setDepthStencilBuffer(QRhiRenderBuffer *renderBuffer) { m_depthStencilBuffer = renderBuffer; }
641
642 QRhiTexture *depthTexture() const { return m_depthTexture; }
643 void setDepthTexture(QRhiTexture *texture) { m_depthTexture = texture; }
644
645 QRhiTexture *depthResolveTexture() const { return m_depthResolveTexture; }
646 void setDepthResolveTexture(QRhiTexture *tex) { m_depthResolveTexture = tex; }
647
648private:
649 QVarLengthArray<QRhiColorAttachment, 8> m_colorAttachments;
650 QRhiRenderBuffer *m_depthStencilBuffer = nullptr;
651 QRhiTexture *m_depthTexture = nullptr;
652 QRhiTexture *m_depthResolveTexture = nullptr;
653};
654
656{
657public:
662
663 QImage image() const { return m_image; }
664 void setImage(const QImage &image) { m_image = image; }
665
666 QByteArray data() const { return m_data; }
667 void setData(const QByteArray &data) { m_data = data; }
668
669 quint32 dataStride() const { return m_dataStride; }
670 void setDataStride(quint32 stride) { m_dataStride = stride; }
671
672 QPoint destinationTopLeft() const { return m_destinationTopLeft; }
673 void setDestinationTopLeft(const QPoint &p) { m_destinationTopLeft = p; }
674
675 QSize sourceSize() const { return m_sourceSize; }
676 void setSourceSize(const QSize &size) { m_sourceSize = size; }
677
678 QPoint sourceTopLeft() const { return m_sourceTopLeft; }
679 void setSourceTopLeft(const QPoint &p) { m_sourceTopLeft = p; }
680
681private:
682 QImage m_image;
684 quint32 m_dataStride = 0;
685 QPoint m_destinationTopLeft;
686 QSize m_sourceSize;
687 QPoint m_sourceTopLeft;
688};
689
691
692class Q_GUI_EXPORT QRhiTextureUploadEntry
693{
694public:
697
698 int layer() const { return m_layer; }
699 void setLayer(int layer) { m_layer = layer; }
700
701 int level() const { return m_level; }
702 void setLevel(int level) { m_level = level; }
703
705 void setDescription(const QRhiTextureSubresourceUploadDescription &desc) { m_desc = desc; }
706
707private:
708 int m_layer = 0;
709 int m_level = 0;
711};
712
714
716{
717public:
720 QRhiTextureUploadDescription(std::initializer_list<QRhiTextureUploadEntry> list);
721
722 void setEntries(std::initializer_list<QRhiTextureUploadEntry> list) { m_entries = list; }
723 template<typename InputIterator>
724 void setEntries(InputIterator first, InputIterator last)
725 {
726 m_entries.clear();
727 std::copy(first, last, std::back_inserter(m_entries));
728 }
729 const QRhiTextureUploadEntry *cbeginEntries() const { return m_entries.cbegin(); }
730 const QRhiTextureUploadEntry *cendEntries() const { return m_entries.cend(); }
731 const QRhiTextureUploadEntry *entryAt(qsizetype index) const { return &m_entries.at(index); }
732 qsizetype entryCount() const { return m_entries.count(); }
733
734private:
735 QVarLengthArray<QRhiTextureUploadEntry, 16> m_entries;
736};
737
739{
740public:
742
743 QSize pixelSize() const { return m_pixelSize; }
744 void setPixelSize(const QSize &sz) { m_pixelSize = sz; }
745
746 int sourceLayer() const { return m_sourceLayer; }
747 void setSourceLayer(int layer) { m_sourceLayer = layer; }
748
749 int sourceLevel() const { return m_sourceLevel; }
750 void setSourceLevel(int level) { m_sourceLevel = level; }
751
752 QPoint sourceTopLeft() const { return m_sourceTopLeft; }
753 void setSourceTopLeft(const QPoint &p) { m_sourceTopLeft = p; }
754
755 int destinationLayer() const { return m_destinationLayer; }
756 void setDestinationLayer(int layer) { m_destinationLayer = layer; }
757
758 int destinationLevel() const { return m_destinationLevel; }
759 void setDestinationLevel(int level) { m_destinationLevel = level; }
760
761 QPoint destinationTopLeft() const { return m_destinationTopLeft; }
762 void setDestinationTopLeft(const QPoint &p) { m_destinationTopLeft = p; }
763
764private:
765 QSize m_pixelSize;
766 int m_sourceLayer = 0;
767 int m_sourceLevel = 0;
768 QPoint m_sourceTopLeft;
769 int m_destinationLayer = 0;
770 int m_destinationLevel = 0;
771 QPoint m_destinationTopLeft;
772};
773
775
776class Q_GUI_EXPORT QRhiReadbackDescription
777{
778public:
781
782 QRhiTexture *texture() const { return m_texture; }
783 void setTexture(QRhiTexture *tex) { m_texture = tex; }
784
785 int layer() const { return m_layer; }
786 void setLayer(int layer) { m_layer = layer; }
787
788 int level() const { return m_level; }
789 void setLevel(int level) { m_level = level; }
790
791private:
792 QRhiTexture *m_texture = nullptr;
793 int m_layer = 0;
794 int m_level = 0;
795};
796
798
799struct Q_GUI_EXPORT QRhiNativeHandles
800{
801};
802
803class Q_GUI_EXPORT QRhiResource
804{
805public:
820
821 virtual ~QRhiResource();
822
823 virtual Type resourceType() const = 0;
824
825 virtual void destroy() = 0;
826
827 void deleteLater();
828
829 QByteArray name() const;
830 void setName(const QByteArray &name);
831
832 quint64 globalResourceId() const;
833
834 QRhi *rhi() const;
835
836protected:
838 Q_DISABLE_COPY(QRhiResource)
839 friend class QRhiImplementation;
840 QRhiImplementation *m_rhi = nullptr;
842 QByteArray m_objectName;
843};
844
845class Q_GUI_EXPORT QRhiBuffer : public QRhiResource
846{
847public:
848 enum Type {
851 Dynamic
852 };
853
855 VertexBuffer = 1 << 0,
856 IndexBuffer = 1 << 1,
857 UniformBuffer = 1 << 2,
858 StorageBuffer = 1 << 3
859 };
860 Q_DECLARE_FLAGS(UsageFlags, UsageFlag)
861
863 const void *objects[3];
865 };
866
867 QRhiResource::Type resourceType() const override;
868
869 Type type() const { return m_type; }
870 void setType(Type t) { m_type = t; }
871
872 UsageFlags usage() const { return m_usage; }
873 void setUsage(UsageFlags u) { m_usage = u; }
874
875 quint32 size() const { return m_size; }
876 void setSize(quint32 sz) { m_size = sz; }
877
878 virtual bool create() = 0;
879
880 virtual NativeBuffer nativeBuffer();
881
882 virtual char *beginFullDynamicBufferUpdateForCurrentFrame();
883 virtual void endFullDynamicBufferUpdateForCurrentFrame();
884
885protected:
886 QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, quint32 size_);
888 UsageFlags m_usage;
890};
891
892Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiBuffer::UsageFlags)
893
894class Q_GUI_EXPORT QRhiTexture : public QRhiResource
895{
896public:
897 enum Flag {
898 RenderTarget = 1 << 0,
899 CubeMap = 1 << 2,
900 MipMapped = 1 << 3,
901 sRGB = 1 << 4,
902 UsedAsTransferSource = 1 << 5,
903 UsedWithGenerateMips = 1 << 6,
904 UsedWithLoadStore = 1 << 7,
905 UsedAsCompressedAtlas = 1 << 8,
906 ExternalOES = 1 << 9,
907 ThreeDimensional = 1 << 10,
908 TextureRectangleGL = 1 << 11,
909 TextureArray = 1 << 12,
910 OneDimensional = 1 << 13
911 };
913
964
967 int layout; // or state
968 };
969
970 QRhiResource::Type resourceType() const override;
971
972 Format format() const { return m_format; }
973 void setFormat(Format fmt) { m_format = fmt; }
974
975 QSize pixelSize() const { return m_pixelSize; }
976 void setPixelSize(const QSize &sz) { m_pixelSize = sz; }
977
978 int depth() const { return m_depth; }
979 void setDepth(int depth) { m_depth = depth; }
980
981 int arraySize() const { return m_arraySize; }
982 void setArraySize(int arraySize) { m_arraySize = arraySize; }
983
984 int arrayRangeStart() const { return m_arrayRangeStart; }
985 int arrayRangeLength() const { return m_arrayRangeLength; }
986 void setArrayRange(int startIndex, int count)
987 {
988 m_arrayRangeStart = startIndex;
989 m_arrayRangeLength = count;
990 }
991
992 Flags flags() const { return m_flags; }
993 void setFlags(Flags f) { m_flags = f; }
994
995 int sampleCount() const { return m_sampleCount; }
996 void setSampleCount(int s) { m_sampleCount = s; }
997
1002 ViewFormat readViewFormat() const { return m_readViewFormat; }
1003 void setReadViewFormat(const ViewFormat &fmt) { m_readViewFormat = fmt; }
1004 ViewFormat writeViewFormat() const { return m_writeViewFormat; }
1005 void setWriteViewFormat(const ViewFormat &fmt) { m_writeViewFormat = fmt; }
1006
1007 virtual bool create() = 0;
1008 virtual NativeTexture nativeTexture();
1009 virtual bool createFrom(NativeTexture src);
1010 virtual void setNativeLayout(int layout);
1011
1012protected:
1013 QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_, int depth_,
1014 int arraySize_, int sampleCount_, Flags flags_);
1021 int m_arrayRangeStart = -1;
1022 int m_arrayRangeLength = -1;
1023 ViewFormat m_readViewFormat = { UnknownFormat, false };
1024 ViewFormat m_writeViewFormat = { UnknownFormat, false };
1025};
1026
1027Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiTexture::Flags)
1028
1029class Q_GUI_EXPORT QRhiSampler : public QRhiResource
1030{
1031public:
1037
1043
1054
1055 QRhiResource::Type resourceType() const override;
1056
1057 Filter magFilter() const { return m_magFilter; }
1058 void setMagFilter(Filter f) { m_magFilter = f; }
1059
1060 Filter minFilter() const { return m_minFilter; }
1061 void setMinFilter(Filter f) { m_minFilter = f; }
1062
1063 Filter mipmapMode() const { return m_mipmapMode; }
1064 void setMipmapMode(Filter f) { m_mipmapMode = f; }
1065
1066 AddressMode addressU() const { return m_addressU; }
1067 void setAddressU(AddressMode mode) { m_addressU = mode; }
1068
1069 AddressMode addressV() const { return m_addressV; }
1070 void setAddressV(AddressMode mode) { m_addressV = mode; }
1071
1072 AddressMode addressW() const { return m_addressW; }
1073 void setAddressW(AddressMode mode) { m_addressW = mode; }
1074
1075 CompareOp textureCompareOp() const { return m_compareOp; }
1076 void setTextureCompareOp(CompareOp op) { m_compareOp = op; }
1077
1078 virtual bool create() = 0;
1079
1080protected:
1082 Filter magFilter_, Filter minFilter_, Filter mipmapMode_,
1091};
1092
1093class Q_GUI_EXPORT QRhiRenderBuffer : public QRhiResource
1094{
1095public:
1096 enum Type {
1098 Color
1100
1101 enum Flag {
1102 UsedWithSwapChainOnly = 1 << 0
1104 Q_DECLARE_FLAGS(Flags, Flag)
1105
1109
1110 QRhiResource::Type resourceType() const override;
1111
1112 Type type() const { return m_type; }
1113 void setType(Type t) { m_type = t; }
1114
1115 QSize pixelSize() const { return m_pixelSize; }
1116 void setPixelSize(const QSize &sz) { m_pixelSize = sz; }
1117
1118 int sampleCount() const { return m_sampleCount; }
1119 void setSampleCount(int s) { m_sampleCount = s; }
1120
1121 Flags flags() const { return m_flags; }
1122 void setFlags(Flags f) { m_flags = f; }
1123
1124 virtual bool create() = 0;
1125 virtual bool createFrom(NativeRenderBuffer src);
1126
1128
1129protected:
1130 QRhiRenderBuffer(QRhiImplementation *rhi, Type type_, const QSize &pixelSize_,
1131 int sampleCount_, Flags flags_, QRhiTexture::Format backingFormatHint_);
1137};
1138
1139Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiRenderBuffer::Flags)
1140
1141class Q_GUI_EXPORT QRhiRenderPassDescriptor : public QRhiResource
1142{
1143public:
1144 QRhiResource::Type resourceType() const override;
1145
1146 virtual bool isCompatible(const QRhiRenderPassDescriptor *other) const = 0;
1147 virtual const QRhiNativeHandles *nativeHandles();
1148
1150
1151 virtual QVector<quint32> serializedFormat() const = 0;
1152
1153protected:
1155};
1156
1157class Q_GUI_EXPORT QRhiRenderTarget : public QRhiResource
1158{
1159public:
1160 virtual QSize pixelSize() const = 0;
1161 virtual float devicePixelRatio() const = 0;
1162 virtual int sampleCount() const = 0;
1163
1164 QRhiRenderPassDescriptor *renderPassDescriptor() const { return m_renderPassDesc; }
1165 void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) { m_renderPassDesc = desc; }
1166
1167protected:
1169 QRhiRenderPassDescriptor *m_renderPassDesc = nullptr;
1170};
1171
1173{
1174public:
1175 QRhiResource::Type resourceType() const override;
1176 QRhiSwapChain *swapChain() const { return m_swapchain; }
1177
1178protected:
1181};
1182
1184{
1185public:
1186 enum Flag {
1187 PreserveColorContents = 1 << 0,
1188 PreserveDepthStencilContents = 1 << 1,
1189 DoNotStoreDepthStencilContents = 1 << 2
1191 Q_DECLARE_FLAGS(Flags, Flag)
1192
1193 QRhiResource::Type resourceType() const override;
1194
1196 void setDescription(const QRhiTextureRenderTargetDescription &desc) { m_desc = desc; }
1197
1198 Flags flags() const { return m_flags; }
1199 void setFlags(Flags f) { m_flags = f; }
1200
1202
1203 virtual bool create() = 0;
1204
1205protected:
1209};
1210
1211Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiTextureRenderTarget::Flags)
1212
1213class Q_GUI_EXPORT QRhiShaderResourceBindings : public QRhiResource
1214{
1215public:
1216 QRhiResource::Type resourceType() const override;
1217
1218 void setBindings(std::initializer_list<QRhiShaderResourceBinding> list) { m_bindings = list; }
1219 template<typename InputIterator>
1220 void setBindings(InputIterator first, InputIterator last)
1221 {
1222 m_bindings.clear();
1223 std::copy(first, last, std::back_inserter(m_bindings));
1224 }
1225 const QRhiShaderResourceBinding *cbeginBindings() const { return m_bindings.cbegin(); }
1226 const QRhiShaderResourceBinding *cendBindings() const { return m_bindings.cend(); }
1227 const QRhiShaderResourceBinding *bindingAt(qsizetype index) const { return &m_bindings.at(index); }
1228 qsizetype bindingCount() const { return m_bindings.count(); }
1229
1230 bool isLayoutCompatible(const QRhiShaderResourceBindings *other) const;
1231
1232 QVector<quint32> serializedLayoutDescription() const { return m_layoutDesc; }
1233
1234 virtual bool create() = 0;
1235
1237 BindingsAreSorted = 0x01
1239 Q_DECLARE_FLAGS(UpdateFlags, UpdateFlag)
1240
1241 virtual void updateResources(UpdateFlags flags = {}) = 0;
1242
1243protected:
1244 static constexpr int BINDING_PREALLOC = 12;
1246 QVarLengthArray<QRhiShaderResourceBinding, BINDING_PREALLOC> m_bindings;
1247 size_t m_layoutDescHash = 0;
1248 // Intentionally not using QVLA for m_layoutDesc: clients like Qt Quick are much
1249 // better served with an implicitly shared container here, because they will likely
1250 // throw this directly into structs serving as cache keys.
1251 QVector<quint32> m_layoutDesc;
1253#ifndef QT_NO_DEBUG_STREAM
1254 friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBindings &);
1255#endif
1256};
1257
1258Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiShaderResourceBindings::UpdateFlags)
1259
1260#ifndef QT_NO_DEBUG_STREAM
1261Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBindings &);
1262#endif
1263
1264// The proper name. Until it gets rolled out universally, have the better name
1265// as a typedef. Eventually it should be reversed (the old name being a typedef
1266// to the new one).
1268
1269class Q_GUI_EXPORT QRhiGraphicsPipeline : public QRhiResource
1270{
1271public:
1272 enum Flag {
1273 UsesBlendConstants = 1 << 0,
1274 UsesStencilRef = 1 << 1,
1275 UsesScissor = 1 << 2,
1276 CompileShadersWithDebugInfo = 1 << 3
1278 Q_DECLARE_FLAGS(Flags, Flag)
1279
1289
1295
1298 CW
1300
1302 R = 1 << 0,
1303 G = 1 << 1,
1304 B = 1 << 2,
1305 A = 1 << 3
1307 Q_DECLARE_FLAGS(ColorMask, ColorMaskComponent)
1308
1330
1338
1340 ColorMask colorWrite = ColorMask(0xF); // R | G | B | A
1341 bool enable = false;
1342 BlendFactor srcColor = One;
1343 BlendFactor dstColor = OneMinusSrcAlpha;
1344 BlendOp opColor = Add;
1346 BlendFactor dstAlpha = OneMinusSrcAlpha;
1347 BlendOp opAlpha = Add;
1348 };
1349
1360
1371
1373 StencilOp failOp = Keep;
1374 StencilOp depthFailOp = Keep;
1375 StencilOp passOp = Keep;
1376 CompareOp compareOp = Always;
1377 };
1378
1383
1384 QRhiResource::Type resourceType() const override;
1385
1386 Flags flags() const { return m_flags; }
1387 void setFlags(Flags f) { m_flags = f; }
1388
1389 Topology topology() const { return m_topology; }
1390 void setTopology(Topology t) { m_topology = t; }
1391
1392 CullMode cullMode() const { return m_cullMode; }
1393 void setCullMode(CullMode mode) { m_cullMode = mode; }
1394
1395 FrontFace frontFace() const { return m_frontFace; }
1396 void setFrontFace(FrontFace f) { m_frontFace = f; }
1397
1398 void setTargetBlends(std::initializer_list<TargetBlend> list) { m_targetBlends = list; }
1399 template<typename InputIterator>
1400 void setTargetBlends(InputIterator first, InputIterator last)
1401 {
1402 m_targetBlends.clear();
1403 std::copy(first, last, std::back_inserter(m_targetBlends));
1404 }
1405 const TargetBlend *cbeginTargetBlends() const { return m_targetBlends.cbegin(); }
1406 const TargetBlend *cendTargetBlends() const { return m_targetBlends.cend(); }
1407 const TargetBlend *targetBlendAt(qsizetype index) const { return &m_targetBlends.at(index); }
1408 qsizetype targetBlendCount() const { return m_targetBlends.count(); }
1409
1410 bool hasDepthTest() const { return m_depthTest; }
1411 void setDepthTest(bool enable) { m_depthTest = enable; }
1412
1413 bool hasDepthWrite() const { return m_depthWrite; }
1414 void setDepthWrite(bool enable) { m_depthWrite = enable; }
1415
1416 CompareOp depthOp() const { return m_depthOp; }
1417 void setDepthOp(CompareOp op) { m_depthOp = op; }
1418
1419 bool hasStencilTest() const { return m_stencilTest; }
1420 void setStencilTest(bool enable) { m_stencilTest = enable; }
1421
1422 StencilOpState stencilFront() const { return m_stencilFront; }
1423 void setStencilFront(const StencilOpState &state) { m_stencilFront = state; }
1424
1425 StencilOpState stencilBack() const { return m_stencilBack; }
1426 void setStencilBack(const StencilOpState &state) { m_stencilBack = state; }
1427
1428 quint32 stencilReadMask() const { return m_stencilReadMask; }
1429 void setStencilReadMask(quint32 mask) { m_stencilReadMask = mask; }
1430
1431 quint32 stencilWriteMask() const { return m_stencilWriteMask; }
1432 void setStencilWriteMask(quint32 mask) { m_stencilWriteMask = mask; }
1433
1434 int sampleCount() const { return m_sampleCount; }
1435 void setSampleCount(int s) { m_sampleCount = s; }
1436
1437 float lineWidth() const { return m_lineWidth; }
1438 void setLineWidth(float width) { m_lineWidth = width; }
1439
1440 int depthBias() const { return m_depthBias; }
1441 void setDepthBias(int bias) { m_depthBias = bias; }
1442
1443 float slopeScaledDepthBias() const { return m_slopeScaledDepthBias; }
1444 void setSlopeScaledDepthBias(float bias) { m_slopeScaledDepthBias = bias; }
1445
1446 void setShaderStages(std::initializer_list<QRhiShaderStage> list) { m_shaderStages = list; }
1447 template<typename InputIterator>
1448 void setShaderStages(InputIterator first, InputIterator last)
1449 {
1450 m_shaderStages.clear();
1451 std::copy(first, last, std::back_inserter(m_shaderStages));
1452 }
1453 const QRhiShaderStage *cbeginShaderStages() const { return m_shaderStages.cbegin(); }
1454 const QRhiShaderStage *cendShaderStages() const { return m_shaderStages.cend(); }
1455 const QRhiShaderStage *shaderStageAt(qsizetype index) const { return &m_shaderStages.at(index); }
1456 qsizetype shaderStageCount() const { return m_shaderStages.count(); }
1457
1458 QRhiVertexInputLayout vertexInputLayout() const { return m_vertexInputLayout; }
1459 void setVertexInputLayout(const QRhiVertexInputLayout &layout) { m_vertexInputLayout = layout; }
1460
1461 QRhiShaderResourceBindings *shaderResourceBindings() const { return m_shaderResourceBindings; }
1462 void setShaderResourceBindings(QRhiShaderResourceBindings *srb) { m_shaderResourceBindings = srb; }
1463
1464 QRhiRenderPassDescriptor *renderPassDescriptor() const { return m_renderPassDesc; }
1465 void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) { m_renderPassDesc = desc; }
1466
1467 int patchControlPointCount() const { return m_patchControlPointCount; }
1468 void setPatchControlPointCount(int count) { m_patchControlPointCount = count; }
1469
1470 PolygonMode polygonMode() const {return m_polygonMode; }
1471 void setPolygonMode(PolygonMode mode) {m_polygonMode = mode; }
1472
1473 int multiViewCount() const { return m_multiViewCount; }
1474 void setMultiViewCount(int count) { m_multiViewCount = count; }
1475
1476 virtual bool create() = 0;
1477
1478protected:
1481 Topology m_topology = Triangles;
1482 CullMode m_cullMode = None;
1483 FrontFace m_frontFace = CCW;
1484 QVarLengthArray<TargetBlend, 8> m_targetBlends;
1485 bool m_depthTest = false;
1486 bool m_depthWrite = false;
1487 CompareOp m_depthOp = Less;
1488 bool m_stencilTest = false;
1491 quint32 m_stencilReadMask = 0xFF;
1492 quint32 m_stencilWriteMask = 0xFF;
1493 int m_sampleCount = 1;
1494 float m_lineWidth = 1.0f;
1495 int m_depthBias = 0;
1496 float m_slopeScaledDepthBias = 0.0f;
1497 int m_patchControlPointCount = 3;
1498 PolygonMode m_polygonMode = Fill;
1499 int m_multiViewCount = 0;
1500 QVarLengthArray<QRhiShaderStage, 4> m_shaderStages;
1502 QRhiShaderResourceBindings *m_shaderResourceBindings = nullptr;
1503 QRhiRenderPassDescriptor *m_renderPassDesc = nullptr;
1504};
1505
1506Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiGraphicsPipeline::Flags)
1507Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiGraphicsPipeline::ColorMask)
1509
1511{
1514 ColorComponentValue
1516
1519 DisplayReferred
1521
1523 union {
1524 struct {
1527 } luminanceInNits;
1528 struct {
1531 } colorComponentValue;
1532 } limits;
1535};
1536
1538
1539#ifndef QT_NO_DEBUG_STREAM
1540Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiSwapChainHdrInfo &);
1541#endif
1542
1544{
1545 void *reserved[2] = {};
1546};
1547
1548class Q_GUI_EXPORT QRhiSwapChain : public QRhiResource
1549{
1550public:
1551 enum Flag {
1552 SurfaceHasPreMulAlpha = 1 << 0,
1553 SurfaceHasNonPreMulAlpha = 1 << 1,
1554 sRGB = 1 << 2,
1555 UsedAsTransferSource = 1 << 3,
1556 NoVSync = 1 << 4,
1557 MinimalBufferCount = 1 << 5
1559 Q_DECLARE_FLAGS(Flags, Flag)
1560
1561 enum Format {
1565 HDRExtendedDisplayP3Linear
1567
1570 RightBuffer
1572
1573 QRhiResource::Type resourceType() const override;
1574
1575 QWindow *window() const { return m_window; }
1576 void setWindow(QWindow *window) { m_window = window; }
1577
1578 QRhiSwapChainProxyData proxyData() const { return m_proxyData; }
1579 void setProxyData(const QRhiSwapChainProxyData &d) { m_proxyData = d; }
1580
1581 Flags flags() const { return m_flags; }
1582 void setFlags(Flags f) { m_flags = f; }
1583
1584 Format format() const { return m_format; }
1585 void setFormat(Format f) { m_format = f; }
1586
1587 QRhiRenderBuffer *depthStencil() const { return m_depthStencil; }
1588 void setDepthStencil(QRhiRenderBuffer *ds) { m_depthStencil = ds; }
1589
1590 int sampleCount() const { return m_sampleCount; }
1591 void setSampleCount(int samples) { m_sampleCount = samples; }
1592
1593 QRhiRenderPassDescriptor *renderPassDescriptor() const { return m_renderPassDesc; }
1594 void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) { m_renderPassDesc = desc; }
1595
1596 QSize currentPixelSize() const { return m_currentPixelSize; }
1597
1600 virtual QRhiRenderTarget *currentFrameRenderTarget(StereoTargetBuffer targetBuffer);
1602 virtual bool isFormatSupported(Format f) = 0;
1604 virtual bool createOrResize() = 0;
1605 virtual QRhiSwapChainHdrInfo hdrInfo();
1606
1607protected:
1609 QWindow *m_window = nullptr;
1611 Format m_format = SDR;
1612 QRhiRenderBuffer *m_depthStencil = nullptr;
1613 int m_sampleCount = 1;
1614 QRhiRenderPassDescriptor *m_renderPassDesc = nullptr;
1617};
1618
1619Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiSwapChain::Flags)
1620
1621class Q_GUI_EXPORT QRhiComputePipeline : public QRhiResource
1622{
1623public:
1624 enum Flag {
1625 CompileShadersWithDebugInfo = 1 << 0
1627 Q_DECLARE_FLAGS(Flags, Flag)
1628
1629 QRhiResource::Type resourceType() const override;
1630 virtual bool create() = 0;
1631
1632 Flags flags() const { return m_flags; }
1633 void setFlags(Flags f) { m_flags = f; }
1634
1635 QRhiShaderStage shaderStage() const { return m_shaderStage; }
1636 void setShaderStage(const QRhiShaderStage &stage) { m_shaderStage = stage; }
1637
1638 QRhiShaderResourceBindings *shaderResourceBindings() const { return m_shaderResourceBindings; }
1639 void setShaderResourceBindings(QRhiShaderResourceBindings *srb) { m_shaderResourceBindings = srb; }
1640
1641protected:
1645 QRhiShaderResourceBindings *m_shaderResourceBindings = nullptr;
1646};
1647
1648Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiComputePipeline::Flags)
1649
1650class Q_GUI_EXPORT QRhiCommandBuffer : public QRhiResource
1651{
1652public:
1655 IndexUInt32
1657
1659 ExternalContent = 0x01,
1660 DoNotTrackResourcesForCompute = 0x02
1662 Q_DECLARE_FLAGS(BeginPassFlags, BeginPassFlag)
1663
1664 QRhiResource::Type resourceType() const override;
1665
1666 void resourceUpdate(QRhiResourceUpdateBatch *resourceUpdates);
1667
1668 void beginPass(QRhiRenderTarget *rt,
1669 const QColor &colorClearValue,
1670 const QRhiDepthStencilClearValue &depthStencilClearValue,
1671 QRhiResourceUpdateBatch *resourceUpdates = nullptr,
1672 BeginPassFlags flags = {});
1673 void endPass(QRhiResourceUpdateBatch *resourceUpdates = nullptr);
1674
1675 void setGraphicsPipeline(QRhiGraphicsPipeline *ps);
1676 using DynamicOffset = QPair<int, quint32>; // binding, offset
1677 void setShaderResources(QRhiShaderResourceBindings *srb = nullptr,
1678 int dynamicOffsetCount = 0,
1679 const DynamicOffset *dynamicOffsets = nullptr);
1680 using VertexInput = QPair<QRhiBuffer *, quint32>; // buffer, offset
1681 void setVertexInput(int startBinding, int bindingCount, const VertexInput *bindings,
1682 QRhiBuffer *indexBuf = nullptr, quint32 indexOffset = 0,
1683 IndexFormat indexFormat = IndexUInt16);
1684
1685 void setViewport(const QRhiViewport &viewport);
1686 void setScissor(const QRhiScissor &scissor);
1687 void setBlendConstants(const QColor &c);
1688 void setStencilRef(quint32 refValue);
1689
1690 void draw(quint32 vertexCount,
1692 quint32 firstVertex = 0,
1693 quint32 firstInstance = 0);
1694
1695 void drawIndexed(quint32 indexCount,
1697 quint32 firstIndex = 0,
1698 qint32 vertexOffset = 0,
1699 quint32 firstInstance = 0);
1700
1701 void debugMarkBegin(const QByteArray &name);
1702 void debugMarkEnd();
1703 void debugMarkMsg(const QByteArray &msg);
1704
1705 void beginComputePass(QRhiResourceUpdateBatch *resourceUpdates = nullptr, BeginPassFlags flags = {});
1706 void endComputePass(QRhiResourceUpdateBatch *resourceUpdates = nullptr);
1707 void setComputePipeline(QRhiComputePipeline *ps);
1708 void dispatch(int x, int y, int z);
1709
1710 const QRhiNativeHandles *nativeHandles();
1711 void beginExternal();
1712 void endExternal();
1713
1714 double lastCompletedGpuTime();
1715
1716protected:
1718};
1719
1720Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiCommandBuffer::BeginPassFlags)
1721
1722struct Q_GUI_EXPORT QRhiReadbackResult
1723{
1724 std::function<void()> completed = nullptr;
1728};
1729
1730class Q_GUI_EXPORT QRhiResourceUpdateBatch
1731{
1732public:
1734
1735 void release();
1736
1737 void merge(QRhiResourceUpdateBatch *other);
1738 bool hasOptimalCapacity() const;
1739
1740 void updateDynamicBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data);
1741 void uploadStaticBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data);
1742 void uploadStaticBuffer(QRhiBuffer *buf, const void *data);
1744 void uploadTexture(QRhiTexture *tex, const QRhiTextureUploadDescription &desc);
1745 void uploadTexture(QRhiTexture *tex, const QImage &image);
1747 void readBackTexture(const QRhiReadbackDescription &rb, QRhiReadbackResult *result);
1748 void generateMips(QRhiTexture *tex);
1749
1750private:
1752 Q_DISABLE_COPY(QRhiResourceUpdateBatch)
1755 friend class QRhi;
1756};
1757
1774
1776
1777#ifndef QT_NO_DEBUG_STREAM
1778Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiDriverInfo &);
1779#endif
1780
1781struct Q_GUI_EXPORT QRhiStats
1782{
1783 qint64 totalPipelineCreationTime = 0;
1784 // Vulkan or D3D12 memory allocator statistics
1785 quint32 blockCount = 0;
1786 quint32 allocCount = 0;
1787 quint64 usedBytes = 0;
1788 quint64 unusedBytes = 0;
1789 // D3D12 only, from IDXGIAdapter3::QueryVideoMemoryInfo(), incl. all resources
1790 quint64 totalUsageBytes = 0;
1791};
1792
1794
1795#ifndef QT_NO_DEBUG_STREAM
1796Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiStats &);
1797#endif
1798
1799struct Q_GUI_EXPORT QRhiInitParams
1800{
1801};
1802
1803class Q_GUI_EXPORT QRhi
1804{
1805public:
1814
1815 enum Flag {
1816 EnableDebugMarkers = 1 << 0,
1817 PreferSoftwareRenderer = 1 << 1,
1818 EnablePipelineCacheDataSave = 1 << 2,
1819 EnableTimestamps = 1 << 3,
1820 SuppressSmokeTestWarnings = 1 << 4
1822 Q_DECLARE_FLAGS(Flags, Flag)
1823
1825 FrameOpSuccess = 0,
1828 FrameOpDeviceLost
1830
1876
1878 };
1879 Q_DECLARE_FLAGS(BeginFrameFlags, BeginFrameFlag)
1880
1882 SkipPresent = 1 << 0
1884 Q_DECLARE_FLAGS(EndFrameFlags, EndFrameFlag)
1885
1902
1903 ~QRhi();
1904
1905 static QRhi *create(Implementation impl,
1907 Flags flags = {},
1908 QRhiNativeHandles *importDevice = nullptr);
1909 static bool probe(Implementation impl, QRhiInitParams *params);
1910
1911 Implementation backend() const;
1912 const char *backendName() const;
1913 static const char *backendName(Implementation impl);
1914 QRhiDriverInfo driverInfo() const;
1915 QThread *thread() const;
1916
1917 using CleanupCallback = std::function<void(QRhi *)>;
1918 void addCleanupCallback(const CleanupCallback &callback);
1919 void addCleanupCallback(const void *key, const CleanupCallback &callback);
1920 void removeCleanupCallback(const void *key);
1921 void runCleanup();
1922
1924 QRhiComputePipeline *newComputePipeline();
1925 QRhiShaderResourceBindings *newShaderResourceBindings();
1926
1927 QRhiBuffer *newBuffer(QRhiBuffer::Type type,
1928 QRhiBuffer::UsageFlags usage,
1929 quint32 size);
1930
1932 const QSize &pixelSize,
1933 int sampleCount = 1,
1934 QRhiRenderBuffer::Flags flags = {},
1936
1938 const QSize &pixelSize,
1939 int sampleCount = 1,
1940 QRhiTexture::Flags flags = {});
1941
1943 int width, int height, int depth,
1944 int sampleCount = 1,
1945 QRhiTexture::Flags flags = {});
1946
1947 QRhiTexture *newTextureArray(QRhiTexture::Format format,
1948 int arraySize,
1949 const QSize &pixelSize,
1950 int sampleCount = 1,
1951 QRhiTexture::Flags flags = {});
1952
1953 QRhiSampler *newSampler(QRhiSampler::Filter magFilter,
1954 QRhiSampler::Filter minFilter,
1955 QRhiSampler::Filter mipmapMode,
1956 QRhiSampler::AddressMode addressU,
1957 QRhiSampler::AddressMode addressV,
1959
1960 QRhiTextureRenderTarget *newTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
1961 QRhiTextureRenderTarget::Flags flags = {});
1962
1963 QRhiSwapChain *newSwapChain();
1964 FrameOpResult beginFrame(QRhiSwapChain *swapChain, BeginFrameFlags flags = {});
1965 FrameOpResult endFrame(QRhiSwapChain *swapChain, EndFrameFlags flags = {});
1966 bool isRecordingFrame() const;
1967 int currentFrameSlot() const;
1968
1969 FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, BeginFrameFlags flags = {});
1970 FrameOpResult endOffscreenFrame(EndFrameFlags flags = {});
1971
1972 QRhi::FrameOpResult finish();
1973
1974 QRhiResourceUpdateBatch *nextResourceUpdateBatch();
1975
1976 QList<int> supportedSampleCounts() const;
1977
1978 int ubufAlignment() const;
1979 int ubufAligned(int v) const;
1980
1981 static int mipLevelsForSize(const QSize &size);
1982 static QSize sizeForMipLevel(int mipLevel, const QSize &baseLevelSize);
1983
1984 bool isYUpInFramebuffer() const;
1985 bool isYUpInNDC() const;
1986 bool isClipDepthZeroToOne() const;
1987
1988 QMatrix4x4 clipSpaceCorrMatrix() const;
1989
1990 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags = {}) const;
1991 bool isFeatureSupported(QRhi::Feature feature) const;
1992 int resourceLimit(ResourceLimit limit) const;
1993
1994 const QRhiNativeHandles *nativeHandles();
1995 bool makeThreadLocalNativeContextCurrent();
1996
1997 static constexpr int MAX_MIP_LEVELS = 16; // -> max width or height is 65536
1998
1999 void releaseCachedResources();
2000
2001 bool isDeviceLost() const;
2002
2003 QByteArray pipelineCacheData();
2004 void setPipelineCacheData(const QByteArray &data);
2005
2006 QRhiStats statistics() const;
2007
2008 static QRhiSwapChainProxyData updateSwapChainProxyData(Implementation impl, QWindow *window);
2009
2010protected:
2011 QRhi();
2012
2013private:
2014 Q_DISABLE_COPY(QRhi)
2015 QRhiImplementation *d = nullptr;
2016};
2017
2019Q_DECLARE_OPERATORS_FOR_FLAGS(QRhi::BeginFrameFlags)
2020Q_DECLARE_OPERATORS_FOR_FLAGS(QRhi::EndFrameFlags)
2021
2023
2024#include <rhi/qrhi_platform.h>
2025
2026#endif
NSData * m_data
\inmodule QtCore
Definition qbytearray.h:57
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
\inmodule QtGui
Definition qimage.h:37
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtGui
Definition qrhi.h:846
void setUsage(UsageFlags u)
Sets the buffer's usage flags to u.
Definition qrhi.h:873
UsageFlags m_usage
Definition qrhi.h:888
Type m_type
Definition qrhi.h:887
quint32 size() const
Definition qrhi.h:875
void setType(Type t)
Sets the buffer's type to t.
Definition qrhi.h:870
Type
Specifies storage type of buffer resource.
Definition qrhi.h:848
@ Immutable
Definition qrhi.h:849
@ Static
Definition qrhi.h:850
UsageFlags usage() const
Definition qrhi.h:872
UsageFlag
Flag values to specify how the buffer is going to be used.
Definition qrhi.h:854
Type type() const
Definition qrhi.h:869
void setSize(quint32 sz)
Sets the size of the buffer in bytes.
Definition qrhi.h:876
virtual bool create()=0
Creates the corresponding native graphics resources.
quint32 m_size
Definition qrhi.h:889
\inmodule QtGui
Definition qrhi.h:576
void setTexture(QRhiTexture *tex)
Sets the texture tex.
Definition qrhi.h:583
QRhiRenderBuffer * renderBuffer() const
Definition qrhi.h:585
int multiViewCount() const
Definition qrhi.h:603
QRhiColorAttachment()=default
Constructs an empty color attachment description.
int resolveLevel() const
Definition qrhi.h:600
QRhiTexture * texture() const
Definition qrhi.h:582
void setLevel(int level)
Sets the mip level.
Definition qrhi.h:592
void setRenderBuffer(QRhiRenderBuffer *rb)
Sets the renderbuffer rb.
Definition qrhi.h:586
int resolveLayer() const
Definition qrhi.h:597
QRhiTexture * resolveTexture() const
Definition qrhi.h:594
void setLayer(int layer)
Sets the layer index.
Definition qrhi.h:589
int level() const
Definition qrhi.h:591
void setResolveLayer(int layer)
Sets the resolve texture layer to use.
Definition qrhi.h:598
void setMultiViewCount(int count)
Sets the view count.
Definition qrhi.h:604
void setResolveLevel(int level)
Sets the resolve texture mip level to use.
Definition qrhi.h:601
void setResolveTexture(QRhiTexture *tex)
Sets the resolve texture tex.
Definition qrhi.h:595
int layer() const
Definition qrhi.h:588
\inmodule QtGui
Definition qrhi.h:1651
BeginPassFlag
Flag values for QRhi::beginPass()
Definition qrhi.h:1658
QPair< int, quint32 > DynamicOffset
Synonym for QPair<int, quint32>.
Definition qrhi.h:1676
QPair< QRhiBuffer *, quint32 > VertexInput
Synonym for QPair<QRhiBuffer *, quint32>.
Definition qrhi.h:1680
IndexFormat
Specifies the index data type.
Definition qrhi.h:1653
\inmodule QtGui
Definition qrhi.h:1622
Flags flags() const
Definition qrhi.h:1632
QRhiShaderStage m_shaderStage
Definition qrhi.h:1644
virtual bool create()=0
void setShaderStage(const QRhiShaderStage &stage)
Sets the shader to use.
Definition qrhi.h:1636
QRhiShaderResourceBindings * shaderResourceBindings() const
Definition qrhi.h:1638
QRhiShaderStage shaderStage() const
Definition qrhi.h:1635
Flag
Flag values for describing pipeline options.
Definition qrhi.h:1624
void setFlags(Flags f)
Sets the flags f.
Definition qrhi.h:1633
void setShaderResourceBindings(QRhiShaderResourceBindings *srb)
Associates with srb describing the resource binding layout and the resources (QRhiBuffer,...
Definition qrhi.h:1639
\inmodule QtGui
Definition qrhi.h:44
friend bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept
Definition qrhi.h:64
friend size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed=0) noexcept
Definition qrhi.h:69
void setDepthClearValue(float d)
Sets the depth clear value to d.
Definition qrhi.h:50
friend bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept
Definition qrhi.h:59
float depthClearValue() const
Definition qrhi.h:49
quint32 stencilClearValue() const
Definition qrhi.h:52
QRhiDepthStencilClearValue()=default
Constructs a depth/stencil clear value with depth clear value 1.0f and stencil clear value 0.
void setStencilClearValue(quint32 s)
Sets the stencil clear value to s.
Definition qrhi.h:53
\inmodule QtGui
Definition qrhi.h:1270
Flag
Flag values for describing the dynamic state of the pipeline, and other options.
Definition qrhi.h:1272
BlendOp
Specifies the blend operation.
Definition qrhi.h:1331
void setStencilFront(const StencilOpState &state)
Sets the stencil test state for front faces.
Definition qrhi.h:1423
void setCullMode(CullMode mode)
Sets the specified face culling mode.
Definition qrhi.h:1393
void setFrontFace(FrontFace f)
Sets the front face mode f.
Definition qrhi.h:1396
StencilOpState stencilBack() const
Definition qrhi.h:1425
PolygonMode
Specifies the polygon rasterization mode.
Definition qrhi.h:1379
const QRhiShaderStage * cendShaderStages() const
Definition qrhi.h:1454
void setTargetBlends(std::initializer_list< TargetBlend > list)
Sets the list of render target blend settings.
Definition qrhi.h:1398
FrontFace
Specifies the front face winding order.
Definition qrhi.h:1296
void setStencilTest(bool enable)
Enables or disables stencil tests based on enable.
Definition qrhi.h:1420
const TargetBlend * cendTargetBlends() const
Definition qrhi.h:1406
BlendFactor
Specifies the blend factor.
Definition qrhi.h:1309
StencilOpState m_stencilFront
Definition qrhi.h:1489
void setDepthWrite(bool enable)
Controls the writing out of depth data into the depth buffer based on enable.
Definition qrhi.h:1414
bool hasDepthWrite() const
Definition qrhi.h:1413
void setShaderResourceBindings(QRhiShaderResourceBindings *srb)
Associates with srb describing the resource binding layout and the resources (QRhiBuffer,...
Definition qrhi.h:1462
QRhiShaderResourceBindings * shaderResourceBindings() const
Definition qrhi.h:1461
void setDepthOp(CompareOp op)
Sets the depth comparison function op.
Definition qrhi.h:1417
CompareOp
Specifies the depth or stencil comparison function.
Definition qrhi.h:1350
int patchControlPointCount() const
Definition qrhi.h:1467
void setSlopeScaledDepthBias(float bias)
Sets the slope scaled depth bias.
Definition qrhi.h:1444
void setVertexInputLayout(const QRhiVertexInputLayout &layout)
Specifies the vertex input layout.
Definition qrhi.h:1459
const TargetBlend * cbeginTargetBlends() const
Definition qrhi.h:1405
CullMode
Specifies the culling mode.
Definition qrhi.h:1290
void setStencilReadMask(quint32 mask)
Sets the stencil read mask.
Definition qrhi.h:1429
QVarLengthArray< QRhiShaderStage, 4 > m_shaderStages
Definition qrhi.h:1500
Flags flags() const
Definition qrhi.h:1386
bool hasDepthTest() const
Definition qrhi.h:1410
void setFlags(Flags f)
Sets the flags f.
Definition qrhi.h:1387
void setShaderStages(std::initializer_list< QRhiShaderStage > list)
Sets the list of shader stages.
Definition qrhi.h:1446
QRhiVertexInputLayout m_vertexInputLayout
Definition qrhi.h:1501
bool hasStencilTest() const
Definition qrhi.h:1419
QRhiRenderPassDescriptor * renderPassDescriptor() const
Definition qrhi.h:1464
QVarLengthArray< TargetBlend, 8 > m_targetBlends
Definition qrhi.h:1484
void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc)
Associates with the specified QRhiRenderPassDescriptor desc.
Definition qrhi.h:1465
int depthBias() const
Definition qrhi.h:1440
const QRhiShaderStage * shaderStageAt(qsizetype index) const
Definition qrhi.h:1455
void setSampleCount(int s)
Sets the sample count.
Definition qrhi.h:1435
FrontFace frontFace() const
Definition qrhi.h:1395
void setShaderStages(InputIterator first, InputIterator last)
Sets the list of shader stages from the iterators first and last.
Definition qrhi.h:1448
void setTopology(Topology t)
Sets the primitive topology t.
Definition qrhi.h:1390
quint32 stencilWriteMask() const
Definition qrhi.h:1431
void setTargetBlends(InputIterator first, InputIterator last)
Sets the list of render target blend settings from the iterators first and last.
Definition qrhi.h:1400
void setMultiViewCount(int count)
Sets the view count for multiview rendering.
Definition qrhi.h:1474
QRhiVertexInputLayout vertexInputLayout() const
Definition qrhi.h:1458
CullMode cullMode() const
Definition qrhi.h:1392
void setPatchControlPointCount(int count)
Sets the number of patch control points to count.
Definition qrhi.h:1468
Topology
Specifies the primitive topology.
Definition qrhi.h:1280
CompareOp depthOp() const
Definition qrhi.h:1416
StencilOpState m_stencilBack
Definition qrhi.h:1490
int sampleCount() const
Definition qrhi.h:1434
quint32 stencilReadMask() const
Definition qrhi.h:1428
const TargetBlend * targetBlendAt(qsizetype index) const
Definition qrhi.h:1407
float lineWidth() const
Definition qrhi.h:1437
virtual bool create()=0
Creates the corresponding native graphics resources.
PolygonMode polygonMode() const
Definition qrhi.h:1470
qsizetype shaderStageCount() const
Definition qrhi.h:1456
void setDepthTest(bool enable)
Enables or disables depth testing based on enable.
Definition qrhi.h:1411
void setDepthBias(int bias)
Sets the depth bias.
Definition qrhi.h:1441
void setPolygonMode(PolygonMode mode)
Sets the polygon mode.
Definition qrhi.h:1471
ColorMaskComponent
Flag values for specifying the color write mask.
Definition qrhi.h:1301
StencilOp
Specifies the stencil operation.
Definition qrhi.h:1361
float slopeScaledDepthBias() const
Definition qrhi.h:1443
void setLineWidth(float width)
Sets the line width.
Definition qrhi.h:1438
StencilOpState stencilFront() const
Definition qrhi.h:1422
void setStencilWriteMask(quint32 mask)
Sets the stencil write mask.
Definition qrhi.h:1432
int multiViewCount() const
Definition qrhi.h:1473
Topology topology() const
Definition qrhi.h:1389
const QRhiShaderStage * cbeginShaderStages() const
Definition qrhi.h:1453
qsizetype targetBlendCount() const
Definition qrhi.h:1408
void setStencilBack(const StencilOpState &state)
Sets the stencil test state for back faces.
Definition qrhi.h:1426
\inmodule QtGui
Definition qrhi.h:777
QRhiReadbackDescription()=default
Constructs an empty texture readback description.
int layer() const
Definition qrhi.h:785
QRhiTexture * texture() const
Definition qrhi.h:782
void setLayer(int layer)
Sets the array layer to read back.
Definition qrhi.h:786
void setLevel(int level)
Sets the mip level to read back.
Definition qrhi.h:789
void setTexture(QRhiTexture *tex)
Sets the texture tex as the source of the readback operation.
Definition qrhi.h:783
int level() const
Definition qrhi.h:788
\inmodule QtGui
Definition qrhi.h:1094
Flags flags() const
Definition qrhi.h:1121
void setPixelSize(const QSize &sz)
Sets the size (in pixels) to sz.
Definition qrhi.h:1116
QSize pixelSize() const
Definition qrhi.h:1115
void setFlags(Flags f)
Sets the flags to f.
Definition qrhi.h:1122
virtual QRhiTexture::Format backingFormat() const =0
void setType(Type t)
Sets the type to t.
Definition qrhi.h:1113
int sampleCount() const
Definition qrhi.h:1118
int m_sampleCount
Definition qrhi.h:1134
QRhiTexture::Format m_backingFormatHint
Definition qrhi.h:1136
QSize m_pixelSize
Definition qrhi.h:1133
void setSampleCount(int s)
Sets the sample count to s.
Definition qrhi.h:1119
Type
Specifies the type of the renderbuffer.
Definition qrhi.h:1096
virtual bool create()=0
Creates the corresponding native graphics resources.
Flag
\variable QRhiRenderBuffer::NativeRenderBuffer::object
Definition qrhi.h:1101
Flags m_flags
Definition qrhi.h:1135
Type type() const
Definition qrhi.h:1112
\inmodule QtGui
Definition qrhi.h:1142
virtual QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() const =0
virtual bool isCompatible(const QRhiRenderPassDescriptor *other) const =0
virtual QVector< quint32 > serializedFormat() const =0
\inmodule QtGui
Definition qrhi.h:1158
void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc)
Sets the QRhiRenderPassDescriptor desc for use with this render target.
Definition qrhi.h:1165
virtual QSize pixelSize() const =0
QRhiRenderPassDescriptor * renderPassDescriptor() const
Definition qrhi.h:1164
virtual int sampleCount() const =0
virtual float devicePixelRatio() const =0
\inmodule QtGui
Definition qrhi.h:1731
\inmodule QtGui
Definition qrhi.h:804
Type
Specifies type of the resource.
Definition qrhi.h:806
@ RenderBuffer
Definition qrhi.h:810
@ RenderPassDescriptor
Definition qrhi.h:811
@ SwapChain
Definition qrhi.h:816
@ ComputePipeline
Definition qrhi.h:817
@ SwapChainRenderTarget
Definition qrhi.h:812
@ GraphicsPipeline
Definition qrhi.h:815
@ TextureRenderTarget
Definition qrhi.h:813
@ ShaderResourceBindings
Definition qrhi.h:814
virtual void destroy()=0
Releases (or requests deferred releasing of) the underlying native graphics resources.
virtual Type resourceType() const =0
\inmodule QtGui
Definition qrhi.h:1030
AddressMode addressV() const
Definition qrhi.h:1069
void setMipmapMode(Filter f)
Sets the mipmap filter mode to f.
Definition qrhi.h:1064
void setAddressW(AddressMode mode)
Sets the depth wrap mode.
Definition qrhi.h:1073
virtual bool create()=0
Filter m_minFilter
Definition qrhi.h:1085
Filter
Specifies the minification, magnification, or mipmap filtering.
Definition qrhi.h:1032
AddressMode m_addressV
Definition qrhi.h:1088
Filter magFilter() const
Definition qrhi.h:1057
Filter m_mipmapMode
Definition qrhi.h:1086
AddressMode m_addressU
Definition qrhi.h:1087
AddressMode
Specifies the addressing mode.
Definition qrhi.h:1038
@ ClampToEdge
Definition qrhi.h:1040
void setMinFilter(Filter f)
Sets the minification filter mode to f.
Definition qrhi.h:1061
CompareOp
Specifies the texture comparison function.
Definition qrhi.h:1044
@ LessOrEqual
Definition qrhi.h:1048
@ GreaterOrEqual
Definition qrhi.h:1051
Filter minFilter() const
Definition qrhi.h:1060
Filter mipmapMode() const
Definition qrhi.h:1063
AddressMode addressW() const
Definition qrhi.h:1072
void setTextureCompareOp(CompareOp op)
Sets the texture comparison function op.
Definition qrhi.h:1076
CompareOp m_compareOp
Definition qrhi.h:1090
void setAddressU(AddressMode mode)
Sets the horizontal wrap mode.
Definition qrhi.h:1067
AddressMode addressU() const
Definition qrhi.h:1066
AddressMode m_addressW
Definition qrhi.h:1089
CompareOp textureCompareOp() const
Definition qrhi.h:1075
void setAddressV(AddressMode mode)
Sets the vertical wrap mode.
Definition qrhi.h:1070
Filter m_magFilter
Definition qrhi.h:1084
void setMagFilter(Filter f)
Sets the magnification filter mode to f.
Definition qrhi.h:1058
\inmodule QtGui
Definition qrhi.h:138
friend size_t qHash(const QRhiScissor &v, size_t seed=0) noexcept
Definition qrhi.h:161
void setScissor(int x, int y, int w, int h)
Sets the scissor position and size to x, y, w, h.
Definition qrhi.h:144
std::array< int, 4 > scissor() const
Definition qrhi.h:143
friend bool operator==(const QRhiScissor &a, const QRhiScissor &b) noexcept
Definition qrhi.h:151
friend bool operator!=(const QRhiScissor &a, const QRhiScissor &b) noexcept
Definition qrhi.h:156
QRhiScissor()=default
Constructs an empty scissor.
\inmodule QtGui
Definition qrhi.h:439
Type
Specifies type of the shader resource bound to a binding point.
Definition qrhi.h:441
static void serializeLayoutDescription(const QRhiShaderResourceBinding *first, const QRhiShaderResourceBinding *last, Output dst)
Definition qrhi.h:549
StageFlag
Flag values to indicate which stages the shader resource is visible in.
Definition qrhi.h:454
\inmodule QtGui
Definition qrhi.h:1214
void setBindings(InputIterator first, InputIterator last)
Sets the list of bindings from the iterators first and last.
Definition qrhi.h:1220
QVarLengthArray< QRhiShaderResourceBinding, BINDING_PREALLOC > m_bindings
Definition qrhi.h:1246
const QRhiShaderResourceBinding * cbeginBindings() const
Definition qrhi.h:1225
void setBindings(std::initializer_list< QRhiShaderResourceBinding > list)
Sets the list of bindings.
Definition qrhi.h:1218
QVector< quint32 > serializedLayoutDescription() const
Definition qrhi.h:1232
const QRhiShaderResourceBinding * bindingAt(qsizetype index) const
Definition qrhi.h:1227
virtual bool create()=0
qsizetype bindingCount() const
Definition qrhi.h:1228
QVector< quint32 > m_layoutDesc
Definition qrhi.h:1251
const QRhiShaderResourceBinding * cendBindings() const
Definition qrhi.h:1226
\inmodule QtGui
Definition qrhi.h:379
void setShaderVariant(QShader::Variant v)
Sets the requested shader variant v.
Definition qrhi.h:401
void setShader(const QShader &s)
Sets the shader collection s.
Definition qrhi.h:398
QRhiShaderStage()=default
Constructs a shader stage description for the vertex stage with an empty QShader.
QShader::Variant shaderVariant() const
Definition qrhi.h:400
QShader shader() const
Definition qrhi.h:397
@ TessellationControl
Definition qrhi.h:383
@ TessellationEvaluation
Definition qrhi.h:384
Type type() const
Definition qrhi.h:394
friend bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept
Definition qrhi.h:415
friend bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept
Definition qrhi.h:408
friend size_t qHash(const QRhiShaderStage &v, size_t seed=0) noexcept
Definition qrhi.h:420
void setType(Type t)
Sets the type of the stage to t.
Definition qrhi.h:395
\inmodule QtGui
Definition qrhi.h:1173
QRhiSwapChain * swapChain() const
Definition qrhi.h:1176
QRhiSwapChain * m_swapchain
Definition qrhi.h:1180
\inmodule QtGui
Definition qrhi.h:1549
QSize currentPixelSize() const
Definition qrhi.h:1596
void setDepthStencil(QRhiRenderBuffer *ds)
Sets the renderbuffer ds for use as a depth-stencil buffer.
Definition qrhi.h:1588
int sampleCount() const
Definition qrhi.h:1590
virtual QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor()=0
Format format() const
Definition qrhi.h:1584
QRhiSwapChainProxyData m_proxyData
Definition qrhi.h:1616
virtual bool createOrResize()=0
Creates the swapchain if not already done and resizes the swapchain buffers to match the current size...
virtual QRhiRenderTarget * currentFrameRenderTarget()=0
virtual QSize surfacePixelSize()=0
QRhiSwapChainProxyData proxyData() const
Definition qrhi.h:1578
Flag
Flag values to describe swapchain properties.
Definition qrhi.h:1551
void setSampleCount(int samples)
Sets the sample count.
Definition qrhi.h:1591
QSize m_currentPixelSize
Definition qrhi.h:1615
Flags flags() const
Definition qrhi.h:1581
void setFlags(Flags f)
Sets the flags f.
Definition qrhi.h:1582
Flags m_flags
Definition qrhi.h:1610
QRhiRenderPassDescriptor * renderPassDescriptor() const
Definition qrhi.h:1593
Format
Describes the swapchain format.
Definition qrhi.h:1561
@ HDRExtendedSrgbLinear
Definition qrhi.h:1563
void setWindow(QWindow *window)
Sets the window.
Definition qrhi.h:1576
StereoTargetBuffer
Selects the backbuffer to use with a stereoscopic swapchain.
Definition qrhi.h:1568
virtual bool isFormatSupported(Format f)=0
void setProxyData(const QRhiSwapChainProxyData &d)
Sets the proxy data d.
Definition qrhi.h:1579
virtual QRhiCommandBuffer * currentFrameCommandBuffer()=0
QRhiRenderBuffer * depthStencil() const
Definition qrhi.h:1587
QWindow * window() const
Definition qrhi.h:1575
void setFormat(Format f)
Sets the format f.
Definition qrhi.h:1585
void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc)
Associates with the QRhiRenderPassDescriptor desc.
Definition qrhi.h:1594
\inmodule QtGui
Definition qrhi.h:739
void setSourceLevel(int level)
Sets the source mip level.
Definition qrhi.h:750
QPoint destinationTopLeft() const
Definition qrhi.h:761
QPoint sourceTopLeft() const
Definition qrhi.h:752
void setPixelSize(const QSize &sz)
Sets the size of the region to copy to sz.
Definition qrhi.h:744
void setDestinationLevel(int level)
Sets the destination mip level.
Definition qrhi.h:759
void setDestinationTopLeft(const QPoint &p)
Sets the destination top-left position p.
Definition qrhi.h:762
int destinationLevel() const
Definition qrhi.h:758
int sourceLevel() const
Definition qrhi.h:749
QSize pixelSize() const
Definition qrhi.h:743
void setDestinationLayer(int layer)
Sets the destination array layer.
Definition qrhi.h:756
int sourceLayer() const
Definition qrhi.h:746
void setSourceTopLeft(const QPoint &p)
Sets the source top-left position to p.
Definition qrhi.h:753
int destinationLayer() const
Definition qrhi.h:755
void setSourceLayer(int layer)
Sets the source array layer.
Definition qrhi.h:747
QRhiTextureCopyDescription()=default
Constructs an empty texture copy description.
const QRhiColorAttachment * cbeginColorAttachments() const
Definition qrhi.h:634
void setDepthResolveTexture(QRhiTexture *tex)
Sets the depth (or depth-stencil) resolve texture tex.
Definition qrhi.h:646
void setDepthTexture(QRhiTexture *texture)
Sets the texture for depth-stencil.
Definition qrhi.h:643
QRhiTexture * depthTexture() const
Definition qrhi.h:642
void setDepthStencilBuffer(QRhiRenderBuffer *renderBuffer)
Sets the renderBuffer for depth-stencil.
Definition qrhi.h:640
const QRhiColorAttachment * cendColorAttachments() const
Definition qrhi.h:635
QRhiRenderBuffer * depthStencilBuffer() const
Definition qrhi.h:639
void setColorAttachments(std::initializer_list< QRhiColorAttachment > list)
Sets the list of color attachments.
Definition qrhi.h:627
const QRhiColorAttachment * colorAttachmentAt(qsizetype index) const
Definition qrhi.h:636
void setColorAttachments(InputIterator first, InputIterator last)
Sets the list of color attachments via the iterators first and last.
Definition qrhi.h:629
qsizetype colorAttachmentCount() const
Definition qrhi.h:637
QRhiTextureRenderTargetDescription()=default
Constructs an empty texture render target description.
QRhiTexture * depthResolveTexture() const
Definition qrhi.h:645
\inmodule QtGui
Definition qrhi.h:1184
void setDescription(const QRhiTextureRenderTargetDescription &desc)
Sets the render target description desc.
Definition qrhi.h:1196
Flags flags() const
Definition qrhi.h:1198
void setFlags(Flags f)
Sets the flags to f.
Definition qrhi.h:1199
QRhiTextureRenderTargetDescription m_desc
Definition qrhi.h:1207
virtual QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor()=0
Flag
Flag values describing the load/store behavior for the render target.
Definition qrhi.h:1186
virtual bool create()=0
Creates the corresponding native graphics resources.
QRhiTextureRenderTargetDescription description() const
Definition qrhi.h:1195
void setSourceTopLeft(const QPoint &p)
Sets the source top-left position p.
Definition qrhi.h:679
QRhiTextureSubresourceUploadDescription()=default
Constructs an empty subresource description.
void setDataStride(quint32 stride)
Sets the data stride in bytes.
Definition qrhi.h:670
void setDestinationTopLeft(const QPoint &p)
Sets the destination top-left position p.
Definition qrhi.h:673
void setData(const QByteArray &data)
Sets data.
Definition qrhi.h:667
void setSourceSize(const QSize &size)
Sets the source size in pixels.
Definition qrhi.h:676
void setImage(const QImage &image)
Sets image.
Definition qrhi.h:664
\inmodule QtGui
Definition qrhi.h:716
const QRhiTextureUploadEntry * cendEntries() const
Definition qrhi.h:730
const QRhiTextureUploadEntry * cbeginEntries() const
Definition qrhi.h:729
QRhiTextureUploadDescription()=default
Constructs an empty texture upload description.
void setEntries(std::initializer_list< QRhiTextureUploadEntry > list)
Sets the list of entries.
Definition qrhi.h:722
const QRhiTextureUploadEntry * entryAt(qsizetype index) const
Definition qrhi.h:731
void setEntries(InputIterator first, InputIterator last)
Sets the list of entries using the iterators first and last.
Definition qrhi.h:724
qsizetype entryCount() const
Definition qrhi.h:732
\inmodule QtGui
Definition qrhi.h:693
void setLevel(int level)
Sets the mip level.
Definition qrhi.h:702
void setDescription(const QRhiTextureSubresourceUploadDescription &desc)
Sets the subresource description desc.
Definition qrhi.h:705
QRhiTextureSubresourceUploadDescription description() const
Definition qrhi.h:704
int layer() const
Definition qrhi.h:698
void setLayer(int layer)
Sets the layer.
Definition qrhi.h:699
int level() const
Definition qrhi.h:701
QRhiTextureUploadEntry()=default
Constructs an empty QRhiTextureUploadEntry targeting layer 0 and level 0.
\inmodule QtGui
Definition qrhi.h:895
QSize m_pixelSize
Definition qrhi.h:1016
int m_arraySize
Definition qrhi.h:1018
int m_depth
Definition qrhi.h:1017
Format format() const
Definition qrhi.h:972
void setArrayRange(int startIndex, int count)
Normally all array layers are exposed and it is up to the shader to select the layer via the third co...
Definition qrhi.h:986
int arraySize() const
Definition qrhi.h:981
ViewFormat writeViewFormat() const
Definition qrhi.h:1004
void setFormat(Format fmt)
Sets the requested texture format to fmt.
Definition qrhi.h:973
int depth() const
Definition qrhi.h:978
void setFlags(Flags f)
Sets the texture flags to f.
Definition qrhi.h:993
Flag
Flag values to specify how the texture is going to be used.
Definition qrhi.h:897
int arrayRangeStart() const
Definition qrhi.h:984
void setDepth(int depth)
Sets the depth for a 3D texture.
Definition qrhi.h:979
int sampleCount() const
Definition qrhi.h:995
virtual bool create()=0
Creates the corresponding native graphics resources.
void setReadViewFormat(const ViewFormat &fmt)
Definition qrhi.h:1003
Format
Specifies the texture format.
Definition qrhi.h:914
@ ASTC_10x8
Definition qrhi.h:959
@ ASTC_8x5
Definition qrhi.h:954
@ ASTC_10x5
Definition qrhi.h:957
@ RGBA32F
Definition qrhi.h:926
@ ETC2_RGBA8
Definition qrhi.h:947
@ ASTC_5x5
Definition qrhi.h:951
@ ASTC_4x4
Definition qrhi.h:949
@ ASTC_6x6
Definition qrhi.h:953
@ ASTC_12x10
Definition qrhi.h:961
@ ETC2_RGB8
Definition qrhi.h:945
@ ASTC_5x4
Definition qrhi.h:950
@ RED_OR_ALPHA8
Definition qrhi.h:923
@ ASTC_6x5
Definition qrhi.h:952
@ ASTC_8x8
Definition qrhi.h:956
@ RGBA16F
Definition qrhi.h:925
@ RGB10A2
Definition qrhi.h:930
@ ASTC_10x6
Definition qrhi.h:958
@ ASTC_10x10
Definition qrhi.h:960
@ UnknownFormat
Definition qrhi.h:915
@ ETC2_RGB8A1
Definition qrhi.h:946
@ ASTC_8x6
Definition qrhi.h:955
Flags flags() const
Definition qrhi.h:992
void setArraySize(int arraySize)
Sets the texture arraySize.
Definition qrhi.h:982
void setWriteViewFormat(const ViewFormat &fmt)
Definition qrhi.h:1005
void setSampleCount(int s)
Sets the sample count to s.
Definition qrhi.h:996
ViewFormat readViewFormat() const
\variable QRhiTexture::ViewFormat::format
Definition qrhi.h:1002
QSize pixelSize() const
Definition qrhi.h:975
Format m_format
Definition qrhi.h:1015
Flags m_flags
Definition qrhi.h:1020
int m_sampleCount
Definition qrhi.h:1019
void setPixelSize(const QSize &sz)
Sets the texture size, specified in pixels, to sz.
Definition qrhi.h:976
int arrayRangeLength() const
Definition qrhi.h:985
\inmodule QtGui
Definition qrhi.h:232
int binding() const
Definition qrhi.h:267
void setMatrixSlice(int slice)
Sets the matrix slice.
Definition qrhi.h:280
int matrixSlice() const
Definition qrhi.h:279
friend size_t qHash(const QRhiVertexInputAttribute &v, size_t seed=0) noexcept
Definition qrhi.h:303
void setLocation(int loc)
Sets the location of the vertex input element to loc.
Definition qrhi.h:271
friend bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept
Definition qrhi.h:298
QRhiVertexInputAttribute()=default
Constructs a default vertex input attribute description.
void setFormat(Format f)
Sets the format of the vertex input element to f.
Definition qrhi.h:274
void setBinding(int b)
Sets the binding point index to b.
Definition qrhi.h:268
Format
Specifies the type of the element data.
Definition qrhi.h:234
Format format() const
Definition qrhi.h:273
quint32 offset() const
Definition qrhi.h:276
void setOffset(quint32 ofs)
Sets the byte offset for the input element to ofs.
Definition qrhi.h:277
friend bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept
Definition qrhi.h:289
int location() const
Definition qrhi.h:270
\inmodule QtGui
Definition qrhi.h:179
void setInstanceStepRate(quint32 rate)
Sets the instance step rate.
Definition qrhi.h:196
void setClassification(Classification c)
Sets the input data classification c.
Definition qrhi.h:193
friend bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept
Definition qrhi.h:210
void setStride(quint32 s)
Sets the stride to s.
Definition qrhi.h:190
Classification
Describes the input data classification.
Definition qrhi.h:181
quint32 instanceStepRate() const
Definition qrhi.h:195
QRhiVertexInputBinding()=default
Constructs a default vertex input binding description.
friend bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept
Definition qrhi.h:203
Classification classification() const
Definition qrhi.h:192
quint32 stride() const
Definition qrhi.h:189
friend size_t qHash(const QRhiVertexInputBinding &v, size_t seed=0) noexcept
Definition qrhi.h:215
\inmodule QtGui
Definition qrhi.h:321
QRhiVertexInputLayout()=default
Constructs an empty vertex input layout description.
const QRhiVertexInputBinding * bindingAt(qsizetype index) const
Definition qrhi.h:334
const QRhiVertexInputAttribute * cendAttributes() const
Definition qrhi.h:345
friend size_t qHash(const QRhiVertexInputLayout &v, size_t seed=0) noexcept
Definition qrhi.h:363
void setBindings(std::initializer_list< QRhiVertexInputBinding > list)
Sets the bindings from the specified list.
Definition qrhi.h:325
const QRhiVertexInputBinding * cendBindings() const
Definition qrhi.h:333
friend bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept
Definition qrhi.h:353
void setAttributes(std::initializer_list< QRhiVertexInputAttribute > list)
Sets the attributes from the specified list.
Definition qrhi.h:337
void setAttributes(InputIterator first, InputIterator last)
Sets the attributes using the iterators first and last.
Definition qrhi.h:339
const QRhiVertexInputAttribute * cbeginAttributes() const
Definition qrhi.h:344
const QRhiVertexInputBinding * cbeginBindings() const
Definition qrhi.h:332
qsizetype attributeCount() const
Definition qrhi.h:347
friend bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) noexcept
Definition qrhi.h:358
void setBindings(InputIterator first, InputIterator last)
Sets the bindings using the iterators first and last.
Definition qrhi.h:327
const QRhiVertexInputAttribute * attributeAt(qsizetype index) const
Definition qrhi.h:346
qsizetype bindingCount() const
Definition qrhi.h:335
\inmodule QtGui
Definition qrhi.h:85
void setMinDepth(float minDepth)
Sets the minDepth of the depth range of the viewport.
Definition qrhi.h:96
friend bool operator!=(const QRhiViewport &a, const QRhiViewport &b) noexcept
Definition qrhi.h:113
float maxDepth() const
Definition qrhi.h:98
void setMaxDepth(float maxDepth)
Sets the maxDepth of the depth range of the viewport.
Definition qrhi.h:99
float minDepth() const
Definition qrhi.h:95
void setViewport(float x, float y, float w, float h)
Sets the viewport's position and size to x, y, w, and h.
Definition qrhi.h:91
std::array< float, 4 > viewport() const
Definition qrhi.h:90
friend size_t qHash(const QRhiViewport &v, size_t seed=0) noexcept
Definition qrhi.h:118
QRhiViewport()=default
Constructs a viewport description with an empty rectangle and a depth range of 0.0f - 1....
friend bool operator==(const QRhiViewport &a, const QRhiViewport &b) noexcept
Definition qrhi.h:106
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1804
Implementation
Describes which graphics API-specific backend gets used by a QRhi instance.
Definition qrhi.h:1806
@ Metal
Definition qrhi.h:1811
@ Vulkan
Definition qrhi.h:1808
@ Null
Definition qrhi.h:1807
@ D3D11
Definition qrhi.h:1810
@ OpenGLES2
Definition qrhi.h:1809
BeginFrameFlag
Flag values for QRhi::beginFrame()
Definition qrhi.h:1877
ResourceLimit
Describes the resource limit to query.
Definition qrhi.h:1886
@ MaxThreadsPerThreadGroup
Definition qrhi.h:1893
@ MaxThreadGroupZ
Definition qrhi.h:1896
@ FramesInFlight
Definition qrhi.h:1890
@ MaxThreadGroupsPerDimension
Definition qrhi.h:1892
@ MaxAsyncReadbackFrames
Definition qrhi.h:1891
@ TextureArraySizeMax
Definition qrhi.h:1897
@ MaxColorAttachments
Definition qrhi.h:1889
@ MaxThreadGroupY
Definition qrhi.h:1895
@ MaxVertexInputs
Definition qrhi.h:1899
@ MaxThreadGroupX
Definition qrhi.h:1894
@ TextureSizeMax
Definition qrhi.h:1888
@ MaxUniformBufferRange
Definition qrhi.h:1898
EndFrameFlag
Flag values for QRhi::endFrame()
Definition qrhi.h:1881
Feature
Flag values to indicate what features are supported by the backend currently in use.
Definition qrhi.h:1831
@ HalfAttributes
Definition qrhi.h:1869
@ CustomInstanceStepRate
Definition qrhi.h:1837
@ NonDynamicUniformBuffers
Definition qrhi.h:1839
@ ElementIndexUint
Definition qrhi.h:1843
@ RenderToNonBaseMipLevel
Definition qrhi.h:1853
@ MultisampleRenderBuffer
Definition qrhi.h:1833
@ RenderTo3DTextureSlice
Definition qrhi.h:1861
@ Tessellation
Definition qrhi.h:1863
@ IntAttributes
Definition qrhi.h:1854
@ TextureArrays
Definition qrhi.h:1862
@ PipelineCacheDataLoadSave
Definition qrhi.h:1857
@ ReadBackNonUniformBuffer
Definition qrhi.h:1850
@ MultiView
Definition qrhi.h:1872
@ TexelFetch
Definition qrhi.h:1852
@ TextureArrayRange
Definition qrhi.h:1865
@ RenderToOneDimensionalTexture
Definition qrhi.h:1870
@ BaseVertex
Definition qrhi.h:1847
@ GeometryShader
Definition qrhi.h:1864
@ Compute
Definition qrhi.h:1844
@ OneDimensionalTextureMipmaps
Definition qrhi.h:1868
@ WideLines
Definition qrhi.h:1845
@ TriangleFanTopology
Definition qrhi.h:1849
@ OneDimensionalTextures
Definition qrhi.h:1867
@ ImageDataStride
Definition qrhi.h:1858
@ TextureViewFormat
Definition qrhi.h:1873
@ BaseInstance
Definition qrhi.h:1848
@ DebugMarkers
Definition qrhi.h:1834
@ ReadBackNonBaseMipLevel
Definition qrhi.h:1851
@ ThreeDimensionalTextureMipmaps
Definition qrhi.h:1871
@ NonFourAlignedEffectiveIndexBufferOffset
Definition qrhi.h:1840
@ RedOrAlpha8IsRed
Definition qrhi.h:1842
@ NonFillPolygonMode
Definition qrhi.h:1866
@ Timestamps
Definition qrhi.h:1835
@ ThreeDimensionalTextures
Definition qrhi.h:1860
@ PrimitiveRestart
Definition qrhi.h:1838
@ ReadBackAnyTextureFormat
Definition qrhi.h:1856
@ RenderBufferImport
Definition qrhi.h:1859
@ ScreenSpaceDerivatives
Definition qrhi.h:1855
@ VertexShaderPointSize
Definition qrhi.h:1846
@ NPOTTextureRepeat
Definition qrhi.h:1841
@ Instancing
Definition qrhi.h:1836
FrameOpResult
Describes the result of operations that can have a soft failure.
Definition qrhi.h:1824
@ FrameOpSwapChainOutOfDate
Definition qrhi.h:1827
@ FrameOpError
Definition qrhi.h:1826
std::function< void(QRhi *)> CleanupCallback
Definition qrhi.h:1917
Flag
Describes what special features to enable.
Definition qrhi.h:1815
\inmodule QtGui
Definition qshader.h:81
Variant
Describes what kind of shader code an entry contains.
Definition qshader.h:103
@ StandardShader
Definition qshader.h:104
\inmodule QtCore
Definition qsize.h:25
\inmodule QtGui
Definition qwindow.h:63
Format
Definition ddsheader.h:14
QHash< int, QWidget * > hash
[35multi]
employee setName("Richard Schmit")
else opt state
[0]
Combined button and popup list for selecting options.
Definition image.cpp:4
static std::unique_ptr< QRhiGraphicsPipeline > newGraphicsPipeline(QRhi *rhi, QRhiShaderResourceBindings *shaderResourceBindings, QRhiRenderPassDescriptor *renderPassDescriptor, QShader vertexShader, QShader fragmentShader)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
static int instanceCount
@ One
static int resourceType(const QByteArray &key)
EGLOutputLayerEXT layer
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
Flags
static QString backendName
@ None
Definition qhash.cpp:531
n varying highp vec2 A
GLint location
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth
GLsizei samples
GLenum mode
GLenum GLuint GLint level
GLuint64 key
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLuint const GLuint GLuint const GLuint * textures
GLuint sampler
GLenum GLenum GLenum GLenum dstAlpha
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat f
GLenum GLenum GLenum srcAlpha
GLenum src
const void GLsizei GLsizei stride
GLint GLsizei width
GLenum type
GLenum GLenum dst
GLenum GLuint GLenum GLsizei const GLchar * buf
GLbitfield flags
GLboolean enable
GLenum GLuint texture
GLenum GLuint GLintptr offset
GLuint name
GLint first
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLint y
GLfloat GLfloat GLfloat GLfloat h
void ** params
GLdouble s
[6]
Definition qopenglext.h:235
const GLubyte * c
GLuint entry
GLfloat bias
GLuint GLenum * rate
GLuint shader
Definition qopenglext.h:665
GLint limit
GLdouble GLdouble t
Definition qopenglext.h:243
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
GLsizeiptr const void GLenum usage
Definition qopenglext.h:543
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiDepthStencilClearValue &)
Definition qrhi.cpp:1229
Q_GUI_EXPORT size_t qHash(const QRhiShaderResourceBinding &b, size_t seed=0) noexcept
static constexpr QSize sizeForMipLevel(int mipLevel, const QSize &baseLevelSize)
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
@ Q_PRIMITIVE_TYPE
Definition qtypeinfo.h:157
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180
unsigned int quint32
Definition qtypes.h:50
int qint32
Definition qtypes.h:49
unsigned long long quint64
Definition qtypes.h:61
ptrdiff_t qsizetype
Definition qtypes.h:165
long long qint64
Definition qtypes.h:60
QVideoFrameFormat::PixelFormat fmt
static QInputDevice::DeviceType deviceType(const UINT cursorType)
QList< int > list
[14]
QDataStream & operator<<(QDataStream &out, const MyClass &myObj)
[4]
QVBoxLayout * layout
sem release()
QSharedPointer< T > other(t)
[5]
view viewport() -> scroll(dx, dy, deviceRect)
myFilter draw(painter, QPoint(0, 0), originalPixmap)
aWidget window() -> setWindowTitle("New Window Title")
[2]
view create()
\inmodule QtGui
Definition qrhi.h:862
\inmodule QtGui
Definition qrhi.h:1759
QByteArray deviceName
Definition qrhi.h:1769
DeviceType
Specifies the graphics device's type, when the information is available.
Definition qrhi.h:1760
@ IntegratedDevice
Definition qrhi.h:1762
\variable QRhiGraphicsPipeline::TargetBlend::colorWrite
Definition qrhi.h:1372
\inmodule QtGui
Definition qrhi.h:1800
\variable QRhiReadbackResult::completed
Definition qrhi.h:800
\inmodule QtGui
Definition qrhi.h:1723
QByteArray data
Definition qrhi.h:1727
QRhiTexture::Format format
Definition qrhi.h:1725
StorageBufferData sbuf
Definition qrhi.h:524
TextureAndOrSamplerData stex
Definition qrhi.h:522
QRhiShaderResourceBinding::StageFlags stage
Definition qrhi.h:498
StorageImageData simage
Definition qrhi.h:523
UniformBufferData ubuf
Definition qrhi.h:521
Output serialize(Output dst) const
Definition qrhi.h:535
QRhiShaderResourceBinding::Type type
Definition qrhi.h:499
\inmodule QtGui
Definition qrhi.h:1782
\inmodule QtGui
Definition qrhi.h:1511
LuminanceBehavior
\value SceneReferred Indicates that the color value of 1.0 is interpreted as 80 nits.
Definition qrhi.h:1517
LimitsType limitsType
Definition qrhi.h:1522
float maxPotentialColorComponentValue
Definition qrhi.h:1530
LimitsType
\value LuminanceInNits Indicates that the \l limits union has its luminanceInNits struct set
Definition qrhi.h:1512
LuminanceBehavior luminanceBehavior
Definition qrhi.h:1533
float maxColorComponentValue
Definition qrhi.h:1529
\inmodule QtGui
Definition qrhi.h:1544
\inmodule QtGui
Definition qrhi.h:965
\inmodule QtGui
Definition qrhi.h:998
QRhiTexture::Format format
Definition qrhi.h:999
Definition moc.h:23