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
qrhigles2_p.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// Qt-Security score:significant reason:default
4
5#ifndef QRHIGLES2_P_H
6#define QRHIGLES2_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include "qrhi_p.h"
20#include <rhi/qshaderdescription.h>
21#include <qopengl.h>
22#include <QByteArray>
23#include <QWindow>
24#include <QPointer>
25#include <QtCore/private/qduplicatetracker_p.h>
26#include <optional>
27
28QT_BEGIN_NAMESPACE
29
30class QOpenGLExtensions;
31class QRhiGles2;
32
65
67{
68 QGles2RenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
69 int sampleCount, QRhiRenderBuffer::Flags flags,
70 QRhiTexture::Format backingFormatHint);
72 void destroy() override;
73 bool create() override;
74 bool createFrom(NativeRenderBuffer src) override;
75 QRhiTexture::Format backingFormat() const override;
76
78 GLuint stencilRenderbuffer = 0; // when packed depth-stencil not supported
80 bool owns = true;
81 uint generation = 0;
82 friend class QRhiGles2;
83};
84
94
95inline bool operator==(const QGles2SamplerData &a, const QGles2SamplerData &b)
96{
97 return a.glminfilter == b.glminfilter
98 && a.glmagfilter == b.glmagfilter
99 && a.glwraps == b.glwraps
100 && a.glwrapt == b.glwrapt
101 && a.glwrapr == b.glwrapr
102 && a.gltexcomparefunc == b.gltexcomparefunc;
103}
104
105inline bool operator!=(const QGles2SamplerData &a, const QGles2SamplerData &b)
106{
107 return !(a == b);
108}
109
111{
112 QGles2Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
113 int arraySize, int sampleCount, Flags flags);
114 ~QGles2Texture();
115 void destroy() override;
116 bool create() override;
117 bool createFrom(NativeTexture src) override;
118 NativeTexture nativeTexture() override;
119
120 bool prepareCreate(QSize *adjustedSize = nullptr);
121
123 bool owns = true;
130 bool specified = false;
131 bool zeroInitialized = false;
134
145 struct UsageState {
147 };
149
150 uint generation = 0;
151 friend class QRhiGles2;
152};
153
155{
156 QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
157 AddressMode u, AddressMode v, AddressMode w);
158 ~QGles2Sampler();
159 void destroy() override;
160 bool create() override;
161
163 uint generation = 0;
164 friend class QRhiGles2;
165};
166
168{
169 QGles2RenderPassDescriptor(QRhiImplementation *rhi);
171 void destroy() override;
172 bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
174 QVector<quint32> serializedFormat() const override;
175};
176
193
195{
196 QGles2SwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
198 void destroy() override;
199
200 QSize pixelSize() const override;
201 float devicePixelRatio() const override;
202 int sampleCount() const override;
203
205};
206
208{
209 QGles2TextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
211 void destroy() override;
212
213 QSize pixelSize() const override;
214 float devicePixelRatio() const override;
215 int sampleCount() const override;
216
218 bool create() override;
219
223 friend class QRhiGles2;
224};
225
227{
228 QGles2ShaderResourceBindings(QRhiImplementation *rhi);
230 void destroy() override;
231 bool create() override;
232 void updateResources(UpdateFlags flags) override;
233
234 bool hasDynamicOffset = false;
235 uint generation = 0;
236 friend class QRhiGles2;
237};
238
248
250
258
260
261using QGles2UniformDescriptionVector = QVarLengthArray<QGles2UniformDescription, 8>;
262using QGles2SamplerDescriptionVector = QVarLengthArray<QGles2SamplerDescription, 4>;
263
265{
266 static constexpr int MAX_TRACKED_LOCATION = 1023;
268 float v[4];
269};
270
289
307
309{
310 QGles2CommandBuffer(QRhiImplementation *rhi);
312 void destroy() override;
313
314 // keep at a reasonably low value otherwise sizeof Command explodes
315 static const int MAX_DYNAMIC_OFFSET_COUNT = 8;
316
317 struct Command {
356
357 // QRhi*/QGles2* references should be kept at minimum (so no
358 // QRhiTexture/Buffer/etc. pointers).
359 union Args {
360 struct {
362 } beginFrame;
363 struct {
364 GLuint timestampQuery;
365 } endFrame;
366 struct {
367 float x, y, w, h;
368 float d0, d1;
369 } viewport;
370 struct {
371 int x, y, w, h;
372 } scissor;
373 struct {
374 float r, g, b, a;
375 } blendConstants;
376 struct {
379 } stencilRef;
380 struct {
381 QRhiGraphicsPipeline *ps;
385 } bindVertexBuffer;
386 struct {
387 GLuint buffer;
388 quint32 offset;
390 } bindIndexBuffer;
391 struct {
392 QRhiGraphicsPipeline *ps;
397 } draw;
398 struct {
399 QRhiGraphicsPipeline *ps;
402 quint32 instanceCount;
403 quint32 baseInstance;
405 } drawIndexed;
406 struct {
407 QRhiGraphicsPipeline *ps;
408 GLuint buffer;
409 quint32 offset;
412 } drawIndirect;
413 struct {
414 QRhiGraphicsPipeline *ps;
415 GLuint buffer;
416 quint32 offset;
417 quint32 drawCount;
418 quint32 stride;
419 } drawIndexedIndirect;
420 struct {
421 QRhiGraphicsPipeline *ps;
422 GLuint buffer;
423 quint32 offset;
427 quint32 stride;
428 } drawIndirectCount;
429 struct {
430 QRhiGraphicsPipeline *ps;
431 GLuint buffer;
432 quint32 offset;
433 GLuint countBuffer;
434 quint32 countOffset;
435 quint32 maxDrawCount;
436 quint32 stride;
437 } drawIndexedIndirectCount;
438 struct {
439 QRhiGraphicsPipeline *ps;
440 } bindGraphicsPipeline;
441 struct {
446 uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT * 2]; // binding, offset
447 } bindShaderResources;
448 struct {
450 float c[4];
451 float d;
453 } clear;
454 struct {
456 bool srgb;
458 bool stereo;
460 } bindFramebuffer;
461 struct {
463 GLuint buffer;
465 int size;
466 const void *data; // must come from retainData()
467 } bufferSubData;
468 struct {
470 GLenum target;
471 GLuint buffer;
472 int offset;
473 int size;
474 } getBufferSubData;
475 struct {
480 int srcX;
481 int srcY;
482 int srcZ;
487 int dstX;
488 int dstY;
489 int dstZ;
490 int w;
491 int h;
492 } copyTex;
493 struct {
494 QRhiReadbackResult *result;
496 int x;
497 int y;
498 int w;
499 int h;
502 int level;
504 } readPixels;
505 struct {
506 GLenum target;
507 GLuint texture;
509 int level;
510 int dx;
511 int dy;
512 int dz;
513 int w;
514 int h;
519 const void *data; // must come from retainImage()
520 } subImage;
521 struct {
522 GLenum target;
523 GLuint texture;
524 GLenum faceTarget;
525 int level;
527 int w;
528 int h;
529 int depth;
530 int size;
531 const void *data; // must come from retainData()
532 } compressedImage;
533 struct {
534 GLenum target;
535 GLuint texture;
536 GLenum faceTarget;
537 int level;
538 int dx;
539 int dy;
540 int dz;
541 int w;
542 int h;
543 GLenum glintformat;
544 int size;
545 const void *data; // must come from retainData()
546 } compressedSubImage;
547 struct {
549 int w;
550 int h;
551 GLenum target;
552 GLuint dstTexture;
553 int dstLevel;
556 } blitFromRenderbuffer;
557 struct {
558 GLenum srcTarget;
559 GLuint srcTexture;
560 int srcLevel;
562 int w;
563 int h;
564 GLenum dstTarget;
565 GLuint dstTexture;
566 int dstLevel;
567 int dstLayer;
568 bool isDepthStencil;
569 } blitFromTexture;
570 struct {
571 GLenum target;
572 GLuint texture;
573 } genMip;
574 struct {
576 } bindComputePipeline;
577 struct {
581 } dispatch;
582 struct {
583 GLuint buffer;
584 quint32 offset;
585 } dispatchIndirect;
586 struct {
588 } barriersForPass;
589 struct {
591 } barrier;
592 struct {
593 GLuint fbo;
596 } invalidateFramebuffer;
597 } args;
598 };
599
605
609
612 double lastGpuTime = 0;
620
622 bool valid = false;
627 bool blendEnabled[16];
628 struct ColorMask { bool r, g, b, a; } colorMask[16];
656 void reset() { valid = false; }
657 struct {
658 // not part of QRhiGraphicsPipeline but used by setGraphicsPipeline()
660 } dynamic;
661 } graphicsPassState;
662
664 enum Access {
665 Read = 0x01,
666 Write = 0x02
667 };
669 void reset() {
670 writtenResources.clear();
671 }
672 } computePassState;
673
675 void *ps;
678 } textureUnitState[16];
679
683
684 // relies heavily on implicit sharing (no copies of the actual data will be made)
685 const void *retainData(const QByteArray &data) {
686 dataRetainPool.append(data);
687 return dataRetainPool.last().constData();
688 }
690 bufferDataRetainPool.append(data);
691 return reinterpret_cast<const uchar *>(bufferDataRetainPool.last().constData());
692 }
693 const void *retainImage(const QImage &image) {
694 imageRetainPool.append(image);
695 return imageRetainPool.last().constBits();
696 }
698 commands.reset();
699 dataRetainPool.clear();
700 bufferDataRetainPool.clear();
701 imageRetainPool.clear();
702
703 passResTrackers.clear();
705 }
706 void resetState() {
709 // do not zero lastGpuTime
710 currentTarget = nullptr;
713 }
715 currentGraphicsPipeline = nullptr;
716 currentComputePipeline = nullptr;
718 currentGraphicsSrb = nullptr;
719 currentComputeSrb = nullptr;
721 graphicsPassState.reset();
722 computePassState.reset();
723 memset(textureUnitState, 0, sizeof(textureUnitState));
724 }
725};
726
729{
730 return a.func == b.func
731 && a.failOp == b.failOp
732 && a.zfailOp == b.zfailOp
733 && a.zpassOp == b.zpassOp;
734}
735
738{
739 return !(a == b);
740}
741
744{
745 return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
746}
747
750{
751 return !(a == b);
752}
753
756{
757 return a.srcColor == b.srcColor
758 && a.dstColor == b.dstColor
759 && a.srcAlpha == b.srcAlpha
760 && a.dstAlpha == b.dstAlpha
761 && a.opColor == b.opColor
762 && a.opAlpha == b.opAlpha;
763}
764
767{
768 return !(a == b);
769}
770
772{
773 static const int TIMESTAMP_PAIRS = 2;
774
777
778 void prepare(QRhiGles2 *rhiD);
779 void destroy(QRhiGles2 *rhiD);
780 bool tryQueryTimestamps(int pairIndex, QRhiGles2 *rhiD, double *elapsedSec);
781};
782
810
812{
813public:
814 QRhiGles2(QRhiGles2InitParams *params, QRhiGles2NativeHandles *importDevice = nullptr);
815
816 bool create(QRhi::Flags flags) override;
817 void destroy() override;
818
822 QRhiBuffer *createBuffer(QRhiBuffer::Type type,
823 QRhiBuffer::UsageFlags usage,
824 quint32 size) override;
825 QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
826 const QSize &pixelSize,
827 int sampleCount,
828 QRhiRenderBuffer::Flags flags,
829 QRhiTexture::Format backingFormatHint) override;
830 QRhiTexture *createTexture(QRhiTexture::Format format,
831 const QSize &pixelSize,
832 int depth,
833 int arraySize,
834 int sampleCount,
835 QRhiTexture::Flags flags) override;
836 QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
837 QRhiSampler::Filter minFilter,
838 QRhiSampler::Filter mipmapMode,
839 QRhiSampler:: AddressMode u,
840 QRhiSampler::AddressMode v,
841 QRhiSampler::AddressMode w) override;
842
843 QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
844 QRhiTextureRenderTarget::Flags flags) override;
845
846 QRhiShadingRateMap *createShadingRateMap() override;
847
848 QRhiSwapChain *createSwapChain() override;
849 QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
850 QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
851 QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
852 QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
853 QRhi::FrameOpResult finish() override;
854
855 void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
856
857 void beginPass(QRhiCommandBuffer *cb,
858 QRhiRenderTarget *rt,
859 const QColor &colorClearValue,
860 const QRhiDepthStencilClearValue &depthStencilClearValue,
861 QRhiResourceUpdateBatch *resourceUpdates,
862 QRhiCommandBuffer::BeginPassFlags flags) override;
863 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
864
865 void setGraphicsPipeline(QRhiCommandBuffer *cb,
866 QRhiGraphicsPipeline *ps) override;
867
868 void setShaderResources(QRhiCommandBuffer *cb,
869 QRhiShaderResourceBindings *srb,
870 int dynamicOffsetCount,
871 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
872
873 void setVertexInput(QRhiCommandBuffer *cb,
874 int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
875 QRhiBuffer *indexBuf, quint32 indexOffset,
876 QRhiCommandBuffer::IndexFormat indexFormat) override;
877
878 void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
879 void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
880 void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
881 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
882 void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override;
883
884 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
885 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
886
887 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
888 quint32 instanceCount, quint32 firstIndex,
889 qint32 vertexOffset, quint32 firstInstance) override;
890
891 void drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
892 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
893
894 void drawIndexedIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
895 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
896
897 void drawIndirectCount(QRhiCommandBuffer *cb,
898 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
899 QRhiBuffer *countBuffer, quint32 countBufferOffset,
900 quint32 maxDrawCount, quint32 stride) override;
901 void drawIndexedIndirectCount(QRhiCommandBuffer *cb,
902 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
903 QRhiBuffer *countBuffer, quint32 countBufferOffset,
904 quint32 maxDrawCount, quint32 stride) override;
905
906 void dispatchIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
907 quint32 indirectBufferOffset) override;
908
909 void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
910 void debugMarkEnd(QRhiCommandBuffer *cb) override;
911 void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
912
913 void beginComputePass(QRhiCommandBuffer *cb,
914 QRhiResourceUpdateBatch *resourceUpdates,
915 QRhiCommandBuffer::BeginPassFlags flags) override;
916 void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
917 void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
918 void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
919
920 const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
921 void beginExternal(QRhiCommandBuffer *cb) override;
922 void endExternal(QRhiCommandBuffer *cb) override;
923 double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
924
925 QList<int> supportedSampleCounts() const override;
926 QList<QSize> supportedShadingRates(int sampleCount) const override;
927 int ubufAlignment() const override;
928 bool isYUpInFramebuffer() const override;
929 bool isYUpInNDC() const override;
930 bool isClipDepthZeroToOne() const override;
931 QMatrix4x4 clipSpaceCorrMatrix() const override;
932 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
933 bool isFeatureSupported(QRhi::Feature feature) const override;
934 int resourceLimit(QRhi::ResourceLimit limit) const override;
935 const QRhiNativeHandles *nativeHandles() override;
936 QRhiDriverInfo driverInfo() const override;
937 QRhiStats statistics() override;
939 void setQueueSubmitParams(QRhiNativeHandles *params) override;
941 bool isDeviceLost() const override;
942
943 QByteArray pipelineCacheData() override;
944 void setPipelineCacheData(const QByteArray &data) override;
945
946 bool ensureContext(QSurface *surface = nullptr) const;
952 int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc);
953 void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
955 QGles2Buffer *bufD,
959 QGles2Texture *texD,
963 void executeCommandBuffer(QRhiCommandBuffer *cb);
966 void *ps, uint psGeneration, int glslLocation,
967 int *texUnit, bool *activeTexUnitAltered);
969 QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs,
970 QRhiShaderResourceBindings *srb,
971 const uint *dynOfsPairs, int dynOfsCount);
973 bool *wantsColorClear = nullptr, bool *wantsDsClear = nullptr);
976 std::optional<QShaderVersion> commonGlslEsVersion(const QRhiShaderStage *stages, int stageCount) const;
977 QByteArray shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion,
978 std::optional<QShaderVersion> commonVersion = std::nullopt);
979 bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion,
980 std::optional<QShaderVersion> commonVersion = std::nullopt);
981 bool linkProgram(GLuint program);
983 void registerUniformIfActive(const QShaderDescription::BlockVariable &var,
984 const QByteArray &namePrefix, int binding, int baseOffset,
985 GLuint program,
986 ActiveUniformLocationTracker *activeUniformLocations,
987 QGles2UniformDescriptionVector *dst);
988 void gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub,
989 ActiveUniformLocationTracker *activeUniformLocations, QGles2UniformDescriptionVector *dst);
990 void gatherSamplers(GLuint program, const QShaderDescription::InOutVariable &v,
991 QGles2SamplerDescriptionVector *dst);
992 void gatherGeneratedSamplers(GLuint program,
993 const QShader::SeparateToCombinedImageSamplerMapping &mapping,
994 QGles2SamplerDescriptionVector *dst);
995 void sanityCheckVertexFragmentInterface(const QShaderDescription &vsDesc, const QShaderDescription &fsDesc);
997
1003 ProgramCacheResult tryLoadFromDiskOrPipelineCache(const QRhiShaderStage *stages,
1004 int stageCount,
1005 GLuint program,
1006 const QVector<QShaderDescription::InOutVariable> &inputVars,
1007 QByteArray *cacheKey,
1008 std::optional<QShaderVersion> commonVersion = std::nullopt);
1009 void trySaveToDiskCache(GLuint program, const QByteArray &cacheKey);
1010 void trySaveToPipelineCache(GLuint program, const QByteArray &cacheKey, bool force = false);
1011
1014 bool importedContext = false;
1019 mutable bool needsMakeCurrentDueToSwap = false;
1020 QOpenGLExtensions *f = nullptr;
1023 const void *) = nullptr;
1026 const GLvoid *) = nullptr;
1028 GLsizei) = nullptr;
1030 const GLvoid *) = nullptr;
1032 GLsizei, const GLvoid *) = nullptr;
1034 GLint) = nullptr;
1036 GLint, GLsizei) = nullptr;
1039 void (QOPENGLF_APIENTRYP glObjectLabel)(GLenum, GLuint, GLsizei, const GLchar *) = nullptr;
1047 // Resolved when caps.baseInstance is true, left null otherwise.
1051 uint vao = 0;
1052 struct Caps {
1054 : ctxMajor(2),
1055 ctxMinor(0),
1056 maxTextureSize(2048),
1057 maxDrawBuffers(4),
1058 maxSamples(16),
1065 maxUniformVectors(4096),
1066 maxVertexInputs(8),
1070 msaaRenderBuffer(false),
1071 multisampledTexture(false),
1072 npotTextureFull(true),
1073 gles(false),
1075 bgraExternalFormat(false),
1076 bgraInternalFormat(false),
1077 r8Format(false),
1078 r16Format(false),
1079 r32uiFormat(false),
1080 floatFormats(false),
1081 rgb10Formats(false),
1082 depthTexture(false),
1083 packedDepthStencil(false),
1085 srgbWriteControl(false),
1086 coreProfile(false),
1087 vertexArrayObject(false),
1088 uniformBuffers(false),
1089 elementIndexUint(false),
1090 depth24(false),
1091 rgba8Format(false),
1092 instancing(false),
1093 baseVertex(false),
1094 baseInstance(false),
1095 compute(false),
1096 textureCompareMode(false),
1097 depthClamp(false),
1098 properMapBuffer(false),
1100 texelFetch(false),
1101 intAttributes(true),
1103 programBinary(false),
1104 texture3D(false),
1105 tessellation(false),
1106 geometryShader(false),
1107 texture1D(false),
1108 hasDrawBuffersFunc(false),
1109 halfAttributes(false),
1110 multiView(false),
1111 timestamps(false),
1112 objectLabel(false),
1115 unpackRowLength(false),
1117 dispatchIndirect(false),
1118 drawIndirectCount(false)
1119 { }
1136 // Multisample fb and blit are supported (GLES 3.0 or OpenGL 3.x). Not
1137 // the same as multisample textures!
1141 uint gles : 1;
1145 uint r8Format : 1;
1146 uint r16Format : 1;
1147 uint r32uiFormat : 1;
1154 uint coreProfile : 1;
1158 uint depth24 : 1;
1159 uint rgba8Format : 1;
1160 uint instancing : 1;
1161 uint baseVertex : 1;
1163 uint compute : 1;
1165 uint depthClamp : 1;
1168 uint texelFetch : 1;
1172 uint texture3D : 1;
1175 uint texture1D : 1;
1178 uint multiView : 1;
1179 uint timestamps : 1;
1180 uint objectLabel : 1;
1192 } caps;
1198 mutable bool contextLost = false;
1199 uint frameNo = 0;
1200
1210 union {
1211 struct {
1213 } buffer;
1214 struct {
1216 } pipeline;
1217 struct {
1219 } texture;
1220 struct {
1223 } renderbuffer;
1224 struct {
1227 } textureRenderTarget;
1228 };
1229 };
1231
1233 OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
1234 bool active = false;
1237 } ofr;
1238
1239 // Keyed by version too: it depends on the other stages of the program.
1241
1247
1267};
1268
1270
1271QT_END_NAMESPACE
1272
1273#endif
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
Definition qbytearray.h:838
friend bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are different, otherwise returns false.
Definition qbytearray.h:849
QRhiBackendCommandList()=default
T * cend() const
Definition qrhi_p.h:827
T * cbegin() const
Definition qrhi_p.h:826
bool isEmpty() const
Definition qrhi_p.h:812
void execute(QRhiCommandBuffer *cb, quint32 firstCommand, quint32 commandCount)
Definition qrhi.cpp:9183
QRhiBufferBackedIndirectCommandBuffer(QRhiImplementation *rhi, Type type, quint32 maxCommandCount)
\variable QRhiIndirectCommandBufferBuildInfo::topology
Definition qrhi.cpp:9093
void enqueueUpload(QRhiResourceUpdateBatch *u)
Definition qrhi.cpp:9147
QRhiIndirectCommandBufferBuildInfo buildInfo
Definition qrhi_p.h:322
void build(const QRhiIndirectCommandBufferBuildInfo &info)
Definition qrhi.cpp:9170
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhi.cpp:9105
bool create() override
Creates the corresponding native objects.
Definition qrhi.cpp:9128
void assign(QByteArray data)
Definition qrhi_p.h:445
QRhiBufferData()=default
void assign(const char *s, quint32 size)
Definition qrhi_p.h:426
quint32 size() const
Definition qrhi_p.h:418
QRhiBufferData(const QRhiBufferData &other)
Definition qrhi_p.h:397
quint32 largeAlloc() const
Definition qrhi_p.h:422
QRhiBufferData & operator=(const QRhiBufferData &other)
Definition qrhi_p.h:403
const char * constData() const
Definition qrhi_p.h:414
const GLvoid const GLvoid GLenum
QRhiStats statistics() override
bool contextLost
void(QOPENGLF_APIENTRYP glGetQueryObjectui64v)(GLuint
const QRhiNativeHandles * nativeHandles(QRhiCommandBuffer *cb) override
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance) override
QOpenGLContext * maybeShareContext
void gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub, ActiveUniformLocationTracker *activeUniformLocations, QGles2UniformDescriptionVector *dst)
void trackedBufferBarrier(QGles2CommandBuffer *cbD, QGles2Buffer *bufD, QGles2Buffer::Access access)
QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override
const GLvoid GLenum
std::optional< QShaderVersion > commonGlslEsVersion(const QRhiShaderStage *stages, int stageCount) const
void enqueueBarriersForPass(QGles2CommandBuffer *cbD)
QList< DeferredReleaseEntry > releaseQueue
void drawIndirectCount(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, QRhiBuffer *countBuffer, quint32 countBufferOffset, quint32 maxDrawCount, quint32 stride) override
int resourceLimit(QRhi::ResourceLimit limit) const override
void setVertexInput(QRhiCommandBuffer *cb, int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings, QRhiBuffer *indexBuf, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat) override
void(QOPENGLF_APIENTRYP glRenderbufferStorageMultisampleEXT)(GLenum
bool isFeatureSupported(QRhi::Feature feature) const override
quint64 GLuint
QRhiGraphicsPipeline * createGraphicsPipeline() override
void bindShaderResources(QGles2CommandBuffer *cbD, QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs, QRhiShaderResourceBindings *srb, const uint *dynOfsPairs, int dynOfsCount)
bool create(QRhi::Flags flags) override
void trackedRegisterTexture(QRhiPassResourceTracker *passResTracker, QGles2Texture *texD, QRhiPassResourceTracker::TextureAccess access, QRhiPassResourceTracker::TextureStage stage)
void executeBindGraphicsPipeline(QGles2CommandBuffer *cbD, QGles2GraphicsPipeline *psD)
void dispatchIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset) override
QRhiDriverInfo driverInfo() const override
QSurfaceFormat requestedFormat
QHash< QByteArray, PipelineCacheData > m_pipelineCache
bool isProgramBinaryDiskCacheEnabled() const
void(QOPENGLF_APIENTRYP glFramebufferTextureMultisampleMultiviewOVR)(GLenum
bool needsMakeCurrentDueToSwap
QRhiShadingRateMap * createShadingRateMap() override
void trackedImageBarrier(QGles2CommandBuffer *cbD, QGles2Texture *texD, QGles2Texture::Access access)
QOpenGLExtensions * f
void trackedRegisterBuffer(QRhiPassResourceTracker *passResTracker, QGles2Buffer *bufD, QRhiPassResourceTracker::BufferAccess access, QRhiPassResourceTracker::BufferStage stage)
void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override
QRhiComputePipeline * createComputePipeline() override
QRhiDriverInfo driverInfoStruct
QSurface * evaluateFallbackSurface() const
void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
void sanityCheckVertexFragmentInterface(const QShaderDescription &vsDesc, const QShaderDescription &fsDesc)
QRhiGles2NativeHandles nativeHandlesStruct
QMatrix4x4 clipSpaceCorrMatrix() const override
QRhi::FrameOpResult finish() override
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override
void(QOPENGLF_APIENTRYP glMultiDrawArraysIndirect)(GLenum
QList< int > supportedSampleCounts() const override
void gatherSamplers(GLuint program, const QShaderDescription::InOutVariable &v, QGles2SamplerDescriptionVector *dst)
QSet< GLint > supportedCompressedFormats
void(QOPENGLF_APIENTRYP glMultiDrawElementsIndirectCount)(GLenum
QRhiSwapChain * createSwapChain() override
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override
void destroy() override
QRhiRenderBuffer * createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint) override
void executeCommandBuffer(QRhiCommandBuffer *cb)
void setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline *ps) override
QList< QShaderVersion > glslVersionsToTry() const
QSurface * fallbackSurface
QRhiGles2(QRhiGles2InitParams *params, QRhiGles2NativeHandles *importDevice=nullptr)
QRhi::Flags rhiFlags
void trySaveToDiskCache(GLuint program, const QByteArray &cacheKey)
GLbitfield barriersForNextDispatch(QGles2CommandBuffer *cbD)
QList< QSize > supportedShadingRates(int sampleCount) const override
void drawIndexedIndirectCount(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, QRhiBuffer *countBuffer, quint32 countBufferOffset, quint32 maxDrawCount, quint32 stride) override
void(QOPENGLF_APIENTRYP glTexSubImage1D)(GLenum
const void GLuint
QRhiTexture * createTexture(QRhiTexture::Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, QRhiTexture::Flags flags) override
void bindCombinedSampler(QGles2CommandBuffer *cbD, QGles2Texture *texD, QGles2Sampler *samplerD, void *ps, uint psGeneration, int glslLocation, int *texUnit, bool *activeTexUnitAltered)
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override
QRhiTextureRenderTarget * createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags) override
QByteArray shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion, std::optional< QShaderVersion > commonVersion=std::nullopt)
void(QOPENGLF_APIENTRYP glMultiDrawElementsIndirect)(GLenum
QOpenGLContext * ctx
QRhiSampler * createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w) override
void beginPass(QRhiCommandBuffer *cb, QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
QGles2SwapChain * currentSwapChain
bool isDeviceLost() const override
QRhiShaderResourceBindings * createShaderResourceBindings() override
void drawIndexedIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override
void drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override
bool isYUpInNDC() const override
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override
void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
void setQueueSubmitParams(QRhiNativeHandles *params) override
bool makeThreadLocalNativeContextCurrent() override
int ubufAlignment() const override
void beginExternal(QRhiCommandBuffer *cb) override
const GLvoid GLint
void endExternal(QRhiCommandBuffer *cb) override
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override
ProgramCacheResult tryLoadFromDiskOrPipelineCache(const QRhiShaderStage *stages, int stageCount, GLuint program, const QVector< QShaderDescription::InOutVariable > &inputVars, QByteArray *cacheKey, std::optional< QShaderVersion > commonVersion=std::nullopt)
QRhiBuffer * createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) override
void(QOPENGLF_APIENTRYP glCompressedTexImage1D)(GLenum
const void GLintptr
bool importedContext
void(QOPENGLF_APIENTRYP glDrawElementsInstancedBaseVertexBaseInstance)(GLenum
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override
void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override
bool ensureContext(QSurface *surface=nullptr) const
void draw(QRhiCommandBuffer *cb, quint32 vertexCount, quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
void(QOPENGLF_APIENTRYP glQueryCounter)(GLuint
QHash< std::pair< QRhiShaderStage, QShaderVersion >, uint > m_shaderCache
void(QOPENGLF_APIENTRYP glDrawArraysInstancedBaseInstance)(GLenum
void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
bool isYUpInFramebuffer() const override
bool linkProgram(GLuint program)
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override
QGles2RenderTargetData * enqueueBindFramebuffer(QRhiRenderTarget *rt, QGles2CommandBuffer *cbD, bool *wantsColorClear=nullptr, bool *wantsDsClear=nullptr)
void debugMarkEnd(QRhiCommandBuffer *cb) override
void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override
void registerUniformIfActive(const QShaderDescription::BlockVariable &var, const QByteArray &namePrefix, int binding, int baseOffset, GLuint program, ActiveUniformLocationTracker *activeUniformLocations, QGles2UniformDescriptionVector *dst)
void setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBindings *srb, int dynamicOffsetCount, const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override
void releaseCachedResources() override
bool isClipDepthZeroToOne() const override
void trySaveToPipelineCache(GLuint program, const QByteArray &cacheKey, bool force=false)
bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion, std::optional< QShaderVersion > commonVersion=std::nullopt)
void executeDeferredReleases()
QByteArray pipelineCacheData() override
double lastCompletedGpuTime(QRhiCommandBuffer *cb) override
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override
QList< int > supportedSampleCountList
QPointer< QWindow > maybeWindow
void enqueueSubresUpload(QGles2Texture *texD, QGles2CommandBuffer *cbD, int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc)
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override
void setPipelineCacheData(const QByteArray &data) override
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override
void gatherGeneratedSamplers(GLuint program, const QShader::SeparateToCombinedImageSamplerMapping &mapping, QGles2SamplerDescriptionVector *dst)
const QRhiNativeHandles * nativeHandles() override
void setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBindings *srb, int dynamicOffsetCount, const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override
Definition qrhinull.cpp:262
double lastCompletedGpuTime(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:439
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override
Definition qrhinull.cpp:468
void dispatchIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset) override
Definition qrhinull.cpp:415
bool isFeatureSupported(QRhi::Feature feature) const override
Definition qrhinull.cpp:114
QRhiNull(QRhiNullInitParams *params)
Definition qrhinull.cpp:45
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override
Definition qrhinull.cpp:395
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override
Definition qrhinull.cpp:407
QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override
Definition qrhinull.cpp:445
void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
Definition qrhinull.cpp:554
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance) override
Definition qrhinull.cpp:325
void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
Definition qrhinull.cpp:650
void beginPass(QRhiCommandBuffer *cb, QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
Definition qrhinull.cpp:623
void setQueueSubmitParams(QRhiNativeHandles *params) override
Definition qrhinull.cpp:184
bool isClipDepthZeroToOne() const override
Definition qrhinull.cpp:97
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
Definition qrhinull.cpp:659
QNullCommandBuffer offscreenCommandBuffer
Definition qrhinull_p.h:312
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
Definition qrhinull.cpp:644
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override
Definition qrhinull.cpp:452
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override
Definition qrhinull.cpp:461
bool isYUpInNDC() const override
Definition qrhinull.cpp:92
QRhiDriverInfo driverInfo() const override
Definition qrhinull.cpp:166
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override
Definition qrhinull.cpp:291
void simulateTextureUpload(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
Definition qrhinull.cpp:479
QRhiComputePipeline * createComputePipeline() override
Definition qrhinull.cpp:246
void setPipelineCacheData(const QByteArray &data) override
Definition qrhinull.cpp:204
void setVertexInput(QRhiCommandBuffer *cb, int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings, QRhiBuffer *indexBuf, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat) override
Definition qrhinull.cpp:272
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override
Definition qrhinull.cpp:384
void draw(QRhiCommandBuffer *cb, quint32 vertexCount, quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override
Definition qrhinull.cpp:315
QByteArray pipelineCacheData() override
Definition qrhinull.cpp:199
void drawIndirectCount(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, QRhiBuffer *countBuffer, quint32 countBufferOffset, quint32 maxDrawCount, quint32 stride) override
Definition qrhinull.cpp:356
void drawIndexedIndirectCount(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, QRhiBuffer *countBuffer, quint32 countBufferOffset, quint32 maxDrawCount, quint32 stride) override
Definition qrhinull.cpp:370
void destroy() override
Definition qrhinull.cpp:57
const QRhiNativeHandles * nativeHandles() override
Definition qrhinull.cpp:161
void setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline *ps) override
Definition qrhinull.cpp:256
void releaseCachedResources() override
Definition qrhinull.cpp:189
void simulateTextureCopy(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
Definition qrhinull.cpp:530
QRhiTexture * createTexture(QRhiTexture::Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, QRhiTexture::Flags flags) override
Definition qrhinull.cpp:216
QList< QSize > supportedShadingRates(int sampleCount) const override
Definition qrhinull.cpp:66
void simulateTextureGenMips(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
Definition qrhinull.cpp:545
void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override
Definition qrhinull.cpp:309
QRhiRenderBuffer * createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint) override
Definition qrhinull.cpp:209
bool makeThreadLocalNativeContextCurrent() override
Definition qrhinull.cpp:178
void drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override
Definition qrhinull.cpp:336
const QRhiNativeHandles * nativeHandles(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:423
QRhiNullNativeHandles nativeHandlesStruct
Definition qrhinull_p.h:310
bool isYUpInFramebuffer() const override
Definition qrhinull.cpp:87
QRhi::FrameOpResult finish() override
Definition qrhinull.cpp:474
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override
Definition qrhinull.cpp:401
QRhiBuffer * createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) override
Definition qrhinull.cpp:77
QRhiStats statistics() override
Definition qrhinull.cpp:173
QRhiShadingRateMap * createShadingRateMap() override
Definition qrhinull.cpp:236
void beginExternal(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:429
QRhiSwapChain * createSwapChain() override
Definition qrhinull.cpp:72
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override
Definition qrhinull.cpp:285
QRhiTextureRenderTarget * createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags) override
Definition qrhinull.cpp:230
QRhiGraphicsPipeline * createGraphicsPipeline() override
Definition qrhinull.cpp:241
bool create(QRhi::Flags flags) override
Definition qrhinull.cpp:51
void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override
Definition qrhinull.cpp:303
void debugMarkEnd(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:390
QList< int > supportedSampleCounts() const override
Definition qrhinull.cpp:61
QMatrix4x4 clipSpaceCorrMatrix() const override
Definition qrhinull.cpp:102
QRhiSampler * createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w) override
Definition qrhinull.cpp:223
void drawIndexedIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override
Definition qrhinull.cpp:346
QRhiSwapChain * currentSwapChain
Definition qrhinull_p.h:311
int ubufAlignment() const override
Definition qrhinull.cpp:82
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override
Definition qrhinull.cpp:107
int resourceLimit(QRhi::ResourceLimit limit) const override
Definition qrhinull.cpp:120
QRhiShaderResourceBindings * createShaderResourceBindings() override
Definition qrhinull.cpp:251
void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override
Definition qrhinull.cpp:297
void endExternal(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:434
bool isDeviceLost() const override
Definition qrhinull.cpp:194
static TextureStage toPassTrackerTextureStage(QRhiShaderResourceBinding::StageFlags stages)
Definition qrhi.cpp:13327
const QVarLengthFlatMap< QRhiBuffer *, Buffer, 12 > & buffers() const
Definition qrhi_p.h:784
static BufferStage toPassTrackerBufferStage(QRhiShaderResourceBinding::StageFlags stages)
Definition qrhi.cpp:13308
const QVarLengthFlatMap< QRhiTexture *, Texture, 12 > & textures() const
Definition qrhi_p.h:792
bool isEmpty() const
Definition qrhi.cpp:13217
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
Definition qrhi.cpp:13234
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
Definition qrhi.cpp:13274
QRhiPipelineCacheDataReader(const char *data, quint32 size)
Definition qrhi_p.h:925
bool readByteArray(QByteArray *dst)
Definition qrhi_p.h:940
bool readUInt32(quint32 *dst)
Definition qrhi_p.h:930
QVarLengthArray< BufferOp, BUFFER_OPS_STATIC_ALLOC > bufferOps
Definition qrhi_p.h:624
QRhiImplementation * rhi
Definition qrhi_p.h:631
QVarLengthArray< TextureOp, TEXTURE_OPS_STATIC_ALLOC > textureOps
Definition qrhi_p.h:628
static const int BUFFER_OPS_STATIC_ALLOC
Definition qrhi_p.h:623
static QRhiResourceUpdateBatchPrivate * get(QRhiResourceUpdateBatch *b)
Definition qrhi_p.h:639
void merge(QRhiResourceUpdateBatchPrivate *other)
Definition qrhi.cpp:11063
QRhiResourceUpdateBatch * q
Definition qrhi_p.h:630
static const int TEXTURE_OPS_STATIC_ALLOC
Definition qrhi_p.h:627
Combined button and popup list for selecting options.
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
#define QOPENGLF_APIENTRYP
Definition qopengl.h:275
static const char * resourceTypeStr(const QRhiResource *res)
Definition qrhi.cpp:9344
static QRhiPassResourceTracker::BufferStage earlierStage(QRhiPassResourceTracker::BufferStage a, QRhiPassResourceTracker::BufferStage b)
Definition qrhi.cpp:13228
QDebug operator<<(QDebug dbg, const QRhiSwapChainHdrInfo &info)
Definition qrhi.cpp:8396
static bool isImageLoadStore(QRhiPassResourceTracker::TextureAccess access)
Definition qrhi.cpp:13267
static const char * deviceTypeStr(QRhiDriverInfo::DeviceType type)
\variable QRhiDriverInfo::deviceName
Definition qrhi.cpp:10323
static QRhiPassResourceTracker::TextureStage earlierStage(QRhiPassResourceTracker::TextureStage a, QRhiPassResourceTracker::TextureStage b)
Definition qrhi.cpp:13261
QRhiTargetRectBoundMode
Definition qrhi_p.h:326
@ UnBounded
Definition qrhi_p.h:327
@ Bounded
Definition qrhi_p.h:328
Q_DECLARE_TYPEINFO(QRhiPassResourceTracker::Texture, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(QRhiBufferData, Q_RELOCATABLE_TYPE)
T * qrhi_objectFromProxyData(QRhiSwapChainProxyData *pd, QWindow *window, QRhi::Implementation impl, uint objectIndex)
Definition qrhi_p.h:914
bool operator!=(const QRhiRenderTargetAttachmentTracker::ResId &a, const QRhiRenderTargetAttachmentTracker::ResId &b)
Definition qrhi_p.h:854
Q_DECLARE_TYPEINFO(QRhiPassResourceTracker::Buffer, Q_RELOCATABLE_TYPE)
#define QRHI_RES(t, x)
Definition qrhi_p.h:30
bool operator==(const QRhiRenderTargetAttachmentTracker::ResId &a, const QRhiRenderTargetAttachmentTracker::ResId &b)
Definition qrhi_p.h:849
bool qrhi_toTopLeftRenderTargetRect(const QSize &outputSize, const std::array< T, N > &r, T *x, T *y, T *w, T *h)
Definition qrhi_p.h:332
bool operator!=(const QGles2CommandBuffer::GraphicsPassState::Blend &a, const QGles2CommandBuffer::GraphicsPassState::Blend &b)
bool operator!=(const QGles2SamplerData &a, const QGles2SamplerData &b)
bool operator==(const QGles2CommandBuffer::GraphicsPassState::StencilFace &a, const QGles2CommandBuffer::GraphicsPassState::StencilFace &b)
bool operator==(const QGles2CommandBuffer::GraphicsPassState::Blend &a, const QGles2CommandBuffer::GraphicsPassState::Blend &b)
Q_DECLARE_TYPEINFO(QRhiGles2::DeferredReleaseEntry, Q_RELOCATABLE_TYPE)
bool operator!=(const QGles2CommandBuffer::GraphicsPassState::ColorMask &a, const QGles2CommandBuffer::GraphicsPassState::ColorMask &b)
bool operator==(const QGles2CommandBuffer::GraphicsPassState::ColorMask &a, const QGles2CommandBuffer::GraphicsPassState::ColorMask &b)
Q_DECLARE_TYPEINFO(QGles2SamplerDescription, Q_RELOCATABLE_TYPE)
bool operator==(const QGles2SamplerData &a, const QGles2SamplerData &b)
Definition qrhigles2_p.h:95
bool operator!=(const QGles2CommandBuffer::GraphicsPassState::StencilFace &a, const QGles2CommandBuffer::GraphicsPassState::StencilFace &b)
Q_DECLARE_TYPEINFO(QGles2UniformDescription, Q_RELOCATABLE_TYPE)
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept
Definition qsize.h:192
QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
@ AccessStorageReadWrite
Definition qrhigles2_p.h:55
QByteArray data
Definition qrhigles2_p.h:47
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
char * beginFullDynamicBufferUpdateForCurrentFrame() override
void endFullDynamicBufferUpdateForCurrentFrame() override
To be called when the entire contents of the buffer data has been updated in the memory block returne...
QRhiBuffer::NativeBuffer nativeBuffer() override
bool create() override
Creates the corresponding native graphics resources.
GLenum targetForDataOps
Definition qrhigles2_p.h:46
quint32 nonZeroSize
Definition qrhigles2_p.h:44
void fullDynamicBufferUpdateForCurrentFrame(const void *data, quint32 size) override
UsageState usageState
Definition qrhigles2_p.h:62
GLuint buffer
Definition qrhigles2_p.h:45
QVarLengthArray< QImage, 4 > imageRetainPool
QRhiShaderResourceBindings * currentGraphicsSrb
QVarLengthArray< QRhiBufferData, 4 > bufferDataRetainPool
static const int MAX_DYNAMIC_OFFSET_COUNT
QRhiBackendCommandList< Command > commands
QRhiComputePipeline * currentComputePipeline
QRhiRenderTarget * currentTarget
QRhiShaderResourceBindings * currentComputeSrb
QVarLengthArray< QRhiPassResourceTracker, 8 > passResTrackers
QGles2CommandBuffer(QRhiImplementation *rhi)
const void * retainImage(const QImage &image)
const void * retainData(const QByteArray &data)
const uchar * retainBufferData(const QRhiBufferData &data)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QRhiGraphicsPipeline * currentGraphicsPipeline
QVarLengthArray< QByteArray, 4 > dataRetainPool
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QGles2UniformState uniformState[QGles2UniformState::MAX_TRACKED_LOCATION+1]
QGles2UniformDescriptionVector uniforms
QRhiShaderResourceBindings * currentSrb
QGles2ComputePipeline(QRhiImplementation *rhi)
QGles2SamplerDescriptionVector samplers
bool create() override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QGles2SamplerDescriptionVector samplers
bool create() override
Creates the corresponding native graphics resources.
QGles2GraphicsPipeline(QRhiImplementation *rhi)
QRhiShaderResourceBindings * currentSrb
QGles2UniformDescriptionVector uniforms
QGles2UniformState uniformState[QGles2UniformState::MAX_TRACKED_LOCATION+1]
bool create() override
Creates the corresponding native graphics resources.
QGles2RenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint)
bool createFrom(NativeRenderBuffer src) override
Similar to create() except that no new native renderbuffer objects are created.
QRhiTexture::Format backingFormat() const override
GLuint stencilRenderbuffer
Definition qrhigles2_p.h:78
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVector< quint32 > serializedFormat() const override
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() const override
bool isCompatible(const QRhiRenderPassDescriptor *other) const override
QGles2RenderPassDescriptor(QRhiImplementation *rhi)
QGles2RenderTargetData(QRhiImplementation *)
std::optional< QRhiSwapChain::StereoTargetBuffer > stereoTarget
QGles2RenderPassDescriptor * rp
QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList
GLenum gltexcomparefunc
Definition qrhigles2_p.h:92
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool create() override
QGles2SamplerData d
QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, AddressMode u, AddressMode v, AddressMode w)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
void updateResources(UpdateFlags flags) override
bool create() override
Creates the corresponding resource binding set.
QGles2ShaderResourceBindings(QRhiImplementation *rhi)
float devicePixelRatio() const override
QGles2SwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
QSize pixelSize() const override
int sampleCount() const override
QGles2RenderTargetData d
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
void prepare(QRhiGles2 *rhiD)
bool active[TIMESTAMP_PAIRS]
bool tryQueryTimestamps(int pairIndex, QRhiGles2 *rhiD, double *elapsedSec)
static const int TIMESTAMP_PAIRS
GLuint query[TIMESTAMP_PAIRS *2]
void destroy(QRhiGles2 *rhiD)
void initSwapChainRenderTarget(QGles2SwapChainRenderTarget *rt)
QGles2SwapChainRenderTarget rtRight
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QGles2CommandBuffer cb
QGles2SwapChainRenderTarget rt
QSurface * surface
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
int currentTimestampPairIndex
bool isFormatSupported(Format f) override
bool createOrResize() override
Creates the swapchain if not already done and resizes the swapchain buffers to match the current size...
QGles2SwapChainTimestamps timestamps
QGles2SwapChain(QRhiImplementation *rhi)
QRhiCommandBuffer * currentFrameCommandBuffer() override
QRhiRenderTarget * currentFrameRenderTarget(StereoTargetBuffer targetBuffer) override
QGles2SwapChainRenderTarget rtLeft
QSize surfacePixelSize() override
QRhiRenderTarget * currentFrameRenderTarget() override
int sampleCount() const override
QGles2TextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
float devicePixelRatio() const override
QSize pixelSize() const override
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
bool create() override
Creates the corresponding native graphics resources.
QGles2RenderTargetData d
bool createFrom(NativeTexture src) override
Similar to create(), except that no new native textures are created.
QGles2Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, Flags flags)
QGles2SamplerData samplerState
GLenum glsizedintformat
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
UsageState usageState
bool prepareCreate(QSize *adjustedSize=nullptr)
GLenum glintformat
bool create() override
Creates the corresponding native graphics resources.
NativeTexture nativeTexture() override
static constexpr int MAX_TRACKED_LOCATION
char * data
Definition qrhinull_p.h:31
QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
Definition qrhinull.cpp:665
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:685
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:675
char * beginFullDynamicBufferUpdateForCurrentFrame() override
Definition qrhinull.cpp:699
QNullCommandBuffer(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool create() override
QNullComputePipeline(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool create() override
Creates the corresponding native graphics resources.
QNullGraphicsPipeline(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:717
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:726
QNullRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint)
Definition qrhinull.cpp:705
QRhiTexture::Format backingFormat() const override
Definition qrhinull.cpp:740
QNullRenderPassDescriptor(QRhiImplementation *rhi)
Definition qrhinull.cpp:850
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() const override
Definition qrhinull.cpp:873
QVector< quint32 > serializedFormat() const override
Definition qrhinull.cpp:881
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:860
bool isCompatible(const QRhiRenderPassDescriptor *other) const override
Definition qrhinull.cpp:867
QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList
Definition qrhinull_p.h:88
QNullRenderPassDescriptor * rp
Definition qrhinull_p.h:85
QNullRenderTargetData(QRhiImplementation *)
Definition qrhinull_p.h:83
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:836
QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, AddressMode u, AddressMode v, AddressMode w)
Definition qrhinull.cpp:825
bool create() override
Definition qrhinull.cpp:843
QNullShaderResourceBindings(QRhiImplementation *rhi)
Definition qrhinull.cpp:981
bool create() override
Creates the corresponding resource binding set.
Definition qrhinull.cpp:998
void updateResources(UpdateFlags flags) override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:991
QSize pixelSize() const override
Definition qrhinull.cpp:901
float devicePixelRatio() const override
Definition qrhinull.cpp:906
QNullRenderTargetData d
Definition qrhinull_p.h:101
QNullSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
Definition qrhinull.cpp:886
int sampleCount() const override
Definition qrhinull.cpp:911
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:897
bool createOrResize() override
Creates the swapchain if not already done and resizes the swapchain buffers to match the current size...
QWindow * window
Definition qrhinull_p.h:167
QSize surfacePixelSize() override
QNullSwapChainRenderTarget rt
Definition qrhinull_p.h:168
bool isFormatSupported(Format f) override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QRhiCommandBuffer * currentFrameCommandBuffer() override
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
QRhiRenderTarget * currentFrameRenderTarget() override
QNullSwapChain(QRhiImplementation *rhi)
QNullCommandBuffer cb
Definition qrhinull_p.h:169
QSize pixelSize() const override
Definition qrhinull.cpp:963
int sampleCount() const override
Definition qrhinull.cpp:976
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:929
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
Definition qrhinull.cpp:936
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:944
QNullTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags)
Definition qrhinull.cpp:916
QNullRenderTargetData d
Definition qrhinull_p.h:117
float devicePixelRatio() const override
Definition qrhinull.cpp:971
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:765
bool createFrom(NativeTexture src) override
Similar to create(), except that no new native textures are created.
Definition qrhinull.cpp:809
QVarLengthArray< std::array< QImage, QRhi::MAX_MIP_LEVELS >, 6 > image
Definition qrhinull_p.h:58
QNullTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, Flags flags)
Definition qrhinull.cpp:745
uint generation
Definition qrhinull_p.h:59
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:756
bool operator!=(const Batch &other) const
Definition qrhi_p.h:679
QVector< T > resources
Definition qrhi_p.h:672
bool operator==(const Batch &other) const
Definition qrhi_p.h:674
void feed(int binding, T resource)
Definition qrhi_p.h:645
QVector< Batch > batches
Definition qrhi_p.h:688
bool operator!=(const QRhiBatchedBindings< T > &other) const
Definition qrhi_p.h:695
bool operator==(const QRhiBatchedBindings< T > &other) const
Definition qrhi_p.h:690
char smallData[SMALL_DATA_SIZE]
Definition qrhi_p.h:384
QByteArray largeData
Definition qrhi_p.h:382
static constexpr quint32 SMALL_DATA_SIZE
Definition qrhi_p.h:383
uint needsDepthStencilCombinedAttach
uint perRenderTargetBlending
int maxThreadGroupsPerDimension
uint glesMultisampleRenderToTexture
int maxFragmentStorageBuffers
uint fixedIndexPrimitiveRestart
uint screenSpaceDerivatives
uint nonBaseLevelFramebufferTexture
uint glesMultiviewMultisampleRenderToTexture
OffscreenFrame(QRhiImplementation *rhi)
QGles2CommandBuffer cbWrapper
QVarLengthArray< data32_t, 128 > packedArray
QVarLengthArray< SeparateTexture, 8 > separateTextureBindings
QVarLengthArray< SeparateSampler, 4 > separateSamplerBindings
static void updateResIdList(const QRhiTextureRenderTargetDescription &desc, ResIdList *dst)
Definition qrhi_p.h:860
static bool isUpToDate(const QRhiTextureRenderTargetDescription &desc, const ResIdList &currentResIdList)
Definition qrhi_p.h:898
static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:507
static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:538
static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:522
static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:500
static BufferOp staticUpload(QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:531
static BufferOp staticUpload(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:515
static BufferOp read(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result)
Definition qrhi_p.h:546
static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:484
static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:491
QRhiTextureCopyDescription desc
Definition qrhi_p.h:574
static TextureOp copy(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc)
Definition qrhi_p.h:594
QVarLengthArray< MipLevelUploadList, 6 > subresDesc
Definition qrhi_p.h:572
static TextureOp upload(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
Definition qrhi_p.h:578
static TextureOp genMips(QRhiTexture *tex)
Definition qrhi_p.h:613
static TextureOp read(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
Definition qrhi_p.h:604
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1566
LimitsType limitsType
Definition qrhi.h:1577
float maxPotentialColorComponentValue
Definition qrhi.h:1585
LuminanceBehavior luminanceBehavior
Definition qrhi.h:1588
float maxColorComponentValue
Definition qrhi.h:1584
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1599
void * reserved[2]
Definition qrhi.h:1600
uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT *2]
QRhiShaderResourceBindings * srb
QRhiGraphicsPipeline * maybeGraphicsPs
QRhiComputePipeline * maybeComputePs
QRhiSwapChain::StereoTargetBuffer stereoTarget