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 {
550 GLuint fbo;
553 } invalidateFramebuffer;
554 } args;
555 };
556
562
566
569 double lastGpuTime = 0;
577
579 bool valid = false;
584 bool blendEnabled[16];
585 struct ColorMask { bool r, g, b, a; } colorMask[16];
613 void reset() { valid = false; }
614 struct {
615 // not part of QRhiGraphicsPipeline but used by setGraphicsPipeline()
617 } dynamic;
618 } graphicsPassState;
619
621 enum Access {
622 Read = 0x01,
623 Write = 0x02
624 };
626 void reset() {
627 writtenResources.clear();
628 }
629 } computePassState;
630
632 void *ps;
635 } textureUnitState[16];
636
640
641 // relies heavily on implicit sharing (no copies of the actual data will be made)
642 const void *retainData(const QByteArray &data) {
643 dataRetainPool.append(data);
644 return dataRetainPool.last().constData();
645 }
647 bufferDataRetainPool.append(data);
648 return reinterpret_cast<const uchar *>(bufferDataRetainPool.last().constData());
649 }
650 const void *retainImage(const QImage &image) {
651 imageRetainPool.append(image);
652 return imageRetainPool.last().constBits();
653 }
655 commands.reset();
656 dataRetainPool.clear();
657 bufferDataRetainPool.clear();
658 imageRetainPool.clear();
659
660 passResTrackers.clear();
662 }
663 void resetState() {
666 // do not zero lastGpuTime
667 currentTarget = nullptr;
670 }
672 currentGraphicsPipeline = nullptr;
673 currentComputePipeline = nullptr;
675 currentGraphicsSrb = nullptr;
676 currentComputeSrb = nullptr;
678 graphicsPassState.reset();
679 computePassState.reset();
680 memset(textureUnitState, 0, sizeof(textureUnitState));
681 }
682};
683
686{
687 return a.func == b.func
688 && a.failOp == b.failOp
689 && a.zfailOp == b.zfailOp
690 && a.zpassOp == b.zpassOp;
691}
692
695{
696 return !(a == b);
697}
698
701{
702 return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
703}
704
707{
708 return !(a == b);
709}
710
713{
714 return a.srcColor == b.srcColor
715 && a.dstColor == b.dstColor
716 && a.srcAlpha == b.srcAlpha
717 && a.dstAlpha == b.dstAlpha
718 && a.opColor == b.opColor
719 && a.opAlpha == b.opAlpha;
720}
721
724{
725 return !(a == b);
726}
727
729{
730 static const int TIMESTAMP_PAIRS = 2;
731
734
735 void prepare(QRhiGles2 *rhiD);
736 void destroy(QRhiGles2 *rhiD);
737 bool tryQueryTimestamps(int pairIndex, QRhiGles2 *rhiD, double *elapsedSec);
738};
739
767
769{
770public:
771 QRhiGles2(QRhiGles2InitParams *params, QRhiGles2NativeHandles *importDevice = nullptr);
772
773 bool create(QRhi::Flags flags) override;
774 void destroy() override;
775
779 QRhiBuffer *createBuffer(QRhiBuffer::Type type,
780 QRhiBuffer::UsageFlags usage,
781 quint32 size) override;
782 QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
783 const QSize &pixelSize,
784 int sampleCount,
785 QRhiRenderBuffer::Flags flags,
786 QRhiTexture::Format backingFormatHint) override;
787 QRhiTexture *createTexture(QRhiTexture::Format format,
788 const QSize &pixelSize,
789 int depth,
790 int arraySize,
791 int sampleCount,
792 QRhiTexture::Flags flags) override;
793 QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
794 QRhiSampler::Filter minFilter,
795 QRhiSampler::Filter mipmapMode,
796 QRhiSampler:: AddressMode u,
797 QRhiSampler::AddressMode v,
798 QRhiSampler::AddressMode w) override;
799
800 QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
801 QRhiTextureRenderTarget::Flags flags) override;
802
803 QRhiShadingRateMap *createShadingRateMap() override;
804
805 QRhiSwapChain *createSwapChain() override;
806 QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
807 QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
808 QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
809 QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
810 QRhi::FrameOpResult finish() override;
811
812 void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
813
814 void beginPass(QRhiCommandBuffer *cb,
815 QRhiRenderTarget *rt,
816 const QColor &colorClearValue,
817 const QRhiDepthStencilClearValue &depthStencilClearValue,
818 QRhiResourceUpdateBatch *resourceUpdates,
819 QRhiCommandBuffer::BeginPassFlags flags) override;
820 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
821
822 void setGraphicsPipeline(QRhiCommandBuffer *cb,
823 QRhiGraphicsPipeline *ps) override;
824
825 void setShaderResources(QRhiCommandBuffer *cb,
826 QRhiShaderResourceBindings *srb,
827 int dynamicOffsetCount,
828 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
829
830 void setVertexInput(QRhiCommandBuffer *cb,
831 int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
832 QRhiBuffer *indexBuf, quint32 indexOffset,
833 QRhiCommandBuffer::IndexFormat indexFormat) override;
834
835 void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
836 void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
837 void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
838 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
839 void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override;
840
841 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
842 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
843
844 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
845 quint32 instanceCount, quint32 firstIndex,
846 qint32 vertexOffset, quint32 firstInstance) override;
847
848 void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
849 void debugMarkEnd(QRhiCommandBuffer *cb) override;
850 void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
851
852 void beginComputePass(QRhiCommandBuffer *cb,
853 QRhiResourceUpdateBatch *resourceUpdates,
854 QRhiCommandBuffer::BeginPassFlags flags) override;
855 void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
856 void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
857 void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
858
859 const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
860 void beginExternal(QRhiCommandBuffer *cb) override;
861 void endExternal(QRhiCommandBuffer *cb) override;
862 double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
863
864 QList<int> supportedSampleCounts() const override;
865 QList<QSize> supportedShadingRates(int sampleCount) const override;
866 int ubufAlignment() const override;
867 bool isYUpInFramebuffer() const override;
868 bool isYUpInNDC() const override;
869 bool isClipDepthZeroToOne() const override;
870 QMatrix4x4 clipSpaceCorrMatrix() const override;
871 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
872 bool isFeatureSupported(QRhi::Feature feature) const override;
873 int resourceLimit(QRhi::ResourceLimit limit) const override;
874 const QRhiNativeHandles *nativeHandles() override;
875 QRhiDriverInfo driverInfo() const override;
876 QRhiStats statistics() override;
878 void setQueueSubmitParams(QRhiNativeHandles *params) override;
880 bool isDeviceLost() const override;
881
882 QByteArray pipelineCacheData() override;
883 void setPipelineCacheData(const QByteArray &data) override;
884
885 bool ensureContext(QSurface *surface = nullptr) const;
891 int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc);
892 void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
894 QGles2Buffer *bufD,
898 QGles2Texture *texD,
901 void executeCommandBuffer(QRhiCommandBuffer *cb);
904 void *ps, uint psGeneration, int glslLocation,
905 int *texUnit, bool *activeTexUnitAltered);
907 QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs,
908 QRhiShaderResourceBindings *srb,
909 const uint *dynOfsPairs, int dynOfsCount);
911 bool *wantsColorClear = nullptr, bool *wantsDsClear = nullptr);
913 QByteArray shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
914 bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
915 bool linkProgram(GLuint program);
917 void registerUniformIfActive(const QShaderDescription::BlockVariable &var,
918 const QByteArray &namePrefix, int binding, int baseOffset,
919 GLuint program,
920 ActiveUniformLocationTracker *activeUniformLocations,
921 QGles2UniformDescriptionVector *dst);
922 void gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub,
923 ActiveUniformLocationTracker *activeUniformLocations, QGles2UniformDescriptionVector *dst);
924 void gatherSamplers(GLuint program, const QShaderDescription::InOutVariable &v,
925 QGles2SamplerDescriptionVector *dst);
926 void gatherGeneratedSamplers(GLuint program,
927 const QShader::SeparateToCombinedImageSamplerMapping &mapping,
928 QGles2SamplerDescriptionVector *dst);
929 void sanityCheckVertexFragmentInterface(const QShaderDescription &vsDesc, const QShaderDescription &fsDesc);
931
937 ProgramCacheResult tryLoadFromDiskOrPipelineCache(const QRhiShaderStage *stages,
938 int stageCount,
939 GLuint program,
940 const QVector<QShaderDescription::InOutVariable> &inputVars,
941 QByteArray *cacheKey);
942 void trySaveToDiskCache(GLuint program, const QByteArray &cacheKey);
943 void trySaveToPipelineCache(GLuint program, const QByteArray &cacheKey, bool force = false);
944
946 QOpenGLContext *ctx = nullptr;
947 bool importedContext = false;
952 mutable bool needsMakeCurrentDueToSwap = false;
953 QOpenGLExtensions *f = nullptr;
956 const void *) = nullptr;
959 const GLvoid *) = nullptr;
961 GLsizei) = nullptr;
963 const GLvoid *) = nullptr;
965 GLsizei, const GLvoid *) = nullptr;
967 GLint) = nullptr;
969 GLint, GLsizei) = nullptr;
972 void (QOPENGLF_APIENTRYP glObjectLabel)(GLenum, GLuint, GLsizei, const GLchar *) = nullptr;
976 uint vao = 0;
977 struct Caps {
979 : ctxMajor(2),
980 ctxMinor(0),
981 maxTextureSize(2048),
983 maxSamples(16),
990 maxUniformVectors(4096),
993 msaaRenderBuffer(false),
994 multisampledTexture(false),
995 npotTextureFull(true),
996 gles(false),
998 bgraExternalFormat(false),
999 bgraInternalFormat(false),
1000 r8Format(false),
1001 r16Format(false),
1002 r32uiFormat(false),
1003 floatFormats(false),
1004 rgb10Formats(false),
1005 depthTexture(false),
1006 packedDepthStencil(false),
1008 srgbWriteControl(false),
1009 coreProfile(false),
1010 uniformBuffers(false),
1011 elementIndexUint(false),
1012 depth24(false),
1013 rgba8Format(false),
1014 instancing(false),
1015 baseVertex(false),
1016 compute(false),
1017 textureCompareMode(false),
1018 properMapBuffer(false),
1020 texelFetch(false),
1021 intAttributes(true),
1023 programBinary(false),
1024 texture3D(false),
1025 tessellation(false),
1026 geometryShader(false),
1027 texture1D(false),
1028 hasDrawBuffersFunc(false),
1029 halfAttributes(false),
1030 multiView(false),
1031 timestamps(false),
1032 objectLabel(false),
1035 unpackRowLength(false),
1037 { }
1052 // Multisample fb and blit are supported (GLES 3.0 or OpenGL 3.x). Not
1053 // the same as multisample textures!
1057 uint gles : 1;
1061 uint r8Format : 1;
1062 uint r16Format : 1;
1063 uint r32uiFormat : 1;
1070 uint coreProfile : 1;
1073 uint depth24 : 1;
1074 uint rgba8Format : 1;
1075 uint instancing : 1;
1076 uint baseVertex : 1;
1077 uint compute : 1;
1079 uint depthClamp : 1;
1082 uint texelFetch : 1;
1086 uint texture3D : 1;
1089 uint texture1D : 1;
1092 uint multiView : 1;
1093 uint timestamps : 1;
1094 uint objectLabel : 1;
1100 } caps;
1106 mutable bool contextLost = false;
1107 uint frameNo = 0;
1108
1118 union {
1119 struct {
1121 } buffer;
1122 struct {
1124 } pipeline;
1125 struct {
1127 } texture;
1128 struct {
1131 } renderbuffer;
1132 struct {
1135 } textureRenderTarget;
1136 };
1137 };
1139
1141 OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
1142 bool active = false;
1145 } ofr;
1146
1148
1154
1173};
1174
1176
1177QT_END_NAMESPACE
1178
1179#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:807
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:818
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:11870
const QVarLengthFlatMap< QRhiBuffer *, Buffer, 12 > & buffers() const
Definition qrhi_p.h:729
static BufferStage toPassTrackerBufferStage(QRhiShaderResourceBinding::StageFlags stages)
Definition qrhi.cpp:11851
const QVarLengthFlatMap< QRhiTexture *, Texture, 12 > & textures() const
Definition qrhi_p.h:737
bool isEmpty() const
Definition qrhi.cpp:11760
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
Definition qrhi.cpp:11777
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
Definition qrhi.cpp:11817
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:10005
QRhiResourceUpdateBatch * q
Definition qrhi_p.h:581
static const int TEXTURE_OPS_STATIC_ALLOC
Definition qrhi_p.h:578
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:8376
static QRhiPassResourceTracker::BufferStage earlierStage(QRhiPassResourceTracker::BufferStage a, QRhiPassResourceTracker::BufferStage b)
Definition qrhi.cpp:11771
QDebug operator<<(QDebug dbg, const QRhiSwapChainHdrInfo &info)
Definition qrhi.cpp:8191
static bool isImageLoadStore(QRhiPassResourceTracker::TextureAccess access)
Definition qrhi.cpp:11810
static const char * deviceTypeStr(QRhiDriverInfo::DeviceType type)
\variable QRhiDriverInfo::deviceName
Definition qrhi.cpp:9295
static QRhiPassResourceTracker::TextureStage earlierStage(QRhiPassResourceTracker::TextureStage a, QRhiPassResourceTracker::TextureStage b)
Definition qrhi.cpp:11804
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:1555
LimitsType limitsType
Definition qrhi.h:1566
float maxPotentialColorComponentValue
Definition qrhi.h:1574
LuminanceBehavior luminanceBehavior
Definition qrhi.h:1577
float maxColorComponentValue
Definition qrhi.h:1573
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1588
void * reserved[2]
Definition qrhi.h:1589
uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT *2]
QRhiShaderResourceBindings * srb
QRhiGraphicsPipeline * maybeGraphicsPs
QRhiComputePipeline * maybeComputePs
QRhiSwapChain::StereoTargetBuffer stereoTarget