20#include <rhi/qshaderdescription.h>
25#include <QtCore/private/qduplicatetracker_p.h>
30class QOpenGLExtensions;
35 QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size);
68 int sampleCount, QRhiRenderBuffer::Flags flags,
69 QRhiTexture::Format backingFormatHint);
73 bool createFrom(NativeRenderBuffer src)
override;
96 return a.glminfilter == b.glminfilter
97 && a.glmagfilter == b.glmagfilter
98 && a.glwraps == b.glwraps
99 && a.glwrapt == b.glwrapt
100 && a.glwrapr == b.glwrapr
101 && a.gltexcomparefunc == b.gltexcomparefunc;
111 QGles2Texture(QRhiImplementation *rhi, Format format,
const QSize &pixelSize,
int depth,
112 int arraySize,
int sampleCount, Flags flags);
155 QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
156 AddressMode u, AddressMode v, AddressMode w);
171 bool isCompatible(
const QRhiRenderPassDescriptor *other)
const override;
260using QGles2UniformDescriptionVector = QVarLengthArray<QGles2UniformDescription, 8>;
261using QGles2SamplerDescriptionVector = QVarLengthArray<QGles2SamplerDescription, 4>;
358 GLuint timestampQuery;
375 QRhiGraphicsPipeline *ps;
386 QRhiGraphicsPipeline *ps;
393 QRhiGraphicsPipeline *ps;
396 quint32 instanceCount;
397 quint32 baseInstance;
401 QRhiGraphicsPipeline *ps;
402 } bindGraphicsPipeline;
409 } bindShaderResources;
456 QRhiReadbackResult *result;
508 } compressedSubImage;
518 } blitFromRenderbuffer;
538 } bindComputePipeline;
554 } invalidateFramebuffer;
628 writtenResources.clear();
636 } textureUnitState[16];
644 dataRetainPool.append(data);
645 return dataRetainPool.last().constData();
648 bufferDataRetainPool.append(data);
649 return reinterpret_cast<
const uchar *>(bufferDataRetainPool.last().constData());
652 imageRetainPool.append(image);
653 return imageRetainPool.last().constBits();
657 dataRetainPool.clear();
658 bufferDataRetainPool.clear();
659 imageRetainPool.clear();
661 passResTrackers.clear();
668 currentTarget =
nullptr;
673 currentGraphicsPipeline =
nullptr;
674 currentComputePipeline =
nullptr;
676 currentGraphicsSrb =
nullptr;
677 currentComputeSrb =
nullptr;
679 graphicsPassState.reset();
681 memset(textureUnitState, 0,
sizeof(textureUnitState));
688 return a.func == b.func
689 && a.failOp == b.failOp
690 && a.zfailOp == b.zfailOp
691 && a.zpassOp == b.zpassOp;
715 return a.srcColor == b.srcColor
716 && a.dstColor == b.dstColor
717 && a.srcAlpha == b.srcAlpha
718 && a.dstAlpha == b.dstAlpha
719 && a.opColor == b.opColor
720 && a.opAlpha == b.opAlpha;
772 QRhiGles2(QRhiGles2InitParams *params, QRhiGles2NativeHandles *importDevice =
nullptr);
774 bool create(QRhi::Flags flags)
override;
781 QRhiBuffer::UsageFlags usage,
782 quint32 size)
override;
784 const QSize &pixelSize,
786 QRhiRenderBuffer::Flags flags,
787 QRhiTexture::Format backingFormatHint)
override;
789 const QSize &pixelSize,
793 QRhiTexture::Flags flags)
override;
795 QRhiSampler::Filter minFilter,
796 QRhiSampler::Filter mipmapMode,
797 QRhiSampler:: AddressMode u,
798 QRhiSampler::AddressMode v,
799 QRhiSampler::AddressMode w)
override;
802 QRhiTextureRenderTarget::Flags flags)
override;
816 QRhiRenderTarget *rt,
817 const QColor &colorClearValue,
818 const QRhiDepthStencilClearValue &depthStencilClearValue,
819 QRhiResourceUpdateBatch *resourceUpdates,
820 QRhiCommandBuffer::BeginPassFlags flags)
override;
821 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
override;
824 QRhiGraphicsPipeline *ps)
override;
827 QRhiShaderResourceBindings *srb,
828 int dynamicOffsetCount,
829 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets)
override;
832 int startBinding,
int bindingCount,
const QRhiCommandBuffer::VertexInput *bindings,
833 QRhiBuffer *indexBuf, quint32 indexOffset,
834 QRhiCommandBuffer::IndexFormat indexFormat)
override;
836 void setViewport(QRhiCommandBuffer *cb,
const QRhiViewport &viewport)
override;
837 void setScissor(QRhiCommandBuffer *cb,
const QRhiScissor &scissor)
override;
839 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue)
override;
840 void setShadingRate(QRhiCommandBuffer *cb,
const QSize &coarsePixelSize)
override;
842 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
843 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance)
override;
845 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
846 quint32 instanceCount, quint32 firstIndex,
847 qint32 vertexOffset, quint32 firstInstance)
override;
849 void debugMarkBegin(QRhiCommandBuffer *cb,
const QByteArray &name)
override;
851 void debugMarkMsg(QRhiCommandBuffer *cb,
const QByteArray &msg)
override;
854 QRhiResourceUpdateBatch *resourceUpdates,
855 QRhiCommandBuffer::BeginPassFlags flags)
override;
892 int layer,
int level,
const QRhiTextureSubresourceUploadDescription &subresDesc);
905 void *ps, uint psGeneration,
int glslLocation,
906 int *texUnit,
bool *activeTexUnitAltered);
908 QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs,
909 QRhiShaderResourceBindings *srb,
910 const uint *dynOfsPairs,
int dynOfsCount);
912 bool *wantsColorClear =
nullptr,
bool *wantsDsClear =
nullptr);
915 bool compileShader(GLuint program,
const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
919 const QByteArray &namePrefix,
int binding,
int baseOffset,
921 ActiveUniformLocationTracker *activeUniformLocations,
922 QGles2UniformDescriptionVector *dst);
923 void gatherUniforms(GLuint program,
const QShaderDescription::UniformBlock &ub,
924 ActiveUniformLocationTracker *activeUniformLocations, QGles2UniformDescriptionVector *dst);
925 void gatherSamplers(GLuint program,
const QShaderDescription::InOutVariable &v,
926 QGles2SamplerDescriptionVector *dst);
928 const QShader::SeparateToCombinedImageSamplerMapping &mapping,
929 QGles2SamplerDescriptionVector *dst);
941 const QVector<QShaderDescription::InOutVariable> &inputVars,
942 QByteArray *cacheKey);
954 QOpenGLExtensions *
f =
nullptr;
957 const void *) =
nullptr;
960 const GLvoid *) =
nullptr;
964 const GLvoid *) =
nullptr;
966 GLsizei,
const GLvoid *) =
nullptr;
1137 } textureRenderTarget;
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
friend bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are different, otherwise returns false.
QRhiBackendCommandList()=default
~QRhiBackendCommandList()
void assign(QByteArray data)
void assign(const char *s, quint32 size)
QRhiBufferData(const QRhiBufferData &other)
quint32 largeAlloc() const
QRhiBufferData & operator=(const QRhiBufferData &other)
const char * constData() const
QHash< QRhiShaderStage, uint > m_shaderCache
const GLvoid const GLvoid GLenum
QRhiStats statistics() override
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
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
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
void trackedImageBarrier(QGles2CommandBuffer *cbD, QGles2Texture *texD, QGles2Texture::Access access)
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
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)
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
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
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
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
double lastCompletedGpuTime(QRhiCommandBuffer *cb) override
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override
bool isFeatureSupported(QRhi::Feature feature) const override
QRhiNull(QRhiNullInitParams *params)
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override
QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override
void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance) override
void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
void beginPass(QRhiCommandBuffer *cb, QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
void setQueueSubmitParams(QRhiNativeHandles *params) override
bool isClipDepthZeroToOne() const override
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
QNullCommandBuffer offscreenCommandBuffer
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override
bool isYUpInNDC() const override
QRhiDriverInfo driverInfo() const override
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override
void simulateTextureUpload(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
QRhiComputePipeline * createComputePipeline() override
void setPipelineCacheData(const QByteArray &data) override
void setVertexInput(QRhiCommandBuffer *cb, int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings, QRhiBuffer *indexBuf, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat) override
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override
void draw(QRhiCommandBuffer *cb, quint32 vertexCount, quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override
QByteArray pipelineCacheData() override
const QRhiNativeHandles * nativeHandles() override
void setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline *ps) override
void releaseCachedResources() override
void simulateTextureCopy(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
QRhiTexture * createTexture(QRhiTexture::Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, QRhiTexture::Flags flags) override
QList< QSize > supportedShadingRates(int sampleCount) const override
void simulateTextureGenMips(const QRhiResourceUpdateBatchPrivate::TextureOp &u)
void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override
QRhiRenderBuffer * createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint) override
bool makeThreadLocalNativeContextCurrent() override
const QRhiNativeHandles * nativeHandles(QRhiCommandBuffer *cb) override
QRhiNullNativeHandles nativeHandlesStruct
bool isYUpInFramebuffer() const override
QRhi::FrameOpResult finish() override
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override
QRhiBuffer * createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) override
QRhiStats statistics() override
QRhiShadingRateMap * createShadingRateMap() override
void beginExternal(QRhiCommandBuffer *cb) override
QRhiSwapChain * createSwapChain() override
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override
QRhiTextureRenderTarget * createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags) override
QRhiGraphicsPipeline * createGraphicsPipeline() override
bool create(QRhi::Flags flags) override
void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override
void debugMarkEnd(QRhiCommandBuffer *cb) override
QList< int > supportedSampleCounts() const override
QMatrix4x4 clipSpaceCorrMatrix() const override
QRhiSampler * createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w) override
QRhiSwapChain * currentSwapChain
int ubufAlignment() const override
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override
int resourceLimit(QRhi::ResourceLimit limit) const override
QRhiShaderResourceBindings * createShaderResourceBindings() override
void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override
void endExternal(QRhiCommandBuffer *cb) override
bool isDeviceLost() const override
static TextureStage toPassTrackerTextureStage(QRhiShaderResourceBinding::StageFlags stages)
const QVarLengthFlatMap< QRhiBuffer *, Buffer, 12 > & buffers() const
static BufferStage toPassTrackerBufferStage(QRhiShaderResourceBinding::StageFlags stages)
const QVarLengthFlatMap< QRhiTexture *, Texture, 12 > & textures() const
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
QVarLengthArray< BufferOp, BUFFER_OPS_STATIC_ALLOC > bufferOps
bool hasOptimalCapacity() const
QVarLengthArray< TextureOp, TEXTURE_OPS_STATIC_ALLOC > textureOps
static const int BUFFER_OPS_STATIC_ALLOC
static QRhiResourceUpdateBatchPrivate * get(QRhiResourceUpdateBatch *b)
void merge(QRhiResourceUpdateBatchPrivate *other)
QRhiResourceUpdateBatch * q
static const int TEXTURE_OPS_STATIC_ALLOC
Combined button and popup list for selecting options.
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
#define QOPENGLF_APIENTRYP
static const char * resourceTypeStr(const QRhiResource *res)
static QRhiPassResourceTracker::BufferStage earlierStage(QRhiPassResourceTracker::BufferStage a, QRhiPassResourceTracker::BufferStage b)
QDebug operator<<(QDebug dbg, const QRhiSwapChainHdrInfo &info)
static bool isImageLoadStore(QRhiPassResourceTracker::TextureAccess access)
static const char * deviceTypeStr(QRhiDriverInfo::DeviceType type)
\variable QRhiDriverInfo::deviceName
static QRhiPassResourceTracker::TextureStage earlierStage(QRhiPassResourceTracker::TextureStage a, QRhiPassResourceTracker::TextureStage b)
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)
bool operator!=(const QRhiRenderTargetAttachmentTracker::ResId &a, const QRhiRenderTargetAttachmentTracker::ResId &b)
Q_DECLARE_TYPEINFO(QRhiPassResourceTracker::Buffer, Q_RELOCATABLE_TYPE)
bool operator==(const QRhiRenderTargetAttachmentTracker::ResId &a, const QRhiRenderTargetAttachmentTracker::ResId &b)
bool qrhi_toTopLeftRenderTargetRect(const QSize &outputSize, const std::array< T, N > &r, T *x, T *y, T *w, T *h)
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)
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
QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
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.
void fullDynamicBufferUpdateForCurrentFrame(const void *data, quint32 size) override
QVarLengthArray< QImage, 4 > imageRetainPool
QRhiShaderResourceBindings * currentGraphicsSrb
uint currentPipelineGeneration
int currentPassResTrackerIndex
QVarLengthArray< QRhiBufferData, 4 > bufferDataRetainPool
uint currentSrbGeneration
static const int MAX_DYNAMIC_OFFSET_COUNT
QRhiBackendCommandList< Command > commands
QRhiComputePipeline * currentComputePipeline
QRhiRenderTarget * currentTarget
QRhiShaderResourceBindings * currentComputeSrb
QVarLengthArray< QRhiPassResourceTracker, 8 > passResTrackers
bool passNeedsResourceTracking
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
uint currentSrbGeneration
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)
~QGles2GraphicsPipeline()
QRhiShaderResourceBindings * currentSrb
uint currentSrbGeneration
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
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()
QGles2RenderPassDescriptor(QRhiImplementation *rhi)
QGles2RenderTargetData(QRhiImplementation *)
std::optional< QRhiSwapChain::StereoTargetBuffer > stereoTarget
QGles2RenderPassDescriptor * rp
QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
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()
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
~QGles2SwapChainRenderTarget()
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.
QGles2SwapChainRenderTarget rt
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)
~QGles2TextureRenderTarget()
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.
GLuint nonMsaaThrowawayDepthTexture
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
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool prepareCreate(QSize *adjustedSize=nullptr)
bool create() override
Creates the corresponding native graphics resources.
NativeTexture nativeTexture() override
QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
bool create() override
Creates the corresponding native graphics resources.
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
char * beginFullDynamicBufferUpdateForCurrentFrame() override
QNullCommandBuffer(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QNullComputePipeline(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool create() override
Creates the corresponding native graphics resources.
QNullGraphicsPipeline(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool create() override
Creates the corresponding native graphics resources.
QNullRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint)
QRhiTexture::Format backingFormat() const override
QNullRenderPassDescriptor(QRhiImplementation *rhi)
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() const override
~QNullRenderPassDescriptor()
QVector< quint32 > serializedFormat() const override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool isCompatible(const QRhiRenderPassDescriptor *other) const override
QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList
QNullRenderPassDescriptor * rp
QNullRenderTargetData(QRhiImplementation *)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, AddressMode u, AddressMode v, AddressMode w)
QNullShaderResourceBindings(QRhiImplementation *rhi)
bool create() override
Creates the corresponding resource binding set.
void updateResources(UpdateFlags flags) override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
~QNullShaderResourceBindings()
QSize pixelSize() const override
float devicePixelRatio() const override
~QNullSwapChainRenderTarget()
QNullSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
int sampleCount() const override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool createOrResize() override
Creates the swapchain if not already done and resizes the swapchain buffers to match the current size...
QSize surfacePixelSize() override
QNullSwapChainRenderTarget rt
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)
~QNullTextureRenderTarget()
QSize pixelSize() const override
int sampleCount() const override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
bool create() override
Creates the corresponding native graphics resources.
QNullTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags)
float devicePixelRatio() const override
bool create() override
Creates the corresponding native graphics resources.
bool createFrom(NativeTexture src) override
Similar to create(), except that no new native textures are created.
QVarLengthArray< std::array< QImage, QRhi::MAX_MIP_LEVELS >, 6 > image
QNullTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, Flags flags)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool operator!=(const Batch &other) const
bool operator==(const Batch &other) const
void feed(int binding, T resource)
bool operator!=(const QRhiBatchedBindings< T > &other) const
bool operator==(const QRhiBatchedBindings< T > &other) const
char smallData[SMALL_DATA_SIZE]
static constexpr quint32 SMALL_DATA_SIZE
uint needsDepthStencilCombinedAttach
uint perRenderTargetBlending
int maxThreadGroupsPerDimension
uint glesMultisampleRenderToTexture
uint fixedIndexPrimitiveRestart
uint screenSpaceDerivatives
uint nonBaseLevelFramebufferTexture
int maxThreadsPerThreadGroup
uint glesMultiviewMultisampleRenderToTexture
GLuint nonMsaaThrowawayDepthTexture
OffscreenFrame(QRhiImplementation *rhi)
QGles2CommandBuffer cbWrapper
QVarLengthArray< data32_t, 128 > packedArray
QVarLengthArray< SeparateTexture, 8 > separateTextureBindings
QVarLengthArray< SeparateSampler, 4 > separateSamplerBindings
UsageState stateAtPassBegin
UsageState stateAtPassBegin
static void updateResIdList(const QRhiTextureRenderTargetDescription &desc, ResIdList *dst)
static bool isUpToDate(const QRhiTextureRenderTargetDescription &desc, const ResIdList ¤tResIdList)
static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, quint32 offset, QByteArray data)
static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, quint32 offset, QByteArray data)
QRhiReadbackResult * result
static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, QByteArray data)
static BufferOp staticUpload(QRhiBuffer *buf, quint32 offset, QByteArray data)
static BufferOp staticUpload(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
static BufferOp read(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result)
static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
QRhiTextureCopyDescription desc
static TextureOp copy(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc)
QRhiReadbackDescription rb
QVarLengthArray< MipLevelUploadList, 6 > subresDesc
static TextureOp upload(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
static TextureOp genMips(QRhiTexture *tex)
static TextureOp read(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
QRhiReadbackResult * result
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
float maxPotentialColorComponentValue
LuminanceBehavior luminanceBehavior
float maxColorComponentValue
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT *2]
QRhiShaderResourceBindings * srb
QRhiGraphicsPipeline * maybeGraphicsPs
QRhiReadbackResult * result
QRhiComputePipeline * maybeComputePs
QRhiTexture::Format format
QRhiSwapChain::StereoTargetBuffer stereoTarget
QRhiGraphicsPipeline * ps