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 {
353
354 // QRhi*/QGles2* references should be kept at minimum (so no
355 // QRhiTexture/Buffer/etc. pointers).
356 union Args {
357 struct {
359 } beginFrame;
360 struct {
361 GLuint timestampQuery;
362 } endFrame;
363 struct {
364 float x, y, w, h;
365 float d0, d1;
366 } viewport;
367 struct {
368 int x, y, w, h;
369 } scissor;
370 struct {
371 float r, g, b, a;
372 } blendConstants;
373 struct {
376 } stencilRef;
377 struct {
378 QRhiGraphicsPipeline *ps;
382 } bindVertexBuffer;
383 struct {
384 GLuint buffer;
385 quint32 offset;
387 } bindIndexBuffer;
388 struct {
389 QRhiGraphicsPipeline *ps;
394 } draw;
395 struct {
396 QRhiGraphicsPipeline *ps;
399 quint32 instanceCount;
400 quint32 baseInstance;
402 } drawIndexed;
403 struct {
404 QRhiGraphicsPipeline *ps;
405 GLuint buffer;
406 quint32 offset;
409 } drawIndirect;
410 struct {
411 QRhiGraphicsPipeline *ps;
412 GLuint buffer;
413 quint32 offset;
414 quint32 drawCount;
415 quint32 stride;
416 } drawIndexedIndirect;
417 struct {
418 QRhiGraphicsPipeline *ps;
419 } bindGraphicsPipeline;
420 struct {
425 uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT * 2]; // binding, offset
426 } bindShaderResources;
427 struct {
429 float c[4];
430 float d;
432 } clear;
433 struct {
435 bool srgb;
437 bool stereo;
439 } bindFramebuffer;
440 struct {
442 GLuint buffer;
444 int size;
445 const void *data; // must come from retainData()
446 } bufferSubData;
447 struct {
449 GLenum target;
450 GLuint buffer;
451 int offset;
452 int size;
453 } getBufferSubData;
454 struct {
459 int srcX;
460 int srcY;
461 int srcZ;
466 int dstX;
467 int dstY;
468 int dstZ;
469 int w;
470 int h;
471 } copyTex;
472 struct {
473 QRhiReadbackResult *result;
475 int x;
476 int y;
477 int w;
478 int h;
481 int level;
483 } readPixels;
484 struct {
485 GLenum target;
486 GLuint texture;
488 int level;
489 int dx;
490 int dy;
491 int dz;
492 int w;
493 int h;
498 const void *data; // must come from retainImage()
499 } subImage;
500 struct {
501 GLenum target;
502 GLuint texture;
503 GLenum faceTarget;
504 int level;
506 int w;
507 int h;
508 int depth;
509 int size;
510 const void *data; // must come from retainData()
511 } compressedImage;
512 struct {
513 GLenum target;
514 GLuint texture;
515 GLenum faceTarget;
516 int level;
517 int dx;
518 int dy;
519 int dz;
520 int w;
521 int h;
522 GLenum glintformat;
523 int size;
524 const void *data; // must come from retainData()
525 } compressedSubImage;
526 struct {
528 int w;
529 int h;
530 GLenum target;
531 GLuint dstTexture;
532 int dstLevel;
535 } blitFromRenderbuffer;
536 struct {
537 GLenum srcTarget;
538 GLuint srcTexture;
539 int srcLevel;
541 int w;
542 int h;
543 GLenum dstTarget;
544 GLuint dstTexture;
545 int dstLevel;
546 int dstLayer;
547 bool isDepthStencil;
548 } blitFromTexture;
549 struct {
550 GLenum target;
551 GLuint texture;
552 } genMip;
553 struct {
555 } bindComputePipeline;
556 struct {
560 } dispatch;
561 struct {
563 } barriersForPass;
564 struct {
566 } barrier;
567 struct {
568 GLuint fbo;
571 } invalidateFramebuffer;
572 } args;
573 };
574
580
584
587 double lastGpuTime = 0;
595
597 bool valid = false;
602 bool blendEnabled[16];
603 struct ColorMask { bool r, g, b, a; } colorMask[16];
631 void reset() { valid = false; }
632 struct {
633 // not part of QRhiGraphicsPipeline but used by setGraphicsPipeline()
635 } dynamic;
636 } graphicsPassState;
637
639 enum Access {
640 Read = 0x01,
641 Write = 0x02
642 };
644 void reset() {
645 writtenResources.clear();
646 }
647 } computePassState;
648
650 void *ps;
653 } textureUnitState[16];
654
658
659 // relies heavily on implicit sharing (no copies of the actual data will be made)
660 const void *retainData(const QByteArray &data) {
661 dataRetainPool.append(data);
662 return dataRetainPool.last().constData();
663 }
665 bufferDataRetainPool.append(data);
666 return reinterpret_cast<const uchar *>(bufferDataRetainPool.last().constData());
667 }
668 const void *retainImage(const QImage &image) {
669 imageRetainPool.append(image);
670 return imageRetainPool.last().constBits();
671 }
673 commands.reset();
674 dataRetainPool.clear();
675 bufferDataRetainPool.clear();
676 imageRetainPool.clear();
677
678 passResTrackers.clear();
680 }
681 void resetState() {
684 // do not zero lastGpuTime
685 currentTarget = nullptr;
688 }
690 currentGraphicsPipeline = nullptr;
691 currentComputePipeline = nullptr;
693 currentGraphicsSrb = nullptr;
694 currentComputeSrb = nullptr;
696 graphicsPassState.reset();
697 computePassState.reset();
698 memset(textureUnitState, 0, sizeof(textureUnitState));
699 }
700};
701
704{
705 return a.func == b.func
706 && a.failOp == b.failOp
707 && a.zfailOp == b.zfailOp
708 && a.zpassOp == b.zpassOp;
709}
710
713{
714 return !(a == b);
715}
716
719{
720 return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
721}
722
725{
726 return !(a == b);
727}
728
731{
732 return a.srcColor == b.srcColor
733 && a.dstColor == b.dstColor
734 && a.srcAlpha == b.srcAlpha
735 && a.dstAlpha == b.dstAlpha
736 && a.opColor == b.opColor
737 && a.opAlpha == b.opAlpha;
738}
739
742{
743 return !(a == b);
744}
745
747{
748 static const int TIMESTAMP_PAIRS = 2;
749
752
753 void prepare(QRhiGles2 *rhiD);
754 void destroy(QRhiGles2 *rhiD);
755 bool tryQueryTimestamps(int pairIndex, QRhiGles2 *rhiD, double *elapsedSec);
756};
757
785
787{
788public:
789 QRhiGles2(QRhiGles2InitParams *params, QRhiGles2NativeHandles *importDevice = nullptr);
790
791 bool create(QRhi::Flags flags) override;
792 void destroy() override;
793
797 QRhiBuffer *createBuffer(QRhiBuffer::Type type,
798 QRhiBuffer::UsageFlags usage,
799 quint32 size) override;
800 QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
801 const QSize &pixelSize,
802 int sampleCount,
803 QRhiRenderBuffer::Flags flags,
804 QRhiTexture::Format backingFormatHint) override;
805 QRhiTexture *createTexture(QRhiTexture::Format format,
806 const QSize &pixelSize,
807 int depth,
808 int arraySize,
809 int sampleCount,
810 QRhiTexture::Flags flags) override;
811 QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
812 QRhiSampler::Filter minFilter,
813 QRhiSampler::Filter mipmapMode,
814 QRhiSampler:: AddressMode u,
815 QRhiSampler::AddressMode v,
816 QRhiSampler::AddressMode w) override;
817
818 QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
819 QRhiTextureRenderTarget::Flags flags) override;
820
821 QRhiShadingRateMap *createShadingRateMap() override;
822
823 QRhiSwapChain *createSwapChain() override;
824 QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
825 QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
826 QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
827 QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
828 QRhi::FrameOpResult finish() override;
829
830 void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
831
832 void beginPass(QRhiCommandBuffer *cb,
833 QRhiRenderTarget *rt,
834 const QColor &colorClearValue,
835 const QRhiDepthStencilClearValue &depthStencilClearValue,
836 QRhiResourceUpdateBatch *resourceUpdates,
837 QRhiCommandBuffer::BeginPassFlags flags) override;
838 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
839
840 void setGraphicsPipeline(QRhiCommandBuffer *cb,
841 QRhiGraphicsPipeline *ps) override;
842
843 void setShaderResources(QRhiCommandBuffer *cb,
844 QRhiShaderResourceBindings *srb,
845 int dynamicOffsetCount,
846 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
847
848 void setVertexInput(QRhiCommandBuffer *cb,
849 int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
850 QRhiBuffer *indexBuf, quint32 indexOffset,
851 QRhiCommandBuffer::IndexFormat indexFormat) override;
852
853 void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
854 void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
855 void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
856 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
857 void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override;
858
859 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
860 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
861
862 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
863 quint32 instanceCount, quint32 firstIndex,
864 qint32 vertexOffset, quint32 firstInstance) override;
865
866 void drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
867 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
868
869 void drawIndexedIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
870 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
871
872 void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
873 void debugMarkEnd(QRhiCommandBuffer *cb) override;
874 void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
875
876 void beginComputePass(QRhiCommandBuffer *cb,
877 QRhiResourceUpdateBatch *resourceUpdates,
878 QRhiCommandBuffer::BeginPassFlags flags) override;
879 void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
880 void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
881 void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
882
883 const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
884 void beginExternal(QRhiCommandBuffer *cb) override;
885 void endExternal(QRhiCommandBuffer *cb) override;
886 double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
887
888 QList<int> supportedSampleCounts() const override;
889 QList<QSize> supportedShadingRates(int sampleCount) const override;
890 int ubufAlignment() const override;
891 bool isYUpInFramebuffer() const override;
892 bool isYUpInNDC() const override;
893 bool isClipDepthZeroToOne() const override;
894 QMatrix4x4 clipSpaceCorrMatrix() const override;
895 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
896 bool isFeatureSupported(QRhi::Feature feature) const override;
897 int resourceLimit(QRhi::ResourceLimit limit) const override;
898 const QRhiNativeHandles *nativeHandles() override;
899 QRhiDriverInfo driverInfo() const override;
900 QRhiStats statistics() override;
902 void setQueueSubmitParams(QRhiNativeHandles *params) override;
904 bool isDeviceLost() const override;
905
906 QByteArray pipelineCacheData() override;
907 void setPipelineCacheData(const QByteArray &data) override;
908
909 bool ensureContext(QSurface *surface = nullptr) const;
915 int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc);
916 void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
918 QGles2Buffer *bufD,
922 QGles2Texture *texD,
925 void executeCommandBuffer(QRhiCommandBuffer *cb);
928 void *ps, uint psGeneration, int glslLocation,
929 int *texUnit, bool *activeTexUnitAltered);
931 QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs,
932 QRhiShaderResourceBindings *srb,
933 const uint *dynOfsPairs, int dynOfsCount);
935 bool *wantsColorClear = nullptr, bool *wantsDsClear = nullptr);
937 QByteArray shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
938 bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
939 bool linkProgram(GLuint program);
941 void registerUniformIfActive(const QShaderDescription::BlockVariable &var,
942 const QByteArray &namePrefix, int binding, int baseOffset,
943 GLuint program,
944 ActiveUniformLocationTracker *activeUniformLocations,
945 QGles2UniformDescriptionVector *dst);
946 void gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub,
947 ActiveUniformLocationTracker *activeUniformLocations, QGles2UniformDescriptionVector *dst);
948 void gatherSamplers(GLuint program, const QShaderDescription::InOutVariable &v,
949 QGles2SamplerDescriptionVector *dst);
950 void gatherGeneratedSamplers(GLuint program,
951 const QShader::SeparateToCombinedImageSamplerMapping &mapping,
952 QGles2SamplerDescriptionVector *dst);
953 void sanityCheckVertexFragmentInterface(const QShaderDescription &vsDesc, const QShaderDescription &fsDesc);
955
961 ProgramCacheResult tryLoadFromDiskOrPipelineCache(const QRhiShaderStage *stages,
962 int stageCount,
963 GLuint program,
964 const QVector<QShaderDescription::InOutVariable> &inputVars,
965 QByteArray *cacheKey);
966 void trySaveToDiskCache(GLuint program, const QByteArray &cacheKey);
967 void trySaveToPipelineCache(GLuint program, const QByteArray &cacheKey, bool force = false);
968
970 QOpenGLContext *ctx = nullptr;
971 bool importedContext = false;
976 mutable bool needsMakeCurrentDueToSwap = false;
977 QOpenGLExtensions *f = nullptr;
980 const void *) = nullptr;
983 const GLvoid *) = nullptr;
985 GLsizei) = nullptr;
987 const GLvoid *) = nullptr;
989 GLsizei, const GLvoid *) = nullptr;
991 GLint) = nullptr;
993 GLint, GLsizei) = nullptr;
996 void (QOPENGLF_APIENTRYP glObjectLabel)(GLenum, GLuint, GLsizei, const GLchar *) = nullptr;
1002 uint vao = 0;
1003 struct Caps {
1005 : ctxMajor(2),
1006 ctxMinor(0),
1007 maxTextureSize(2048),
1008 maxDrawBuffers(4),
1009 maxSamples(16),
1016 maxUniformVectors(4096),
1017 maxVertexInputs(8),
1019 msaaRenderBuffer(false),
1020 multisampledTexture(false),
1021 npotTextureFull(true),
1022 gles(false),
1024 bgraExternalFormat(false),
1025 bgraInternalFormat(false),
1026 r8Format(false),
1027 r16Format(false),
1028 r32uiFormat(false),
1029 floatFormats(false),
1030 rgb10Formats(false),
1031 depthTexture(false),
1032 packedDepthStencil(false),
1034 srgbWriteControl(false),
1035 coreProfile(false),
1036 vertexArrayObject(false),
1037 uniformBuffers(false),
1038 elementIndexUint(false),
1039 depth24(false),
1040 rgba8Format(false),
1041 instancing(false),
1042 baseVertex(false),
1043 compute(false),
1044 textureCompareMode(false),
1045 depthClamp(false),
1046 properMapBuffer(false),
1048 texelFetch(false),
1049 intAttributes(true),
1051 programBinary(false),
1052 texture3D(false),
1053 tessellation(false),
1054 geometryShader(false),
1055 texture1D(false),
1056 hasDrawBuffersFunc(false),
1057 halfAttributes(false),
1058 multiView(false),
1059 timestamps(false),
1060 objectLabel(false),
1063 unpackRowLength(false),
1065 { }
1080 // Multisample fb and blit are supported (GLES 3.0 or OpenGL 3.x). Not
1081 // the same as multisample textures!
1085 uint gles : 1;
1089 uint r8Format : 1;
1090 uint r16Format : 1;
1091 uint r32uiFormat : 1;
1098 uint coreProfile : 1;
1102 uint depth24 : 1;
1103 uint rgba8Format : 1;
1104 uint instancing : 1;
1105 uint baseVertex : 1;
1106 uint compute : 1;
1108 uint depthClamp : 1;
1111 uint texelFetch : 1;
1115 uint texture3D : 1;
1118 uint texture1D : 1;
1121 uint multiView : 1;
1122 uint timestamps : 1;
1123 uint objectLabel : 1;
1133 } caps;
1139 mutable bool contextLost = false;
1140 uint frameNo = 0;
1141
1151 union {
1152 struct {
1154 } buffer;
1155 struct {
1157 } pipeline;
1158 struct {
1160 } texture;
1161 struct {
1164 } renderbuffer;
1165 struct {
1168 } textureRenderTarget;
1169 };
1170 };
1172
1174 OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
1175 bool active = false;
1178 } ofr;
1179
1181
1187
1206};
1207
1209
1210QT_END_NAMESPACE
1211
1212#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:815
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:826
QRhiBackendCommandList()=default
T * cend() const
Definition qrhi_p.h:786
T * cbegin() const
Definition qrhi_p.h:785
bool isEmpty() const
Definition qrhi_p.h:771
void assign(QByteArray data)
Definition qrhi_p.h:405
QRhiBufferData()=default
void assign(const char *s, quint32 size)
Definition qrhi_p.h:386
quint32 size() const
Definition qrhi_p.h:378
QRhiBufferData(const QRhiBufferData &other)
Definition qrhi_p.h:357
quint32 largeAlloc() const
Definition qrhi_p.h:382
QRhiBufferData & operator=(const QRhiBufferData &other)
Definition qrhi_p.h:363
const char * constData() const
Definition qrhi_p.h:374
QHash< QRhiShaderStage, uint > m_shaderCache
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
void enqueueBarriersForPass(QGles2CommandBuffer *cbD)
QList< DeferredReleaseEntry > releaseQueue
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)
QRhiDriverInfo driverInfo() const override
QSurfaceFormat requestedFormat
QHash< QByteArray, PipelineCacheData > m_pipelineCache
bool isProgramBinaryDiskCacheEnabled() const
void(QOPENGLF_APIENTRYP glFramebufferTextureMultisampleMultiviewOVR)(GLenum
bool needsMakeCurrentDueToSwap
QRhiShadingRateMap * createShadingRateMap() override
const void GLint
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
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
QSurface * fallbackSurface
QRhiGles2(QRhiGles2InitParams *params, QRhiGles2NativeHandles *importDevice=nullptr)
QRhi::Flags rhiFlags
void trySaveToDiskCache(GLuint program, const QByteArray &cacheKey)
QList< QSize > supportedShadingRates(int sampleCount) const override
bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion)
void(QOPENGLF_APIENTRYP glTexSubImage1D)(GLenum
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
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
void endExternal(QRhiCommandBuffer *cb) override
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override
QByteArray shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion)
QRhiBuffer * createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) override
void(QOPENGLF_APIENTRYP glCompressedTexImage1D)(GLenum
bool importedContext
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
ProgramCacheResult tryLoadFromDiskOrPipelineCache(const QRhiShaderStage *stages, int stageCount, GLuint program, const QVector< QShaderDescription::InOutVariable > &inputVars, QByteArray *cacheKey)
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
@ ProgramCacheError
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)
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:259
double lastCompletedGpuTime(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:400
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override
Definition qrhinull.cpp:429
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:364
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override
Definition qrhinull.cpp:376
QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override
Definition qrhinull.cpp:406
void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
Definition qrhinull.cpp:515
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance) override
Definition qrhinull.cpp:322
void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
Definition qrhinull.cpp:611
void beginPass(QRhiCommandBuffer *cb, QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
Definition qrhinull.cpp:584
void setQueueSubmitParams(QRhiNativeHandles *params) override
Definition qrhinull.cpp:181
bool isClipDepthZeroToOne() const override
Definition qrhinull.cpp:97
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
Definition qrhinull.cpp:620
QNullCommandBuffer offscreenCommandBuffer
Definition qrhinull_p.h:302
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
Definition qrhinull.cpp:605
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override
Definition qrhinull.cpp:413
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override
Definition qrhinull.cpp:422
bool isYUpInNDC() const override
Definition qrhinull.cpp:92
QRhiDriverInfo driverInfo() const override
Definition qrhinull.cpp:163
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override
Definition qrhinull.cpp:288
void simulateTextureUpload(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
Definition qrhinull.cpp:440
QRhiComputePipeline * createComputePipeline() override
Definition qrhinull.cpp:243
void setPipelineCacheData(const QByteArray &data) override
Definition qrhinull.cpp:201
void setVertexInput(QRhiCommandBuffer *cb, int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings, QRhiBuffer *indexBuf, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat) override
Definition qrhinull.cpp:269
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override
Definition qrhinull.cpp:353
void draw(QRhiCommandBuffer *cb, quint32 vertexCount, quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override
Definition qrhinull.cpp:312
QByteArray pipelineCacheData() override
Definition qrhinull.cpp:196
void destroy() override
Definition qrhinull.cpp:57
const QRhiNativeHandles * nativeHandles() override
Definition qrhinull.cpp:158
void setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline *ps) override
Definition qrhinull.cpp:253
void releaseCachedResources() override
Definition qrhinull.cpp:186
void simulateTextureCopy(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
Definition qrhinull.cpp:491
QRhiTexture * createTexture(QRhiTexture::Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, QRhiTexture::Flags flags) override
Definition qrhinull.cpp:213
QList< QSize > supportedShadingRates(int sampleCount) const override
Definition qrhinull.cpp:66
void simulateTextureGenMips(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
Definition qrhinull.cpp:506
void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override
Definition qrhinull.cpp:306
QRhiRenderBuffer * createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint) override
Definition qrhinull.cpp:206
bool makeThreadLocalNativeContextCurrent() override
Definition qrhinull.cpp:175
void drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override
Definition qrhinull.cpp:333
const QRhiNativeHandles * nativeHandles(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:384
QRhiNullNativeHandles nativeHandlesStruct
Definition qrhinull_p.h:300
bool isYUpInFramebuffer() const override
Definition qrhinull.cpp:87
QRhi::FrameOpResult finish() override
Definition qrhinull.cpp:435
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override
Definition qrhinull.cpp:370
QRhiBuffer * createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) override
Definition qrhinull.cpp:77
QRhiStats statistics() override
Definition qrhinull.cpp:170
QRhiShadingRateMap * createShadingRateMap() override
Definition qrhinull.cpp:233
void beginExternal(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:390
QRhiSwapChain * createSwapChain() override
Definition qrhinull.cpp:72
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override
Definition qrhinull.cpp:282
QRhiTextureRenderTarget * createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags) override
Definition qrhinull.cpp:227
QRhiGraphicsPipeline * createGraphicsPipeline() override
Definition qrhinull.cpp:238
bool create(QRhi::Flags flags) override
Definition qrhinull.cpp:51
void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override
Definition qrhinull.cpp:300
void debugMarkEnd(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:359
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:220
void drawIndexedIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override
Definition qrhinull.cpp:343
QRhiSwapChain * currentSwapChain
Definition qrhinull_p.h:301
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:248
void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override
Definition qrhinull.cpp:294
void endExternal(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:395
bool isDeviceLost() const override
Definition qrhinull.cpp:191
static TextureStage toPassTrackerTextureStage(QRhiShaderResourceBinding::StageFlags stages)
Definition qrhi.cpp:12185
const QVarLengthFlatMap< QRhiBuffer *, Buffer, 12 > & buffers() const
Definition qrhi_p.h:743
static BufferStage toPassTrackerBufferStage(QRhiShaderResourceBinding::StageFlags stages)
Definition qrhi.cpp:12166
const QVarLengthFlatMap< QRhiTexture *, Texture, 12 > & textures() const
Definition qrhi_p.h:751
bool isEmpty() const
Definition qrhi.cpp:12075
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
Definition qrhi.cpp:12092
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
Definition qrhi.cpp:12132
QRhiPipelineCacheDataReader(const char *data, quint32 size)
Definition qrhi_p.h:884
bool readByteArray(QByteArray *dst)
Definition qrhi_p.h:899
bool readUInt32(quint32 *dst)
Definition qrhi_p.h:889
QVarLengthArray< BufferOp, BUFFER_OPS_STATIC_ALLOC > bufferOps
Definition qrhi_p.h:584
QRhiImplementation * rhi
Definition qrhi_p.h:591
QVarLengthArray< TextureOp, TEXTURE_OPS_STATIC_ALLOC > textureOps
Definition qrhi_p.h:588
static const int BUFFER_OPS_STATIC_ALLOC
Definition qrhi_p.h:583
static QRhiResourceUpdateBatchPrivate * get(QRhiResourceUpdateBatch *b)
Definition qrhi_p.h:599
void merge(QRhiResourceUpdateBatchPrivate *other)
Definition qrhi.cpp:10243
QRhiResourceUpdateBatch * q
Definition qrhi_p.h:590
static const int TEXTURE_OPS_STATIC_ALLOC
Definition qrhi_p.h:587
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:8554
static QRhiPassResourceTracker::BufferStage earlierStage(QRhiPassResourceTracker::BufferStage a, QRhiPassResourceTracker::BufferStage b)
Definition qrhi.cpp:12086
QDebug operator<<(QDebug dbg, const QRhiSwapChainHdrInfo &info)
Definition qrhi.cpp:8301
static bool isImageLoadStore(QRhiPassResourceTracker::TextureAccess access)
Definition qrhi.cpp:12125
static const char * deviceTypeStr(QRhiDriverInfo::DeviceType type)
\variable QRhiDriverInfo::deviceName
Definition qrhi.cpp:9531
static QRhiPassResourceTracker::TextureStage earlierStage(QRhiPassResourceTracker::TextureStage a, QRhiPassResourceTracker::TextureStage b)
Definition qrhi.cpp:12119
QRhiTargetRectBoundMode
Definition qrhi_p.h:286
@ UnBounded
Definition qrhi_p.h:287
@ Bounded
Definition qrhi_p.h:288
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:873
bool operator!=(const QRhiRenderTargetAttachmentTracker::ResId &a, const QRhiRenderTargetAttachmentTracker::ResId &b)
Definition qrhi_p.h:813
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:808
bool qrhi_toTopLeftRenderTargetRect(const QSize &outputSize, const std::array< T, N > &r, T *x, T *y, T *w, T *h)
Definition qrhi_p.h:292
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:626
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:646
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:636
char * beginFullDynamicBufferUpdateForCurrentFrame() override
Definition qrhinull.cpp:660
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.
Definition qrhinull.cpp:986
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:993
QNullGraphicsPipeline(QRhiImplementation *rhi)
Definition qrhinull.cpp:976
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:678
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:687
QNullRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint)
Definition qrhinull.cpp:666
QRhiTexture::Format backingFormat() const override
Definition qrhinull.cpp:701
QNullRenderPassDescriptor(QRhiImplementation *rhi)
Definition qrhinull.cpp:811
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() const override
Definition qrhinull.cpp:834
QVector< quint32 > serializedFormat() const override
Definition qrhinull.cpp:842
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:821
bool isCompatible(const QRhiRenderPassDescriptor *other) const override
Definition qrhinull.cpp:828
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:797
QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, AddressMode u, AddressMode v, AddressMode w)
Definition qrhinull.cpp:786
bool create() override
Definition qrhinull.cpp:804
QNullShaderResourceBindings(QRhiImplementation *rhi)
Definition qrhinull.cpp:942
bool create() override
Creates the corresponding resource binding set.
Definition qrhinull.cpp:959
void updateResources(UpdateFlags flags) override
Definition qrhinull.cpp:971
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:952
QSize pixelSize() const override
Definition qrhinull.cpp:862
float devicePixelRatio() const override
Definition qrhinull.cpp:867
QNullRenderTargetData d
Definition qrhinull_p.h:101
QNullSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
Definition qrhinull.cpp:847
int sampleCount() const override
Definition qrhinull.cpp:872
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:858
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:924
int sampleCount() const override
Definition qrhinull.cpp:937
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:890
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
Definition qrhinull.cpp:897
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:905
QNullTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags)
Definition qrhinull.cpp:877
QNullRenderTargetData d
Definition qrhinull_p.h:117
float devicePixelRatio() const override
Definition qrhinull.cpp:932
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:726
bool createFrom(NativeTexture src) override
Similar to create(), except that no new native textures are created.
Definition qrhinull.cpp:770
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:706
uint generation
Definition qrhinull_p.h:59
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:717
bool operator!=(const Batch &other) const
Definition qrhi_p.h:639
QVector< T > resources
Definition qrhi_p.h:632
bool operator==(const Batch &other) const
Definition qrhi_p.h:634
void feed(int binding, T resource)
Definition qrhi_p.h:605
QVector< Batch > batches
Definition qrhi_p.h:648
bool operator!=(const QRhiBatchedBindings< T > &other) const
Definition qrhi_p.h:655
bool operator==(const QRhiBatchedBindings< T > &other) const
Definition qrhi_p.h:650
char smallData[SMALL_DATA_SIZE]
Definition qrhi_p.h:344
QByteArray largeData
Definition qrhi_p.h:342
static constexpr quint32 SMALL_DATA_SIZE
Definition qrhi_p.h:343
uint needsDepthStencilCombinedAttach
uint perRenderTargetBlending
int maxThreadGroupsPerDimension
uint glesMultisampleRenderToTexture
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:819
static bool isUpToDate(const QRhiTextureRenderTargetDescription &desc, const ResIdList &currentResIdList)
Definition qrhi_p.h:857
static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:467
static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:498
static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:482
static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:460
static BufferOp staticUpload(QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:491
static BufferOp staticUpload(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:475
static BufferOp read(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result)
Definition qrhi_p.h:506
static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:444
static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:451
QRhiTextureCopyDescription desc
Definition qrhi_p.h:534
static TextureOp copy(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc)
Definition qrhi_p.h:554
QVarLengthArray< MipLevelUploadList, 6 > subresDesc
Definition qrhi_p.h:532
static TextureOp upload(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
Definition qrhi_p.h:538
static TextureOp genMips(QRhiTexture *tex)
Definition qrhi_p.h:573
static TextureOp read(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
Definition qrhi_p.h:564
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1562
LimitsType limitsType
Definition qrhi.h:1573
float maxPotentialColorComponentValue
Definition qrhi.h:1581
LuminanceBehavior luminanceBehavior
Definition qrhi.h:1584
float maxColorComponentValue
Definition qrhi.h:1580
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1595
void * reserved[2]
Definition qrhi.h:1596
uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT *2]
QRhiShaderResourceBindings * srb
QRhiGraphicsPipeline * maybeGraphicsPs
QRhiComputePipeline * maybeComputePs
QRhiSwapChain::StereoTargetBuffer stereoTarget