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
4#ifndef QRHIGLES2_P_H
5#define QRHIGLES2_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qrhi_p.h"
19#include <rhi/qshaderdescription.h>
20#include <qopengl.h>
21#include <QByteArray>
22#include <QWindow>
23#include <QPointer>
24#include <QtCore/private/qduplicatetracker_p.h>
25#include <optional>
26
27QT_BEGIN_NAMESPACE
28
29class QOpenGLExtensions;
30class QRhiGles2;
31
63
65{
66 QGles2RenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
67 int sampleCount, QRhiRenderBuffer::Flags flags,
68 QRhiTexture::Format backingFormatHint);
70 void destroy() override;
71 bool create() override;
72 bool createFrom(NativeRenderBuffer src) override;
73 QRhiTexture::Format backingFormat() const override;
74
76 GLuint stencilRenderbuffer = 0; // when packed depth-stencil not supported
78 bool owns = true;
79 uint generation = 0;
80 friend class QRhiGles2;
81};
82
92
93inline bool operator==(const QGles2SamplerData &a, const QGles2SamplerData &b)
94{
95 return a.glminfilter == b.glminfilter
96 && a.glmagfilter == b.glmagfilter
97 && a.glwraps == b.glwraps
98 && a.glwrapt == b.glwrapt
99 && a.glwrapr == b.glwrapr
100 && a.gltexcomparefunc == b.gltexcomparefunc;
101}
102
103inline bool operator!=(const QGles2SamplerData &a, const QGles2SamplerData &b)
104{
105 return !(a == b);
106}
107
109{
110 QGles2Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
111 int arraySize, int sampleCount, Flags flags);
112 ~QGles2Texture();
113 void destroy() override;
114 bool create() override;
115 bool createFrom(NativeTexture src) override;
116 NativeTexture nativeTexture() override;
117
118 bool prepareCreate(QSize *adjustedSize = nullptr);
119
121 bool owns = true;
128 bool specified = false;
129 bool zeroInitialized = false;
132
143 struct UsageState {
145 };
147
148 uint generation = 0;
149 friend class QRhiGles2;
150};
151
153{
154 QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
155 AddressMode u, AddressMode v, AddressMode w);
156 ~QGles2Sampler();
157 void destroy() override;
158 bool create() override;
159
161 uint generation = 0;
162 friend class QRhiGles2;
163};
164
166{
167 QGles2RenderPassDescriptor(QRhiImplementation *rhi);
169 void destroy() override;
170 bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
172 QVector<quint32> serializedFormat() const override;
173};
174
191
193{
194 QGles2SwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
196 void destroy() override;
197
198 QSize pixelSize() const override;
199 float devicePixelRatio() const override;
200 int sampleCount() const override;
201
203};
204
206{
207 QGles2TextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
209 void destroy() override;
210
211 QSize pixelSize() const override;
212 float devicePixelRatio() const override;
213 int sampleCount() const override;
214
216 bool create() override;
217
221 friend class QRhiGles2;
222};
223
225{
226 QGles2ShaderResourceBindings(QRhiImplementation *rhi);
228 void destroy() override;
229 bool create() override;
230 void updateResources(UpdateFlags flags) override;
231
232 bool hasDynamicOffset = false;
233 uint generation = 0;
234 friend class QRhiGles2;
235};
236
246
248
256
258
259using QGles2UniformDescriptionVector = QVarLengthArray<QGles2UniformDescription, 8>;
260using QGles2SamplerDescriptionVector = QVarLengthArray<QGles2SamplerDescription, 4>;
261
263{
264 static constexpr int MAX_TRACKED_LOCATION = 1023;
266 float v[4];
267};
268
287
305
307{
308 QGles2CommandBuffer(QRhiImplementation *rhi);
310 void destroy() override;
311
312 // keep at a reasonably low value otherwise sizeof Command explodes
313 static const int MAX_DYNAMIC_OFFSET_COUNT = 8;
314
315 struct Command {
349
350 // QRhi*/QGles2* references should be kept at minimum (so no
351 // QRhiTexture/Buffer/etc. pointers).
352 union Args {
353 struct {
355 } beginFrame;
356 struct {
357 GLuint timestampQuery;
358 } endFrame;
359 struct {
360 float x, y, w, h;
361 float d0, d1;
362 } viewport;
363 struct {
364 int x, y, w, h;
365 } scissor;
366 struct {
367 float r, g, b, a;
368 } blendConstants;
369 struct {
372 } stencilRef;
373 struct {
374 QRhiGraphicsPipeline *ps;
378 } bindVertexBuffer;
379 struct {
380 GLuint buffer;
381 quint32 offset;
383 } bindIndexBuffer;
384 struct {
385 QRhiGraphicsPipeline *ps;
390 } draw;
391 struct {
392 QRhiGraphicsPipeline *ps;
395 quint32 instanceCount;
396 quint32 baseInstance;
398 } drawIndexed;
399 struct {
400 QRhiGraphicsPipeline *ps;
401 } bindGraphicsPipeline;
402 struct {
407 uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT * 2]; // binding, offset
408 } bindShaderResources;
409 struct {
411 float c[4];
412 float d;
414 } clear;
415 struct {
417 bool srgb;
419 bool stereo;
421 } bindFramebuffer;
422 struct {
424 GLuint buffer;
426 int size;
427 const void *data; // must come from retainData()
428 } bufferSubData;
429 struct {
431 GLenum target;
432 GLuint buffer;
433 int offset;
434 int size;
435 } getBufferSubData;
436 struct {
441 int srcX;
442 int srcY;
443 int srcZ;
448 int dstX;
449 int dstY;
450 int dstZ;
451 int w;
452 int h;
453 } copyTex;
454 struct {
455 QRhiReadbackResult *result;
457 int x;
458 int y;
459 int w;
460 int h;
463 int level;
465 } readPixels;
466 struct {
467 GLenum target;
468 GLuint texture;
470 int level;
471 int dx;
472 int dy;
473 int dz;
474 int w;
475 int h;
480 const void *data; // must come from retainImage()
481 } subImage;
482 struct {
483 GLenum target;
484 GLuint texture;
485 GLenum faceTarget;
486 int level;
488 int w;
489 int h;
490 int depth;
491 int size;
492 const void *data; // must come from retainData()
493 } compressedImage;
494 struct {
495 GLenum target;
496 GLuint texture;
497 GLenum faceTarget;
498 int level;
499 int dx;
500 int dy;
501 int dz;
502 int w;
503 int h;
504 GLenum glintformat;
505 int size;
506 const void *data; // must come from retainData()
507 } compressedSubImage;
508 struct {
510 int w;
511 int h;
512 GLenum target;
513 GLuint dstTexture;
514 int dstLevel;
517 } blitFromRenderbuffer;
518 struct {
519 GLenum srcTarget;
520 GLuint srcTexture;
521 int srcLevel;
523 int w;
524 int h;
525 GLenum dstTarget;
526 GLuint dstTexture;
527 int dstLevel;
528 int dstLayer;
529 bool isDepthStencil;
530 } blitFromTexture;
531 struct {
532 GLenum target;
533 GLuint texture;
534 } genMip;
535 struct {
537 } bindComputePipeline;
538 struct {
542 } dispatch;
543 struct {
545 } barriersForPass;
546 struct {
548 } barrier;
549 struct {
552 } invalidateFramebuffer;
553 } args;
554 };
555
561
565
568 double lastGpuTime = 0;
576
578 bool valid = false;
583 bool blendEnabled[16];
584 struct ColorMask { bool r, g, b, a; } colorMask[16];
611 void reset() { valid = false; }
612 struct {
613 // not part of QRhiGraphicsPipeline but used by setGraphicsPipeline()
615 } dynamic;
616 } graphicsPassState;
617
619 enum Access {
620 Read = 0x01,
621 Write = 0x02
622 };
624 void reset() {
625 writtenResources.clear();
626 }
627 } computePassState;
628
630 void *ps;
633 } textureUnitState[16];
634
638
639 // relies heavily on implicit sharing (no copies of the actual data will be made)
640 const void *retainData(const QByteArray &data) {
641 dataRetainPool.append(data);
642 return dataRetainPool.last().constData();
643 }
645 bufferDataRetainPool.append(data);
646 return reinterpret_cast<const uchar *>(bufferDataRetainPool.last().constData());
647 }
648 const void *retainImage(const QImage &image) {
649 imageRetainPool.append(image);
650 return imageRetainPool.last().constBits();
651 }
653 commands.reset();
654 dataRetainPool.clear();
655 bufferDataRetainPool.clear();
656 imageRetainPool.clear();
657
658 passResTrackers.clear();
660 }
661 void resetState() {
664 // do not zero lastGpuTime
665 currentTarget = nullptr;
668 }
670 currentGraphicsPipeline = nullptr;
671 currentComputePipeline = nullptr;
673 currentGraphicsSrb = nullptr;
674 currentComputeSrb = nullptr;
676 graphicsPassState.reset();
677 computePassState.reset();
678 memset(textureUnitState, 0, sizeof(textureUnitState));
679 }
680};
681
684{
685 return a.func == b.func
686 && a.failOp == b.failOp
687 && a.zfailOp == b.zfailOp
688 && a.zpassOp == b.zpassOp;
689}
690
693{
694 return !(a == b);
695}
696
699{
700 return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
701}
702
705{
706 return !(a == b);
707}
708
711{
712 return a.srcColor == b.srcColor
713 && a.dstColor == b.dstColor
714 && a.srcAlpha == b.srcAlpha
715 && a.dstAlpha == b.dstAlpha
716 && a.opColor == b.opColor
717 && a.opAlpha == b.opAlpha;
718}
719
722{
723 return !(a == b);
724}
725
727{
728 static const int TIMESTAMP_PAIRS = 2;
729
732
733 void prepare(QRhiGles2 *rhiD);
734 void destroy(QRhiGles2 *rhiD);
735 bool tryQueryTimestamps(int pairIndex, QRhiGles2 *rhiD, double *elapsedSec);
736};
737
765
767{
768public:
769 QRhiGles2(QRhiGles2InitParams *params, QRhiGles2NativeHandles *importDevice = nullptr);
770
771 bool create(QRhi::Flags flags) override;
772 void destroy() override;
773
777 QRhiBuffer *createBuffer(QRhiBuffer::Type type,
778 QRhiBuffer::UsageFlags usage,
779 quint32 size) override;
780 QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
781 const QSize &pixelSize,
782 int sampleCount,
783 QRhiRenderBuffer::Flags flags,
784 QRhiTexture::Format backingFormatHint) override;
785 QRhiTexture *createTexture(QRhiTexture::Format format,
786 const QSize &pixelSize,
787 int depth,
788 int arraySize,
789 int sampleCount,
790 QRhiTexture::Flags flags) override;
791 QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
792 QRhiSampler::Filter minFilter,
793 QRhiSampler::Filter mipmapMode,
794 QRhiSampler:: AddressMode u,
795 QRhiSampler::AddressMode v,
796 QRhiSampler::AddressMode w) override;
797
798 QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
799 QRhiTextureRenderTarget::Flags flags) override;
800
801 QRhiShadingRateMap *createShadingRateMap() override;
802
803 QRhiSwapChain *createSwapChain() override;
804 QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
805 QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
806 QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
807 QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
808 QRhi::FrameOpResult finish() override;
809
810 void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
811
812 void beginPass(QRhiCommandBuffer *cb,
813 QRhiRenderTarget *rt,
814 const QColor &colorClearValue,
815 const QRhiDepthStencilClearValue &depthStencilClearValue,
816 QRhiResourceUpdateBatch *resourceUpdates,
817 QRhiCommandBuffer::BeginPassFlags flags) override;
818 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
819
820 void setGraphicsPipeline(QRhiCommandBuffer *cb,
821 QRhiGraphicsPipeline *ps) override;
822
823 void setShaderResources(QRhiCommandBuffer *cb,
824 QRhiShaderResourceBindings *srb,
825 int dynamicOffsetCount,
826 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
827
828 void setVertexInput(QRhiCommandBuffer *cb,
829 int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
830 QRhiBuffer *indexBuf, quint32 indexOffset,
831 QRhiCommandBuffer::IndexFormat indexFormat) override;
832
833 void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
834 void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
835 void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
836 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
837 void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override;
838
839 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
840 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
841
842 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
843 quint32 instanceCount, quint32 firstIndex,
844 qint32 vertexOffset, quint32 firstInstance) override;
845
846 void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
847 void debugMarkEnd(QRhiCommandBuffer *cb) override;
848 void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
849
850 void beginComputePass(QRhiCommandBuffer *cb,
851 QRhiResourceUpdateBatch *resourceUpdates,
852 QRhiCommandBuffer::BeginPassFlags flags) override;
853 void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
854 void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
855 void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
856
857 const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
858 void beginExternal(QRhiCommandBuffer *cb) override;
859 void endExternal(QRhiCommandBuffer *cb) override;
860 double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
861
862 QList<int> supportedSampleCounts() const override;
863 QList<QSize> supportedShadingRates(int sampleCount) const override;
864 int ubufAlignment() const override;
865 bool isYUpInFramebuffer() const override;
866 bool isYUpInNDC() const override;
867 bool isClipDepthZeroToOne() const override;
868 QMatrix4x4 clipSpaceCorrMatrix() const override;
869 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
870 bool isFeatureSupported(QRhi::Feature feature) const override;
871 int resourceLimit(QRhi::ResourceLimit limit) const override;
872 const QRhiNativeHandles *nativeHandles() override;
873 QRhiDriverInfo driverInfo() const override;
874 QRhiStats statistics() override;
876 void setQueueSubmitParams(QRhiNativeHandles *params) override;
878 bool isDeviceLost() const override;
879
880 QByteArray pipelineCacheData() override;
881 void setPipelineCacheData(const QByteArray &data) override;
882
883 bool ensureContext(QSurface *surface = nullptr) const;
889 int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc);
890 void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
892 QGles2Buffer *bufD,
896 QGles2Texture *texD,
899 void executeCommandBuffer(QRhiCommandBuffer *cb);
902 void *ps, uint psGeneration, int glslLocation,
903 int *texUnit, bool *activeTexUnitAltered);
905 QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs,
906 QRhiShaderResourceBindings *srb,
907 const uint *dynOfsPairs, int dynOfsCount);
909 bool *wantsColorClear = nullptr, bool *wantsDsClear = nullptr);
911 QByteArray shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
912 bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
913 bool linkProgram(GLuint program);
915 void registerUniformIfActive(const QShaderDescription::BlockVariable &var,
916 const QByteArray &namePrefix, int binding, int baseOffset,
917 GLuint program,
918 ActiveUniformLocationTracker *activeUniformLocations,
919 QGles2UniformDescriptionVector *dst);
920 void gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub,
921 ActiveUniformLocationTracker *activeUniformLocations, QGles2UniformDescriptionVector *dst);
922 void gatherSamplers(GLuint program, const QShaderDescription::InOutVariable &v,
923 QGles2SamplerDescriptionVector *dst);
924 void gatherGeneratedSamplers(GLuint program,
925 const QShader::SeparateToCombinedImageSamplerMapping &mapping,
926 QGles2SamplerDescriptionVector *dst);
927 void sanityCheckVertexFragmentInterface(const QShaderDescription &vsDesc, const QShaderDescription &fsDesc);
929
935 ProgramCacheResult tryLoadFromDiskOrPipelineCache(const QRhiShaderStage *stages,
936 int stageCount,
937 GLuint program,
938 const QVector<QShaderDescription::InOutVariable> &inputVars,
939 QByteArray *cacheKey);
940 void trySaveToDiskCache(GLuint program, const QByteArray &cacheKey);
941 void trySaveToPipelineCache(GLuint program, const QByteArray &cacheKey, bool force = false);
942
944 QOpenGLContext *ctx = nullptr;
945 bool importedContext = false;
950 mutable bool needsMakeCurrentDueToSwap = false;
951 QOpenGLExtensions *f = nullptr;
954 const void *) = nullptr;
957 const GLvoid *) = nullptr;
959 GLsizei) = nullptr;
961 const GLvoid *) = nullptr;
963 GLsizei, const GLvoid *) = nullptr;
965 GLint) = nullptr;
967 GLint, GLsizei) = nullptr;
970 void (QOPENGLF_APIENTRYP glObjectLabel)(GLenum, GLuint, GLsizei, const GLchar *) = nullptr;
974 uint vao = 0;
975 struct Caps {
977 : ctxMajor(2),
978 ctxMinor(0),
979 maxTextureSize(2048),
981 maxSamples(16),
988 maxUniformVectors(4096),
991 msaaRenderBuffer(false),
992 multisampledTexture(false),
993 npotTextureFull(true),
994 gles(false),
996 bgraExternalFormat(false),
997 bgraInternalFormat(false),
998 r8Format(false),
999 r16Format(false),
1000 r32uiFormat(false),
1001 floatFormats(false),
1002 rgb10Formats(false),
1003 depthTexture(false),
1004 packedDepthStencil(false),
1006 srgbWriteControl(false),
1007 coreProfile(false),
1008 uniformBuffers(false),
1009 elementIndexUint(false),
1010 depth24(false),
1011 rgba8Format(false),
1012 instancing(false),
1013 baseVertex(false),
1014 compute(false),
1015 textureCompareMode(false),
1016 properMapBuffer(false),
1018 texelFetch(false),
1019 intAttributes(true),
1021 programBinary(false),
1022 texture3D(false),
1023 tessellation(false),
1024 geometryShader(false),
1025 texture1D(false),
1026 hasDrawBuffersFunc(false),
1027 halfAttributes(false),
1028 multiView(false),
1029 timestamps(false),
1030 objectLabel(false),
1033 unpackRowLength(false),
1035 { }
1050 // Multisample fb and blit are supported (GLES 3.0 or OpenGL 3.x). Not
1051 // the same as multisample textures!
1055 uint gles : 1;
1059 uint r8Format : 1;
1060 uint r16Format : 1;
1061 uint r32uiFormat : 1;
1068 uint coreProfile : 1;
1071 uint depth24 : 1;
1072 uint rgba8Format : 1;
1073 uint instancing : 1;
1074 uint baseVertex : 1;
1075 uint compute : 1;
1079 uint texelFetch : 1;
1083 uint texture3D : 1;
1086 uint texture1D : 1;
1089 uint multiView : 1;
1090 uint timestamps : 1;
1091 uint objectLabel : 1;
1097 } caps;
1103 mutable bool contextLost = false;
1104 uint frameNo = 0;
1105
1115 union {
1116 struct {
1118 } buffer;
1119 struct {
1121 } pipeline;
1122 struct {
1124 } texture;
1125 struct {
1128 } renderbuffer;
1129 struct {
1132 } textureRenderTarget;
1133 };
1134 };
1136
1138 OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
1139 bool active = false;
1142 } ofr;
1143
1145
1151
1170};
1171
1173
1174QT_END_NAMESPACE
1175
1176#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:801
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:812
QRhiBackendCommandList()=default
T * cend() const
Definition qrhi_p.h:772
T * cbegin() const
Definition qrhi_p.h:771
bool isEmpty() const
Definition qrhi_p.h:757
void assign(QByteArray data)
Definition qrhi_p.h:396
QRhiBufferData()=default
void assign(const char *s, quint32 size)
Definition qrhi_p.h:377
quint32 size() const
Definition qrhi_p.h:369
QRhiBufferData(const QRhiBufferData &other)
Definition qrhi_p.h:348
quint32 largeAlloc() const
Definition qrhi_p.h:373
QRhiBufferData & operator=(const QRhiBufferData &other)
Definition qrhi_p.h:354
const char * constData() const
Definition qrhi_p.h:365
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
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
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
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:258
double lastCompletedGpuTime(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:379
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override
Definition qrhinull.cpp:408
bool isFeatureSupported(QRhi::Feature feature) const override
Definition qrhinull.cpp:113
QRhiNull(QRhiNullInitParams *params)
Definition qrhinull.cpp:44
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override
Definition qrhinull.cpp:343
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override
Definition qrhinull.cpp:355
QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override
Definition qrhinull.cpp:385
void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
Definition qrhinull.cpp:485
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance) override
Definition qrhinull.cpp:321
void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
Definition qrhinull.cpp:581
void beginPass(QRhiCommandBuffer *cb, QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
Definition qrhinull.cpp:554
void setQueueSubmitParams(QRhiNativeHandles *params) override
Definition qrhinull.cpp:180
bool isClipDepthZeroToOne() const override
Definition qrhinull.cpp:96
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
Definition qrhinull.cpp:590
QNullCommandBuffer offscreenCommandBuffer
Definition qrhinull_p.h:295
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
Definition qrhinull.cpp:575
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override
Definition qrhinull.cpp:392
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override
Definition qrhinull.cpp:401
bool isYUpInNDC() const override
Definition qrhinull.cpp:91
QRhiDriverInfo driverInfo() const override
Definition qrhinull.cpp:162
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override
Definition qrhinull.cpp:287
void simulateTextureUpload(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
Definition qrhinull.cpp:419
QRhiComputePipeline * createComputePipeline() override
Definition qrhinull.cpp:242
void setPipelineCacheData(const QByteArray &data) override
Definition qrhinull.cpp:200
void setVertexInput(QRhiCommandBuffer *cb, int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings, QRhiBuffer *indexBuf, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat) override
Definition qrhinull.cpp:268
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override
Definition qrhinull.cpp:332
void draw(QRhiCommandBuffer *cb, quint32 vertexCount, quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override
Definition qrhinull.cpp:311
QByteArray pipelineCacheData() override
Definition qrhinull.cpp:195
void destroy() override
Definition qrhinull.cpp:56
const QRhiNativeHandles * nativeHandles() override
Definition qrhinull.cpp:157
void setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline *ps) override
Definition qrhinull.cpp:252
void releaseCachedResources() override
Definition qrhinull.cpp:185
void simulateTextureCopy(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
Definition qrhinull.cpp:461
QRhiTexture * createTexture(QRhiTexture::Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, QRhiTexture::Flags flags) override
Definition qrhinull.cpp:212
QList< QSize > supportedShadingRates(int sampleCount) const override
Definition qrhinull.cpp:65
void simulateTextureGenMips(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
Definition qrhinull.cpp:476
void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override
Definition qrhinull.cpp:305
QRhiRenderBuffer * createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint) override
Definition qrhinull.cpp:205
bool makeThreadLocalNativeContextCurrent() override
Definition qrhinull.cpp:174
const QRhiNativeHandles * nativeHandles(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:363
QRhiNullNativeHandles nativeHandlesStruct
Definition qrhinull_p.h:293
bool isYUpInFramebuffer() const override
Definition qrhinull.cpp:86
QRhi::FrameOpResult finish() override
Definition qrhinull.cpp:414
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override
Definition qrhinull.cpp:349
QRhiBuffer * createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) override
Definition qrhinull.cpp:76
QRhiStats statistics() override
Definition qrhinull.cpp:169
QRhiShadingRateMap * createShadingRateMap() override
Definition qrhinull.cpp:232
void beginExternal(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:369
QRhiSwapChain * createSwapChain() override
Definition qrhinull.cpp:71
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override
Definition qrhinull.cpp:281
QRhiTextureRenderTarget * createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags) override
Definition qrhinull.cpp:226
QRhiGraphicsPipeline * createGraphicsPipeline() override
Definition qrhinull.cpp:237
bool create(QRhi::Flags flags) override
Definition qrhinull.cpp:50
void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override
Definition qrhinull.cpp:299
void debugMarkEnd(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:338
QList< int > supportedSampleCounts() const override
Definition qrhinull.cpp:60
QMatrix4x4 clipSpaceCorrMatrix() const override
Definition qrhinull.cpp:101
QRhiSampler * createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w) override
Definition qrhinull.cpp:219
QRhiSwapChain * currentSwapChain
Definition qrhinull_p.h:294
int ubufAlignment() const override
Definition qrhinull.cpp:81
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override
Definition qrhinull.cpp:106
int resourceLimit(QRhi::ResourceLimit limit) const override
Definition qrhinull.cpp:119
QRhiShaderResourceBindings * createShaderResourceBindings() override
Definition qrhinull.cpp:247
void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override
Definition qrhinull.cpp:293
void endExternal(QRhiCommandBuffer *cb) override
Definition qrhinull.cpp:374
bool isDeviceLost() const override
Definition qrhinull.cpp:190
static TextureStage toPassTrackerTextureStage(QRhiShaderResourceBinding::StageFlags stages)
Definition qrhi.cpp:11850
const QVarLengthFlatMap< QRhiBuffer *, Buffer, 12 > & buffers() const
Definition qrhi_p.h:729
static BufferStage toPassTrackerBufferStage(QRhiShaderResourceBinding::StageFlags stages)
Definition qrhi.cpp:11831
const QVarLengthFlatMap< QRhiTexture *, Texture, 12 > & textures() const
Definition qrhi_p.h:737
bool isEmpty() const
Definition qrhi.cpp:11740
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
Definition qrhi.cpp:11757
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
Definition qrhi.cpp:11797
QVarLengthArray< BufferOp, BUFFER_OPS_STATIC_ALLOC > bufferOps
Definition qrhi_p.h:575
QRhiImplementation * rhi
Definition qrhi_p.h:582
QVarLengthArray< TextureOp, TEXTURE_OPS_STATIC_ALLOC > textureOps
Definition qrhi_p.h:579
static const int BUFFER_OPS_STATIC_ALLOC
Definition qrhi_p.h:574
static QRhiResourceUpdateBatchPrivate * get(QRhiResourceUpdateBatch *b)
Definition qrhi_p.h:590
void merge(QRhiResourceUpdateBatchPrivate *other)
Definition qrhi.cpp:9985
QRhiResourceUpdateBatch * q
Definition qrhi_p.h:581
static const int TEXTURE_OPS_STATIC_ALLOC
Definition qrhi_p.h:578
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
#define QOPENGLF_APIENTRYP
Definition qopengl.h:275
static const char * resourceTypeStr(const QRhiResource *res)
Definition qrhi.cpp:8356
static QRhiPassResourceTracker::BufferStage earlierStage(QRhiPassResourceTracker::BufferStage a, QRhiPassResourceTracker::BufferStage b)
Definition qrhi.cpp:11751
QDebug operator<<(QDebug dbg, const QRhiSwapChainHdrInfo &info)
Definition qrhi.cpp:8171
static bool isImageLoadStore(QRhiPassResourceTracker::TextureAccess access)
Definition qrhi.cpp:11790
static const char * deviceTypeStr(QRhiDriverInfo::DeviceType type)
\variable QRhiDriverInfo::deviceName
Definition qrhi.cpp:9275
static QRhiPassResourceTracker::TextureStage earlierStage(QRhiPassResourceTracker::TextureStage a, QRhiPassResourceTracker::TextureStage b)
Definition qrhi.cpp:11784
QRhiTargetRectBoundMode
Definition qrhi_p.h:277
@ UnBounded
Definition qrhi_p.h:278
@ Bounded
Definition qrhi_p.h:279
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:859
bool operator!=(const QRhiRenderTargetAttachmentTracker::ResId &a, const QRhiRenderTargetAttachmentTracker::ResId &b)
Definition qrhi_p.h:799
Q_DECLARE_TYPEINFO(QRhiPassResourceTracker::Buffer, Q_RELOCATABLE_TYPE)
#define QRHI_RES(t, x)
Definition qrhi_p.h:29
bool operator==(const QRhiRenderTargetAttachmentTracker::ResId &a, const QRhiRenderTargetAttachmentTracker::ResId &b)
Definition qrhi_p.h:794
bool qrhi_toTopLeftRenderTargetRect(const QSize &outputSize, const std::array< T, N > &r, T *x, T *y, T *w, T *h)
Definition qrhi_p.h:283
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:93
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:191
QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
@ AccessStorageReadWrite
Definition qrhigles2_p.h:54
QByteArray data
Definition qrhigles2_p.h:46
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:45
quint32 nonZeroSize
Definition qrhigles2_p.h:43
void fullDynamicBufferUpdateForCurrentFrame(const void *data, quint32 size) override
UsageState usageState
Definition qrhigles2_p.h:60
GLuint buffer
Definition qrhigles2_p.h:44
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:76
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:90
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:30
QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
Definition qrhinull.cpp:596
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:616
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:606
char * beginFullDynamicBufferUpdateForCurrentFrame() override
Definition qrhinull.cpp:630
QNullCommandBuffer(QRhiImplementation *rhi)
Definition qrhinull.cpp:992
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.
Definition qrhinull.cpp:978
bool create() override
Definition qrhinull.cpp:985
QNullComputePipeline(QRhiImplementation *rhi)
Definition qrhinull.cpp:968
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:951
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:958
QNullGraphicsPipeline(QRhiImplementation *rhi)
Definition qrhinull.cpp:941
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:648
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:657
QNullRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint)
Definition qrhinull.cpp:636
QRhiTexture::Format backingFormat() const override
Definition qrhinull.cpp:671
QNullRenderPassDescriptor(QRhiImplementation *rhi)
Definition qrhinull.cpp:776
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() const override
Definition qrhinull.cpp:799
QVector< quint32 > serializedFormat() const override
Definition qrhinull.cpp:807
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:786
bool isCompatible(const QRhiRenderPassDescriptor *other) const override
Definition qrhinull.cpp:793
QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList
Definition qrhinull_p.h:87
QNullRenderPassDescriptor * rp
Definition qrhinull_p.h:84
QNullRenderTargetData(QRhiImplementation *)
Definition qrhinull_p.h:82
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:762
QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, AddressMode u, AddressMode v, AddressMode w)
Definition qrhinull.cpp:751
bool create() override
Definition qrhinull.cpp:769
QNullShaderResourceBindings(QRhiImplementation *rhi)
Definition qrhinull.cpp:907
bool create() override
Creates the corresponding resource binding set.
Definition qrhinull.cpp:924
void updateResources(UpdateFlags flags) override
Definition qrhinull.cpp:936
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:917
QSize pixelSize() const override
Definition qrhinull.cpp:827
float devicePixelRatio() const override
Definition qrhinull.cpp:832
QNullRenderTargetData d
Definition qrhinull_p.h:100
QNullSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
Definition qrhinull.cpp:812
int sampleCount() const override
Definition qrhinull.cpp:837
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:823
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:166
QSize surfacePixelSize() override
QNullSwapChainRenderTarget rt
Definition qrhinull_p.h:167
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:168
QSize pixelSize() const override
Definition qrhinull.cpp:889
int sampleCount() const override
Definition qrhinull.cpp:902
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:855
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
Definition qrhinull.cpp:862
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:870
QNullTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags)
Definition qrhinull.cpp:842
QNullRenderTargetData d
Definition qrhinull_p.h:116
float devicePixelRatio() const override
Definition qrhinull.cpp:897
bool create() override
Creates the corresponding native graphics resources.
Definition qrhinull.cpp:696
bool createFrom(NativeTexture src) override
Similar to create(), except that no new native textures are created.
Definition qrhinull.cpp:735
QVarLengthArray< std::array< QImage, QRhi::MAX_MIP_LEVELS >, 6 > image
Definition qrhinull_p.h:57
QNullTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, Flags flags)
Definition qrhinull.cpp:676
uint generation
Definition qrhinull_p.h:58
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
Definition qrhinull.cpp:687
bool operator!=(const Batch &other) const
Definition qrhi_p.h:630
bool operator==(const Batch &other) const
Definition qrhi_p.h:625
QVarLengthArray< T, 4 > resources
Definition qrhi_p.h:623
void feed(int binding, T resource)
Definition qrhi_p.h:596
QVarLengthArray< Batch, 4 > batches
Definition qrhi_p.h:636
bool operator!=(const QRhiBatchedBindings< T > &other) const
Definition qrhi_p.h:643
bool operator==(const QRhiBatchedBindings< T > &other) const
Definition qrhi_p.h:638
char smallData[SMALL_DATA_SIZE]
Definition qrhi_p.h:335
QByteArray largeData
Definition qrhi_p.h:333
static constexpr quint32 SMALL_DATA_SIZE
Definition qrhi_p.h:334
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:805
static bool isUpToDate(const QRhiTextureRenderTargetDescription &desc, const ResIdList &currentResIdList)
Definition qrhi_p.h:843
static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:458
static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:489
static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:473
static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:451
static BufferOp staticUpload(QRhiBuffer *buf, quint32 offset, QByteArray data)
Definition qrhi_p.h:482
static BufferOp staticUpload(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:466
static BufferOp read(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result)
Definition qrhi_p.h:497
static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:435
static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:442
QRhiTextureCopyDescription desc
Definition qrhi_p.h:525
static TextureOp copy(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc)
Definition qrhi_p.h:545
QVarLengthArray< MipLevelUploadList, 6 > subresDesc
Definition qrhi_p.h:523
static TextureOp upload(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
Definition qrhi_p.h:529
static TextureOp genMips(QRhiTexture *tex)
Definition qrhi_p.h:564
static TextureOp read(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
Definition qrhi_p.h:555
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1551
LimitsType limitsType
Definition qrhi.h:1562
float maxPotentialColorComponentValue
Definition qrhi.h:1570
LuminanceBehavior luminanceBehavior
Definition qrhi.h:1573
float maxColorComponentValue
Definition qrhi.h:1569
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1584
void * reserved[2]
Definition qrhi.h:1585
uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT *2]
QRhiShaderResourceBindings * srb
QRhiGraphicsPipeline * maybeGraphicsPs
QRhiComputePipeline * maybeComputePs
QRhiSwapChain::StereoTargetBuffer stereoTarget