Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
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"
20#include <qopengl.h>
21#include <QByteArray>
22#include <QWindow>
23#include <QPointer>
24#include <QtCore/private/qduplicatetracker_p.h>
25#include <optional>
26
28
30class QRhiGles2;
31
62
64{
66 int sampleCount, QRhiRenderBuffer::Flags flags,
67 QRhiTexture::Format backingFormatHint);
69 void destroy() override;
70 bool create() override;
71 bool createFrom(NativeRenderBuffer src) override;
72 QRhiTexture::Format backingFormat() const override;
73
75 GLuint stencilRenderbuffer = 0; // when packed depth-stencil not supported
77 bool owns = true;
79 friend class QRhiGles2;
80};
81
91
93{
94 return a.glminfilter == b.glminfilter
95 && a.glmagfilter == b.glmagfilter
96 && a.glwraps == b.glwraps
97 && a.glwrapt == b.glwrapt
98 && a.glwrapr == b.glwrapr
99 && a.gltexcomparefunc == b.gltexcomparefunc;
100}
101
103{
104 return !(a == b);
105}
106
149
162
164{
167 void destroy() override;
168 bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
170 QVector<quint32> serializedFormat() const override;
171};
172
174{
176
177 bool isValid() const { return rp != nullptr; }
178
181 float dpr = 1;
182 int sampleCount = 1;
184 int dsAttCount = 0;
185 bool srgbUpdateAndBlend = false;
187 std::optional<QRhiSwapChain::StereoTargetBuffer> stereoTarget;
188};
189
191{
194 void destroy() override;
195
196 QSize pixelSize() const override;
197 float devicePixelRatio() const override;
198 int sampleCount() const override;
199
201};
202
221
223{
226 void destroy() override;
227 bool create() override;
228 void updateResources(UpdateFlags flags) override;
229
230 bool hasDynamicOffset = false;
232 friend class QRhiGles2;
233};
234
244
246
254
256
257using QGles2UniformDescriptionVector = QVarLengthArray<QGles2UniformDescription, 8>;
258using QGles2SamplerDescriptionVector = QVarLengthArray<QGles2SamplerDescription, 4>;
259
261{
262 static constexpr int MAX_TRACKED_LOCATION = 1023;
264 float v[4];
265};
266
284
301
303{
306 void destroy() override;
307
308 // keep at a reasonably low value otherwise sizeof Command explodes
309 static const int MAX_DYNAMIC_OFFSET_COUNT = 8;
310
311 struct Command {
345
346 // QRhi*/QGles2* references should be kept at minimum (so no
347 // QRhiTexture/Buffer/etc. pointers).
348 union Args {
349 struct {
352 struct {
355 struct {
356 float x, y, w, h;
357 float d0, d1;
359 struct {
360 int x, y, w, h;
362 struct {
363 float r, g, b, a;
365 struct {
369 struct {
375 struct {
380 struct {
387 struct {
395 struct {
398 struct {
405 struct {
407 float c[4];
408 float d;
411 struct {
413 bool srgb;
415 bool stereo;
418 struct {
422 int size;
423 const void *data; // must come from retainData()
425 struct {
429 int offset;
430 int size;
432 struct {
437 int srcX;
438 int srcY;
439 int srcZ;
444 int dstX;
445 int dstY;
446 int dstZ;
447 int w;
448 int h;
450 struct {
453 int w;
454 int h;
457 int level;
460 struct {
464 int level;
465 int dx;
466 int dy;
467 int dz;
468 int w;
469 int h;
474 const void *data; // must come from retainImage()
476 struct {
480 int level;
482 int w;
483 int h;
484 int depth;
485 int size;
486 const void *data; // must come from retainData()
488 struct {
492 int level;
493 int dx;
494 int dy;
495 int dz;
496 int w;
497 int h;
499 int size;
500 const void *data; // must come from retainData()
502 struct {
504 int w;
505 int h;
508 int dstLevel;
512 struct {
515 int srcLevel;
517 int w;
518 int h;
521 int dstLevel;
522 int dstLayer;
523 bool isDepthStencil;
525 struct {
529 struct {
532 struct {
537 struct {
540 struct {
543 struct {
548 };
549
555
556 QRhiBackendCommandList<Command> commands;
557 QVarLengthArray<QRhiPassResourceTracker, 8> passResTrackers;
559
562 double lastGpuTime = 0;
570
611
613 enum Access {
614 Read = 0x01,
615 Write = 0x02
616 };
617 QHash<QRhiResource *, QPair<int, bool> > writtenResources;
618 void reset() {
620 }
622
628
629 QVarLengthArray<QByteArray, 4> dataRetainPool;
630 QVarLengthArray<QRhiBufferData, 4> bufferDataRetainPool;
631 QVarLengthArray<QImage, 4> imageRetainPool;
632
633 // relies heavily on implicit sharing (no copies of the actual data will be made)
634 const void *retainData(const QByteArray &data) {
636 return dataRetainPool.last().constData();
637 }
640 return reinterpret_cast<const uchar *>(bufferDataRetainPool.last().constData());
641 }
642 const void *retainImage(const QImage &image) {
644 return imageRetainPool.last().constBits();
645 }
655 void resetState() {
658 // do not zero lastGpuTime
659 currentTarget = nullptr;
662 }
664 currentGraphicsPipeline = nullptr;
665 currentComputePipeline = nullptr;
667 currentGraphicsSrb = nullptr;
668 currentComputeSrb = nullptr;
670 graphicsPassState.reset();
671 computePassState.reset();
672 memset(textureUnitState, 0, sizeof(textureUnitState));
673 }
674};
675
678{
679 return a.func == b.func
680 && a.failOp == b.failOp
681 && a.zfailOp == b.zfailOp
682 && a.zpassOp == b.zpassOp;
683}
684
690
693{
694 return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
695}
696
702
705{
706 return a.srcColor == b.srcColor
707 && a.dstColor == b.dstColor
708 && a.srcAlpha == b.srcAlpha
709 && a.dstAlpha == b.dstAlpha
710 && a.opColor == b.opColor
711 && a.opAlpha == b.opAlpha;
712}
713
719
721{
722 static const int TIMESTAMP_PAIRS = 2;
723
726
727 void prepare(QRhiGles2 *rhiD);
728 void destroy(QRhiGles2 *rhiD);
729 bool tryQueryTimestamps(int pairIndex, QRhiGles2 *rhiD, double *elapsedSec);
730};
731
760
762{
763public:
765
766 bool create(QRhi::Flags flags) override;
767 void destroy() override;
768
773 QRhiBuffer::UsageFlags usage,
774 quint32 size) override;
776 const QSize &pixelSize,
777 int sampleCount,
778 QRhiRenderBuffer::Flags flags,
779 QRhiTexture::Format backingFormatHint) override;
781 const QSize &pixelSize,
782 int depth,
783 int arraySize,
784 int sampleCount,
785 QRhiTexture::Flags flags) override;
787 QRhiSampler::Filter minFilter,
788 QRhiSampler::Filter mipmapMode,
791 QRhiSampler::AddressMode w) override;
792
794 QRhiTextureRenderTarget::Flags flags) override;
795
796 QRhiSwapChain *createSwapChain() override;
797 QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
798 QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
799 QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
800 QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
801 QRhi::FrameOpResult finish() override;
802
803 void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
804
807 const QColor &colorClearValue,
808 const QRhiDepthStencilClearValue &depthStencilClearValue,
809 QRhiResourceUpdateBatch *resourceUpdates,
810 QRhiCommandBuffer::BeginPassFlags flags) override;
811 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
812
814 QRhiGraphicsPipeline *ps) override;
815
818 int dynamicOffsetCount,
819 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
820
822 int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
823 QRhiBuffer *indexBuf, quint32 indexOffset,
824 QRhiCommandBuffer::IndexFormat indexFormat) override;
825
826 void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
827 void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
828 void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
829 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
830
831 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
832 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
833
834 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
835 quint32 instanceCount, quint32 firstIndex,
836 qint32 vertexOffset, quint32 firstInstance) override;
837
838 void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
839 void debugMarkEnd(QRhiCommandBuffer *cb) override;
840 void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
841
843 QRhiResourceUpdateBatch *resourceUpdates,
844 QRhiCommandBuffer::BeginPassFlags flags) override;
845 void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
847 void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
848
850 void beginExternal(QRhiCommandBuffer *cb) override;
851 void endExternal(QRhiCommandBuffer *cb) override;
852 double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
853
854 QList<int> supportedSampleCounts() const override;
855 int ubufAlignment() const override;
856 bool isYUpInFramebuffer() const override;
857 bool isYUpInNDC() const override;
858 bool isClipDepthZeroToOne() const override;
859 QMatrix4x4 clipSpaceCorrMatrix() const override;
860 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
861 bool isFeatureSupported(QRhi::Feature feature) const override;
862 int resourceLimit(QRhi::ResourceLimit limit) const override;
863 const QRhiNativeHandles *nativeHandles() override;
864 QRhiDriverInfo driverInfo() const override;
865 QRhiStats statistics() override;
867 void releaseCachedResources() override;
868 bool isDeviceLost() const override;
869
870 QByteArray pipelineCacheData() override;
871 void setPipelineCacheData(const QByteArray &data) override;
872
873 bool ensureContext(QSurface *surface = nullptr) const;
879 int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc);
882 QGles2Buffer *bufD,
886 QGles2Texture *texD,
892 void *ps, uint psGeneration, int glslLocation,
893 int *texUnit, bool *activeTexUnitAltered);
895 QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs,
897 const uint *dynOfsPairs, int dynOfsCount);
899 bool *wantsColorClear = nullptr, bool *wantsDsClear = nullptr);
901 QByteArray shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
902 bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
905 const QByteArray &namePrefix, int binding, int baseOffset,
907 QDuplicateTracker<int, 256> *activeUniformLocations,
910 QDuplicateTracker<int, 256> *activeUniformLocations, QGles2UniformDescriptionVector *dst);
918
925 int stageCount,
927 const QVector<QShaderDescription::InOutVariable> &inputVars,
930 void trySaveToPipelineCache(GLuint program, const QByteArray &cacheKey, bool force = false);
931
932 QRhi::Flags rhiFlags;
933 QOpenGLContext *ctx = nullptr;
934 bool importedContext = false;
937 QPointer<QWindow> maybeWindow = nullptr;
939 mutable bool needsMakeCurrentDueToSwap = false;
941 void (QOPENGLF_APIENTRYP glPolygonMode) (GLenum, GLenum) = nullptr;
943 const void *) = nullptr;
944 void(QOPENGLF_APIENTRYP glTexStorage1D)(GLenum, GLint, GLenum, GLsizei) = nullptr;
946 const GLvoid *) = nullptr;
948 GLsizei) = nullptr;
950 const GLvoid *) = nullptr;
951 void(QOPENGLF_APIENTRYP glCompressedTexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum,
952 GLsizei, const GLvoid *) = nullptr;
953 void(QOPENGLF_APIENTRYP glFramebufferTexture1D)(GLenum, GLenum, GLenum, GLuint,
954 GLint) = nullptr;
955 void(QOPENGLF_APIENTRYP glFramebufferTextureMultiviewOVR)(GLenum, GLenum, GLuint, GLint,
956 GLint, GLsizei) = nullptr;
957 void (QOPENGLF_APIENTRYP glQueryCounter)(GLuint, GLenum) = nullptr;
958 void (QOPENGLF_APIENTRYP glGetQueryObjectui64v)(GLuint, GLenum, quint64 *) = nullptr;
959 void (QOPENGLF_APIENTRYP glObjectLabel)(GLenum, GLuint, GLsizei, const GLchar *) = nullptr;
960 void (QOPENGLF_APIENTRYP glFramebufferTexture2DMultisampleEXT)(GLenum, GLenum, GLenum, GLuint, GLint, GLsizei) = nullptr;
961 void (QOPENGLF_APIENTRYP glFramebufferTextureMultisampleMultiviewOVR)(GLenum, GLenum, GLuint, GLint, GLsizei, GLint, GLsizei) = nullptr;
963 struct Caps {
965 : ctxMajor(2),
966 ctxMinor(0),
967 maxTextureSize(2048),
969 maxSamples(16),
976 maxUniformVectors(4096),
981 npotTextureFull(true),
982 gles(false),
997 depth24(false),
1001 compute(false),
1006 intAttributes(true),
1021 { }
1036 // Multisample fb and blit are supported (GLES 3.0 or OpenGL 3.x). Not
1037 // the same as multisample textures!
1083 mutable QList<int> supportedSampleCountList;
1086 mutable bool contextLost = false;
1087
1117 QList<DeferredReleaseEntry> releaseQueue;
1118
1125
1126 QHash<QRhiShaderStage, uint> m_shaderCache;
1127
1132 QHash<QByteArray, PipelineCacheData> m_pipelineCache;
1133};
1134
1136
1138
1139#endif
\inmodule QtCore
Definition qbytearray.h:57
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
Definition qbytearray.h:124
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
Definition qhash.h:951
\inmodule QtGui
Definition qimage.h:37
const uchar * constBits() const
Returns a pointer to the first pixel data.
Definition qimage.cpp:1733
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtGui
const char * constData() const
Definition qrhi_p.h:353
\inmodule QtGui
Definition qrhi.h:846
Type
Specifies storage type of buffer resource.
Definition qrhi.h:848
\inmodule QtGui
Definition qrhi.h:1651
QPair< int, quint32 > DynamicOffset
Synonym for QPair<int, quint32>.
Definition qrhi.h:1676
QPair< QRhiBuffer *, quint32 > VertexInput
Synonym for QPair<QRhiBuffer *, quint32>.
Definition qrhi.h:1680
IndexFormat
Specifies the index data type.
Definition qrhi.h:1653
\inmodule QtGui
Definition qrhi.h:1622
\inmodule QtGui
Definition qrhi.h:44
\inmodule QtGui
\variable QRhiGles2InitParams::format
QHash< QRhiShaderStage, uint > m_shaderCache
const GLvoid const GLvoid GLenum
QRhiStats statistics() override
bool contextLost
void gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub, QDuplicateTracker< int, 256 > *activeUniformLocations, QGles2UniformDescriptionVector *dst)
void(QOPENGLF_APIENTRYP glGetQueryObjectui64v)(GLuint
void registerUniformIfActive(const QShaderDescription::BlockVariable &var, const QByteArray &namePrefix, int binding, int baseOffset, GLuint program, QDuplicateTracker< int, 256 > *activeUniformLocations, QGles2UniformDescriptionVector *dst)
const GLvoid const GLvoid GLuint
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance) override
quint64 GLsizei
QOpenGLContext * maybeShareContext
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
bool isFeatureSupported(QRhi::Feature feature) const override
QRhiGraphicsPipeline * createGraphicsPipeline() override
void bindShaderResources(QGles2CommandBuffer *cbD, QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs, QRhiShaderResourceBindings *srb, const uint *dynOfsPairs, int dynOfsCount)
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
void trackedImageBarrier(QGles2CommandBuffer *cbD, QGles2Texture *texD, QGles2Texture::Access access)
void trackedRegisterBuffer(QRhiPassResourceTracker *passResTracker, QGles2Buffer *bufD, QRhiPassResourceTracker::BufferAccess access, QRhiPassResourceTracker::BufferStage stage)
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)
struct QRhiGles2::Caps caps
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
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)
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
const GLvoid const GLvoid GLint
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 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)
struct QRhiGles2::OffscreenFrame ofr
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override
void setPipelineCacheData(const QByteArray &data) override
const void GLenum
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override
void gatherGeneratedSamplers(GLuint program, const QShader::SeparateToCombinedImageSamplerMapping &mapping, QGles2SamplerDescriptionVector *dst)
const QRhiNativeHandles * nativeHandles() override
\inmodule QtGui
Definition qrhi.h:1270
\inmodule QtGui
Definition qrhi.h:1094
QSize pixelSize() const
Definition qrhi.h:1115
int sampleCount() const
Definition qrhi.h:1118
Type
Specifies the type of the renderbuffer.
Definition qrhi.h:1096
\inmodule QtGui
Definition qrhi.h:1142
\inmodule QtGui
Definition qrhi.h:1158
\inmodule QtGui
Definition qrhi.h:1731
QRhi * rhi() const
Definition qrhi.cpp:3603
\inmodule QtGui
Definition qrhi.h:1030
Filter
Specifies the minification, magnification, or mipmap filtering.
Definition qrhi.h:1032
Filter magFilter() const
Definition qrhi.h:1057
AddressMode
Specifies the addressing mode.
Definition qrhi.h:1038
Filter minFilter() const
Definition qrhi.h:1060
Filter mipmapMode() const
Definition qrhi.h:1063
\inmodule QtGui
Definition qrhi.h:138
\inmodule QtGui
Definition qrhi.h:1214
\inmodule QtGui
Definition qrhi.h:379
\inmodule QtGui
Definition qrhi.h:1173
\inmodule QtGui
Definition qrhi.h:1549
Format
Describes the swapchain format.
Definition qrhi.h:1561
StereoTargetBuffer
Selects the backbuffer to use with a stereoscopic swapchain.
Definition qrhi.h:1568
\inmodule QtGui
Definition qrhi.h:1184
\inmodule QtGui
Definition qrhi.h:895
int arraySize() const
Definition qrhi.h:981
int sampleCount() const
Definition qrhi.h:995
Format
Specifies the texture format.
Definition qrhi.h:914
QSize pixelSize() const
Definition qrhi.h:975
\inmodule QtGui
Definition qrhi.h:85
ResourceLimit
Describes the resource limit to query.
Definition qrhi.h:1886
Feature
Flag values to indicate what features are supported by the backend currently in use.
Definition qrhi.h:1831
FrameOpResult
Describes the result of operations that can have a soft failure.
Definition qrhi.h:1824
VariableType
Represents the type of a variable or block member.
\inmodule QtGui
Definition qshader.h:32
\inmodule QtCore
Definition qsize.h:25
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
\inmodule QtGui
Definition qsurface.h:21
void append(const T &t)
Definition lalr.h:268
EGLContext ctx
Combined button and popup list for selecting options.
Definition image.cpp:4
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
static int instanceCount
EGLOutputLayerEXT layer
Flags
static QByteArray cacheKey(Args &&...args)
#define QOPENGLF_APIENTRYP
Definition qopengl.h:275
char GLchar
Definition qopengl.h:158
GLboolean GLboolean GLboolean b
typedef GLint(GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC)(GLuint program
GLbitfield stages
GLsizei const GLfloat * v
[13]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth
GLenum GLuint GLint level
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei const GLubyte * commands
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat f
GLenum src
GLenum GLuint buffer
GLenum type
GLenum GLenum dst
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
GLenum access
GLbitfield flags
GLenum GLuint texture
GLuint program
GLuint name
GLint GLsizei GLsizei GLenum format
GLint y
void ** params
GLenum query
const GLubyte * c
GLuint renderbuffer
typedef GLbitfield(APIENTRYP PFNGLQUERYMATRIXXOESPROC)(GLfixed *mantissa
GLint limit
GLuint framebuffer
GLenum GLenum GLenum GLenum mapping
GLint GLfloat GLint stencil
GLsizeiptr const void GLenum usage
Definition qopenglext.h:543
bool operator!=(const QGles2SamplerData &a, const QGles2SamplerData &b)
bool operator==(const QGles2SamplerData &a, const QGles2SamplerData &b)
Definition qrhigles2_p.h:92
#define GLuint
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180
unsigned int quint32
Definition qtypes.h:50
unsigned char uchar
Definition qtypes.h:32
int qint32
Definition qtypes.h:49
unsigned long long quint64
Definition qtypes.h:61
unsigned int uint
Definition qtypes.h:34
QSharedPointer< T > other(t)
[5]
view viewport() -> scroll(dx, dy, deviceRect)
view create()
QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
@ AccessStorageReadWrite
Definition qrhigles2_p.h:53
QByteArray data
Definition qrhigles2_p.h:45
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:44
quint32 nonZeroSize
Definition qrhigles2_p.h:42
UsageState usageState
Definition qrhigles2_p.h:59
union QGles2CommandBuffer::Command::Args args
QHash< QRhiResource *, QPair< int, bool > > writtenResources
struct QGles2CommandBuffer::GraphicsPassState::Blend blend
struct QGles2CommandBuffer::GraphicsPassState::@294 dynamic
struct QGles2CommandBuffer::GraphicsPassState::ColorMask colorMask
QVarLengthArray< QImage, 4 > imageRetainPool
struct QGles2CommandBuffer::ComputePassState computePassState
QRhiShaderResourceBindings * currentGraphicsSrb
QVarLengthArray< QRhiBufferData, 4 > bufferDataRetainPool
static const int MAX_DYNAMIC_OFFSET_COUNT
struct QGles2CommandBuffer::GraphicsPassState graphicsPassState
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.
struct QGles2CommandBuffer::TextureUnitState textureUnitState[16]
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:75
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:89
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
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
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
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
QShaderDescription::VariableType type
static constexpr int MAX_TRACKED_LOCATION
\inmodule QtGui
Definition qrhi.h:862
\inmodule QtGui
Definition qrhi.h:1759
uint needsDepthStencilCombinedAttach
int maxThreadGroupsPerDimension
uint glesMultisampleRenderToTexture
uint fixedIndexPrimitiveRestart
uint screenSpaceDerivatives
uint nonBaseLevelFramebufferTexture
uint glesMultiviewMultisampleRenderToTexture
struct QRhiGles2::DeferredReleaseEntry::@302::@308 textureRenderTarget
struct QRhiGles2::DeferredReleaseEntry::@302::@305 pipeline
OffscreenFrame(QRhiImplementation *rhi)
QGles2CommandBuffer cbWrapper
\variable QRhiReadbackResult::completed
Definition qrhi.h:800
\inmodule QtGui
Definition qrhi.h:1723
\inmodule QtGui
Definition qrhi.h:1782
\inmodule QtGui
Definition qrhi.h:965
\variable QShaderDescription::InOutVariable::name
\variable QShaderDescription::BlockVariable::name
Definition moc.h:23
struct QGles2CommandBuffer::Command::Args::@288 genMip
struct QGles2CommandBuffer::Command::Args::@279 bufferSubData
struct QGles2CommandBuffer::Command::Args::@269 blendConstants
struct QGles2CommandBuffer::Command::Args::@283 subImage
struct QGles2CommandBuffer::Command::Args::@266 endFrame
struct QGles2CommandBuffer::Command::Args::@281 copyTex
struct QGles2CommandBuffer::Command::Args::@275 bindGraphicsPipeline
struct QGles2CommandBuffer::Command::Args::@267 viewport
struct QGles2CommandBuffer::Command::Args::@268 scissor
uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT *2]
struct QGles2CommandBuffer::Command::Args::@274 drawIndexed
struct QGles2CommandBuffer::Command::Args::@277 clear
QRhiShaderResourceBindings * srb
QRhiGraphicsPipeline * maybeGraphicsPs
struct QGles2CommandBuffer::Command::Args::@272 bindIndexBuffer
struct QGles2CommandBuffer::Command::Args::@270 stencilRef
struct QGles2CommandBuffer::Command::Args::@290 dispatch
struct QGles2CommandBuffer::Command::Args::@271 bindVertexBuffer
struct QGles2CommandBuffer::Command::Args::@273 draw
struct QGles2CommandBuffer::Command::Args::@292 barrier
struct QGles2CommandBuffer::Command::Args::@276 bindShaderResources
struct QGles2CommandBuffer::Command::Args::@280 getBufferSubData
struct QGles2CommandBuffer::Command::Args::@286 blitFromRenderbuffer
QRhiComputePipeline * maybeComputePs
struct QGles2CommandBuffer::Command::Args::@291 barriersForPass
QRhiSwapChain::StereoTargetBuffer stereoTarget
struct QGles2CommandBuffer::Command::Args::@289 bindComputePipeline
struct QGles2CommandBuffer::Command::Args::@265 beginFrame
struct QGles2CommandBuffer::Command::Args::@284 compressedImage
struct QGles2CommandBuffer::Command::Args::@287 blitFromTexture
struct QGles2CommandBuffer::Command::Args::@282 readPixels
struct QGles2CommandBuffer::Command::Args::@293 invalidateFramebuffer
struct QGles2CommandBuffer::Command::Args::@278 bindFramebuffer
struct QGles2CommandBuffer::Command::Args::@285 compressedSubImage