42 #include <QLoggingCategory>
54 #if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
843 return a.depthClearValue() ==
b.depthClearValue()
844 &&
a.stencilClearValue() ==
b.stencilClearValue();
865 return seed * (
uint(
qFloor(
qreal(
v.depthClearValue()) * 100)) +
v.stencilClearValue());
868 #ifndef QT_NO_DEBUG_STREAM
872 dbg.
nospace() <<
"QRhiDepthStencilClearValue(depth-clear=" <<
v.depthClearValue()
873 <<
" stencil-clear=" <<
v.stencilClearValue()
924 : m_rect { {
x,
y,
w,
h } },
925 m_minDepth(minDepth),
938 return a.viewport() ==
b.viewport()
939 &&
a.minDepth() ==
b.minDepth()
940 &&
a.maxDepth() ==
b.maxDepth();
961 const std::array<float, 4>
r =
v.viewport();
966 #ifndef QT_NO_DEBUG_STREAM
970 const std::array<float, 4>
r =
v.viewport();
971 dbg.
nospace() <<
"QRhiViewport(bottom-left-x=" <<
r[0]
972 <<
" bottom-left-y=" <<
r[1]
974 <<
" height=" <<
r[3]
975 <<
" minDepth=" <<
v.minDepth()
976 <<
" maxDepth=" <<
v.maxDepth()
1019 : m_rect { {
x,
y,
w,
h } }
1031 return a.scissor() ==
b.scissor();
1052 const std::array<int, 4>
r =
v.scissor();
1056 #ifndef QT_NO_DEBUG_STREAM
1060 const std::array<int, 4>
r =
s.scissor();
1061 dbg.
nospace() <<
"QRhiScissor(bottom-left-x=" <<
r[0]
1062 <<
" bottom-left-y=" <<
r[1]
1063 <<
" width=" <<
r[2]
1064 <<
" height=" <<
r[3]
1150 m_classification(cls),
1151 m_instanceStepRate(stepRate)
1163 return a.stride() ==
b.stride()
1164 &&
a.classification() ==
b.classification()
1165 &&
a.instanceStepRate() ==
b.instanceStepRate();
1186 return seed +
v.stride() +
v.classification();
1189 #ifndef QT_NO_DEBUG_STREAM
1193 dbg.
nospace() <<
"QRhiVertexInputBinding(stride=" <<
b.stride()
1194 <<
" cls=" <<
b.classification()
1195 <<
" step-rate=" <<
b.instanceStepRate()
1314 : m_binding(binding),
1318 m_matrixSlice(matrixSlice)
1330 return a.binding() ==
b.binding()
1331 &&
a.location() ==
b.location()
1332 &&
a.format() ==
b.format()
1333 &&
a.offset() ==
b.offset();
1354 return seed +
uint(
v.binding()) +
uint(
v.location()) +
uint(
v.format()) +
v.offset();
1357 #ifndef QT_NO_DEBUG_STREAM
1361 dbg.
nospace() <<
"QRhiVertexInputAttribute(binding=" <<
a.binding()
1362 <<
" location=" <<
a.location()
1363 <<
" format=" <<
a.format()
1364 <<
" offset=" <<
a.offset()
1394 return a.m_bindings ==
b.m_bindings &&
a.m_attributes ==
b.m_attributes;
1415 return qHash(
v.m_bindings, seed) +
qHash(
v.m_attributes, seed);
1418 #ifndef QT_NO_DEBUG_STREAM
1422 dbg.
nospace() <<
"QRhiVertexInputLayout(bindings=" <<
v.m_bindings
1423 <<
" attributes=" <<
v.m_attributes
1476 return a.type() ==
b.type()
1477 &&
a.shader() ==
b.shader()
1478 &&
a.shaderVariant() ==
b.shaderVariant();
1499 return v.type() +
qHash(
v.shader(), seed) +
v.shaderVariant();
1502 #ifndef QT_NO_DEBUG_STREAM
1506 dbg.
nospace() <<
"QRhiShaderStage(type=" <<
s.type()
1507 <<
" shader=" <<
s.shader()
1508 <<
" variant=" <<
s.shaderVariant()
1570 : m_renderBuffer(renderBuffer)
1600 m_colorAttachments.
append(colorAttachment);
1610 : m_depthStencilBuffer(depthStencilBuffer)
1612 m_colorAttachments.
append(colorAttachment);
1625 : m_depthTexture(depthTexture)
1627 m_colorAttachments.
append(colorAttachment);
2198 m_type(type_), m_usage(usage_), m_size(size_)
2364 int sampleCount_,
Flags flags_,
2367 m_type(type_), m_pixelSize(pixelSize_), m_sampleCount(sampleCount_), m_flags(flags_),
2368 m_backingFormatHint(backingFormatHint_)
2597 int arraySize_,
int sampleCount_,
Flags flags_)
2599 m_format(format_), m_pixelSize(pixelSize_), m_depth(depth_),
2600 m_arraySize(arraySize_), m_sampleCount(sampleCount_), m_flags(flags_)
2737 m_magFilter(magFilter_), m_minFilter(minFilter_), m_mipmapMode(mipmapMode_),
2738 m_addressU(u_), m_addressV(v_), m_addressW(w_),
3180 layoutDescAppender =
d->serialize(layoutDescAppender);
3272 b.d.binding = binding;
3275 b.d.u.ubuf.buf =
buf;
3276 b.d.u.ubuf.offset = 0;
3277 b.d.u.ubuf.maybeSize = 0;
3278 b.d.u.ubuf.hasDynamicOffset =
false;
3310 b.d.binding = binding;
3313 b.d.u.ubuf.buf =
buf;
3315 b.d.u.ubuf.maybeSize =
size;
3316 b.d.u.ubuf.hasDynamicOffset =
false;
3347 b.d.binding = binding;
3350 b.d.u.ubuf.buf =
buf;
3351 b.d.u.ubuf.offset = 0;
3352 b.d.u.ubuf.maybeSize =
size;
3353 b.d.u.ubuf.hasDynamicOffset =
true;
3378 b.d.binding = binding;
3381 b.d.u.stex.count = 1;
3382 b.d.u.stex.texSamplers[0].tex =
tex;
3383 b.d.u.stex.texSamplers[0].sampler =
sampler;
3426 b.d.binding = binding;
3429 b.d.u.stex.count =
count;
3432 b.d.u.stex.texSamplers[
i] = texSamplers[
i];
3434 b.d.u.stex.texSamplers[
i] = {};
3459 b.d.binding = binding;
3462 b.d.u.simage.tex =
tex;
3463 b.d.u.simage.level =
level;
3487 b.d.binding = binding;
3490 b.d.u.simage.tex =
tex;
3491 b.d.u.simage.level =
level;
3515 b.d.binding = binding;
3518 b.d.u.simage.tex =
tex;
3519 b.d.u.simage.level =
level;
3541 b.d.binding = binding;
3544 b.d.u.sbuf.buf =
buf;
3545 b.d.u.sbuf.offset = 0;
3546 b.d.u.sbuf.maybeSize = 0;
3570 b.d.binding = binding;
3573 b.d.u.sbuf.buf =
buf;
3575 b.d.u.sbuf.maybeSize =
size;
3597 b.d.binding = binding;
3600 b.d.u.sbuf.buf =
buf;
3601 b.d.u.sbuf.offset = 0;
3602 b.d.u.sbuf.maybeSize = 0;
3626 b.d.binding = binding;
3629 b.d.u.sbuf.buf =
buf;
3631 b.d.u.sbuf.maybeSize =
size;
3653 b.d.binding = binding;
3656 b.d.u.sbuf.buf =
buf;
3657 b.d.u.sbuf.offset = 0;
3658 b.d.u.sbuf.maybeSize = 0;
3682 b.d.binding = binding;
3685 b.d.u.sbuf.buf =
buf;
3687 b.d.u.sbuf.maybeSize =
size;
3794 h ^=
qHash(
reinterpret_cast<quintptr>(
d->u.stex.texSamplers[0].sampler));
3816 #ifndef QT_NO_DEBUG_STREAM
3821 dbg.
nospace() <<
"QRhiShaderResourceBinding("
3822 <<
"binding=" <<
d->binding
3823 <<
" stage=" <<
d->stage
3824 <<
" type=" <<
d->type;
3827 dbg.
nospace() <<
" UniformBuffer("
3828 <<
"buffer=" <<
d->u.ubuf.buf
3829 <<
" offset=" <<
d->u.ubuf.offset
3830 <<
" maybeSize=" <<
d->u.ubuf.maybeSize
3834 dbg.
nospace() <<
" SampledTextures("
3835 <<
"count=" <<
d->u.stex.count;
3836 for (
int i = 0;
i <
d->u.stex.count; ++
i) {
3837 dbg.
nospace() <<
" texture=" <<
d->u.stex.texSamplers[
i].tex
3838 <<
" sampler=" <<
d->u.stex.texSamplers[
i].sampler;
3843 dbg.
nospace() <<
" ImageLoad("
3844 <<
"texture=" <<
d->u.simage.tex
3845 <<
" level=" <<
d->u.simage.level
3849 dbg.
nospace() <<
" ImageStore("
3850 <<
"texture=" <<
d->u.simage.tex
3851 <<
" level=" <<
d->u.simage.level
3855 dbg.
nospace() <<
" ImageLoadStore("
3856 <<
"texture=" <<
d->u.simage.tex
3857 <<
" level=" <<
d->u.simage.level
3861 dbg.
nospace() <<
" BufferLoad("
3862 <<
"buffer=" <<
d->u.sbuf.buf
3863 <<
" offset=" <<
d->u.sbuf.offset
3864 <<
" maybeSize=" <<
d->u.sbuf.maybeSize
3868 dbg.
nospace() <<
" BufferStore("
3869 <<
"buffer=" <<
d->u.sbuf.buf
3870 <<
" offset=" <<
d->u.sbuf.offset
3871 <<
" maybeSize=" <<
d->u.sbuf.maybeSize
3875 dbg.
nospace() <<
" BufferLoadStore("
3876 <<
"buffer=" <<
d->u.sbuf.buf
3877 <<
" offset=" <<
d->u.sbuf.offset
3878 <<
" maybeSize=" <<
d->u.sbuf.maybeSize
3882 dbg.
nospace() <<
" UNKNOWN()";
3890 #ifndef QT_NO_DEBUG_STREAM
3894 dbg.
nospace() <<
"QRhiShaderResourceBindings("
4560 switch (
res->resourceType()) {
4568 return "RenderBuffer";
4570 return "RenderPassDescriptor";
4572 return "RenderTarget";
4574 return "TextureRenderTarget";
4576 return "ShaderResourceBindings";
4578 return "GraphicsPipeline";
4582 return "ComputePipeline";
4584 return "CommandBuffer";
4601 static bool leakCheck =
true;
4604 static bool leakCheck = qEnvironmentVariableIntValue(
"QT_RHI_LEAK_CHECK");
4608 qWarning(
"QRhi %p going down with %d unreleased resources that own native graphics objects. This is not nice.",
4609 q,
int(resources.
count()));
4613 qWarning(
" %s resource %p (%s)", resourceTypeStr(
res),
res,
res->m_objectName.constData());
4619 res->m_rhi =
nullptr;
4633 QSize *blockDim)
const
4746 *byteSize = wblocks * hblocks *
blockSize;
4748 *blockDim =
QSize(xdim, ydim);
4815 *bytesPerPixel = bpc;
4828 approxSize += byteSize;
4830 approxSize *=
depth;
4831 approxSize *=
uint(layerCount);
4838 qWarning(
"Cannot build a graphics pipeline without any stages");
4842 bool hasVertexStage =
false;
4844 if (!
it->shader().isValid()) {
4845 qWarning(
"Empty shader passed to graphics pipeline");
4849 hasVertexStage =
true;
4851 if (!hasVertexStage) {
4852 qWarning(
"Cannot build a graphics pipeline without a vertex stage");
4857 qWarning(
"Cannot build a graphics pipeline without a QRhiRenderPassDescriptor");
4862 qWarning(
"Cannot build a graphics pipeline without QRhiShaderResourceBindings");
4872 bool bindingsOk =
true;
4873 const int CHECKED_BINDINGS_COUNT = 64;
4874 bool bindingSeen[CHECKED_BINDINGS_COUNT] = {};
4876 const int binding =
it->data()->binding;
4877 if (binding >= CHECKED_BINDINGS_COUNT)
4880 qWarning(
"Invalid binding number %d", binding);
4884 switch (
it->data()->type) {
4886 if (!bindingSeen[binding]) {
4887 bindingSeen[binding] =
true;
4889 qWarning(
"Uniform buffer duplicates an existing binding number %d", binding);
4894 if (!bindingSeen[binding]) {
4895 bindingSeen[binding] =
true;
4897 qWarning(
"Combined image sampler duplicates an existing binding number %d", binding);
4906 if (!bindingSeen[binding]) {
4907 bindingSeen[binding] =
true;
4909 qWarning(
"Image duplicates an existing binding number %d", binding);
4918 if (!bindingSeen[binding]) {
4919 bindingSeen[binding] =
true;
4921 qWarning(
"Buffer duplicates an existing binding number %d", binding);
4926 qWarning(
"Unknown binding type %d",
int(
it->data()->type));
4958 d->pendingDeleteResources.
clear();
4980 std::unique_ptr<QRhi>
r(
new QRhi);
4987 #if QT_CONFIG(vulkan)
4993 qWarning(
"This build of Qt has no Vulkan support");
4997 #ifndef QT_NO_OPENGL
5002 qWarning(
"This build of Qt has no OpenGL support");
5011 qWarning(
"This platform has no Direct3D 11 support");
5015 #if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
5020 qWarning(
"This platform has no Metal support");
5039 if (qEnvironmentVariableIsSet(
"QSG_INFO"))
5044 if (
r->d->create(
flags)) {
5045 r->d->implType = impl;
5067 switch (d->implType) {
5115 #ifndef QT_NO_DEBUG_STREAM
5122 return "Integrated";
5138 dbg.
nospace() <<
"QRhiDriverInfo(deviceName=" <<
info.deviceName
5140 <<
" vendorId=0x" <<
info.vendorId
5141 <<
" deviceType=" << deviceTypeStr(
info.deviceType)
5161 return d->implThread;
5194 d->cleanupCallbacks.
clear();
5330 const int opListSize = d->
bufferOps.size();
5331 if (
idx < opListSize)
5350 if (idx < d->bufferOps.size())
5363 if (
buf->size() > 0) {
5365 if (idx < d->bufferOps.size())
5399 if (idx < d->bufferOps.size())
5414 if (
desc.cbeginEntries() !=
desc.cendEntries()) {
5416 if (idx < d->textureOps.size())
5452 if (idx < d->textureOps.size())
5522 if (idx < d->textureOps.size())
5546 if (idx < d->textureOps.size())
5573 if (!(d->resUpdPoolMap &
mask)) {
5574 d->resUpdPoolMap |=
mask;
5577 d->lastResUpdIdx =
i;
5582 const int poolSize = d->resUpdPool.
size();
5583 for (
int i = d->lastResUpdIdx + 1;
i < poolSize; ++
i) {
5587 for (
int i = 0;
i <= d->lastResUpdIdx; ++
i) {
5596 const int oldSize = d->resUpdPool.
count();
5597 const int newSize = oldSize + qMin(4, qMax(0, 64 - oldSize));
5598 d->resUpdPool.
resize(newSize);
5599 for (
int i = oldSize;
i < newSize; ++
i)
5601 u = nextFreeBatch();
5603 qWarning(
"Resource update batch pool exhausted (max is 64)");
5666 if (resourceUpdates)
5720 const QColor &colorClearValue,
5723 BeginPassFlags
flags)
5815 int dynamicOffsetCount,
5970 m_rhi->
draw(
this, vertexCount, instanceCount, firstVertex, firstInstance);
6008 m_rhi->
drawIndexed(
this, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
6210 return (
v + byteAlign - 1) & ~(byteAlign - 1);
6227 const int w = qMax(1, baseLevelSize.
width() >> mipLevel);
6228 const int h = qMax(1, baseLevelSize.
height() >> mipLevel);
6379 return &d->profiler;
6399 if (
u->d->poolIndex < 0)
6400 u->d->trimOpLists();
6563 QRhiBuffer::UsageFlags
usage,
6590 const QSize &pixelSize,
6610 const QSize &pixelSize,
6664 const QSize &pixelSize,
6686 return d->
createSampler(magFilter, minFilter, mipmapMode, addressU, addressV, addressW);
6762 qWarning(
"Attempted to call beginFrame() within a still active frame; ignored");
6797 qWarning(
"Attempted to call endFrame() without an active frame; ignored");
6804 d->pendingDeleteResources.
clear();
6907 qWarning(
"Attempted to call beginOffscreenFrame() within a still active frame; ignored");
6924 qWarning(
"Attempted to call endOffscreenFrame() without an active frame; ignored");
6929 d->pendingDeleteResources.
clear();
6983 return counter.fetchAndAddRelaxed(1) + 1;
6988 return m_buffers.isEmpty() && m_textures.isEmpty();
7006 auto it = m_buffers.find(
buf);
7007 if (
it != m_buffers.end()) {
7010 qWarning(
"Buffer %p (%s) used with different accesses within the same pass, this is not allowed.",
7014 if (
it->stage != *stage) {
7015 it->stage = earlierStage(
it->stage, *stage);
7025 b.stateAtPassBegin =
state;
7026 m_buffers.insert(
buf,
b);
7045 auto it = m_textures.find(
tex);
7046 if (
it != m_textures.end()) {
7052 if (isImageLoadStore(
it->access) && isImageLoadStore(*
access)) {
7057 qWarning(
"Texture %p (%s) used with different accesses within the same pass, this is not allowed.",
7061 if (
it->stage != *stage) {
7062 it->stage = earlierStage(
it->stage, *stage);
7071 t.stateAtPassBegin =
state;
7072 m_textures.insert(
tex,
t);
small capitals from c petite p scientific f u
small capitals from c petite p scientific i
[1]
The QByteArray class provides an array of bytes.
QByteArray & replace(qsizetype index, qsizetype len, const char *s, qsizetype alen)
The QColor class provides colors based on RGB, HSV or CMYK values.
operator<<(QDataStream &ds, qfloat16 f)
The QDebug class provides an output stream for debugging information.
Convenience class for custom QDebug operators.
template< typename Enum > size_t qHash(QFlags< Enum > flags, size_t seed=0) noexcept
template< typename Enum > bool operator==(Enum lhs, QFlags< Enum > rhs)
The QImage class provides a hardware-independent image representation that allows direct access to th...
The QLoggingCategory class represents a category, or 'area' in the logging infrastructure.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
virtual char * beginFullDynamicBufferUpdateForCurrentFrame()
QRhiResource::Type resourceType() const override
virtual void endFullDynamicBufferUpdateForCurrentFrame()
virtual NativeBuffer nativeBuffer()
QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, int size_)
an array with pointers to the native object handles.
QRhiColorAttachment()=default
void endPass(QRhiResourceUpdateBatch *resourceUpdates=nullptr)
void debugMarkMsg(const QByteArray &msg)
void draw(quint32 vertexCount, quint32 instanceCount=1, quint32 firstVertex=0, quint32 firstInstance=0)
void setBlendConstants(const QColor &c)
void setScissor(const QRhiScissor &scissor)
void beginComputePass(QRhiResourceUpdateBatch *resourceUpdates=nullptr, BeginPassFlags flags={})
void drawIndexed(quint32 indexCount, quint32 instanceCount=1, quint32 firstIndex=0, qint32 vertexOffset=0, quint32 firstInstance=0)
void setStencilRef(quint32 refValue)
QPair< QRhiBuffer *, quint32 > VertexInput
const QRhiNativeHandles * nativeHandles()
QRhiCommandBuffer(QRhiImplementation *rhi)
void resourceUpdate(QRhiResourceUpdateBatch *resourceUpdates)
void dispatch(int x, int y, int z)
void beginPass(QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates=nullptr, BeginPassFlags flags={})
void setShaderResources(QRhiShaderResourceBindings *srb=nullptr, int dynamicOffsetCount=0, const DynamicOffset *dynamicOffsets=nullptr)
void debugMarkBegin(const QByteArray &name)
void setViewport(const QRhiViewport &viewport)
QRhiResource::Type resourceType() const override
void endComputePass(QRhiResourceUpdateBatch *resourceUpdates=nullptr)
QPair< int, quint32 > DynamicOffset
void setComputePipeline(QRhiComputePipeline *ps)
void setVertexInput(int startBinding, int bindingCount, const VertexInput *bindings, QRhiBuffer *indexBuf=nullptr, quint32 indexOffset=0, IndexFormat indexFormat=IndexUInt16)
void setGraphicsPipeline(QRhiGraphicsPipeline *ps)
QRhiResource::Type resourceType() const override
QRhiComputePipeline(QRhiImplementation *rhi)
size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed) noexcept
bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept
bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) noexcept
QRhiRenderPassDescriptor * renderPassDescriptor() const
QRhiShaderResourceBindings * shaderResourceBindings() const
QRhiGraphicsPipeline(QRhiImplementation *rhi)
QRhiResource::Type resourceType() const override
const QRhiShaderStage * cendShaderStages() const
const QRhiShaderStage * cbeginShaderStages() const
bool isClipDepthZeroToOne() const
FrameOpResult endOffscreenFrame(EndFrameFlags flags={})
bool makeThreadLocalNativeContextCurrent()
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags={}) const
int ubufAligned(int v) const
int resourceLimit(ResourceLimit limit) const
QRhiTexture * newTextureArray(QRhiTexture::Format format, int arraySize, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
QMatrix4x4 clipSpaceCorrMatrix() const
bool isYUpInFramebuffer() const
bool isFeatureSupported(QRhi::Feature feature) const
QRhiShaderResourceBindings * newShaderResourceBindings()
QList< int > supportedSampleCounts() const
QSize sizeForMipLevel(int mipLevel, const QSize &baseLevelSize) const
QRhiRenderBuffer * newRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount=1, QRhiRenderBuffer::Flags flags={}, QRhiTexture::Format backingFormatHint=QRhiTexture::UnknownFormat)
Implementation backend() const
QRhiBuffer * newBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size)
int currentFrameSlot() const
FrameOpResult beginFrame(QRhiSwapChain *swapChain, BeginFrameFlags flags={})
QRhi::FrameOpResult finish()
QRhiComputePipeline * newComputePipeline()
QRhiSwapChain * newSwapChain()
FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, BeginFrameFlags flags={})
QRhiSampler * newSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode addressU, QRhiSampler::AddressMode addressV, QRhiSampler::AddressMode addressW=QRhiSampler::Repeat)
QRhiTextureRenderTarget * newTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags={})
bool isRecordingFrame() const
const char * backendName() const
QRhiGraphicsPipeline * newGraphicsPipeline()
void addCleanupCallback(const CleanupCallback &callback)
static QRhi * create(Implementation impl, QRhiInitParams *params, Flags flags={}, QRhiNativeHandles *importDevice=nullptr)
QByteArray pipelineCacheData()
int mipLevelsForSize(const QSize &size) const
FrameOpResult endFrame(QRhiSwapChain *swapChain, EndFrameFlags flags={})
QRhiProfiler * profiler()
QRhiTexture * newTexture(QRhiTexture::Format format, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
void setPipelineCacheData(const QByteArray &data)
QRhiDriverInfo driverInfo() const
const QRhiNativeHandles * nativeHandles()
QRhiResourceUpdateBatch * nextResourceUpdateBatch()
int ubufAlignment() const
bool isDeviceLost() const
void releaseCachedResources()
std::function< void(QRhi *)> CleanupCallback
virtual bool isClipDepthZeroToOne() const =0
virtual void endExternal(QRhiCommandBuffer *cb)=0
virtual QRhiSwapChain * createSwapChain()=0
virtual QRhiBuffer * createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size)=0
virtual void beginPass(QRhiCommandBuffer *cb, QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags)=0
virtual void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps)=0
virtual const QRhiNativeHandles * nativeHandles(QRhiCommandBuffer *cb)=0
virtual void releaseCachedResources()=0
virtual ~QRhiImplementation()
virtual bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const =0
virtual QRhiDriverInfo driverInfo() const =0
bool isCompressedFormat(QRhiTexture::Format format) const
void updateLayoutDesc(QRhiShaderResourceBindings *srb)
virtual bool isYUpInFramebuffer() const =0
virtual void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)=0
virtual void debugMarkEnd(QRhiCommandBuffer *cb)=0
virtual QRhi::FrameOpResult finish()=0
virtual QRhiTexture * createTexture(QRhiTexture::Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, QRhiTexture::Flags flags)=0
virtual QRhiComputePipeline * createComputePipeline()=0
virtual QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags)=0
virtual void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)=0
virtual int ubufAlignment() const =0
void compressedFormatInfo(QRhiTexture::Format format, const QSize &size, quint32 *bpl, quint32 *byteSize, QSize *blockDim) const
virtual QRhiSampler * createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w)=0
virtual QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags)=0
quint32 approxByteSizeForTexture(QRhiTexture::Format format, const QSize &baseSize, int depth, int mipCount, int layerCount)
virtual QRhiShaderResourceBindings * createShaderResourceBindings()=0
virtual void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)=0
virtual QRhiRenderBuffer * createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint)=0
bool sanityCheckShaderResourceBindings(QRhiShaderResourceBindings *srb)
virtual void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags)=0
virtual void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c)=0
virtual void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name)=0
virtual int resourceLimit(QRhi::ResourceLimit limit) const =0
virtual void setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBindings *srb, int dynamicOffsetCount, const QRhiCommandBuffer::DynamicOffset *dynamicOffsets)=0
virtual void setPipelineCacheData(const QByteArray &data)=0
virtual bool isDeviceLost() const =0
virtual void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport)=0
virtual void beginExternal(QRhiCommandBuffer *cb)=0
virtual QMatrix4x4 clipSpaceCorrMatrix() const =0
virtual void dispatch(QRhiCommandBuffer *cb, int x, int y, int z)=0
virtual bool makeThreadLocalNativeContextCurrent()=0
void addDeleteLater(QRhiResource *res)
virtual void setVertexInput(QRhiCommandBuffer *cb, int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings, QRhiBuffer *indexBuf, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat)=0
virtual QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags)=0
virtual void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue)=0
bool sanityCheckGraphicsPipeline(QRhiGraphicsPipeline *ps)
virtual void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg)=0
virtual QList< int > supportedSampleCounts() const =0
void addCleanupCallback(const QRhi::CleanupCallback &callback)
virtual bool isYUpInNDC() const =0
virtual void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance)=0
virtual bool isFeatureSupported(QRhi::Feature feature) const =0
virtual void setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline *ps)=0
void textureFormatInfo(QRhiTexture::Format format, const QSize &size, quint32 *bpl, quint32 *byteSize, quint32 *bytesPerPixel) const
virtual void draw(QRhiCommandBuffer *cb, quint32 vertexCount, quint32 instanceCount, quint32 firstVertex, quint32 firstInstance)=0
virtual QByteArray pipelineCacheData()=0
virtual QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags)=0
virtual void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor)=0
virtual QRhiTextureRenderTarget * createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags)=0
virtual QRhiGraphicsPipeline * createGraphicsPipeline()=0
static TextureStage toPassTrackerTextureStage(QRhiShaderResourceBinding::StageFlags stages)
static BufferStage toPassTrackerBufferStage(QRhiShaderResourceBinding::StageFlags stages)
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
static QRhiProfilerPrivate * get(QRhiProfiler *p)
QRhiImplementation * rhiDWhenEnabled
QRhiReadbackDescription()=default
QRhiRenderBuffer(QRhiImplementation *rhi, Type type_, const QSize &pixelSize_, int sampleCount_, Flags flags_, QRhiTexture::Format backingFormatHint_)
QRhiResource::Type resourceType() const override
virtual bool createFrom(NativeRenderBuffer src)
QRhiResource::Type resourceType() const override
virtual const QRhiNativeHandles * nativeHandles()
QRhiRenderPassDescriptor(QRhiImplementation *rhi)
QRhiResource::Type resourceType() const override
QRhiRenderTarget(QRhiImplementation *rhi)
QRhiResource(QRhiImplementation *rhi)
quint64 globalResourceId() const
void setName(const QByteArray &name)
QRhiImplementation * m_rhi
void uploadStaticBuffer(QRhiBuffer *buf, int offset, int size, const void *data)
~QRhiResourceUpdateBatch()
void merge(QRhiResourceUpdateBatch *other)
void generateMips(QRhiTexture *tex)
void uploadTexture(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
void updateDynamicBuffer(QRhiBuffer *buf, int offset, int size, const void *data)
void readBackTexture(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
void readBackBuffer(QRhiBuffer *buf, int offset, int size, QRhiBufferReadbackResult *result)
void copyTexture(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc=QRhiTextureCopyDescription())
bool hasOptimalCapacity() const
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)
static const int TEXTURE_OPS_STATIC_ALLOC
QRhiResource::Type resourceType() const override
QRhiSampler(QRhiImplementation *rhi, Filter magFilter_, Filter minFilter_, Filter mipmapMode_, AddressMode u_, AddressMode v_, AddressMode w_)
size_t qHash(const QRhiScissor &v, size_t seed) noexcept
bool operator==(const QRhiScissor &a, const QRhiScissor &b) noexcept
bool operator!=(const QRhiScissor &a, const QRhiScissor &b) noexcept
static QRhiShaderResourceBinding bufferStore(int binding, StageFlags stage, QRhiBuffer *buf)
static QRhiShaderResourceBinding imageLoadStore(int binding, StageFlags stage, QRhiTexture *tex, int level)
bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept
size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) noexcept
static QRhiShaderResourceBinding uniformBufferWithDynamicOffset(int binding, StageFlags stage, QRhiBuffer *buf, int size)
bool isLayoutCompatible(const QRhiShaderResourceBinding &other) const
static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf)
static QRhiShaderResourceBinding sampledTexture(int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler)
static QRhiShaderResourceBinding imageLoad(int binding, StageFlags stage, QRhiTexture *tex, int level)
bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept
static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf)
static QRhiShaderResourceBinding imageStore(int binding, StageFlags stage, QRhiTexture *tex, int level)
static QRhiShaderResourceBinding sampledTextures(int binding, StageFlags stage, int count, const TextureAndSampler *texSamplers)
static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf)
static const int LAYOUT_DESC_ENTRIES_PER_BINDING
bool isLayoutCompatible(const QRhiShaderResourceBindings *other) const
QVarLengthArray< QRhiShaderResourceBinding, BINDING_PREALLOC > m_bindings
QRhiShaderResourceBindings(QRhiImplementation *rhi)
static const int BINDING_PREALLOC
const QRhiShaderResourceBinding * cendBindings() const
const QRhiShaderResourceBinding * cbeginBindings() const
QVector< quint32 > m_layoutDesc
QRhiResource::Type resourceType() const override
QRhiShaderStage()=default
bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept
bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) noexcept
size_t qHash(const QRhiShaderStage &v, size_t seed) noexcept
QRhiResource::Type resourceType() const override
QRhiSwapChain(QRhiImplementation *rhi)
QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_, int depth_, int arraySize_, int sampleCount_, Flags flags_)
64-bit integer containing the native object handle.
QRhiResource::Type resourceType() const override
virtual void setNativeLayout(int layout)
virtual bool createFrom(NativeTexture src)
virtual NativeTexture nativeTexture()
QRhiTextureRenderTargetDescription()=default
QRhiResource::Type resourceType() const override
QRhiTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc_, Flags flags_)
QRhiTextureSubresourceUploadDescription()=default
QRhiTextureUploadDescription()=default
QRhiTextureUploadEntry()=default
bool operator==(const QRhiViewport &a, const QRhiViewport &b) noexcept
size_t qHash(const QRhiViewport &v, size_t seed) noexcept
bool operator!=(const QRhiViewport &a, const QRhiViewport &b) noexcept
The QSize class defines the size of a two-dimensional object using integer point precision.
constexpr int height() const noexcept
constexpr int width() const noexcept
static QThread * currentThread()
constexpr size_type size() const noexcept
void resize(qsizetype sz)
QRhiShaderResourceBindings * srb
QRhiGraphicsPipeline * ps
qDeleteAll(list.begin(), list.end())
auto it unsigned count const
backing_store_ptr info
[4]
QRhiTextureRenderTarget * rt
QTextStream & hex(QTextStream &stream)
#define Q_BASIC_ATOMIC_INITIALIZER(a)
QT_END_INCLUDE_NAMESPACE typedef double qreal
unsigned long long quint64
#define Q_LOGGING_CATEGORY(name,...)
GLboolean GLboolean GLboolean b
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]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
const void GLsizei GLsizei stride
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
GLdouble GLdouble GLdouble GLdouble q
GLsizeiptr const void GLenum usage
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
view viewport() -> scroll(dx, dy, deviceRect)
Contains information about the underlying native resources of a buffer.
static BufferOp staticUpload(QRhiBuffer *buf, int offset, int size, const void *data)
static BufferOp read(QRhiBuffer *buf, int offset, int size, QRhiBufferReadbackResult *result)
static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, int offset, int size, const void *data)
static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, int offset, int size, const void *data)
static BufferOp dynamicUpdate(QRhiBuffer *buf, int offset, int size, const void *data)
static TextureOp copy(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc)
static TextureOp upload(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
static TextureOp genMips(QRhiTexture *tex)
static TextureOp read(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
TextureAndSampler texSamplers[MAX_TEX_SAMPLER_ARRAY_SIZE]
QRhiShaderResourceBinding::StageFlags stage
static const int MAX_TEX_SAMPLER_ARRAY_SIZE
union QRhiShaderResourceBinding::Data::@552 u
QRhiShaderResourceBinding::Type type
Contains information about the underlying native resources of a texture.
QRhiShaderResourceBinding bindings[2]