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
qrhi.cpp
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#include "qrhi_p.h"
5#include <qmath.h>
6#include <QLoggingCategory>
7
8#include "qrhinull_p.h"
9#ifndef QT_NO_OPENGL
10#include "qrhigles2_p.h"
11#endif
12#if QT_CONFIG(vulkan)
13#include "qrhivulkan_p.h"
14#endif
15#ifdef Q_OS_WIN
16#include "qrhid3d11_p.h"
17#include "qrhid3d12_p.h"
18#endif
19#if QT_CONFIG(metal)
20#include "qrhimetal_p.h"
21#endif
22
23#include <memory>
24
26
27Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
28
29
1182 : m_d(d),
1183 m_s(s)
1184{
1185}
1186
1228#ifndef QT_NO_DEBUG_STREAM
1230{
1231 QDebugStateSaver saver(dbg);
1232 dbg.nospace() << "QRhiDepthStencilClearValue(depth-clear=" << v.depthClearValue()
1233 << " stencil-clear=" << v.stencilClearValue()
1234 << ')';
1235 return dbg;
1236}
1237#endif
1238
1286QRhiViewport::QRhiViewport(float x, float y, float w, float h, float minDepth, float maxDepth)
1287 : m_rect { { x, y, w, h } },
1288 m_minDepth(minDepth),
1289 m_maxDepth(maxDepth)
1290{
1291}
1292
1348#ifndef QT_NO_DEBUG_STREAM
1350{
1351 QDebugStateSaver saver(dbg);
1352 const std::array<float, 4> r = v.viewport();
1353 dbg.nospace() << "QRhiViewport(bottom-left-x=" << r[0]
1354 << " bottom-left-y=" << r[1]
1355 << " width=" << r[2]
1356 << " height=" << r[3]
1357 << " minDepth=" << v.minDepth()
1358 << " maxDepth=" << v.maxDepth()
1359 << ')';
1360 return dbg;
1361}
1362#endif
1363
1403QRhiScissor::QRhiScissor(int x, int y, int w, int h)
1404 : m_rect { { x, y, w, h } }
1405{
1406}
1407
1441#ifndef QT_NO_DEBUG_STREAM
1443{
1444 QDebugStateSaver saver(dbg);
1445 const std::array<int, 4> r = s.scissor();
1446 dbg.nospace() << "QRhiScissor(bottom-left-x=" << r[0]
1447 << " bottom-left-y=" << r[1]
1448 << " width=" << r[2]
1449 << " height=" << r[3]
1450 << ')';
1451 return dbg;
1452}
1453#endif
1454
1537 : m_stride(stride),
1538 m_classification(cls),
1539 m_instanceStepRate(stepRate)
1540{
1541}
1542
1593#ifndef QT_NO_DEBUG_STREAM
1595{
1596 QDebugStateSaver saver(dbg);
1597 dbg.nospace() << "QRhiVertexInputBinding(stride=" << b.stride()
1598 << " cls=" << b.classification()
1599 << " step-rate=" << b.instanceStepRate()
1600 << ')';
1601 return dbg;
1602}
1603#endif
1604
1742 : m_binding(binding),
1743 m_location(location),
1744 m_format(format),
1745 m_offset(offset),
1746 m_matrixSlice(matrixSlice)
1747{
1748}
1749
1831#ifndef QT_NO_DEBUG_STREAM
1833{
1834 QDebugStateSaver saver(dbg);
1835 dbg.nospace() << "QRhiVertexInputAttribute(binding=" << a.binding()
1836 << " location=" << a.location()
1837 << " format=" << a.format()
1838 << " offset=" << a.offset()
1839 << ')';
1840 return dbg;
1841}
1842#endif
1843
1845{
1846 switch (type) {
1855
1864
1873
1882
1883 default:
1884 Q_UNREACHABLE_RETURN(QRhiVertexInputAttribute::Float);
1885 }
1886}
1887
1889{
1890 switch (format) {
1892 return 4 * sizeof(float);
1894 return 4 * sizeof(float); // vec3 still takes 16 bytes
1896 return 2 * sizeof(float);
1898 return sizeof(float);
1899
1901 return 4 * sizeof(quint8);
1903 return 2 * sizeof(quint8);
1905 return sizeof(quint8);
1906
1908 return 4 * sizeof(quint32);
1910 return 4 * sizeof(quint32); // ivec3 still takes 16 bytes
1912 return 2 * sizeof(quint32);
1914 return sizeof(quint32);
1915
1917 return 4 * sizeof(qint32);
1919 return 4 * sizeof(qint32); // uvec3 still takes 16 bytes
1921 return 2 * sizeof(qint32);
1923 return sizeof(qint32);
1924
1926 return 4 * sizeof(qfloat16);
1928 return 4 * sizeof(qfloat16); // half3 still takes 8 bytes
1930 return 2 * sizeof(qfloat16);
1932 return sizeof(qfloat16);
1933
1935 return 4 * sizeof(quint16);
1937 return 4 * sizeof(quint16); // ivec3 still takes 8 bytes
1939 return 2 * sizeof(quint16);
1941 return sizeof(quint16);
1942
1944 return 4 * sizeof(qint16);
1946 return 4 * sizeof(qint16); // uvec3 still takes 8 bytes
1948 return 2 * sizeof(qint16);
1950 return sizeof(qint16);
1951
1952 default:
1953 Q_UNREACHABLE_RETURN(1);
1954 }
1955}
1956
2074#ifndef QT_NO_DEBUG_STREAM
2076{
2077 QDebugStateSaver saver(dbg);
2078 dbg.nospace() << "QRhiVertexInputLayout(bindings=" << v.m_bindings
2079 << " attributes=" << v.m_attributes
2080 << ')';
2081 return dbg;
2082}
2083#endif
2084
2193 : m_type(type),
2194 m_shader(shader),
2195 m_shaderVariant(v)
2196{
2197}
2198
2219#ifndef QT_NO_DEBUG_STREAM
2221{
2222 QDebugStateSaver saver(dbg);
2223 dbg.nospace() << "QRhiShaderStage(type=" << s.type()
2224 << " shader=" << s.shader()
2225 << " variant=" << s.shaderVariant()
2226 << ')';
2227 return dbg;
2228}
2229#endif
2230
2288
2294 : m_renderBuffer(renderBuffer)
2295{
2296}
2297
2595{
2596 m_colorAttachments.append(colorAttachment);
2597}
2598
2605 QRhiRenderBuffer *depthStencilBuffer)
2606 : m_depthStencilBuffer(depthStencilBuffer)
2607{
2608 m_colorAttachments.append(colorAttachment);
2609}
2610
2620 QRhiTexture *depthTexture)
2621 : m_depthTexture(depthTexture)
2622{
2623 m_colorAttachments.append(colorAttachment);
2624}
2625
2835
2847
2856
2979 : m_layer(layer),
2980 m_level(level),
2981 m_desc(desc)
2982{
2983}
2984
3119
3129QRhiTextureUploadDescription::QRhiTextureUploadDescription(std::initializer_list<QRhiTextureUploadEntry> list)
3130 : m_entries(list)
3131{
3132}
3133
3321
3469
3482{
3483 // destroy() cannot be called here, due to virtuals; it is up to the
3484 // subclasses to do that.
3485}
3486
3546{
3547 if (m_rhi)
3548 m_rhi->addDeleteLater(this);
3549 else
3550 delete this;
3551}
3552
3557{
3558 return m_objectName;
3559}
3560
3582{
3584}
3585
3593{
3594 return m_id;
3595}
3596
3604{
3605 return m_rhi ? m_rhi->q : nullptr;
3606}
3607
3829QRhiBuffer::QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, quint32 size_)
3830 : QRhiResource(rhi),
3831 m_type(type_), m_usage(usage_), m_size(size_)
3832{
3833}
3834
3839{
3840 return Buffer;
3841}
3842
3935
3971{
3972 return nullptr;
3973}
3974
3983
4060 int sampleCount_, Flags flags_,
4061 QRhiTexture::Format backingFormatHint_)
4062 : QRhiResource(rhi),
4063 m_type(type_), m_pixelSize(pixelSize_), m_sampleCount(sampleCount_), m_flags(flags_),
4064 m_backingFormatHint(backingFormatHint_)
4065{
4066}
4067
4075
4120{
4121 Q_UNUSED(src);
4122 return false;
4123}
4124
4423QRhiTexture::QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_, int depth_,
4424 int arraySize_, int sampleCount_, Flags flags_)
4425 : QRhiResource(rhi),
4426 m_format(format_), m_pixelSize(pixelSize_), m_depth(depth_),
4427 m_arraySize(arraySize_), m_sampleCount(sampleCount_), m_flags(flags_)
4428{
4429}
4430
4438
4461
4491{
4492 Q_UNUSED(src);
4493 return false;
4494}
4495
4523
4753 Filter magFilter_, Filter minFilter_, Filter mipmapMode_,
4755 : QRhiResource(rhi),
4756 m_magFilter(magFilter_), m_minFilter(minFilter_), m_mipmapMode(mipmapMode_),
4757 m_addressU(u_), m_addressV(v_), m_addressW(w_),
4758 m_compareOp(QRhiSampler::Never)
4759{
4760}
4761
4769
4865
4873
4956{
4957 return nullptr;
4958}
4959
4986
5037 : QRhiRenderTarget(rhi),
5038 m_swapchain(swapchain_)
5039{
5040}
5041
5065
5151 Flags flags_)
5152 : QRhiRenderTarget(rhi),
5153 m_desc(desc_),
5154 m_flags(flags_)
5155{
5156}
5157
5165
5321
5329
5352{
5353 if (other == this)
5354 return true;
5355
5356 if (!other)
5357 return false;
5358
5359 // This can become a hot code path. Therefore we do not iterate and call
5360 // isLayoutCompatible() on m_bindings, but rather check a pre-calculated
5361 // hash code and then, if the hash matched, do a uint array comparison
5362 // (that's still more cache friendly).
5363
5364 return m_layoutDescHash == other->m_layoutDescHash
5365 && m_layoutDesc == other->m_layoutDesc;
5366}
5367
5388{
5389 srb->m_layoutDescHash = 0;
5390 srb->m_layoutDesc.clear();
5391 auto layoutDescAppender = std::back_inserter(srb->m_layoutDesc);
5392 for (const QRhiShaderResourceBinding &b : std::as_const(srb->m_bindings)) {
5394 srb->m_layoutDescHash ^= uint(d->binding) ^ uint(d->stage) ^ uint(d->type)
5395 ^ uint(d->arraySize());
5396 layoutDescAppender = d->serialize(layoutDescAppender);
5397 }
5398}
5399
5504{
5505 // everything that goes into a VkDescriptorSetLayoutBinding must match
5506 return d.binding == other.d.binding
5507 && d.stage == other.d.stage
5508 && d.type == other.d.type
5509 && d.arraySize() == other.d.arraySize();
5510}
5511
5530 int binding, StageFlags stage, QRhiBuffer *buf)
5531{
5533 b.d.binding = binding;
5534 b.d.stage = stage;
5535 b.d.type = UniformBuffer;
5536 b.d.u.ubuf.buf = buf;
5537 b.d.u.ubuf.offset = 0;
5538 b.d.u.ubuf.maybeSize = 0; // entire buffer
5539 b.d.u.ubuf.hasDynamicOffset = false;
5540 return b;
5541}
5542
5567 int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
5568{
5569 Q_ASSERT(size > 0);
5571 b.d.binding = binding;
5572 b.d.stage = stage;
5573 b.d.type = UniformBuffer;
5574 b.d.u.ubuf.buf = buf;
5575 b.d.u.ubuf.offset = offset;
5576 b.d.u.ubuf.maybeSize = size;
5577 b.d.u.ubuf.hasDynamicOffset = false;
5578 return b;
5579}
5580
5604 int binding, StageFlags stage, QRhiBuffer *buf, quint32 size)
5605{
5606 Q_ASSERT(size > 0);
5608 b.d.binding = binding;
5609 b.d.stage = stage;
5610 b.d.type = UniformBuffer;
5611 b.d.u.ubuf.buf = buf;
5612 b.d.u.ubuf.offset = 0;
5613 b.d.u.ubuf.maybeSize = size;
5614 b.d.u.ubuf.hasDynamicOffset = true;
5615 return b;
5616}
5617
5644 int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler)
5645{
5647 b.d.binding = binding;
5648 b.d.stage = stage;
5649 b.d.type = SampledTexture;
5650 b.d.u.stex.count = 1;
5651 b.d.u.stex.texSamplers[0] = { tex, sampler };
5652 return b;
5653}
5654
5690 int binding, StageFlags stage, int count, const TextureAndSampler *texSamplers)
5691{
5694 b.d.binding = binding;
5695 b.d.stage = stage;
5696 b.d.type = SampledTexture;
5697 b.d.u.stex.count = count;
5698 for (int i = 0; i < count; ++i) {
5699 if (texSamplers)
5700 b.d.u.stex.texSamplers[i] = texSamplers[i];
5701 else
5702 b.d.u.stex.texSamplers[i] = { nullptr, nullptr };
5703 }
5704 return b;
5705}
5706
5737{
5739 b.d.binding = binding;
5740 b.d.stage = stage;
5741 b.d.type = Texture;
5742 b.d.u.stex.count = 1;
5743 b.d.u.stex.texSamplers[0] = { tex, nullptr };
5744 return b;
5745}
5746
5768{
5771 b.d.binding = binding;
5772 b.d.stage = stage;
5773 b.d.type = Texture;
5774 b.d.u.stex.count = count;
5775 for (int i = 0; i < count; ++i) {
5776 if (tex)
5777 b.d.u.stex.texSamplers[i] = { tex[i], nullptr };
5778 else
5779 b.d.u.stex.texSamplers[i] = { nullptr, nullptr };
5780 }
5781 return b;
5782}
5783
5813{
5815 b.d.binding = binding;
5816 b.d.stage = stage;
5817 b.d.type = Sampler;
5818 b.d.u.stex.count = 1;
5819 b.d.u.stex.texSamplers[0] = { nullptr, sampler };
5820 return b;
5821}
5822
5847 int binding, StageFlags stage, QRhiTexture *tex, int level)
5848{
5850 b.d.binding = binding;
5851 b.d.stage = stage;
5852 b.d.type = ImageLoad;
5853 b.d.u.simage.tex = tex;
5854 b.d.u.simage.level = level;
5855 return b;
5856}
5857
5882 int binding, StageFlags stage, QRhiTexture *tex, int level)
5883{
5885 b.d.binding = binding;
5886 b.d.stage = stage;
5887 b.d.type = ImageStore;
5888 b.d.u.simage.tex = tex;
5889 b.d.u.simage.level = level;
5890 return b;
5891}
5892
5917 int binding, StageFlags stage, QRhiTexture *tex, int level)
5918{
5920 b.d.binding = binding;
5921 b.d.stage = stage;
5922 b.d.type = ImageLoadStore;
5923 b.d.u.simage.tex = tex;
5924 b.d.u.simage.level = level;
5925 return b;
5926}
5927
5950 int binding, StageFlags stage, QRhiBuffer *buf)
5951{
5953 b.d.binding = binding;
5954 b.d.stage = stage;
5955 b.d.type = BufferLoad;
5956 b.d.u.sbuf.buf = buf;
5957 b.d.u.sbuf.offset = 0;
5958 b.d.u.sbuf.maybeSize = 0; // entire buffer
5959 return b;
5960}
5961
5985 int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
5986{
5987 Q_ASSERT(size > 0);
5989 b.d.binding = binding;
5990 b.d.stage = stage;
5991 b.d.type = BufferLoad;
5992 b.d.u.sbuf.buf = buf;
5993 b.d.u.sbuf.offset = offset;
5994 b.d.u.sbuf.maybeSize = size;
5995 return b;
5996}
5997
6020 int binding, StageFlags stage, QRhiBuffer *buf)
6021{
6023 b.d.binding = binding;
6024 b.d.stage = stage;
6025 b.d.type = BufferStore;
6026 b.d.u.sbuf.buf = buf;
6027 b.d.u.sbuf.offset = 0;
6028 b.d.u.sbuf.maybeSize = 0; // entire buffer
6029 return b;
6030}
6031
6055 int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
6056{
6057 Q_ASSERT(size > 0);
6059 b.d.binding = binding;
6060 b.d.stage = stage;
6061 b.d.type = BufferStore;
6062 b.d.u.sbuf.buf = buf;
6063 b.d.u.sbuf.offset = offset;
6064 b.d.u.sbuf.maybeSize = size;
6065 return b;
6066}
6067
6090 int binding, StageFlags stage, QRhiBuffer *buf)
6091{
6093 b.d.binding = binding;
6094 b.d.stage = stage;
6095 b.d.type = BufferLoadStore;
6096 b.d.u.sbuf.buf = buf;
6097 b.d.u.sbuf.offset = 0;
6098 b.d.u.sbuf.maybeSize = 0; // entire buffer
6099 return b;
6100}
6101
6125 int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
6126{
6127 Q_ASSERT(size > 0);
6129 b.d.binding = binding;
6130 b.d.stage = stage;
6131 b.d.type = BufferLoadStore;
6132 b.d.u.sbuf.buf = buf;
6133 b.d.u.sbuf.offset = offset;
6134 b.d.u.sbuf.maybeSize = size;
6135 return b;
6136}
6137
6149{
6152
6153 if (da == db)
6154 return true;
6155
6156
6157 if (da->binding != db->binding
6158 || da->stage != db->stage
6159 || da->type != db->type)
6160 {
6161 return false;
6162 }
6163
6164 switch (da->type) {
6166 if (da->u.ubuf.buf != db->u.ubuf.buf
6167 || da->u.ubuf.offset != db->u.ubuf.offset
6168 || da->u.ubuf.maybeSize != db->u.ubuf.maybeSize)
6169 {
6170 return false;
6171 }
6172 break;
6174 if (da->u.stex.count != db->u.stex.count)
6175 return false;
6176 for (int i = 0; i < da->u.stex.count; ++i) {
6177 if (da->u.stex.texSamplers[i].tex != db->u.stex.texSamplers[i].tex
6178 || da->u.stex.texSamplers[i].sampler != db->u.stex.texSamplers[i].sampler)
6179 {
6180 return false;
6181 }
6182 }
6183 break;
6185 if (da->u.stex.count != db->u.stex.count)
6186 return false;
6187 for (int i = 0; i < da->u.stex.count; ++i) {
6188 if (da->u.stex.texSamplers[i].tex != db->u.stex.texSamplers[i].tex)
6189 return false;
6190 }
6191 break;
6193 if (da->u.stex.texSamplers[0].sampler != db->u.stex.texSamplers[0].sampler)
6194 return false;
6195 break;
6199 if (da->u.simage.tex != db->u.simage.tex
6200 || da->u.simage.level != db->u.simage.level)
6201 {
6202 return false;
6203 }
6204 break;
6208 if (da->u.sbuf.buf != db->u.sbuf.buf
6209 || da->u.sbuf.offset != db->u.sbuf.offset
6210 || da->u.sbuf.maybeSize != db->u.sbuf.maybeSize)
6211 {
6212 return false;
6213 }
6214 break;
6215 default:
6216 Q_UNREACHABLE_RETURN(false);
6217 }
6218
6219 return true;
6220}
6221
6229{
6230 return !(a == b);
6231}
6232
6238size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) noexcept
6239{
6242 seed = hash(seed, d->binding);
6243 seed = hash(seed, d->stage);
6244 seed = hash(seed, d->type);
6245 switch (d->type) {
6247 seed = hash(seed, reinterpret_cast<quintptr>(d->u.ubuf.buf));
6248 break;
6250 seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].tex));
6251 seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].sampler));
6252 break;
6254 seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].tex));
6255 break;
6257 seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].sampler));
6258 break;
6262 seed = hash(seed, reinterpret_cast<quintptr>(d->u.simage.tex));
6263 break;
6267 seed = hash(seed, reinterpret_cast<quintptr>(d->u.sbuf.buf));
6268 break;
6269 }
6270 return seed;
6271}
6272
6273#ifndef QT_NO_DEBUG_STREAM
6275{
6276 QDebugStateSaver saver(dbg);
6278 dbg.nospace() << "QRhiShaderResourceBinding("
6279 << "binding=" << d->binding
6280 << " stage=" << d->stage
6281 << " type=" << d->type;
6282 switch (d->type) {
6284 dbg.nospace() << " UniformBuffer("
6285 << "buffer=" << d->u.ubuf.buf
6286 << " offset=" << d->u.ubuf.offset
6287 << " maybeSize=" << d->u.ubuf.maybeSize
6288 << ')';
6289 break;
6291 dbg.nospace() << " SampledTextures("
6292 << "count=" << d->u.stex.count;
6293 for (int i = 0; i < d->u.stex.count; ++i) {
6294 dbg.nospace() << " texture=" << d->u.stex.texSamplers[i].tex
6295 << " sampler=" << d->u.stex.texSamplers[i].sampler;
6296 }
6297 dbg.nospace() << ')';
6298 break;
6300 dbg.nospace() << " Textures("
6301 << "count=" << d->u.stex.count;
6302 for (int i = 0; i < d->u.stex.count; ++i)
6303 dbg.nospace() << " texture=" << d->u.stex.texSamplers[i].tex;
6304 dbg.nospace() << ')';
6305 break;
6307 dbg.nospace() << " Sampler("
6308 << " sampler=" << d->u.stex.texSamplers[0].sampler
6309 << ')';
6310 break;
6312 dbg.nospace() << " ImageLoad("
6313 << "texture=" << d->u.simage.tex
6314 << " level=" << d->u.simage.level
6315 << ')';
6316 break;
6318 dbg.nospace() << " ImageStore("
6319 << "texture=" << d->u.simage.tex
6320 << " level=" << d->u.simage.level
6321 << ')';
6322 break;
6324 dbg.nospace() << " ImageLoadStore("
6325 << "texture=" << d->u.simage.tex
6326 << " level=" << d->u.simage.level
6327 << ')';
6328 break;
6330 dbg.nospace() << " BufferLoad("
6331 << "buffer=" << d->u.sbuf.buf
6332 << " offset=" << d->u.sbuf.offset
6333 << " maybeSize=" << d->u.sbuf.maybeSize
6334 << ')';
6335 break;
6337 dbg.nospace() << " BufferStore("
6338 << "buffer=" << d->u.sbuf.buf
6339 << " offset=" << d->u.sbuf.offset
6340 << " maybeSize=" << d->u.sbuf.maybeSize
6341 << ')';
6342 break;
6344 dbg.nospace() << " BufferLoadStore("
6345 << "buffer=" << d->u.sbuf.buf
6346 << " offset=" << d->u.sbuf.offset
6347 << " maybeSize=" << d->u.sbuf.maybeSize
6348 << ')';
6349 break;
6350 default:
6351 dbg.nospace() << " UNKNOWN()";
6352 break;
6353 }
6354 dbg.nospace() << ')';
6355 return dbg;
6356}
6357#endif
6358
6359#ifndef QT_NO_DEBUG_STREAM
6361{
6362 QDebugStateSaver saver(dbg);
6363 dbg.nospace() << "QRhiShaderResourceBindings("
6364 << srb.m_bindings
6365 << ')';
6366 return dbg;
6367}
6368#endif
6369
6711
6719
7320
7328
7479
7801{
7804 info.limits.luminanceInNits.minLuminance = 0.0f;
7805 info.limits.luminanceInNits.maxLuminance = 1000.0f;
7806 info.luminanceBehavior = QRhiSwapChainHdrInfo::SceneReferred;
7807 info.sdrWhiteLevel = 200.0f;
7808 return info;
7809}
7810
7811#ifndef QT_NO_DEBUG_STREAM
7813{
7814 QDebugStateSaver saver(dbg);
7815 dbg.nospace() << "QRhiSwapChainHdrInfo(";
7816 switch (info.limitsType) {
7818 dbg.nospace() << " minLuminance=" << info.limits.luminanceInNits.minLuminance
7819 << " maxLuminance=" << info.limits.luminanceInNits.maxLuminance;
7820 break;
7822 dbg.nospace() << " maxColorComponentValue=" << info.limits.colorComponentValue.maxColorComponentValue;
7823 dbg.nospace() << " maxPotentialColorComponentValue=" << info.limits.colorComponentValue.maxPotentialColorComponentValue;
7824 break;
7825 }
7826 switch (info.luminanceBehavior) {
7828 dbg.nospace() << " scene-referred, SDR white level=" << info.sdrWhiteLevel;
7829 break;
7831 dbg.nospace() << " display-referred";
7832 break;
7833 }
7834 dbg.nospace() << ')';
7835 return dbg;
7836}
7837#endif
7838
7872
7880
7986
7994
7995static const char *resourceTypeStr(const QRhiResource *res)
7996{
7997 switch (res->resourceType()) {
7999 return "Buffer";
8001 return "Texture";
8003 return "Sampler";
8005 return "RenderBuffer";
8007 return "RenderPassDescriptor";
8009 return "SwapChainRenderTarget";
8011 return "TextureRenderTarget";
8013 return "ShaderResourceBindings";
8015 return "GraphicsPipeline";
8017 return "SwapChain";
8019 return "ComputePipeline";
8021 return "CommandBuffer";
8022 }
8023
8024 Q_UNREACHABLE_RETURN("");
8025}
8026
8028{
8029 qDeleteAll(resUpdPool);
8030
8031 // Be nice and show something about leaked stuff. Though we may not get
8032 // this far with some backends where the allocator or the api may check
8033 // and freak out for unfreed graphics objects in the derived dtor already.
8034#ifndef QT_NO_DEBUG
8035 // debug builds: just do it always
8036 static bool leakCheck = true;
8037#else
8038 // release builds: opt-in
8039 static bool leakCheck = qEnvironmentVariableIntValue("QT_RHI_LEAK_CHECK");
8040#endif
8041 if (!resources.isEmpty()) {
8042 if (leakCheck) {
8043 qWarning("QRhi %p going down with %d unreleased resources that own native graphics objects. This is not nice.",
8044 q, int(resources.size()));
8045 }
8046 for (auto it = resources.cbegin(), end = resources.cend(); it != end; ++it) {
8047 QRhiResource *res = it.key();
8048 const bool ownsNativeResources = it.value();
8049 if (leakCheck && ownsNativeResources)
8050 qWarning(" %s resource %p (%s)", resourceTypeStr(res), res, res->m_objectName.constData());
8051
8052 // Null out the resource's rhi pointer. This is why it makes sense to do null
8053 // checks in the destroy() implementations of the various resource types. It
8054 // allows to survive in bad applications that somehow manage to destroy a
8055 // resource of a QRhi after the QRhi itself.
8056 res->m_rhi = nullptr;
8057 }
8058 }
8059}
8060
8067
8069 quint32 *bpl, quint32 *byteSize,
8070 QSize *blockDim) const
8071{
8072 int xdim = 4;
8073 int ydim = 4;
8074 quint32 blockSize = 0;
8075
8076 switch (format) {
8077 case QRhiTexture::BC1:
8078 blockSize = 8;
8079 break;
8080 case QRhiTexture::BC2:
8081 blockSize = 16;
8082 break;
8083 case QRhiTexture::BC3:
8084 blockSize = 16;
8085 break;
8086 case QRhiTexture::BC4:
8087 blockSize = 8;
8088 break;
8089 case QRhiTexture::BC5:
8090 blockSize = 16;
8091 break;
8092 case QRhiTexture::BC6H:
8093 blockSize = 16;
8094 break;
8095 case QRhiTexture::BC7:
8096 blockSize = 16;
8097 break;
8098
8100 blockSize = 8;
8101 break;
8103 blockSize = 8;
8104 break;
8106 blockSize = 16;
8107 break;
8108
8110 blockSize = 16;
8111 break;
8113 blockSize = 16;
8114 xdim = 5;
8115 break;
8117 blockSize = 16;
8118 xdim = ydim = 5;
8119 break;
8121 blockSize = 16;
8122 xdim = 6;
8123 ydim = 5;
8124 break;
8126 blockSize = 16;
8127 xdim = ydim = 6;
8128 break;
8130 blockSize = 16;
8131 xdim = 8;
8132 ydim = 5;
8133 break;
8135 blockSize = 16;
8136 xdim = 8;
8137 ydim = 6;
8138 break;
8140 blockSize = 16;
8141 xdim = ydim = 8;
8142 break;
8144 blockSize = 16;
8145 xdim = 10;
8146 ydim = 5;
8147 break;
8149 blockSize = 16;
8150 xdim = 10;
8151 ydim = 6;
8152 break;
8154 blockSize = 16;
8155 xdim = 10;
8156 ydim = 8;
8157 break;
8159 blockSize = 16;
8160 xdim = ydim = 10;
8161 break;
8163 blockSize = 16;
8164 xdim = 12;
8165 ydim = 10;
8166 break;
8168 blockSize = 16;
8169 xdim = ydim = 12;
8170 break;
8171
8172 default:
8173 Q_UNREACHABLE();
8174 break;
8175 }
8176
8177 const quint32 wblocks = uint((size.width() + xdim - 1) / xdim);
8178 const quint32 hblocks = uint((size.height() + ydim - 1) / ydim);
8179
8180 if (bpl)
8181 *bpl = wblocks * blockSize;
8182 if (byteSize)
8183 *byteSize = wblocks * hblocks * blockSize;
8184 if (blockDim)
8185 *blockDim = QSize(xdim, ydim);
8186}
8187
8189 quint32 *bpl, quint32 *byteSize, quint32 *bytesPerPixel) const
8190{
8192 compressedFormatInfo(format, size, bpl, byteSize, nullptr);
8193 return;
8194 }
8195
8196 quint32 bpc = 0;
8197 switch (format) {
8198 case QRhiTexture::RGBA8:
8199 bpc = 4;
8200 break;
8201 case QRhiTexture::BGRA8:
8202 bpc = 4;
8203 break;
8204 case QRhiTexture::R8:
8205 bpc = 1;
8206 break;
8207 case QRhiTexture::RG8:
8208 bpc = 2;
8209 break;
8210 case QRhiTexture::R16:
8211 bpc = 2;
8212 break;
8213 case QRhiTexture::RG16:
8214 bpc = 4;
8215 break;
8217 bpc = 1;
8218 break;
8219
8221 bpc = 8;
8222 break;
8224 bpc = 16;
8225 break;
8226 case QRhiTexture::R16F:
8227 bpc = 2;
8228 break;
8229 case QRhiTexture::R32F:
8230 bpc = 4;
8231 break;
8232
8234 bpc = 4;
8235 break;
8236
8237 case QRhiTexture::D16:
8238 bpc = 2;
8239 break;
8240 case QRhiTexture::D24:
8241 case QRhiTexture::D24S8:
8242 case QRhiTexture::D32F:
8243 bpc = 4;
8244 break;
8245
8247 bpc = 8;
8248 break;
8249
8250 default:
8251 Q_UNREACHABLE();
8252 break;
8253 }
8254
8255 if (bpl)
8256 *bpl = uint(size.width()) * bpc;
8257 if (byteSize)
8258 *byteSize = uint(size.width() * size.height()) * bpc;
8259 if (bytesPerPixel)
8260 *bytesPerPixel = bpc;
8261}
8262
8264{
8265 switch (format) {
8266 case QRhiTexture::D24S8:
8268 return true;
8269 default:
8270 break;
8271 }
8272 return false;
8273}
8274
8276{
8277 if (ps->cbeginShaderStages() == ps->cendShaderStages()) {
8278 qWarning("Cannot build a graphics pipeline without any stages");
8279 return false;
8280 }
8281
8282 bool hasVertexStage = false;
8283 for (auto it = ps->cbeginShaderStages(), itEnd = ps->cendShaderStages(); it != itEnd; ++it) {
8284 if (!it->shader().isValid()) {
8285 qWarning("Empty shader passed to graphics pipeline");
8286 return false;
8287 }
8288 if (it->type() == QRhiShaderStage::Vertex)
8289 hasVertexStage = true;
8290 }
8291 if (!hasVertexStage) {
8292 qWarning("Cannot build a graphics pipeline without a vertex stage");
8293 return false;
8294 }
8295
8296 if (!ps->renderPassDescriptor()) {
8297 qWarning("Cannot build a graphics pipeline without a QRhiRenderPassDescriptor");
8298 return false;
8299 }
8300
8301 if (!ps->shaderResourceBindings()) {
8302 qWarning("Cannot build a graphics pipeline without QRhiShaderResourceBindings");
8303 return false;
8304 }
8305
8306 return true;
8307}
8308
8310{
8311#ifndef QT_NO_DEBUG
8312 bool bindingsOk = true;
8313 const int CHECKED_BINDINGS_COUNT = 64;
8314 bool bindingSeen[CHECKED_BINDINGS_COUNT] = {};
8315 for (auto it = srb->cbeginBindings(), end = srb->cendBindings(); it != end; ++it) {
8316 const int binding = shaderResourceBindingData(*it)->binding;
8317 if (binding >= CHECKED_BINDINGS_COUNT)
8318 continue;
8319 if (binding < 0) {
8320 qWarning("Invalid binding number %d", binding);
8321 bindingsOk = false;
8322 continue;
8323 }
8324 switch (shaderResourceBindingData(*it)->type) {
8326 if (!bindingSeen[binding]) {
8327 bindingSeen[binding] = true;
8328 } else {
8329 qWarning("Uniform buffer duplicates an existing binding number %d", binding);
8330 bindingsOk = false;
8331 }
8332 break;
8334 if (!bindingSeen[binding]) {
8335 bindingSeen[binding] = true;
8336 } else {
8337 qWarning("Combined image sampler duplicates an existing binding number %d", binding);
8338 bindingsOk = false;
8339 }
8340 break;
8342 if (!bindingSeen[binding]) {
8343 bindingSeen[binding] = true;
8344 } else {
8345 qWarning("Texture duplicates an existing binding number %d", binding);
8346 bindingsOk = false;
8347 }
8348 break;
8350 if (!bindingSeen[binding]) {
8351 bindingSeen[binding] = true;
8352 } else {
8353 qWarning("Sampler duplicates an existing binding number %d", binding);
8354 bindingsOk = false;
8355 }
8356 break;
8360 if (!bindingSeen[binding]) {
8361 bindingSeen[binding] = true;
8362 } else {
8363 qWarning("Image duplicates an existing binding number %d", binding);
8364 bindingsOk = false;
8365 }
8366 break;
8370 if (!bindingSeen[binding]) {
8371 bindingSeen[binding] = true;
8372 } else {
8373 qWarning("Buffer duplicates an existing binding number %d", binding);
8374 bindingsOk = false;
8375 }
8376 break;
8377 default:
8378 qWarning("Unknown binding type %d", int(shaderResourceBindingData(*it)->type));
8379 bindingsOk = false;
8380 break;
8381 }
8382 }
8383
8384 if (!bindingsOk) {
8385 qWarning() << *srb;
8386 return false;
8387 }
8388#else
8389 Q_UNUSED(srb);
8390#endif
8391 return true;
8392}
8393
8395{
8396 // Stay compatible with QSurfaceFormat and friends where samples == 0 means the same as 1.
8397 const int s = qBound(1, sampleCount, 64);
8398 const QList<int> supported = supportedSampleCounts();
8399 int result = 1;
8400
8401 // Stay compatible with Qt 5 in that requesting an unsupported sample count
8402 // is not an error (although we still do a categorized debug print about
8403 // this), and rather a supported value, preferably a close one, not just 1,
8404 // is used instead. This is actually deviating from Qt 5 as that performs a
8405 // clamping only and does not handle cases such as when sample count 2 is
8406 // not supported but 4 is. (OpenGL handles things like that gracefully,
8407 // other APIs may not, so improve this by picking the next largest, or in
8408 // absence of that, the largest value; this with the goal to not reduce
8409 // quality by rather picking a larger-than-requested value than a smaller one)
8410
8411 for (int i = 0, ie = supported.count(); i != ie; ++i) {
8412 // assumes the 'supported' list is sorted
8413 if (supported[i] >= s) {
8414 result = supported[i];
8415 break;
8416 }
8417 }
8418
8419 if (result != s) {
8420 if (result == 1 && !supported.isEmpty())
8421 result = supported.last();
8422 qCDebug(QRHI_LOG_INFO, "Attempted to set unsupported sample count %d, using %d instead",
8423 sampleCount, result);
8424 }
8425
8426 return result;
8427}
8428
8433{
8434}
8435
8440{
8441 if (!d)
8442 return;
8443
8444 runCleanup();
8445
8446 qDeleteAll(d->pendingDeleteResources);
8447 d->pendingDeleteResources.clear();
8448
8449 d->destroy();
8450 delete d;
8451}
8452
8454{
8455 q = rhi;
8456
8457 // Play nice with QSG_INFO since that is still the most commonly used
8458 // way to get graphics info printed from Qt Quick apps, and the Quick
8459 // scenegraph is our primary user.
8460 if (qEnvironmentVariableIsSet("QSG_INFO"))
8461 const_cast<QLoggingCategory &>(QRHI_LOG_INFO()).setEnabled(QtDebugMsg, true);
8462
8464
8465 implType = impl;
8466 implThread = QThread::currentThread();
8467}
8468
8500{
8501 std::unique_ptr<QRhi> r(new QRhi);
8502
8503 switch (impl) {
8504 case Null:
8505 r->d = new QRhiNull(static_cast<QRhiNullInitParams *>(params));
8506 break;
8507 case Vulkan:
8508#if QT_CONFIG(vulkan)
8509 r->d = new QRhiVulkan(static_cast<QRhiVulkanInitParams *>(params),
8510 static_cast<QRhiVulkanNativeHandles *>(importDevice));
8511 break;
8512#else
8513 Q_UNUSED(importDevice);
8514 qWarning("This build of Qt has no Vulkan support");
8515 break;
8516#endif
8517 case OpenGLES2:
8518#ifndef QT_NO_OPENGL
8519 r->d = new QRhiGles2(static_cast<QRhiGles2InitParams *>(params),
8520 static_cast<QRhiGles2NativeHandles *>(importDevice));
8521 break;
8522#else
8523 qWarning("This build of Qt has no OpenGL support");
8524 break;
8525#endif
8526 case D3D11:
8527#ifdef Q_OS_WIN
8528 r->d = new QRhiD3D11(static_cast<QRhiD3D11InitParams *>(params),
8529 static_cast<QRhiD3D11NativeHandles *>(importDevice));
8530 break;
8531#else
8532 qWarning("This platform has no Direct3D 11 support");
8533 break;
8534#endif
8535 case Metal:
8536#if QT_CONFIG(metal)
8537 r->d = new QRhiMetal(static_cast<QRhiMetalInitParams *>(params),
8538 static_cast<QRhiMetalNativeHandles *>(importDevice));
8539 break;
8540#else
8541 qWarning("This platform has no Metal support");
8542 break;
8543#endif
8544 case D3D12:
8545#ifdef Q_OS_WIN
8546#ifdef QRHI_D3D12_AVAILABLE
8547 r->d = new QRhiD3D12(static_cast<QRhiD3D12InitParams *>(params),
8548 static_cast<QRhiD3D12NativeHandles *>(importDevice));
8549 break;
8550#else
8551 qWarning("Qt was built without Direct3D 12 support. "
8552 "This is likely due to having ancient SDK headers (such as d3d12.h) in the Qt build environment. "
8553 "Rebuild Qt with an SDK supporting D3D12 features introduced in Windows 10 version 1703, "
8554 "or use an MSVC build as those typically are built with more up-to-date SDKs.");
8555 break;
8556#endif
8557#else
8558 qWarning("This platform has no Direct3D 12 support");
8559 break;
8560#endif
8561 }
8562
8563 if (r->d) {
8564 r->d->prepareForCreate(r.get(), impl, flags);
8565 if (r->d->create(flags))
8566 return r.release();
8567 }
8568
8569 return nullptr;
8570}
8571
8586{
8587 bool ok = false;
8588
8589 // The only place currently where this makes sense is Metal, where the API
8590 // is simple enough so that a special probing function - doing nothing but
8591 // a MTLCreateSystemDefaultDevice - is reasonable. Elsewhere, just call
8592 // create() and then drop the result.
8593
8594 if (impl == Metal) {
8595#if QT_CONFIG(metal)
8596 ok = QRhiMetal::probe(static_cast<QRhiMetalInitParams *>(params));
8597#endif
8598 } else {
8599 QRhi *rhi = create(impl, params);
8600 ok = rhi != nullptr;
8601 delete rhi;
8602 }
8603 return ok;
8604}
8605
8645{
8646#if QT_CONFIG(metal)
8647 if (impl == Metal)
8649#else
8650 Q_UNUSED(impl);
8652#endif
8653 return {};
8654}
8655
8660{
8661 return d->implType;
8662}
8663
8669{
8670 switch (impl) {
8671 case QRhi::Null:
8672 return "Null";
8673 case QRhi::Vulkan:
8674 return "Vulkan";
8675 case QRhi::OpenGLES2:
8676 return "OpenGL";
8677 case QRhi::D3D11:
8678 return "D3D11";
8679 case QRhi::Metal:
8680 return "Metal";
8681 case QRhi::D3D12:
8682 return "D3D12";
8683 }
8684
8685 Q_UNREACHABLE_RETURN("Unknown");
8686}
8687
8691const char *QRhi::backendName() const
8692{
8693 return backendName(d->implType);
8694}
8695
8756#ifndef QT_NO_DEBUG_STREAM
8758{
8759 switch (type) {
8761 return "Unknown";
8763 return "Integrated";
8765 return "Discrete";
8767 return "External";
8769 return "Virtual";
8771 return "Cpu";
8772 }
8773
8774 Q_UNREACHABLE_RETURN(nullptr);
8775}
8777{
8778 QDebugStateSaver saver(dbg);
8779 dbg.nospace() << "QRhiDriverInfo(deviceName=" << info.deviceName
8780 << " deviceId=0x" << Qt::hex << info.deviceId
8781 << " vendorId=0x" << info.vendorId
8782 << " deviceType=" << deviceTypeStr(info.deviceType)
8783 << ')';
8784 return dbg;
8785}
8786#endif
8787
8793{
8794 return d->driverInfo();
8795}
8796
8801{
8802 return d->implThread;
8803}
8804
8818{
8819 d->addCleanupCallback(callback);
8820}
8821
8832void QRhi::addCleanupCallback(const void *key, const CleanupCallback &callback)
8833{
8834 d->addCleanupCallback(key, callback);
8835}
8836
8845{
8847}
8848
8858{
8859 for (const CleanupCallback &f : std::as_const(d->cleanupCallbacks))
8860 f(this);
8861
8862 d->cleanupCallbacks.clear();
8863
8864 for (auto it = d->keyedCleanupCallbacks.cbegin(), end = d->keyedCleanupCallbacks.cend(); it != end; ++it)
8865 it.value()(this);
8866
8867 d->keyedCleanupCallbacks.clear();
8868}
8869
8897QRhiResourceUpdateBatch::QRhiResourceUpdateBatch(QRhiImplementation *rhi)
8899{
8900 d->q = this;
8901 d->rhi = rhi;
8902}
8903
8908
8919{
8920 d->free();
8921}
8922
8961
8976{
8977 return d->hasOptimalCapacity();
8978}
8979
9000{
9001 if (size > 0) {
9002 const int idx = d->activeBufferOpCount++;
9003 const int opListSize = d->bufferOps.size();
9004 if (idx < opListSize)
9006 else
9008 }
9009}
9010
9020{
9021 if (size > 0) {
9022 const int idx = d->activeBufferOpCount++;
9023 if (idx < d->bufferOps.size())
9025 else
9027 }
9028}
9029
9037{
9038 if (buf->size() > 0) {
9039 const int idx = d->activeBufferOpCount++;
9040 if (idx < d->bufferOps.size())
9042 else
9044 }
9045}
9046
9079
9088{
9089 if (desc.cbeginEntries() != desc.cendEntries()) {
9090 const int idx = d->activeTextureOpCount++;
9091 if (idx < d->textureOps.size())
9093 else
9095 }
9096}
9097
9111
9125{
9126 const int idx = d->activeTextureOpCount++;
9127 if (idx < d->textureOps.size())
9129 else
9131}
9132
9202
9219{
9220 const int idx = d->activeTextureOpCount++;
9221 if (idx < d->textureOps.size())
9223 else
9225}
9226
9261{
9262 // By default we prefer spreading out the utilization of the 64 batches as
9263 // much as possible, meaning we won't pick the first one even if it's free,
9264 // but prefer picking one after the last picked one. Relevant due to how
9265 // QVLA and QRhiBufferData allocations behind the bufferOps are reused; in
9266 // typical Qt Quick scenes this leads to a form of (eventually) seeding all
9267 // the 64 resource batches with buffer operation data allocations which are
9268 // then reused in subsequent frames. This comes at the expense of using
9269 // more memory, but has proven good results when (CPU) profiling typical
9270 // Quick/Quick3D apps.
9271 //
9272 // Prefering memory over performance means that we always pick the first
9273 // free batch, and triggering the aggressive deallocating of all backing
9274 // memory (see trimOpLists) before returning it.
9275 static const bool preferMemoryOverPerformance = qEnvironmentVariableIntValue("QT_RHI_MINIMIZE_POOLS");
9276
9277 auto nextFreeBatch = [this]() -> QRhiResourceUpdateBatch * {
9278 auto isFree = [this](int i) -> QRhiResourceUpdateBatch * {
9279 const quint64 mask = 1ULL << quint64(i);
9280 if (!(d->resUpdPoolMap & mask)) {
9281 d->resUpdPoolMap |= mask;
9282 QRhiResourceUpdateBatch *u = d->resUpdPool[i];
9283 QRhiResourceUpdateBatchPrivate::get(u)->poolIndex = i;
9284 if (!preferMemoryOverPerformance)
9285 d->lastResUpdIdx = i;
9286 return u;
9287 }
9288 return nullptr;
9289 };
9290 const int poolSize = d->resUpdPool.size();
9291 for (int i = d->lastResUpdIdx + 1; i < poolSize; ++i) {
9292 if (QRhiResourceUpdateBatch *u = isFree(i))
9293 return u;
9294 }
9295 for (int i = 0; i <= d->lastResUpdIdx; ++i) {
9296 if (QRhiResourceUpdateBatch *u = isFree(i))
9297 return u;
9298 }
9299 return nullptr;
9300 };
9301
9302 QRhiResourceUpdateBatch *u = nextFreeBatch();
9303 if (!u) {
9304 const int oldSize = d->resUpdPool.size();
9305 const int newSize = oldSize + qMin(4, qMax(0, 64 - oldSize));
9306 d->resUpdPool.resize(newSize);
9307 for (int i = oldSize; i < newSize; ++i)
9308 d->resUpdPool[i] = new QRhiResourceUpdateBatch(d);
9309 u = nextFreeBatch();
9310 if (!u)
9311 qWarning("Resource update batch pool exhausted (max is 64)");
9312 }
9313
9314 if (preferMemoryOverPerformance && u)
9315 u->d->trimOpLists();
9316
9317 return u;
9318}
9319
9321{
9322 Q_ASSERT(poolIndex >= 0 && rhi->resUpdPool[poolIndex] == q);
9323
9326
9327 const quint64 mask = 1ULL << quint64(poolIndex);
9328 rhi->resUpdPoolMap &= ~mask;
9329 poolIndex = -1;
9330
9331 // textureOps is cleared, to not keep the potentially large image pixel
9332 // data alive, but it is expected that the container keeps the list alloc
9333 // at least. Only trimOpList() goes for the more aggressive route with squeeze.
9334 textureOps.clear();
9335
9336 // bufferOps is not touched, to allow reusing allocations (incl. in the
9337 // elements' QRhiBufferData) as much as possible when this batch is used
9338 // again in the future, which is important for performance, in particular
9339 // with Qt Quick.
9340}
9341
9343{
9344 int combinedSize = activeBufferOpCount + other->activeBufferOpCount;
9345 if (bufferOps.size() < combinedSize)
9346 bufferOps.resize(combinedSize);
9347 for (int i = activeBufferOpCount; i < combinedSize; ++i)
9348 bufferOps[i] = std::move(other->bufferOps[i - activeBufferOpCount]);
9349 activeBufferOpCount += other->activeBufferOpCount;
9350
9351 combinedSize = activeTextureOpCount + other->activeTextureOpCount;
9352 if (textureOps.size() < combinedSize)
9353 textureOps.resize(combinedSize);
9354 for (int i = activeTextureOpCount; i < combinedSize; ++i)
9355 textureOps[i] = std::move(other->textureOps[i - activeTextureOpCount]);
9356 activeTextureOpCount += other->activeTextureOpCount;
9357}
9358
9364
9366{
9367 // Unlike free(), this is expected to aggressively deallocate all memory
9368 // used by both the buffer and texture operation lists. (i.e. using
9369 // squeeze() to only keep the stack prealloc of the QVLAs)
9370 //
9371 // This (e.g. just the destruction of bufferOps elements) may have a
9372 // non-negligible performance impact e.g. with Qt Quick with scenes where
9373 // there are lots of buffer operations per frame.
9374
9376 bufferOps.clear();
9377 bufferOps.squeeze();
9378
9380 textureOps.clear();
9381 textureOps.squeeze();
9382}
9383
9393{
9394 if (resourceUpdates)
9395 m_rhi->resourceUpdate(this, resourceUpdates);
9396}
9397
9452 const QColor &colorClearValue,
9453 const QRhiDepthStencilClearValue &depthStencilClearValue,
9454 QRhiResourceUpdateBatch *resourceUpdates,
9455 BeginPassFlags flags)
9456{
9457 m_rhi->beginPass(this, rt, colorClearValue, depthStencilClearValue, resourceUpdates, flags);
9458}
9459
9469{
9470 m_rhi->endPass(this, resourceUpdates);
9471}
9472
9489{
9490 Q_ASSERT(ps != nullptr);
9491 m_rhi->setGraphicsPipeline(this, ps);
9492}
9493
9547 int dynamicOffsetCount,
9548 const DynamicOffset *dynamicOffsets)
9549{
9550 m_rhi->setShaderResources(this, srb, dynamicOffsetCount, dynamicOffsets);
9551}
9552
9608void QRhiCommandBuffer::setVertexInput(int startBinding, int bindingCount, const VertexInput *bindings,
9609 QRhiBuffer *indexBuf, quint32 indexOffset,
9610 IndexFormat indexFormat)
9611{
9612 m_rhi->setVertexInput(this, startBinding, bindingCount, bindings, indexBuf, indexOffset, indexFormat);
9613}
9614
9633
9649{
9650 m_rhi->setScissor(this, scissor);
9651}
9652
9666
9677{
9678 m_rhi->setStencilRef(this, refValue);
9679}
9680
9698 quint32 firstVertex,
9699 quint32 firstInstance)
9700{
9701 m_rhi->draw(this, vertexCount, instanceCount, firstVertex, firstInstance);
9702}
9703
9735 quint32 firstIndex,
9736 qint32 vertexOffset,
9737 quint32 firstInstance)
9738{
9739 m_rhi->drawIndexed(this, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
9740}
9741
9758
9771
9783{
9784 m_rhi->debugMarkMsg(this, msg);
9785}
9786
9807{
9808 m_rhi->beginComputePass(this, resourceUpdates, flags);
9809}
9810
9818{
9819 m_rhi->endComputePass(this, resourceUpdates);
9820}
9821
9839
9860{
9861 m_rhi->dispatch(this, x, y, z);
9862}
9863
9877
9921
9933{
9934 m_rhi->endExternal(this);
9935}
9936
9999{
10000 return m_rhi->lastCompletedGpuTime(this);
10001}
10002
10007int QRhi::ubufAligned(int v) const
10008{
10009 const int byteAlign = ubufAlignment();
10010 return (v + byteAlign - 1) & ~(byteAlign - 1);
10011}
10012
10017{
10018 return qFloor(std::log2(qMax(size.width(), size.height()))) + 1;
10019}
10020
10025QSize QRhi::sizeForMipLevel(int mipLevel, const QSize &baseLevelSize)
10026{
10027 const int w = qMax(1, baseLevelSize.width() >> mipLevel);
10028 const int h = qMax(1, baseLevelSize.height() >> mipLevel);
10029 return QSize(w, h);
10030}
10031
10039{
10040 return d->isYUpInFramebuffer();
10041}
10042
10053{
10054 return d->isYUpInNDC();
10055}
10056
10078{
10079 return d->isClipDepthZeroToOne();
10080}
10081
10100{
10101 return d->clipSpaceCorrMatrix();
10102}
10103
10111{
10113}
10114
10119{
10120 return d->isFeatureSupported(feature);
10121}
10122
10130{
10131 return d->resourceLimit(limit);
10132}
10133
10146{
10147 return d->nativeHandles();
10148}
10149
10170
10184{
10186
10187 for (QRhiResourceUpdateBatch *u : d->resUpdPool) {
10188 if (u->d->poolIndex < 0)
10189 u->d->trimOpLists();
10190 }
10191}
10192
10236{
10237 return d->isDeviceLost();
10238}
10239
10280{
10281 return d->pipelineCacheData();
10282}
10283
10337
10404#ifndef QT_NO_DEBUG_STREAM
10406{
10407 QDebugStateSaver saver(dbg);
10408 dbg.nospace() << "QRhiStats("
10409 << "totalPipelineCreationTime=" << info.totalPipelineCreationTime
10410 << " blockCount=" << info.blockCount
10411 << " allocCount=" << info.allocCount
10412 << " usedBytes=" << info.usedBytes
10413 << " unusedBytes=" << info.unusedBytes
10414 << " totalUsageBytes=" << info.totalUsageBytes
10415 << ')';
10416 return dbg;
10417}
10418#endif
10419
10465{
10466 return d->statistics();
10467}
10468
10478
10491
10501
10517 QRhiBuffer::UsageFlags usage,
10518 quint32 size)
10519{
10520 return d->createBuffer(type, usage, size);
10521}
10522
10544 const QSize &pixelSize,
10545 int sampleCount,
10546 QRhiRenderBuffer::Flags flags,
10547 QRhiTexture::Format backingFormatHint)
10548{
10549 return d->createRenderBuffer(type, pixelSize, sampleCount, flags, backingFormatHint);
10550}
10551
10571 const QSize &pixelSize,
10572 int sampleCount,
10573 QRhiTexture::Flags flags)
10574{
10575 if (pixelSize.height() == 0)
10577
10578 return d->createTexture(format, pixelSize, 1, 0, sampleCount, flags);
10579}
10580
10604 int width, int height, int depth,
10605 int sampleCount,
10606 QRhiTexture::Flags flags)
10607{
10608 if (depth > 0)
10610
10611 if (height == 0 && depth == 0)
10613
10614 return d->createTexture(format, QSize(width, height), depth, 0, sampleCount, flags);
10615}
10616
10645 int arraySize,
10646 const QSize &pixelSize,
10647 int sampleCount,
10648 QRhiTexture::Flags flags)
10649{
10651
10652 if (pixelSize.height() == 0)
10654
10655 return d->createTexture(format, pixelSize, 1, arraySize, sampleCount, flags);
10656}
10657
10674 QRhiSampler::Filter minFilter,
10675 QRhiSampler::Filter mipmapMode,
10676 QRhiSampler::AddressMode addressU,
10677 QRhiSampler::AddressMode addressV,
10678 QRhiSampler::AddressMode addressW)
10679{
10680 return d->createSampler(magFilter, minFilter, mipmapMode, addressU, addressV, addressW);
10681}
10682
10691 QRhiTextureRenderTarget::Flags flags)
10692{
10693 return d->createTextureRenderTarget(desc, flags);
10694}
10695
10702{
10703 return d->createSwapChain();
10704}
10705
10754{
10755 if (d->inFrame)
10756 qWarning("Attempted to call beginFrame() within a still active frame; ignored");
10757
10759 if (r == FrameOpSuccess)
10760 d->inFrame = true;
10761
10762 return r;
10763}
10764
10789{
10790 if (!d->inFrame)
10791 qWarning("Attempted to call endFrame() without an active frame; ignored");
10792
10793 QRhi::FrameOpResult r = d->inFrame ? d->endFrame(swapChain, flags) : FrameOpSuccess;
10794 d->inFrame = false;
10795 // deleteLater is a high level QRhi concept the backends know
10796 // nothing about - handle it here.
10797 qDeleteAll(d->pendingDeleteResources);
10798 d->pendingDeleteResources.clear();
10799
10800 return r;
10801}
10802
10811{
10812 return d->inFrame;
10813}
10814
10855{
10856 return d->currentFrameSlot;
10857}
10858
10902{
10903 if (d->inFrame)
10904 qWarning("Attempted to call beginOffscreenFrame() within a still active frame; ignored");
10905
10907 if (r == FrameOpSuccess)
10908 d->inFrame = true;
10909
10910 return r;
10911}
10912
10921{
10922 if (!d->inFrame)
10923 qWarning("Attempted to call endOffscreenFrame() without an active frame; ignored");
10924
10926 d->inFrame = false;
10927 qDeleteAll(d->pendingDeleteResources);
10928 d->pendingDeleteResources.clear();
10929
10930 return r;
10931}
10932
10945{
10946 return d->finish();
10947}
10948
10962{
10963 return d->supportedSampleCounts();
10964}
10965
10977{
10978 return d->ubufAlignment();
10979}
10980
10981Q_CONSTINIT static QBasicAtomicInteger<QRhiGlobalObjectIdGenerator::Type> counter = Q_BASIC_ATOMIC_INITIALIZER(0);
10982
10984{
10985 return counter.fetchAndAddRelaxed(1) + 1;
10986}
10987
10989{
10990 return m_buffers.isEmpty() && m_textures.isEmpty();
10991}
10992
10994{
10995 m_buffers.clear();
10996 m_textures.clear();
10997}
10998
11004
11006 const UsageState &state)
11007{
11008 auto it = m_buffers.find(buf);
11009 if (it != m_buffers.end()) {
11010 if (it->access != *access) {
11011 const QByteArray name = buf->name();
11012 qWarning("Buffer %p (%s) used with different accesses within the same pass, this is not allowed.",
11013 buf, name.constData());
11014 return;
11015 }
11016 if (it->stage != *stage) {
11017 it->stage = earlierStage(it->stage, *stage);
11018 *stage = it->stage;
11019 }
11020 return;
11021 }
11022
11023 Buffer b;
11024 b.slot = slot;
11025 b.access = *access;
11026 b.stage = *stage;
11027 b.stateAtPassBegin = state; // first use -> initial state
11028 m_buffers.insert(buf, b);
11029}
11030
11036
11043
11045 const UsageState &state)
11046{
11047 auto it = m_textures.find(tex);
11048 if (it != m_textures.end()) {
11049 if (it->access != *access) {
11050 // Different subresources of a texture may be used for both load
11051 // and store in the same pass. (think reading from one mip level
11052 // and writing to another one in a compute shader) This we can
11053 // handle by treating the entire resource as read-write.
11054 if (isImageLoadStore(it->access) && isImageLoadStore(*access)) {
11056 *access = it->access;
11057 } else {
11058 const QByteArray name = tex->name();
11059 qWarning("Texture %p (%s) used with different accesses within the same pass, this is not allowed.",
11060 tex, name.constData());
11061 }
11062 }
11063 if (it->stage != *stage) {
11064 it->stage = earlierStage(it->stage, *stage);
11065 *stage = it->stage;
11066 }
11067 return;
11068 }
11069
11070 Texture t;
11071 t.access = *access;
11072 t.stage = *stage;
11073 t.stateAtPassBegin = state; // first use -> initial state
11074 m_textures.insert(tex, t);
11075}
11076
11095
11114
NSData * m_data
\inmodule QtCore
Definition qbytearray.h:57
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
\inmodule QtCore
const_iterator cbegin() const noexcept
Definition qhash.h:1215
qsizetype size() const noexcept
Returns the number of items in the hash.
Definition qhash.h:928
const_iterator cend() const noexcept
Definition qhash.h:1219
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:952
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
Definition qhash.h:929
\inmodule QtGui
Definition qimage.h:37
\inmodule QtCore
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtGui
Definition qrhi.h:846
virtual char * beginFullDynamicBufferUpdateForCurrentFrame()
Definition qrhi.cpp:3970
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:3838
Type
Specifies storage type of buffer resource.
Definition qrhi.h:848
QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, quint32 size_)
\variable QRhiBuffer::NativeBuffer::objects
Definition qrhi.cpp:3829
virtual void endFullDynamicBufferUpdateForCurrentFrame()
To be called when the entire contents of the buffer data has been updated in the memory block returne...
Definition qrhi.cpp:3980
virtual NativeBuffer nativeBuffer()
Definition qrhi.cpp:3931
\inmodule QtGui
Definition qrhi.h:576
QRhiColorAttachment()=default
Constructs an empty color attachment description.
\inmodule QtGui
Definition qrhi.h:1652
void endPass(QRhiResourceUpdateBatch *resourceUpdates=nullptr)
Records ending the current render pass.
Definition qrhi.cpp:9468
void debugMarkMsg(const QByteArray &msg)
Inserts a debug message msg into the command stream.
Definition qrhi.cpp:9782
void draw(quint32 vertexCount, quint32 instanceCount=1, quint32 firstVertex=0, quint32 firstInstance=0)
Records a non-indexed draw.
Definition qrhi.cpp:9696
void setBlendConstants(const QColor &c)
Records setting the active blend constants to c.
Definition qrhi.cpp:9662
void endExternal()
To be called once the externally added commands are recorded to the command buffer or context.
Definition qrhi.cpp:9932
void setScissor(const QRhiScissor &scissor)
Records setting the active scissor rectangle specified in scissor.
Definition qrhi.cpp:9648
void beginComputePass(QRhiResourceUpdateBatch *resourceUpdates=nullptr, BeginPassFlags flags={})
Records starting a new compute pass.
Definition qrhi.cpp:9806
void drawIndexed(quint32 indexCount, quint32 instanceCount=1, quint32 firstIndex=0, qint32 vertexOffset=0, quint32 firstInstance=0)
Records an indexed draw.
Definition qrhi.cpp:9733
void setStencilRef(quint32 refValue)
Records setting the active stencil reference value to refValue.
Definition qrhi.cpp:9676
const QRhiNativeHandles * nativeHandles()
Definition qrhi.cpp:9873
QRhiCommandBuffer(QRhiImplementation *rhi)
Definition qrhi.cpp:7982
void resourceUpdate(QRhiResourceUpdateBatch *resourceUpdates)
Sometimes committing resource updates is necessary or just more convenient without starting a render ...
Definition qrhi.cpp:9392
void dispatch(int x, int y, int z)
Records dispatching compute work items, with x, y, and z specifying the number of local workgroups in...
Definition qrhi.cpp:9859
void beginPass(QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates=nullptr, BeginPassFlags flags={})
Records starting a new render pass targeting the render target rt.
Definition qrhi.cpp:9451
double lastCompletedGpuTime()
Definition qrhi.cpp:9998
void setShaderResources(QRhiShaderResourceBindings *srb=nullptr, int dynamicOffsetCount=0, const DynamicOffset *dynamicOffsets=nullptr)
Records binding a set of shader resources, such as, uniform buffers or textures, that are made visibl...
Definition qrhi.cpp:9546
QPair< int, quint32 > DynamicOffset
Synonym for QPair<int, quint32>.
Definition qrhi.h:1677
void beginExternal()
To be called when the application before the application is about to enqueue commands to the current ...
Definition qrhi.cpp:9917
void debugMarkBegin(const QByteArray &name)
Records a named debug group on the command buffer with the specified name.
Definition qrhi.cpp:9754
void setViewport(const QRhiViewport &viewport)
Records setting the active viewport rectangle specified in viewport.
Definition qrhi.cpp:9629
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:7990
void debugMarkEnd()
Records the end of a debug group.
Definition qrhi.cpp:9767
QPair< QRhiBuffer *, quint32 > VertexInput
Synonym for QPair<QRhiBuffer *, quint32>.
Definition qrhi.h:1681
void endComputePass(QRhiResourceUpdateBatch *resourceUpdates=nullptr)
Records ending the current compute pass.
Definition qrhi.cpp:9817
IndexFormat
Specifies the index data type.
Definition qrhi.h:1654
void setComputePipeline(QRhiComputePipeline *ps)
Records setting a new compute pipeline ps.
Definition qrhi.cpp:9835
void setVertexInput(int startBinding, int bindingCount, const VertexInput *bindings, QRhiBuffer *indexBuf=nullptr, quint32 indexOffset=0, IndexFormat indexFormat=IndexUInt16)
Records vertex input bindings.
Definition qrhi.cpp:9608
void setGraphicsPipeline(QRhiGraphicsPipeline *ps)
Records setting a new graphics pipeline ps.
Definition qrhi.cpp:9488
\inmodule QtGui
Definition qrhi.h:1623
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:7868
QRhiComputePipeline(QRhiImplementation *rhi)
Definition qrhi.cpp:7876
\inmodule QtGui
\variable QRhiD3D11InitParams::enableDebugLayer
\inmodule QtGui
Definition qrhi.h:44
\inmodule QtGui
\variable QRhiGles2InitParams::format
\inmodule QtGui
Definition qrhi.h:1271
const QRhiShaderStage * cendShaderStages() const
Definition qrhi.h:1455
QRhiShaderResourceBindings * shaderResourceBindings() const
Definition qrhi.h:1462
QRhiRenderPassDescriptor * renderPassDescriptor() const
Definition qrhi.h:1465
QRhiGraphicsPipeline(QRhiImplementation *rhi)
\variable QRhiGraphicsPipeline::StencilOpState::failOp
Definition qrhi.cpp:6707
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:6715
const QRhiShaderStage * cbeginShaderStages() const
Definition qrhi.h:1454
virtual bool isClipDepthZeroToOne() const =0
bool isStencilSupportingFormat(QRhiTexture::Format format) const
Definition qrhi.cpp:8263
virtual void endExternal(QRhiCommandBuffer *cb)=0
virtual QRhiTextureRenderTarget * createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags)=0
virtual QRhiComputePipeline * createComputePipeline()=0
virtual QRhiGraphicsPipeline * createGraphicsPipeline()=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
void removeCleanupCallback(const void *key)
Definition qrhi_p.h:187
virtual void releaseCachedResources()=0
int effectiveSampleCount(int sampleCount) const
Definition qrhi.cpp:8394
virtual ~QRhiImplementation()
Definition qrhi.cpp:8027
virtual bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const =0
virtual QRhiDriverInfo driverInfo() const =0
bool isCompressedFormat(QRhiTexture::Format format) const
Definition qrhi.cpp:8061
static const QRhiShaderResourceBinding::Data * shaderResourceBindingData(const QRhiShaderResourceBinding &binding)
Definition qrhi_p.h:220
void updateLayoutDesc(QRhiShaderResourceBindings *srb)
Definition qrhi.cpp:5387
virtual QRhiSampler * createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w)=0
virtual QRhiTexture * createTexture(QRhiTexture::Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, QRhiTexture::Flags flags)=0
virtual bool isYUpInFramebuffer() const =0
virtual QList< int > supportedSampleCounts() const =0
virtual void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)=0
virtual void debugMarkEnd(QRhiCommandBuffer *cb)=0
virtual QRhi::FrameOpResult finish()=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
Definition qrhi.cpp:8068
virtual QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags)=0
virtual void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)=0
bool sanityCheckShaderResourceBindings(QRhiShaderResourceBindings *srb)
Definition qrhi.cpp:8309
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 QRhiBuffer * createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size)=0
void prepareForCreate(QRhi *rhi, QRhi::Implementation impl, QRhi::Flags flags)
Definition qrhi.cpp:8453
virtual bool isDeviceLost() const =0
virtual const QRhiNativeHandles * nativeHandles(QRhiCommandBuffer *cb)=0
virtual void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport)=0
virtual void beginExternal(QRhiCommandBuffer *cb)=0
virtual QMatrix4x4 clipSpaceCorrMatrix() const =0
quint32 byteSizePerVertexForVertexInputFormat(QRhiVertexInputAttribute::Format format) const
Definition qrhi.cpp:1888
virtual void dispatch(QRhiCommandBuffer *cb, int x, int y, int z)=0
virtual bool makeThreadLocalNativeContextCurrent()=0
void addDeleteLater(QRhiResource *res)
Definition qrhi_p.h:169
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)
Definition qrhi.cpp:8275
virtual void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg)=0
QRhiVertexInputAttribute::Format shaderDescVariableFormatToVertexInputFormat(QShaderDescription::VariableType type) const
Definition qrhi.cpp:1844
virtual double lastCompletedGpuTime(QRhiCommandBuffer *cb)=0
virtual QRhiRenderBuffer * createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint)=0
void addCleanupCallback(const QRhi::CleanupCallback &callback)
Definition qrhi_p.h:177
virtual bool isYUpInNDC() const =0
virtual void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance)=0
virtual QRhiShaderResourceBindings * createShaderResourceBindings()=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
Definition qrhi.cpp:8188
virtual void draw(QRhiCommandBuffer *cb, quint32 vertexCount, quint32 instanceCount, quint32 firstVertex, quint32 firstInstance)=0
virtual void destroy()=0
virtual QByteArray pipelineCacheData()=0
virtual QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags)=0
virtual QRhiStats statistics()=0
virtual void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor)=0
virtual QRhiSwapChain * createSwapChain()=0
\inmodule QtRhi
\inmodule QtRhi
static QRhiSwapChainProxyData updateSwapChainProxyData(QWindow *window)
static bool probe(QRhiMetalInitParams *params)
Definition qrhimetal.mm:499
static TextureStage toPassTrackerTextureStage(QRhiShaderResourceBinding::StageFlags stages)
Definition qrhi.cpp:11096
static BufferStage toPassTrackerBufferStage(QRhiShaderResourceBinding::StageFlags stages)
Definition qrhi.cpp:11077
bool isEmpty() const
Definition qrhi.cpp:10988
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
Definition qrhi.cpp:11005
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
Definition qrhi.cpp:11044
\inmodule QtGui
Definition qrhi.h:777
QRhiReadbackDescription()=default
Constructs an empty texture readback description.
\inmodule QtGui
Definition qrhi.h:1095
QRhiRenderBuffer(QRhiImplementation *rhi, Type type_, const QSize &pixelSize_, int sampleCount_, Flags flags_, QRhiTexture::Format backingFormatHint_)
Definition qrhi.cpp:4059
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:4071
Type
Specifies the type of the renderbuffer.
Definition qrhi.h:1097
virtual bool createFrom(NativeRenderBuffer src)
Similar to create() except that no new native renderbuffer objects are created.
Definition qrhi.cpp:4119
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:4869
virtual const QRhiNativeHandles * nativeHandles()
Definition qrhi.cpp:4955
QRhiRenderPassDescriptor(QRhiImplementation *rhi)
Definition qrhi.cpp:4861
\inmodule QtGui
Definition qrhi.h:1159
QRhiRenderTarget(QRhiImplementation *rhi)
Definition qrhi.cpp:4982
QVarLengthArray< BufferOp, BUFFER_OPS_STATIC_ALLOC > bufferOps
Definition qrhi_p.h:521
bool hasOptimalCapacity() const
Definition qrhi.cpp:9359
QRhiImplementation * rhi
Definition qrhi_p.h:528
QVarLengthArray< TextureOp, TEXTURE_OPS_STATIC_ALLOC > textureOps
Definition qrhi_p.h:525
static const int BUFFER_OPS_STATIC_ALLOC
Definition qrhi_p.h:520
static QRhiResourceUpdateBatchPrivate * get(QRhiResourceUpdateBatch *b)
Definition qrhi_p.h:536
void merge(QRhiResourceUpdateBatchPrivate *other)
Definition qrhi.cpp:9342
static const int TEXTURE_OPS_STATIC_ALLOC
Definition qrhi_p.h:524
\inmodule QtGui
Definition qrhi.h:1732
void merge(QRhiResourceUpdateBatch *other)
Copies all queued operations from the other batch into this one.
Definition qrhi.cpp:8957
void generateMips(QRhiTexture *tex)
Enqueues a mipmap generation operation for the specified texture tex.
Definition qrhi.cpp:9218
void updateDynamicBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Enqueues updating a region of a QRhiBuffer buf created with the type QRhiBuffer::Dynamic.
Definition qrhi.cpp:8999
void uploadStaticBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Enqueues updating a region of a QRhiBuffer buf created with the type QRhiBuffer::Immutable or QRhiBuf...
Definition qrhi.cpp:9019
void uploadTexture(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
Enqueues uploading the image data for one or more mip levels in one or more layers of the texture tex...
Definition qrhi.cpp:9087
void readBackTexture(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
Enqueues a texture-to-host copy operation as described by rb.
Definition qrhi.cpp:9194
void readBackBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result)
Enqueues reading back a region of the QRhiBuffer buf.
Definition qrhi.cpp:9071
void copyTexture(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc=QRhiTextureCopyDescription())
Enqueues a texture-to-texture copy operation from src into dst as described by desc.
Definition qrhi.cpp:9124
bool hasOptimalCapacity() const
Definition qrhi.cpp:8975
\inmodule QtGui
Definition qrhi.h:804
QRhiResource(QRhiImplementation *rhi)
Definition qrhi.cpp:3464
QByteArray m_objectName
Definition qrhi.h:842
Type
Specifies type of the resource.
Definition qrhi.h:806
@ RenderBuffer
Definition qrhi.h:810
@ RenderPassDescriptor
Definition qrhi.h:811
@ SwapChain
Definition qrhi.h:816
@ ComputePipeline
Definition qrhi.h:817
@ SwapChainRenderTarget
Definition qrhi.h:812
@ GraphicsPipeline
Definition qrhi.h:815
@ CommandBuffer
Definition qrhi.h:818
@ TextureRenderTarget
Definition qrhi.h:813
@ ShaderResourceBindings
Definition qrhi.h:814
virtual ~QRhiResource()
Destructor.
Definition qrhi.cpp:3481
quint64 m_id
Definition qrhi.h:841
QByteArray name() const
Definition qrhi.cpp:3556
quint64 globalResourceId() const
Definition qrhi.cpp:3592
QRhi * rhi() const
Definition qrhi.cpp:3603
void setName(const QByteArray &name)
Sets a name for the object.
Definition qrhi.cpp:3581
QRhiImplementation * m_rhi
Definition qrhi.h:840
void deleteLater()
When called without a frame being recorded, this function is equivalent to deleting the object.
Definition qrhi.cpp:3545
\inmodule QtGui
Definition qrhi.h:1031
Filter
Specifies the minification, magnification, or mipmap filtering.
Definition qrhi.h:1033
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:4765
AddressMode
Specifies the addressing mode.
Definition qrhi.h:1039
QRhiSampler(QRhiImplementation *rhi, Filter magFilter_, Filter minFilter_, Filter mipmapMode_, AddressMode u_, AddressMode v_, AddressMode w_)
Definition qrhi.cpp:4752
\inmodule QtGui
Definition qrhi.h:138
QRhiScissor()=default
Constructs an empty scissor.
\inmodule QtGui
Definition qrhi.h:439
static QRhiShaderResourceBinding bufferStore(int binding, StageFlags stage, QRhiBuffer *buf)
Definition qrhi.cpp:6019
static QRhiShaderResourceBinding imageLoadStore(int binding, StageFlags stage, QRhiTexture *tex, int level)
Definition qrhi.cpp:5916
bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept
Definition qrhi.cpp:6228
size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) noexcept
Definition qrhi.cpp:6238
bool isLayoutCompatible(const QRhiShaderResourceBinding &other) const
Definition qrhi.cpp:5503
static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf)
Definition qrhi.cpp:5949
static QRhiShaderResourceBinding sampledTexture(int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler)
Definition qrhi.cpp:5643
static QRhiShaderResourceBinding imageLoad(int binding, StageFlags stage, QRhiTexture *tex, int level)
Definition qrhi.cpp:5846
static QRhiShaderResourceBinding sampler(int binding, StageFlags stage, QRhiSampler *sampler)
Definition qrhi.cpp:5812
static QRhiShaderResourceBinding texture(int binding, StageFlags stage, QRhiTexture *tex)
Definition qrhi.cpp:5736
bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept
Definition qrhi.cpp:6148
static QRhiShaderResourceBinding textures(int binding, StageFlags stage, int count, QRhiTexture **tex)
Definition qrhi.cpp:5767
static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf)
Definition qrhi.cpp:6089
static QRhiShaderResourceBinding imageStore(int binding, StageFlags stage, QRhiTexture *tex, int level)
Definition qrhi.cpp:5881
static constexpr int LAYOUT_DESC_ENTRIES_PER_BINDING
Definition qrhi.h:546
static QRhiShaderResourceBinding sampledTextures(int binding, StageFlags stage, int count, const TextureAndSampler *texSamplers)
Definition qrhi.cpp:5689
static QRhiShaderResourceBinding uniformBufferWithDynamicOffset(int binding, StageFlags stage, QRhiBuffer *buf, quint32 size)
Definition qrhi.cpp:5603
static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf)
Definition qrhi.cpp:5529
\inmodule QtGui
Definition qrhi.h:1215
bool isLayoutCompatible(const QRhiShaderResourceBindings *other) const
Definition qrhi.cpp:5351
QVarLengthArray< QRhiShaderResourceBinding, BINDING_PREALLOC > m_bindings
Definition qrhi.h:1247
QRhiShaderResourceBindings(QRhiImplementation *rhi)
Definition qrhi.cpp:5316
const QRhiShaderResourceBinding * cbeginBindings() const
Definition qrhi.h:1226
static constexpr int BINDING_PREALLOC
Definition qrhi.h:1245
QVector< quint32 > m_layoutDesc
Definition qrhi.h:1252
const QRhiShaderResourceBinding * cendBindings() const
Definition qrhi.h:1227
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:5325
\inmodule QtGui
Definition qrhi.h:379
QRhiShaderStage()=default
Constructs a shader stage description for the vertex stage with an empty QShader.
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:5061
QRhiSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain_)
Definition qrhi.cpp:5036
\inmodule QtGui
Definition qrhi.h:1550
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:7324
virtual QRhiRenderTarget * currentFrameRenderTarget()=0
QRhiSwapChain(QRhiImplementation *rhi)
Definition qrhi.cpp:7316
StereoTargetBuffer
Selects the backbuffer to use with a stereoscopic swapchain.
Definition qrhi.h:1569
virtual QRhiSwapChainHdrInfo hdrInfo()
\variable QRhiSwapChainHdrInfo::limitsType
Definition qrhi.cpp:7800
\inmodule QtGui
Definition qrhi.h:739
QRhiTextureRenderTargetDescription()=default
Constructs an empty texture render target description.
\inmodule QtGui
Definition qrhi.h:1185
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:5161
QRhiTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc_, Flags flags_)
Definition qrhi.cpp:5149
QRhiTextureSubresourceUploadDescription()=default
Constructs an empty subresource description.
\inmodule QtGui
Definition qrhi.h:716
QRhiTextureUploadDescription()=default
Constructs an empty texture upload description.
\inmodule QtGui
Definition qrhi.h:693
QRhiTextureUploadEntry()=default
Constructs an empty QRhiTextureUploadEntry targeting layer 0 and level 0.
\inmodule QtGui
Definition qrhi.h:895
QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_, int depth_, int arraySize_, int sampleCount_, Flags flags_)
\variable QRhiTexture::NativeTexture::object
Definition qrhi.cpp:4423
@ ThreeDimensional
Definition qrhi.h:907
@ OneDimensional
Definition qrhi.h:910
@ TextureArray
Definition qrhi.h:909
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:4434
Format
Specifies the texture format.
Definition qrhi.h:914
@ ASTC_10x8
Definition qrhi.h:960
@ ASTC_12x12
Definition qrhi.h:963
@ ASTC_8x5
Definition qrhi.h:955
@ ASTC_10x5
Definition qrhi.h:958
@ RGBA32F
Definition qrhi.h:926
@ ETC2_RGBA8
Definition qrhi.h:948
@ ASTC_5x5
Definition qrhi.h:952
@ ASTC_4x4
Definition qrhi.h:950
@ ASTC_6x6
Definition qrhi.h:954
@ ASTC_12x10
Definition qrhi.h:962
@ ETC2_RGB8
Definition qrhi.h:946
@ ASTC_5x4
Definition qrhi.h:951
@ RED_OR_ALPHA8
Definition qrhi.h:923
@ ASTC_6x5
Definition qrhi.h:953
@ ASTC_8x8
Definition qrhi.h:957
@ RGBA16F
Definition qrhi.h:925
@ RGB10A2
Definition qrhi.h:930
@ ASTC_10x6
Definition qrhi.h:959
@ ASTC_10x10
Definition qrhi.h:961
@ ETC2_RGB8A1
Definition qrhi.h:947
@ ASTC_8x6
Definition qrhi.h:956
virtual void setNativeLayout(int layout)
With some graphics APIs, such as Vulkan, integrating custom rendering code that uses the graphics API...
Definition qrhi.cpp:4519
virtual bool createFrom(NativeTexture src)
Similar to create(), except that no new native textures are created.
Definition qrhi.cpp:4490
virtual NativeTexture nativeTexture()
Definition qrhi.cpp:4457
\inmodule QtGui
Definition qrhi.h:232
QRhiVertexInputAttribute()=default
Constructs a default vertex input attribute description.
Format
Specifies the type of the element data.
Definition qrhi.h:234
\inmodule QtGui
Definition qrhi.h:179
Classification
Describes the input data classification.
Definition qrhi.h:181
QRhiVertexInputBinding()=default
Constructs a default vertex input binding description.
\inmodule QtGui
Definition qrhi.h:321
\inmodule QtGui
Definition qrhi.h:85
QRhiViewport()=default
Constructs a viewport description with an empty rectangle and a depth range of 0.0f - 1....
\inmodule QtGui
\variable QRhiVulkanInitParams::inst
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1805
QRhiBuffer * newBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size)
Definition qrhi.cpp:10516
bool isClipDepthZeroToOne() const
Definition qrhi.cpp:10077
FrameOpResult endOffscreenFrame(EndFrameFlags flags={})
Ends, submits, and waits for the offscreen frame.
Definition qrhi.cpp:10920
bool makeThreadLocalNativeContextCurrent()
With OpenGL this makes the OpenGL context current on the current thread.
Definition qrhi.cpp:10166
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags={}) const
Definition qrhi.cpp:10110
int ubufAligned(int v) const
Definition qrhi.cpp:10007
QRhiStats statistics() const
Gathers and returns statistics about the timings and allocations of graphics resources.
Definition qrhi.cpp:10464
int resourceLimit(ResourceLimit limit) const
Definition qrhi.cpp:10129
QRhiTexture * newTextureArray(QRhiTexture::Format format, int arraySize, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
Definition qrhi.cpp:10644
QMatrix4x4 clipSpaceCorrMatrix() const
Definition qrhi.cpp:10099
QThread * thread() const
Definition qrhi.cpp:8800
bool isYUpInFramebuffer() const
Definition qrhi.cpp:10038
bool isYUpInNDC() const
Definition qrhi.cpp:10052
static QRhiSwapChainProxyData updateSwapChainProxyData(Implementation impl, QWindow *window)
Generates and returns a QRhiSwapChainProxyData struct containing opaque data specific to the backend ...
Definition qrhi.cpp:8644
bool isFeatureSupported(QRhi::Feature feature) const
Definition qrhi.cpp:10118
void runCleanup()
Invokes all registered cleanup functions.
Definition qrhi.cpp:8857
QRhiShaderResourceBindings * newShaderResourceBindings()
Definition qrhi.cpp:10497
QList< int > supportedSampleCounts() const
Definition qrhi.cpp:10961
QRhiRenderBuffer * newRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount=1, QRhiRenderBuffer::Flags flags={}, QRhiTexture::Format backingFormatHint=QRhiTexture::UnknownFormat)
Definition qrhi.cpp:10543
Implementation backend() const
Definition qrhi.cpp:8659
Implementation
Describes which graphics API-specific backend gets used by a QRhi instance.
Definition qrhi.h:1807
@ Metal
Definition qrhi.h:1812
@ Vulkan
Definition qrhi.h:1809
@ Null
Definition qrhi.h:1808
@ D3D11
Definition qrhi.h:1811
@ D3D12
Definition qrhi.h:1813
@ OpenGLES2
Definition qrhi.h:1810
static int mipLevelsForSize(const QSize &size)
Definition qrhi.cpp:10016
int currentFrameSlot() const
Definition qrhi.cpp:10854
FrameOpResult beginFrame(QRhiSwapChain *swapChain, BeginFrameFlags flags={})
Starts a new frame targeting the next available buffer of swapChain.
Definition qrhi.cpp:10753
QRhi::FrameOpResult finish()
Waits for any work on the graphics queue (where applicable) to complete, then executes all deferred o...
Definition qrhi.cpp:10944
QRhiComputePipeline * newComputePipeline()
Definition qrhi.cpp:10487
QRhiSwapChain * newSwapChain()
Definition qrhi.cpp:10701
FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, BeginFrameFlags flags={})
Starts a new offscreen frame.
Definition qrhi.cpp:10901
QRhiSampler * newSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode addressU, QRhiSampler::AddressMode addressV, QRhiSampler::AddressMode addressW=QRhiSampler::Repeat)
Definition qrhi.cpp:10673
QRhiTextureRenderTarget * newTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags={})
Definition qrhi.cpp:10690
bool isRecordingFrame() const
Definition qrhi.cpp:10810
void removeCleanupCallback(const void *key)
Deregisters the callback with key.
Definition qrhi.cpp:8844
const char * backendName() const
Definition qrhi.cpp:8691
QRhiGraphicsPipeline * newGraphicsPipeline()
Definition qrhi.cpp:10474
static bool probe(Implementation impl, QRhiInitParams *params)
Definition qrhi.cpp:8585
void addCleanupCallback(const CleanupCallback &callback)
Registers a callback that is invoked either when the QRhi is destroyed, or when runCleanup() is calle...
Definition qrhi.cpp:8817
static QRhi * create(Implementation impl, QRhiInitParams *params, Flags flags={}, QRhiNativeHandles *importDevice=nullptr)
Definition qrhi.cpp:8499
QRhi()
Definition qrhi.cpp:8432
QByteArray pipelineCacheData()
Definition qrhi.cpp:10279
~QRhi()
Destructor.
Definition qrhi.cpp:8439
FrameOpResult endFrame(QRhiSwapChain *swapChain, EndFrameFlags flags={})
Ends, commits, and presents a frame that was started in the last beginFrame() on swapChain.
Definition qrhi.cpp:10788
ResourceLimit
Describes the resource limit to query.
Definition qrhi.h:1887
QRhiTexture * newTexture(QRhiTexture::Format format, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
Definition qrhi.cpp:10570
void setPipelineCacheData(const QByteArray &data)
Loads data into the pipeline cache, when applicable.
Definition qrhi.cpp:10333
QRhiDriverInfo driverInfo() const
Definition qrhi.cpp:8792
Feature
Flag values to indicate what features are supported by the backend currently in use.
Definition qrhi.h:1832
const QRhiNativeHandles * nativeHandles()
Definition qrhi.cpp:10145
QRhiResourceUpdateBatch * nextResourceUpdateBatch()
Definition qrhi.cpp:9260
static QSize sizeForMipLevel(int mipLevel, const QSize &baseLevelSize)
Definition qrhi.cpp:10025
int ubufAlignment() const
Definition qrhi.cpp:10976
FrameOpResult
Describes the result of operations that can have a soft failure.
Definition qrhi.h:1825
@ FrameOpSuccess
Definition qrhi.h:1826
bool isDeviceLost() const
Definition qrhi.cpp:10235
void releaseCachedResources()
Attempts to release resources in the backend's caches.
Definition qrhi.cpp:10183
std::function< void(QRhi *)> CleanupCallback
Definition qrhi.h:1918
@ EnableDebugMarkers
Definition qrhi.h:1817
void clear()
Definition qset.h:62
VariableType
Represents the type of a variable or block member.
\inmodule QtGui
Definition qshader.h:81
Variant
Describes what kind of shader code an entry contains.
Definition qshader.h:103
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
static QThread * currentThread()
Definition qthread.cpp:1039
constexpr size_type size() const noexcept
void resize(qsizetype sz)
void append(const T &t)
\inmodule QtGui
Definition qwindow.h:63
\keyword 16-bit Floating Point Support\inmodule QtCore \inheaderfile QFloat16
Definition qfloat16.h:47
QHash< int, QWidget * > hash
[35multi]
qDeleteAll(list.begin(), list.end())
QSet< QString >::iterator it
else opt state
[0]
Combined button and popup list for selecting options.
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
Definition image.cpp:4
#define Q_BASIC_ATOMIC_INITIALIZER(a)
const int blockSize
static int instanceCount
EGLOutputLayerEXT layer
Flags
@ QtDebugMsg
Definition qlogging.h:30
#define qWarning
Definition qlogging.h:167
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
int qFloor(T v)
Definition qmath.h:42
QT_BEGIN_NAMESPACE constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:19
constexpr const T & qBound(const T &min, const T &val, const T &max)
Definition qminmax.h:23
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:21
GLint location
GLboolean GLboolean GLboolean b
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
GLuint64 key
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLuint GLuint end
GLuint sampler
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat f
GLenum src
const void GLsizei GLsizei stride
GLint GLsizei width
GLenum type
GLenum GLenum dst
GLenum access
GLenum GLuint GLenum GLsizei const GLchar * buf
GLbitfield flags
GLenum GLuint texture
GLenum GLuint GLintptr offset
GLuint name
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLint y
GLfloat GLfloat GLfloat GLfloat h
GLuint counter
void ** params
GLdouble s
[6]
Definition qopenglext.h:235
GLuint res
const GLubyte * c
GLuint entry
GLuint shader
Definition qopenglext.h:665
GLint limit
GLdouble GLdouble t
Definition qopenglext.h:243
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLuint64EXT * result
[6]
GLsizeiptr const void GLenum usage
Definition qopenglext.h:543
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
static const char * resourceTypeStr(const QRhiResource *res)
Definition qrhi.cpp:7995
static QRhiPassResourceTracker::BufferStage earlierStage(QRhiPassResourceTracker::BufferStage a, QRhiPassResourceTracker::BufferStage b)
Definition qrhi.cpp:10999
QDebug operator<<(QDebug dbg, const QRhiDepthStencilClearValue &v)
Definition qrhi.cpp:1229
static bool isImageLoadStore(QRhiPassResourceTracker::TextureAccess access)
Definition qrhi.cpp:11037
static const char * deviceTypeStr(QRhiDriverInfo::DeviceType type)
\variable QRhiDriverInfo::deviceName
Definition qrhi.cpp:8757
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
static constexpr size_t poolSize
Definition qstdweb.cpp:112
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
#define Q_UNUSED(x)
unsigned int quint32
Definition qtypes.h:50
short qint16
Definition qtypes.h:47
unsigned short quint16
Definition qtypes.h:48
size_t quintptr
Definition qtypes.h:167
int qint32
Definition qtypes.h:49
unsigned long long quint64
Definition qtypes.h:61
unsigned int uint
Definition qtypes.h:34
unsigned char quint8
Definition qtypes.h:46
QList< int > list
[14]
QVBoxLayout * layout
QMimeDatabase db
[0]
QSharedPointer< T > other(t)
[5]
view viewport() -> scroll(dx, dy, deviceRect)
aWidget window() -> setWindowTitle("New Window Title")
[2]
QHostInfo info
[0]
view create()
\inmodule QtGui
Definition qrhi.h:862
\inmodule QtGui
Definition qrhi.h:1760
DeviceType
Specifies the graphics device's type, when the information is available.
Definition qrhi.h:1761
@ IntegratedDevice
Definition qrhi.h:1763
\inmodule QtGui
Definition qrhi.h:1801
\variable QRhiReadbackResult::completed
Definition qrhi.h:800
\inmodule QtGui
\inmodule QtGui
Definition qrhi.h:1724
static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:434
static BufferOp staticUpload(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:423
static BufferOp read(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result)
Definition qrhi_p.h:443
static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:403
static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Definition qrhi_p.h:414
static TextureOp copy(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc)
Definition qrhi_p.h:491
static TextureOp upload(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
Definition qrhi_p.h:475
static TextureOp genMips(QRhiTexture *tex)
Definition qrhi_p.h:510
static TextureOp read(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
Definition qrhi_p.h:501
QRhiShaderResourceBinding::StageFlags stage
Definition qrhi.h:498
static constexpr int MAX_TEX_SAMPLER_ARRAY_SIZE
Definition qrhi.h:506
QRhiShaderResourceBinding::Type type
Definition qrhi.h:499
\inmodule QtGui
Definition qrhi.h:1783
\inmodule QtGui
Definition qrhi.h:1512
\inmodule QtGui
Definition qrhi.h:1545
\inmodule QtGui
Definition qrhi.h:966
Definition moc.h:23