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
4420QRhiTexture::QRhiTexture(QRhiImplementation *rhi, Format format_, const QSize &pixelSize_, int depth_,
4421 int arraySize_, int sampleCount_, Flags flags_)
4422 : QRhiResource(rhi),
4423 m_format(format_), m_pixelSize(pixelSize_), m_depth(depth_),
4424 m_arraySize(arraySize_), m_sampleCount(sampleCount_), m_flags(flags_)
4425{
4426}
4427
4435
4458
4488{
4489 Q_UNUSED(src);
4490 return false;
4491}
4492
4520
4750 Filter magFilter_, Filter minFilter_, Filter mipmapMode_,
4752 : QRhiResource(rhi),
4753 m_magFilter(magFilter_), m_minFilter(minFilter_), m_mipmapMode(mipmapMode_),
4754 m_addressU(u_), m_addressV(v_), m_addressW(w_),
4755 m_compareOp(QRhiSampler::Never)
4756{
4757}
4758
4766
4862
4870
4953{
4954 return nullptr;
4955}
4956
4983
5034 : QRhiRenderTarget(rhi),
5035 m_swapchain(swapchain_)
5036{
5037}
5038
5062
5148 Flags flags_)
5149 : QRhiRenderTarget(rhi),
5150 m_desc(desc_),
5151 m_flags(flags_)
5152{
5153}
5154
5162
5318
5326
5349{
5350 if (other == this)
5351 return true;
5352
5353 if (!other)
5354 return false;
5355
5356 // This can become a hot code path. Therefore we do not iterate and call
5357 // isLayoutCompatible() on m_bindings, but rather check a pre-calculated
5358 // hash code and then, if the hash matched, do a uint array comparison
5359 // (that's still more cache friendly).
5360
5361 return m_layoutDescHash == other->m_layoutDescHash
5362 && m_layoutDesc == other->m_layoutDesc;
5363}
5364
5385{
5386 srb->m_layoutDescHash = 0;
5387 srb->m_layoutDesc.clear();
5388 auto layoutDescAppender = std::back_inserter(srb->m_layoutDesc);
5389 for (const QRhiShaderResourceBinding &b : std::as_const(srb->m_bindings)) {
5391 srb->m_layoutDescHash ^= uint(d->binding) ^ uint(d->stage) ^ uint(d->type)
5392 ^ uint(d->arraySize());
5393 layoutDescAppender = d->serialize(layoutDescAppender);
5394 }
5395}
5396
5501{
5502 // everything that goes into a VkDescriptorSetLayoutBinding must match
5503 return d.binding == other.d.binding
5504 && d.stage == other.d.stage
5505 && d.type == other.d.type
5506 && d.arraySize() == other.d.arraySize();
5507}
5508
5527 int binding, StageFlags stage, QRhiBuffer *buf)
5528{
5530 b.d.binding = binding;
5531 b.d.stage = stage;
5532 b.d.type = UniformBuffer;
5533 b.d.u.ubuf.buf = buf;
5534 b.d.u.ubuf.offset = 0;
5535 b.d.u.ubuf.maybeSize = 0; // entire buffer
5536 b.d.u.ubuf.hasDynamicOffset = false;
5537 return b;
5538}
5539
5564 int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
5565{
5566 Q_ASSERT(size > 0);
5568 b.d.binding = binding;
5569 b.d.stage = stage;
5570 b.d.type = UniformBuffer;
5571 b.d.u.ubuf.buf = buf;
5572 b.d.u.ubuf.offset = offset;
5573 b.d.u.ubuf.maybeSize = size;
5574 b.d.u.ubuf.hasDynamicOffset = false;
5575 return b;
5576}
5577
5601 int binding, StageFlags stage, QRhiBuffer *buf, quint32 size)
5602{
5603 Q_ASSERT(size > 0);
5605 b.d.binding = binding;
5606 b.d.stage = stage;
5607 b.d.type = UniformBuffer;
5608 b.d.u.ubuf.buf = buf;
5609 b.d.u.ubuf.offset = 0;
5610 b.d.u.ubuf.maybeSize = size;
5611 b.d.u.ubuf.hasDynamicOffset = true;
5612 return b;
5613}
5614
5641 int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler)
5642{
5644 b.d.binding = binding;
5645 b.d.stage = stage;
5646 b.d.type = SampledTexture;
5647 b.d.u.stex.count = 1;
5648 b.d.u.stex.texSamplers[0] = { tex, sampler };
5649 return b;
5650}
5651
5687 int binding, StageFlags stage, int count, const TextureAndSampler *texSamplers)
5688{
5691 b.d.binding = binding;
5692 b.d.stage = stage;
5693 b.d.type = SampledTexture;
5694 b.d.u.stex.count = count;
5695 for (int i = 0; i < count; ++i) {
5696 if (texSamplers)
5697 b.d.u.stex.texSamplers[i] = texSamplers[i];
5698 else
5699 b.d.u.stex.texSamplers[i] = { nullptr, nullptr };
5700 }
5701 return b;
5702}
5703
5734{
5736 b.d.binding = binding;
5737 b.d.stage = stage;
5738 b.d.type = Texture;
5739 b.d.u.stex.count = 1;
5740 b.d.u.stex.texSamplers[0] = { tex, nullptr };
5741 return b;
5742}
5743
5765{
5768 b.d.binding = binding;
5769 b.d.stage = stage;
5770 b.d.type = Texture;
5771 b.d.u.stex.count = count;
5772 for (int i = 0; i < count; ++i) {
5773 if (tex)
5774 b.d.u.stex.texSamplers[i] = { tex[i], nullptr };
5775 else
5776 b.d.u.stex.texSamplers[i] = { nullptr, nullptr };
5777 }
5778 return b;
5779}
5780
5810{
5812 b.d.binding = binding;
5813 b.d.stage = stage;
5814 b.d.type = Sampler;
5815 b.d.u.stex.count = 1;
5816 b.d.u.stex.texSamplers[0] = { nullptr, sampler };
5817 return b;
5818}
5819
5844 int binding, StageFlags stage, QRhiTexture *tex, int level)
5845{
5847 b.d.binding = binding;
5848 b.d.stage = stage;
5849 b.d.type = ImageLoad;
5850 b.d.u.simage.tex = tex;
5851 b.d.u.simage.level = level;
5852 return b;
5853}
5854
5879 int binding, StageFlags stage, QRhiTexture *tex, int level)
5880{
5882 b.d.binding = binding;
5883 b.d.stage = stage;
5884 b.d.type = ImageStore;
5885 b.d.u.simage.tex = tex;
5886 b.d.u.simage.level = level;
5887 return b;
5888}
5889
5914 int binding, StageFlags stage, QRhiTexture *tex, int level)
5915{
5917 b.d.binding = binding;
5918 b.d.stage = stage;
5919 b.d.type = ImageLoadStore;
5920 b.d.u.simage.tex = tex;
5921 b.d.u.simage.level = level;
5922 return b;
5923}
5924
5947 int binding, StageFlags stage, QRhiBuffer *buf)
5948{
5950 b.d.binding = binding;
5951 b.d.stage = stage;
5952 b.d.type = BufferLoad;
5953 b.d.u.sbuf.buf = buf;
5954 b.d.u.sbuf.offset = 0;
5955 b.d.u.sbuf.maybeSize = 0; // entire buffer
5956 return b;
5957}
5958
5982 int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
5983{
5984 Q_ASSERT(size > 0);
5986 b.d.binding = binding;
5987 b.d.stage = stage;
5988 b.d.type = BufferLoad;
5989 b.d.u.sbuf.buf = buf;
5990 b.d.u.sbuf.offset = offset;
5991 b.d.u.sbuf.maybeSize = size;
5992 return b;
5993}
5994
6017 int binding, StageFlags stage, QRhiBuffer *buf)
6018{
6020 b.d.binding = binding;
6021 b.d.stage = stage;
6022 b.d.type = BufferStore;
6023 b.d.u.sbuf.buf = buf;
6024 b.d.u.sbuf.offset = 0;
6025 b.d.u.sbuf.maybeSize = 0; // entire buffer
6026 return b;
6027}
6028
6052 int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
6053{
6054 Q_ASSERT(size > 0);
6056 b.d.binding = binding;
6057 b.d.stage = stage;
6058 b.d.type = BufferStore;
6059 b.d.u.sbuf.buf = buf;
6060 b.d.u.sbuf.offset = offset;
6061 b.d.u.sbuf.maybeSize = size;
6062 return b;
6063}
6064
6087 int binding, StageFlags stage, QRhiBuffer *buf)
6088{
6090 b.d.binding = binding;
6091 b.d.stage = stage;
6092 b.d.type = BufferLoadStore;
6093 b.d.u.sbuf.buf = buf;
6094 b.d.u.sbuf.offset = 0;
6095 b.d.u.sbuf.maybeSize = 0; // entire buffer
6096 return b;
6097}
6098
6122 int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size)
6123{
6124 Q_ASSERT(size > 0);
6126 b.d.binding = binding;
6127 b.d.stage = stage;
6128 b.d.type = BufferLoadStore;
6129 b.d.u.sbuf.buf = buf;
6130 b.d.u.sbuf.offset = offset;
6131 b.d.u.sbuf.maybeSize = size;
6132 return b;
6133}
6134
6146{
6149
6150 if (da == db)
6151 return true;
6152
6153
6154 if (da->binding != db->binding
6155 || da->stage != db->stage
6156 || da->type != db->type)
6157 {
6158 return false;
6159 }
6160
6161 switch (da->type) {
6163 if (da->u.ubuf.buf != db->u.ubuf.buf
6164 || da->u.ubuf.offset != db->u.ubuf.offset
6165 || da->u.ubuf.maybeSize != db->u.ubuf.maybeSize)
6166 {
6167 return false;
6168 }
6169 break;
6171 if (da->u.stex.count != db->u.stex.count)
6172 return false;
6173 for (int i = 0; i < da->u.stex.count; ++i) {
6174 if (da->u.stex.texSamplers[i].tex != db->u.stex.texSamplers[i].tex
6175 || da->u.stex.texSamplers[i].sampler != db->u.stex.texSamplers[i].sampler)
6176 {
6177 return false;
6178 }
6179 }
6180 break;
6182 if (da->u.stex.count != db->u.stex.count)
6183 return false;
6184 for (int i = 0; i < da->u.stex.count; ++i) {
6185 if (da->u.stex.texSamplers[i].tex != db->u.stex.texSamplers[i].tex)
6186 return false;
6187 }
6188 break;
6190 if (da->u.stex.texSamplers[0].sampler != db->u.stex.texSamplers[0].sampler)
6191 return false;
6192 break;
6196 if (da->u.simage.tex != db->u.simage.tex
6197 || da->u.simage.level != db->u.simage.level)
6198 {
6199 return false;
6200 }
6201 break;
6205 if (da->u.sbuf.buf != db->u.sbuf.buf
6206 || da->u.sbuf.offset != db->u.sbuf.offset
6207 || da->u.sbuf.maybeSize != db->u.sbuf.maybeSize)
6208 {
6209 return false;
6210 }
6211 break;
6212 default:
6213 Q_UNREACHABLE_RETURN(false);
6214 }
6215
6216 return true;
6217}
6218
6226{
6227 return !(a == b);
6228}
6229
6235size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) noexcept
6236{
6239 seed = hash(seed, d->binding);
6240 seed = hash(seed, d->stage);
6241 seed = hash(seed, d->type);
6242 switch (d->type) {
6244 seed = hash(seed, reinterpret_cast<quintptr>(d->u.ubuf.buf));
6245 break;
6247 seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].tex));
6248 seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].sampler));
6249 break;
6251 seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].tex));
6252 break;
6254 seed = hash(seed, reinterpret_cast<quintptr>(d->u.stex.texSamplers[0].sampler));
6255 break;
6259 seed = hash(seed, reinterpret_cast<quintptr>(d->u.simage.tex));
6260 break;
6264 seed = hash(seed, reinterpret_cast<quintptr>(d->u.sbuf.buf));
6265 break;
6266 }
6267 return seed;
6268}
6269
6270#ifndef QT_NO_DEBUG_STREAM
6272{
6273 QDebugStateSaver saver(dbg);
6275 dbg.nospace() << "QRhiShaderResourceBinding("
6276 << "binding=" << d->binding
6277 << " stage=" << d->stage
6278 << " type=" << d->type;
6279 switch (d->type) {
6281 dbg.nospace() << " UniformBuffer("
6282 << "buffer=" << d->u.ubuf.buf
6283 << " offset=" << d->u.ubuf.offset
6284 << " maybeSize=" << d->u.ubuf.maybeSize
6285 << ')';
6286 break;
6288 dbg.nospace() << " SampledTextures("
6289 << "count=" << d->u.stex.count;
6290 for (int i = 0; i < d->u.stex.count; ++i) {
6291 dbg.nospace() << " texture=" << d->u.stex.texSamplers[i].tex
6292 << " sampler=" << d->u.stex.texSamplers[i].sampler;
6293 }
6294 dbg.nospace() << ')';
6295 break;
6297 dbg.nospace() << " Textures("
6298 << "count=" << d->u.stex.count;
6299 for (int i = 0; i < d->u.stex.count; ++i)
6300 dbg.nospace() << " texture=" << d->u.stex.texSamplers[i].tex;
6301 dbg.nospace() << ')';
6302 break;
6304 dbg.nospace() << " Sampler("
6305 << " sampler=" << d->u.stex.texSamplers[0].sampler
6306 << ')';
6307 break;
6309 dbg.nospace() << " ImageLoad("
6310 << "texture=" << d->u.simage.tex
6311 << " level=" << d->u.simage.level
6312 << ')';
6313 break;
6315 dbg.nospace() << " ImageStore("
6316 << "texture=" << d->u.simage.tex
6317 << " level=" << d->u.simage.level
6318 << ')';
6319 break;
6321 dbg.nospace() << " ImageLoadStore("
6322 << "texture=" << d->u.simage.tex
6323 << " level=" << d->u.simage.level
6324 << ')';
6325 break;
6327 dbg.nospace() << " BufferLoad("
6328 << "buffer=" << d->u.sbuf.buf
6329 << " offset=" << d->u.sbuf.offset
6330 << " maybeSize=" << d->u.sbuf.maybeSize
6331 << ')';
6332 break;
6334 dbg.nospace() << " BufferStore("
6335 << "buffer=" << d->u.sbuf.buf
6336 << " offset=" << d->u.sbuf.offset
6337 << " maybeSize=" << d->u.sbuf.maybeSize
6338 << ')';
6339 break;
6341 dbg.nospace() << " BufferLoadStore("
6342 << "buffer=" << d->u.sbuf.buf
6343 << " offset=" << d->u.sbuf.offset
6344 << " maybeSize=" << d->u.sbuf.maybeSize
6345 << ')';
6346 break;
6347 default:
6348 dbg.nospace() << " UNKNOWN()";
6349 break;
6350 }
6351 dbg.nospace() << ')';
6352 return dbg;
6353}
6354#endif
6355
6356#ifndef QT_NO_DEBUG_STREAM
6358{
6359 QDebugStateSaver saver(dbg);
6360 dbg.nospace() << "QRhiShaderResourceBindings("
6361 << srb.m_bindings
6362 << ')';
6363 return dbg;
6364}
6365#endif
6366
6708
6716
7317
7325
7476
7798{
7801 info.limits.luminanceInNits.minLuminance = 0.0f;
7802 info.limits.luminanceInNits.maxLuminance = 1000.0f;
7803 info.luminanceBehavior = QRhiSwapChainHdrInfo::SceneReferred;
7804 info.sdrWhiteLevel = 200.0f;
7805 return info;
7806}
7807
7808#ifndef QT_NO_DEBUG_STREAM
7810{
7811 QDebugStateSaver saver(dbg);
7812 dbg.nospace() << "QRhiSwapChainHdrInfo(";
7813 switch (info.limitsType) {
7815 dbg.nospace() << " minLuminance=" << info.limits.luminanceInNits.minLuminance
7816 << " maxLuminance=" << info.limits.luminanceInNits.maxLuminance;
7817 break;
7819 dbg.nospace() << " maxColorComponentValue=" << info.limits.colorComponentValue.maxColorComponentValue;
7820 dbg.nospace() << " maxPotentialColorComponentValue=" << info.limits.colorComponentValue.maxPotentialColorComponentValue;
7821 break;
7822 }
7823 switch (info.luminanceBehavior) {
7825 dbg.nospace() << " scene-referred, SDR white level=" << info.sdrWhiteLevel;
7826 break;
7828 dbg.nospace() << " display-referred";
7829 break;
7830 }
7831 dbg.nospace() << ')';
7832 return dbg;
7833}
7834#endif
7835
7869
7877
7983
7991
7992static const char *resourceTypeStr(const QRhiResource *res)
7993{
7994 switch (res->resourceType()) {
7996 return "Buffer";
7998 return "Texture";
8000 return "Sampler";
8002 return "RenderBuffer";
8004 return "RenderPassDescriptor";
8006 return "SwapChainRenderTarget";
8008 return "TextureRenderTarget";
8010 return "ShaderResourceBindings";
8012 return "GraphicsPipeline";
8014 return "SwapChain";
8016 return "ComputePipeline";
8018 return "CommandBuffer";
8019 }
8020
8021 Q_UNREACHABLE_RETURN("");
8022}
8023
8025{
8026 qDeleteAll(resUpdPool);
8027
8028 // Be nice and show something about leaked stuff. Though we may not get
8029 // this far with some backends where the allocator or the api may check
8030 // and freak out for unfreed graphics objects in the derived dtor already.
8031#ifndef QT_NO_DEBUG
8032 // debug builds: just do it always
8033 static bool leakCheck = true;
8034#else
8035 // release builds: opt-in
8036 static bool leakCheck = qEnvironmentVariableIntValue("QT_RHI_LEAK_CHECK");
8037#endif
8038 if (!resources.isEmpty()) {
8039 if (leakCheck) {
8040 qWarning("QRhi %p going down with %d unreleased resources that own native graphics objects. This is not nice.",
8041 q, int(resources.size()));
8042 }
8043 for (auto it = resources.cbegin(), end = resources.cend(); it != end; ++it) {
8044 QRhiResource *res = it.key();
8045 const bool ownsNativeResources = it.value();
8046 if (leakCheck && ownsNativeResources)
8047 qWarning(" %s resource %p (%s)", resourceTypeStr(res), res, res->m_objectName.constData());
8048
8049 // Null out the resource's rhi pointer. This is why it makes sense to do null
8050 // checks in the destroy() implementations of the various resource types. It
8051 // allows to survive in bad applications that somehow manage to destroy a
8052 // resource of a QRhi after the QRhi itself.
8053 res->m_rhi = nullptr;
8054 }
8055 }
8056}
8057
8064
8066 quint32 *bpl, quint32 *byteSize,
8067 QSize *blockDim) const
8068{
8069 int xdim = 4;
8070 int ydim = 4;
8071 quint32 blockSize = 0;
8072
8073 switch (format) {
8074 case QRhiTexture::BC1:
8075 blockSize = 8;
8076 break;
8077 case QRhiTexture::BC2:
8078 blockSize = 16;
8079 break;
8080 case QRhiTexture::BC3:
8081 blockSize = 16;
8082 break;
8083 case QRhiTexture::BC4:
8084 blockSize = 8;
8085 break;
8086 case QRhiTexture::BC5:
8087 blockSize = 16;
8088 break;
8089 case QRhiTexture::BC6H:
8090 blockSize = 16;
8091 break;
8092 case QRhiTexture::BC7:
8093 blockSize = 16;
8094 break;
8095
8097 blockSize = 8;
8098 break;
8100 blockSize = 8;
8101 break;
8103 blockSize = 16;
8104 break;
8105
8107 blockSize = 16;
8108 break;
8110 blockSize = 16;
8111 xdim = 5;
8112 break;
8114 blockSize = 16;
8115 xdim = ydim = 5;
8116 break;
8118 blockSize = 16;
8119 xdim = 6;
8120 ydim = 5;
8121 break;
8123 blockSize = 16;
8124 xdim = ydim = 6;
8125 break;
8127 blockSize = 16;
8128 xdim = 8;
8129 ydim = 5;
8130 break;
8132 blockSize = 16;
8133 xdim = 8;
8134 ydim = 6;
8135 break;
8137 blockSize = 16;
8138 xdim = ydim = 8;
8139 break;
8141 blockSize = 16;
8142 xdim = 10;
8143 ydim = 5;
8144 break;
8146 blockSize = 16;
8147 xdim = 10;
8148 ydim = 6;
8149 break;
8151 blockSize = 16;
8152 xdim = 10;
8153 ydim = 8;
8154 break;
8156 blockSize = 16;
8157 xdim = ydim = 10;
8158 break;
8160 blockSize = 16;
8161 xdim = 12;
8162 ydim = 10;
8163 break;
8165 blockSize = 16;
8166 xdim = ydim = 12;
8167 break;
8168
8169 default:
8170 Q_UNREACHABLE();
8171 break;
8172 }
8173
8174 const quint32 wblocks = uint((size.width() + xdim - 1) / xdim);
8175 const quint32 hblocks = uint((size.height() + ydim - 1) / ydim);
8176
8177 if (bpl)
8178 *bpl = wblocks * blockSize;
8179 if (byteSize)
8180 *byteSize = wblocks * hblocks * blockSize;
8181 if (blockDim)
8182 *blockDim = QSize(xdim, ydim);
8183}
8184
8186 quint32 *bpl, quint32 *byteSize, quint32 *bytesPerPixel) const
8187{
8189 compressedFormatInfo(format, size, bpl, byteSize, nullptr);
8190 return;
8191 }
8192
8193 quint32 bpc = 0;
8194 switch (format) {
8195 case QRhiTexture::RGBA8:
8196 bpc = 4;
8197 break;
8198 case QRhiTexture::BGRA8:
8199 bpc = 4;
8200 break;
8201 case QRhiTexture::R8:
8202 bpc = 1;
8203 break;
8204 case QRhiTexture::RG8:
8205 bpc = 2;
8206 break;
8207 case QRhiTexture::R16:
8208 bpc = 2;
8209 break;
8210 case QRhiTexture::RG16:
8211 bpc = 4;
8212 break;
8214 bpc = 1;
8215 break;
8216
8218 bpc = 8;
8219 break;
8221 bpc = 16;
8222 break;
8223 case QRhiTexture::R16F:
8224 bpc = 2;
8225 break;
8226 case QRhiTexture::R32F:
8227 bpc = 4;
8228 break;
8229
8231 bpc = 4;
8232 break;
8233
8234 case QRhiTexture::D16:
8235 bpc = 2;
8236 break;
8237 case QRhiTexture::D24:
8238 case QRhiTexture::D24S8:
8239 case QRhiTexture::D32F:
8240 bpc = 4;
8241 break;
8242
8243 default:
8244 Q_UNREACHABLE();
8245 break;
8246 }
8247
8248 if (bpl)
8249 *bpl = uint(size.width()) * bpc;
8250 if (byteSize)
8251 *byteSize = uint(size.width() * size.height()) * bpc;
8252 if (bytesPerPixel)
8253 *bytesPerPixel = bpc;
8254}
8255
8257{
8258 switch (format) {
8259 case QRhiTexture::D24S8:
8260 return true;
8261 default:
8262 break;
8263 }
8264 return false;
8265}
8266
8268{
8269 if (ps->cbeginShaderStages() == ps->cendShaderStages()) {
8270 qWarning("Cannot build a graphics pipeline without any stages");
8271 return false;
8272 }
8273
8274 bool hasVertexStage = false;
8275 for (auto it = ps->cbeginShaderStages(), itEnd = ps->cendShaderStages(); it != itEnd; ++it) {
8276 if (!it->shader().isValid()) {
8277 qWarning("Empty shader passed to graphics pipeline");
8278 return false;
8279 }
8280 if (it->type() == QRhiShaderStage::Vertex)
8281 hasVertexStage = true;
8282 }
8283 if (!hasVertexStage) {
8284 qWarning("Cannot build a graphics pipeline without a vertex stage");
8285 return false;
8286 }
8287
8288 if (!ps->renderPassDescriptor()) {
8289 qWarning("Cannot build a graphics pipeline without a QRhiRenderPassDescriptor");
8290 return false;
8291 }
8292
8293 if (!ps->shaderResourceBindings()) {
8294 qWarning("Cannot build a graphics pipeline without QRhiShaderResourceBindings");
8295 return false;
8296 }
8297
8298 return true;
8299}
8300
8302{
8303#ifndef QT_NO_DEBUG
8304 bool bindingsOk = true;
8305 const int CHECKED_BINDINGS_COUNT = 64;
8306 bool bindingSeen[CHECKED_BINDINGS_COUNT] = {};
8307 for (auto it = srb->cbeginBindings(), end = srb->cendBindings(); it != end; ++it) {
8308 const int binding = shaderResourceBindingData(*it)->binding;
8309 if (binding >= CHECKED_BINDINGS_COUNT)
8310 continue;
8311 if (binding < 0) {
8312 qWarning("Invalid binding number %d", binding);
8313 bindingsOk = false;
8314 continue;
8315 }
8316 switch (shaderResourceBindingData(*it)->type) {
8318 if (!bindingSeen[binding]) {
8319 bindingSeen[binding] = true;
8320 } else {
8321 qWarning("Uniform buffer duplicates an existing binding number %d", binding);
8322 bindingsOk = false;
8323 }
8324 break;
8326 if (!bindingSeen[binding]) {
8327 bindingSeen[binding] = true;
8328 } else {
8329 qWarning("Combined image sampler 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("Texture 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("Sampler duplicates an existing binding number %d", binding);
8346 bindingsOk = false;
8347 }
8348 break;
8352 if (!bindingSeen[binding]) {
8353 bindingSeen[binding] = true;
8354 } else {
8355 qWarning("Image duplicates an existing binding number %d", binding);
8356 bindingsOk = false;
8357 }
8358 break;
8362 if (!bindingSeen[binding]) {
8363 bindingSeen[binding] = true;
8364 } else {
8365 qWarning("Buffer duplicates an existing binding number %d", binding);
8366 bindingsOk = false;
8367 }
8368 break;
8369 default:
8370 qWarning("Unknown binding type %d", int(shaderResourceBindingData(*it)->type));
8371 bindingsOk = false;
8372 break;
8373 }
8374 }
8375
8376 if (!bindingsOk) {
8377 qWarning() << *srb;
8378 return false;
8379 }
8380#else
8381 Q_UNUSED(srb);
8382#endif
8383 return true;
8384}
8385
8387{
8388 // Stay compatible with QSurfaceFormat and friends where samples == 0 means the same as 1.
8389 const int s = qBound(1, sampleCount, 64);
8390 const QList<int> supported = supportedSampleCounts();
8391 int result = 1;
8392
8393 // Stay compatible with Qt 5 in that requesting an unsupported sample count
8394 // is not an error (although we still do a categorized debug print about
8395 // this), and rather a supported value, preferably a close one, not just 1,
8396 // is used instead. This is actually deviating from Qt 5 as that performs a
8397 // clamping only and does not handle cases such as when sample count 2 is
8398 // not supported but 4 is. (OpenGL handles things like that gracefully,
8399 // other APIs may not, so improve this by picking the next largest, or in
8400 // absence of that, the largest value; this with the goal to not reduce
8401 // quality by rather picking a larger-than-requested value than a smaller one)
8402
8403 for (int i = 0, ie = supported.count(); i != ie; ++i) {
8404 // assumes the 'supported' list is sorted
8405 if (supported[i] >= s) {
8406 result = supported[i];
8407 break;
8408 }
8409 }
8410
8411 if (result != s) {
8412 if (result == 1 && !supported.isEmpty())
8413 result = supported.last();
8414 qCDebug(QRHI_LOG_INFO, "Attempted to set unsupported sample count %d, using %d instead",
8415 sampleCount, result);
8416 }
8417
8418 return result;
8419}
8420
8425{
8426}
8427
8432{
8433 if (!d)
8434 return;
8435
8436 runCleanup();
8437
8438 qDeleteAll(d->pendingDeleteResources);
8439 d->pendingDeleteResources.clear();
8440
8441 d->destroy();
8442 delete d;
8443}
8444
8446{
8447 q = rhi;
8448
8449 // Play nice with QSG_INFO since that is still the most commonly used
8450 // way to get graphics info printed from Qt Quick apps, and the Quick
8451 // scenegraph is our primary user.
8452 if (qEnvironmentVariableIsSet("QSG_INFO"))
8453 const_cast<QLoggingCategory &>(QRHI_LOG_INFO()).setEnabled(QtDebugMsg, true);
8454
8456
8457 implType = impl;
8458 implThread = QThread::currentThread();
8459}
8460
8492{
8493 std::unique_ptr<QRhi> r(new QRhi);
8494
8495 switch (impl) {
8496 case Null:
8497 r->d = new QRhiNull(static_cast<QRhiNullInitParams *>(params));
8498 break;
8499 case Vulkan:
8500#if QT_CONFIG(vulkan)
8501 r->d = new QRhiVulkan(static_cast<QRhiVulkanInitParams *>(params),
8502 static_cast<QRhiVulkanNativeHandles *>(importDevice));
8503 break;
8504#else
8505 Q_UNUSED(importDevice);
8506 qWarning("This build of Qt has no Vulkan support");
8507 break;
8508#endif
8509 case OpenGLES2:
8510#ifndef QT_NO_OPENGL
8511 r->d = new QRhiGles2(static_cast<QRhiGles2InitParams *>(params),
8512 static_cast<QRhiGles2NativeHandles *>(importDevice));
8513 break;
8514#else
8515 qWarning("This build of Qt has no OpenGL support");
8516 break;
8517#endif
8518 case D3D11:
8519#ifdef Q_OS_WIN
8520 r->d = new QRhiD3D11(static_cast<QRhiD3D11InitParams *>(params),
8521 static_cast<QRhiD3D11NativeHandles *>(importDevice));
8522 break;
8523#else
8524 qWarning("This platform has no Direct3D 11 support");
8525 break;
8526#endif
8527 case Metal:
8528#if QT_CONFIG(metal)
8529 r->d = new QRhiMetal(static_cast<QRhiMetalInitParams *>(params),
8530 static_cast<QRhiMetalNativeHandles *>(importDevice));
8531 break;
8532#else
8533 qWarning("This platform has no Metal support");
8534 break;
8535#endif
8536 case D3D12:
8537#ifdef Q_OS_WIN
8538#ifdef QRHI_D3D12_AVAILABLE
8539 r->d = new QRhiD3D12(static_cast<QRhiD3D12InitParams *>(params),
8540 static_cast<QRhiD3D12NativeHandles *>(importDevice));
8541 break;
8542#else
8543 qWarning("Qt was built without Direct3D 12 support. "
8544 "This is likely due to having ancient SDK headers (such as d3d12.h) in the Qt build environment. "
8545 "Rebuild Qt with an SDK supporting D3D12 features introduced in Windows 10 version 1703, "
8546 "or use an MSVC build as those typically are built with more up-to-date SDKs.");
8547 break;
8548#endif
8549#else
8550 qWarning("This platform has no Direct3D 12 support");
8551 break;
8552#endif
8553 }
8554
8555 if (r->d) {
8556 r->d->prepareForCreate(r.get(), impl, flags);
8557 if (r->d->create(flags))
8558 return r.release();
8559 }
8560
8561 return nullptr;
8562}
8563
8578{
8579 bool ok = false;
8580
8581 // The only place currently where this makes sense is Metal, where the API
8582 // is simple enough so that a special probing function - doing nothing but
8583 // a MTLCreateSystemDefaultDevice - is reasonable. Elsewhere, just call
8584 // create() and then drop the result.
8585
8586 if (impl == Metal) {
8587#if QT_CONFIG(metal)
8588 ok = QRhiMetal::probe(static_cast<QRhiMetalInitParams *>(params));
8589#endif
8590 } else {
8591 QRhi *rhi = create(impl, params);
8592 ok = rhi != nullptr;
8593 delete rhi;
8594 }
8595 return ok;
8596}
8597
8637{
8638#if QT_CONFIG(metal)
8639 if (impl == Metal)
8641#else
8642 Q_UNUSED(impl);
8644#endif
8645 return {};
8646}
8647
8652{
8653 return d->implType;
8654}
8655
8661{
8662 switch (impl) {
8663 case QRhi::Null:
8664 return "Null";
8665 case QRhi::Vulkan:
8666 return "Vulkan";
8667 case QRhi::OpenGLES2:
8668 return "OpenGL";
8669 case QRhi::D3D11:
8670 return "D3D11";
8671 case QRhi::Metal:
8672 return "Metal";
8673 case QRhi::D3D12:
8674 return "D3D12";
8675 }
8676
8677 Q_UNREACHABLE_RETURN("Unknown");
8678}
8679
8683const char *QRhi::backendName() const
8684{
8685 return backendName(d->implType);
8686}
8687
8748#ifndef QT_NO_DEBUG_STREAM
8750{
8751 switch (type) {
8753 return "Unknown";
8755 return "Integrated";
8757 return "Discrete";
8759 return "External";
8761 return "Virtual";
8763 return "Cpu";
8764 }
8765
8766 Q_UNREACHABLE_RETURN(nullptr);
8767}
8769{
8770 QDebugStateSaver saver(dbg);
8771 dbg.nospace() << "QRhiDriverInfo(deviceName=" << info.deviceName
8772 << " deviceId=0x" << Qt::hex << info.deviceId
8773 << " vendorId=0x" << info.vendorId
8774 << " deviceType=" << deviceTypeStr(info.deviceType)
8775 << ')';
8776 return dbg;
8777}
8778#endif
8779
8785{
8786 return d->driverInfo();
8787}
8788
8793{
8794 return d->implThread;
8795}
8796
8810{
8811 d->addCleanupCallback(callback);
8812}
8813
8824void QRhi::addCleanupCallback(const void *key, const CleanupCallback &callback)
8825{
8826 d->addCleanupCallback(key, callback);
8827}
8828
8837{
8839}
8840
8850{
8851 for (const CleanupCallback &f : std::as_const(d->cleanupCallbacks))
8852 f(this);
8853
8854 d->cleanupCallbacks.clear();
8855
8856 for (auto it = d->keyedCleanupCallbacks.cbegin(), end = d->keyedCleanupCallbacks.cend(); it != end; ++it)
8857 it.value()(this);
8858
8859 d->keyedCleanupCallbacks.clear();
8860}
8861
8889QRhiResourceUpdateBatch::QRhiResourceUpdateBatch(QRhiImplementation *rhi)
8891{
8892 d->q = this;
8893 d->rhi = rhi;
8894}
8895
8900
8911{
8912 d->free();
8913}
8914
8953
8968{
8969 return d->hasOptimalCapacity();
8970}
8971
8992{
8993 if (size > 0) {
8994 const int idx = d->activeBufferOpCount++;
8995 const int opListSize = d->bufferOps.size();
8996 if (idx < opListSize)
8998 else
9000 }
9001}
9002
9012{
9013 if (size > 0) {
9014 const int idx = d->activeBufferOpCount++;
9015 if (idx < d->bufferOps.size())
9017 else
9019 }
9020}
9021
9029{
9030 if (buf->size() > 0) {
9031 const int idx = d->activeBufferOpCount++;
9032 if (idx < d->bufferOps.size())
9034 else
9036 }
9037}
9038
9071
9080{
9081 if (desc.cbeginEntries() != desc.cendEntries()) {
9082 const int idx = d->activeTextureOpCount++;
9083 if (idx < d->textureOps.size())
9085 else
9087 }
9088}
9089
9103
9117{
9118 const int idx = d->activeTextureOpCount++;
9119 if (idx < d->textureOps.size())
9121 else
9123}
9124
9194
9211{
9212 const int idx = d->activeTextureOpCount++;
9213 if (idx < d->textureOps.size())
9215 else
9217}
9218
9253{
9254 // By default we prefer spreading out the utilization of the 64 batches as
9255 // much as possible, meaning we won't pick the first one even if it's free,
9256 // but prefer picking one after the last picked one. Relevant due to how
9257 // QVLA and QRhiBufferData allocations behind the bufferOps are reused; in
9258 // typical Qt Quick scenes this leads to a form of (eventually) seeding all
9259 // the 64 resource batches with buffer operation data allocations which are
9260 // then reused in subsequent frames. This comes at the expense of using
9261 // more memory, but has proven good results when (CPU) profiling typical
9262 // Quick/Quick3D apps.
9263 //
9264 // Prefering memory over performance means that we always pick the first
9265 // free batch, and triggering the aggressive deallocating of all backing
9266 // memory (see trimOpLists) before returning it.
9267 static const bool preferMemoryOverPerformance = qEnvironmentVariableIntValue("QT_RHI_MINIMIZE_POOLS");
9268
9269 auto nextFreeBatch = [this]() -> QRhiResourceUpdateBatch * {
9270 auto isFree = [this](int i) -> QRhiResourceUpdateBatch * {
9271 const quint64 mask = 1ULL << quint64(i);
9272 if (!(d->resUpdPoolMap & mask)) {
9273 d->resUpdPoolMap |= mask;
9274 QRhiResourceUpdateBatch *u = d->resUpdPool[i];
9275 QRhiResourceUpdateBatchPrivate::get(u)->poolIndex = i;
9276 if (!preferMemoryOverPerformance)
9277 d->lastResUpdIdx = i;
9278 return u;
9279 }
9280 return nullptr;
9281 };
9282 const int poolSize = d->resUpdPool.size();
9283 for (int i = d->lastResUpdIdx + 1; i < poolSize; ++i) {
9284 if (QRhiResourceUpdateBatch *u = isFree(i))
9285 return u;
9286 }
9287 for (int i = 0; i <= d->lastResUpdIdx; ++i) {
9288 if (QRhiResourceUpdateBatch *u = isFree(i))
9289 return u;
9290 }
9291 return nullptr;
9292 };
9293
9294 QRhiResourceUpdateBatch *u = nextFreeBatch();
9295 if (!u) {
9296 const int oldSize = d->resUpdPool.size();
9297 const int newSize = oldSize + qMin(4, qMax(0, 64 - oldSize));
9298 d->resUpdPool.resize(newSize);
9299 for (int i = oldSize; i < newSize; ++i)
9300 d->resUpdPool[i] = new QRhiResourceUpdateBatch(d);
9301 u = nextFreeBatch();
9302 if (!u)
9303 qWarning("Resource update batch pool exhausted (max is 64)");
9304 }
9305
9306 if (preferMemoryOverPerformance && u)
9307 u->d->trimOpLists();
9308
9309 return u;
9310}
9311
9313{
9314 Q_ASSERT(poolIndex >= 0 && rhi->resUpdPool[poolIndex] == q);
9315
9318
9319 const quint64 mask = 1ULL << quint64(poolIndex);
9320 rhi->resUpdPoolMap &= ~mask;
9321 poolIndex = -1;
9322
9323 // textureOps is cleared, to not keep the potentially large image pixel
9324 // data alive, but it is expected that the container keeps the list alloc
9325 // at least. Only trimOpList() goes for the more aggressive route with squeeze.
9326 textureOps.clear();
9327
9328 // bufferOps is not touched, to allow reusing allocations (incl. in the
9329 // elements' QRhiBufferData) as much as possible when this batch is used
9330 // again in the future, which is important for performance, in particular
9331 // with Qt Quick.
9332}
9333
9335{
9336 int combinedSize = activeBufferOpCount + other->activeBufferOpCount;
9337 if (bufferOps.size() < combinedSize)
9338 bufferOps.resize(combinedSize);
9339 for (int i = activeBufferOpCount; i < combinedSize; ++i)
9340 bufferOps[i] = std::move(other->bufferOps[i - activeBufferOpCount]);
9341 activeBufferOpCount += other->activeBufferOpCount;
9342
9343 combinedSize = activeTextureOpCount + other->activeTextureOpCount;
9344 if (textureOps.size() < combinedSize)
9345 textureOps.resize(combinedSize);
9346 for (int i = activeTextureOpCount; i < combinedSize; ++i)
9347 textureOps[i] = std::move(other->textureOps[i - activeTextureOpCount]);
9348 activeTextureOpCount += other->activeTextureOpCount;
9349}
9350
9356
9358{
9359 // Unlike free(), this is expected to aggressively deallocate all memory
9360 // used by both the buffer and texture operation lists. (i.e. using
9361 // squeeze() to only keep the stack prealloc of the QVLAs)
9362 //
9363 // This (e.g. just the destruction of bufferOps elements) may have a
9364 // non-negligible performance impact e.g. with Qt Quick with scenes where
9365 // there are lots of buffer operations per frame.
9366
9368 bufferOps.clear();
9369 bufferOps.squeeze();
9370
9372 textureOps.clear();
9373 textureOps.squeeze();
9374}
9375
9385{
9386 if (resourceUpdates)
9387 m_rhi->resourceUpdate(this, resourceUpdates);
9388}
9389
9444 const QColor &colorClearValue,
9445 const QRhiDepthStencilClearValue &depthStencilClearValue,
9446 QRhiResourceUpdateBatch *resourceUpdates,
9447 BeginPassFlags flags)
9448{
9449 m_rhi->beginPass(this, rt, colorClearValue, depthStencilClearValue, resourceUpdates, flags);
9450}
9451
9461{
9462 m_rhi->endPass(this, resourceUpdates);
9463}
9464
9481{
9482 Q_ASSERT(ps != nullptr);
9483 m_rhi->setGraphicsPipeline(this, ps);
9484}
9485
9539 int dynamicOffsetCount,
9540 const DynamicOffset *dynamicOffsets)
9541{
9542 m_rhi->setShaderResources(this, srb, dynamicOffsetCount, dynamicOffsets);
9543}
9544
9600void QRhiCommandBuffer::setVertexInput(int startBinding, int bindingCount, const VertexInput *bindings,
9601 QRhiBuffer *indexBuf, quint32 indexOffset,
9602 IndexFormat indexFormat)
9603{
9604 m_rhi->setVertexInput(this, startBinding, bindingCount, bindings, indexBuf, indexOffset, indexFormat);
9605}
9606
9625
9641{
9642 m_rhi->setScissor(this, scissor);
9643}
9644
9658
9669{
9670 m_rhi->setStencilRef(this, refValue);
9671}
9672
9690 quint32 firstVertex,
9691 quint32 firstInstance)
9692{
9693 m_rhi->draw(this, vertexCount, instanceCount, firstVertex, firstInstance);
9694}
9695
9727 quint32 firstIndex,
9728 qint32 vertexOffset,
9729 quint32 firstInstance)
9730{
9731 m_rhi->drawIndexed(this, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
9732}
9733
9750
9763
9775{
9776 m_rhi->debugMarkMsg(this, msg);
9777}
9778
9799{
9800 m_rhi->beginComputePass(this, resourceUpdates, flags);
9801}
9802
9810{
9811 m_rhi->endComputePass(this, resourceUpdates);
9812}
9813
9831
9852{
9853 m_rhi->dispatch(this, x, y, z);
9854}
9855
9869
9913
9925{
9926 m_rhi->endExternal(this);
9927}
9928
9994
9999int QRhi::ubufAligned(int v) const
10000{
10001 const int byteAlign = ubufAlignment();
10002 return (v + byteAlign - 1) & ~(byteAlign - 1);
10003}
10004
10009{
10010 return qFloor(std::log2(qMax(size.width(), size.height()))) + 1;
10011}
10012
10017QSize QRhi::sizeForMipLevel(int mipLevel, const QSize &baseLevelSize)
10018{
10019 const int w = qMax(1, baseLevelSize.width() >> mipLevel);
10020 const int h = qMax(1, baseLevelSize.height() >> mipLevel);
10021 return QSize(w, h);
10022}
10023
10031{
10032 return d->isYUpInFramebuffer();
10033}
10034
10045{
10046 return d->isYUpInNDC();
10047}
10048
10070{
10071 return d->isClipDepthZeroToOne();
10072}
10073
10092{
10093 return d->clipSpaceCorrMatrix();
10094}
10095
10103{
10105}
10106
10111{
10112 return d->isFeatureSupported(feature);
10113}
10114
10122{
10123 return d->resourceLimit(limit);
10124}
10125
10138{
10139 return d->nativeHandles();
10140}
10141
10162
10176{
10178
10179 for (QRhiResourceUpdateBatch *u : d->resUpdPool) {
10180 if (u->d->poolIndex < 0)
10181 u->d->trimOpLists();
10182 }
10183}
10184
10228{
10229 return d->isDeviceLost();
10230}
10231
10272{
10273 return d->pipelineCacheData();
10274}
10275
10329
10396#ifndef QT_NO_DEBUG_STREAM
10398{
10399 QDebugStateSaver saver(dbg);
10400 dbg.nospace() << "QRhiStats("
10401 << "totalPipelineCreationTime=" << info.totalPipelineCreationTime
10402 << " blockCount=" << info.blockCount
10403 << " allocCount=" << info.allocCount
10404 << " usedBytes=" << info.usedBytes
10405 << " unusedBytes=" << info.unusedBytes
10406 << " totalUsageBytes=" << info.totalUsageBytes
10407 << ')';
10408 return dbg;
10409}
10410#endif
10411
10457{
10458 return d->statistics();
10459}
10460
10470
10483
10493
10509 QRhiBuffer::UsageFlags usage,
10510 quint32 size)
10511{
10512 return d->createBuffer(type, usage, size);
10513}
10514
10536 const QSize &pixelSize,
10537 int sampleCount,
10538 QRhiRenderBuffer::Flags flags,
10539 QRhiTexture::Format backingFormatHint)
10540{
10541 return d->createRenderBuffer(type, pixelSize, sampleCount, flags, backingFormatHint);
10542}
10543
10563 const QSize &pixelSize,
10564 int sampleCount,
10565 QRhiTexture::Flags flags)
10566{
10567 if (pixelSize.height() == 0)
10569
10570 return d->createTexture(format, pixelSize, 1, 0, sampleCount, flags);
10571}
10572
10596 int width, int height, int depth,
10597 int sampleCount,
10598 QRhiTexture::Flags flags)
10599{
10600 if (depth > 0)
10602
10603 if (height == 0 && depth == 0)
10605
10606 return d->createTexture(format, QSize(width, height), depth, 0, sampleCount, flags);
10607}
10608
10637 int arraySize,
10638 const QSize &pixelSize,
10639 int sampleCount,
10640 QRhiTexture::Flags flags)
10641{
10643
10644 if (pixelSize.height() == 0)
10646
10647 return d->createTexture(format, pixelSize, 1, arraySize, sampleCount, flags);
10648}
10649
10666 QRhiSampler::Filter minFilter,
10667 QRhiSampler::Filter mipmapMode,
10668 QRhiSampler::AddressMode addressU,
10669 QRhiSampler::AddressMode addressV,
10670 QRhiSampler::AddressMode addressW)
10671{
10672 return d->createSampler(magFilter, minFilter, mipmapMode, addressU, addressV, addressW);
10673}
10674
10683 QRhiTextureRenderTarget::Flags flags)
10684{
10685 return d->createTextureRenderTarget(desc, flags);
10686}
10687
10694{
10695 return d->createSwapChain();
10696}
10697
10746{
10747 if (d->inFrame)
10748 qWarning("Attempted to call beginFrame() within a still active frame; ignored");
10749
10751 if (r == FrameOpSuccess)
10752 d->inFrame = true;
10753
10754 return r;
10755}
10756
10781{
10782 if (!d->inFrame)
10783 qWarning("Attempted to call endFrame() without an active frame; ignored");
10784
10785 QRhi::FrameOpResult r = d->inFrame ? d->endFrame(swapChain, flags) : FrameOpSuccess;
10786 d->inFrame = false;
10787 // deleteLater is a high level QRhi concept the backends know
10788 // nothing about - handle it here.
10789 qDeleteAll(d->pendingDeleteResources);
10790 d->pendingDeleteResources.clear();
10791
10792 return r;
10793}
10794
10803{
10804 return d->inFrame;
10805}
10806
10847{
10848 return d->currentFrameSlot;
10849}
10850
10894{
10895 if (d->inFrame)
10896 qWarning("Attempted to call beginOffscreenFrame() within a still active frame; ignored");
10897
10899 if (r == FrameOpSuccess)
10900 d->inFrame = true;
10901
10902 return r;
10903}
10904
10913{
10914 if (!d->inFrame)
10915 qWarning("Attempted to call endOffscreenFrame() without an active frame; ignored");
10916
10918 d->inFrame = false;
10919 qDeleteAll(d->pendingDeleteResources);
10920 d->pendingDeleteResources.clear();
10921
10922 return r;
10923}
10924
10937{
10938 return d->finish();
10939}
10940
10954{
10955 return d->supportedSampleCounts();
10956}
10957
10969{
10970 return d->ubufAlignment();
10971}
10972
10973Q_CONSTINIT static QBasicAtomicInteger<QRhiGlobalObjectIdGenerator::Type> counter = Q_BASIC_ATOMIC_INITIALIZER(0);
10974
10976{
10977 return counter.fetchAndAddRelaxed(1) + 1;
10978}
10979
10981{
10982 return m_buffers.isEmpty() && m_textures.isEmpty();
10983}
10984
10986{
10987 m_buffers.clear();
10988 m_textures.clear();
10989}
10990
10996
10998 const UsageState &state)
10999{
11000 auto it = m_buffers.find(buf);
11001 if (it != m_buffers.end()) {
11002 if (it->access != *access) {
11003 const QByteArray name = buf->name();
11004 qWarning("Buffer %p (%s) used with different accesses within the same pass, this is not allowed.",
11005 buf, name.constData());
11006 return;
11007 }
11008 if (it->stage != *stage) {
11009 it->stage = earlierStage(it->stage, *stage);
11010 *stage = it->stage;
11011 }
11012 return;
11013 }
11014
11015 Buffer b;
11016 b.slot = slot;
11017 b.access = *access;
11018 b.stage = *stage;
11019 b.stateAtPassBegin = state; // first use -> initial state
11020 m_buffers.insert(buf, b);
11021}
11022
11028
11035
11037 const UsageState &state)
11038{
11039 auto it = m_textures.find(tex);
11040 if (it != m_textures.end()) {
11041 if (it->access != *access) {
11042 // Different subresources of a texture may be used for both load
11043 // and store in the same pass. (think reading from one mip level
11044 // and writing to another one in a compute shader) This we can
11045 // handle by treating the entire resource as read-write.
11046 if (isImageLoadStore(it->access) && isImageLoadStore(*access)) {
11048 *access = it->access;
11049 } else {
11050 const QByteArray name = tex->name();
11051 qWarning("Texture %p (%s) used with different accesses within the same pass, this is not allowed.",
11052 tex, name.constData());
11053 }
11054 }
11055 if (it->stage != *stage) {
11056 it->stage = earlierStage(it->stage, *stage);
11057 *stage = it->stage;
11058 }
11059 return;
11060 }
11061
11062 Texture t;
11063 t.access = *access;
11064 t.stage = *stage;
11065 t.stateAtPassBegin = state; // first use -> initial state
11066 m_textures.insert(tex, t);
11067}
11068
11087
11106
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:1214
qsizetype size() const noexcept
Returns the number of items in the hash.
Definition qhash.h:927
const_iterator cend() const noexcept
Definition qhash.h:1218
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
Definition qhash.h:951
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
Definition qhash.h:928
\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:1651
void endPass(QRhiResourceUpdateBatch *resourceUpdates=nullptr)
Records ending the current render pass.
Definition qrhi.cpp:9460
void debugMarkMsg(const QByteArray &msg)
Inserts a debug message msg into the command stream.
Definition qrhi.cpp:9774
void draw(quint32 vertexCount, quint32 instanceCount=1, quint32 firstVertex=0, quint32 firstInstance=0)
Records a non-indexed draw.
Definition qrhi.cpp:9688
void setBlendConstants(const QColor &c)
Records setting the active blend constants to c.
Definition qrhi.cpp:9654
void endExternal()
To be called once the externally added commands are recorded to the command buffer or context.
Definition qrhi.cpp:9924
void setScissor(const QRhiScissor &scissor)
Records setting the active scissor rectangle specified in scissor.
Definition qrhi.cpp:9640
void beginComputePass(QRhiResourceUpdateBatch *resourceUpdates=nullptr, BeginPassFlags flags={})
Records starting a new compute pass.
Definition qrhi.cpp:9798
void drawIndexed(quint32 indexCount, quint32 instanceCount=1, quint32 firstIndex=0, qint32 vertexOffset=0, quint32 firstInstance=0)
Records an indexed draw.
Definition qrhi.cpp:9725
void setStencilRef(quint32 refValue)
Records setting the active stencil reference value to refValue.
Definition qrhi.cpp:9668
const QRhiNativeHandles * nativeHandles()
Definition qrhi.cpp:9865
QRhiCommandBuffer(QRhiImplementation *rhi)
Definition qrhi.cpp:7979
void resourceUpdate(QRhiResourceUpdateBatch *resourceUpdates)
Sometimes committing resource updates is necessary or just more convenient without starting a render ...
Definition qrhi.cpp:9384
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:9851
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:9443
double lastCompletedGpuTime()
Definition qrhi.cpp:9990
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:9538
QPair< int, quint32 > DynamicOffset
Synonym for QPair<int, quint32>.
Definition qrhi.h:1676
void beginExternal()
To be called when the application before the application is about to enqueue commands to the current ...
Definition qrhi.cpp:9909
void debugMarkBegin(const QByteArray &name)
Records a named debug group on the command buffer with the specified name.
Definition qrhi.cpp:9746
void setViewport(const QRhiViewport &viewport)
Records setting the active viewport rectangle specified in viewport.
Definition qrhi.cpp:9621
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:7987
void debugMarkEnd()
Records the end of a debug group.
Definition qrhi.cpp:9759
QPair< QRhiBuffer *, quint32 > VertexInput
Synonym for QPair<QRhiBuffer *, quint32>.
Definition qrhi.h:1680
void endComputePass(QRhiResourceUpdateBatch *resourceUpdates=nullptr)
Records ending the current compute pass.
Definition qrhi.cpp:9809
IndexFormat
Specifies the index data type.
Definition qrhi.h:1653
void setComputePipeline(QRhiComputePipeline *ps)
Records setting a new compute pipeline ps.
Definition qrhi.cpp:9827
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:9600
void setGraphicsPipeline(QRhiGraphicsPipeline *ps)
Records setting a new graphics pipeline ps.
Definition qrhi.cpp:9480
\inmodule QtGui
Definition qrhi.h:1622
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:7865
QRhiComputePipeline(QRhiImplementation *rhi)
Definition qrhi.cpp:7873
\inmodule QtGui
\variable QRhiD3D11InitParams::enableDebugLayer
\inmodule QtGui
Definition qrhi.h:44
\inmodule QtGui
\variable QRhiGles2InitParams::format
\inmodule QtGui
Definition qrhi.h:1270
const QRhiShaderStage * cendShaderStages() const
Definition qrhi.h:1454
QRhiShaderResourceBindings * shaderResourceBindings() const
Definition qrhi.h:1461
QRhiRenderPassDescriptor * renderPassDescriptor() const
Definition qrhi.h:1464
QRhiGraphicsPipeline(QRhiImplementation *rhi)
\variable QRhiGraphicsPipeline::StencilOpState::failOp
Definition qrhi.cpp:6704
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:6712
const QRhiShaderStage * cbeginShaderStages() const
Definition qrhi.h:1453
virtual bool isClipDepthZeroToOne() const =0
bool isStencilSupportingFormat(QRhiTexture::Format format) const
Definition qrhi.cpp:8256
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:8386
virtual ~QRhiImplementation()
Definition qrhi.cpp:8024
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:8058
static const QRhiShaderResourceBinding::Data * shaderResourceBindingData(const QRhiShaderResourceBinding &binding)
Definition qrhi_p.h:220
void updateLayoutDesc(QRhiShaderResourceBindings *srb)
Definition qrhi.cpp:5384
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:8065
virtual QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags)=0
virtual void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)=0
bool sanityCheckShaderResourceBindings(QRhiShaderResourceBindings *srb)
Definition qrhi.cpp:8301
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:8445
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:8267
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:8185
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:502
static TextureStage toPassTrackerTextureStage(QRhiShaderResourceBinding::StageFlags stages)
Definition qrhi.cpp:11088
static BufferStage toPassTrackerBufferStage(QRhiShaderResourceBinding::StageFlags stages)
Definition qrhi.cpp:11069
bool isEmpty() const
Definition qrhi.cpp:10980
void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage, const UsageState &state)
Definition qrhi.cpp:10997
void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage, const UsageState &state)
Definition qrhi.cpp:11036
\inmodule QtGui
Definition qrhi.h:777
QRhiReadbackDescription()=default
Constructs an empty texture readback description.
\inmodule QtGui
Definition qrhi.h:1094
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:1096
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:4866
virtual const QRhiNativeHandles * nativeHandles()
Definition qrhi.cpp:4952
QRhiRenderPassDescriptor(QRhiImplementation *rhi)
Definition qrhi.cpp:4858
\inmodule QtGui
Definition qrhi.h:1158
QRhiRenderTarget(QRhiImplementation *rhi)
Definition qrhi.cpp:4979
QVarLengthArray< BufferOp, BUFFER_OPS_STATIC_ALLOC > bufferOps
Definition qrhi_p.h:521
bool hasOptimalCapacity() const
Definition qrhi.cpp:9351
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:9334
static const int TEXTURE_OPS_STATIC_ALLOC
Definition qrhi_p.h:524
\inmodule QtGui
Definition qrhi.h:1731
void merge(QRhiResourceUpdateBatch *other)
Copies all queued operations from the other batch into this one.
Definition qrhi.cpp:8949
void generateMips(QRhiTexture *tex)
Enqueues a mipmap generation operation for the specified texture tex.
Definition qrhi.cpp:9210
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:8991
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:9011
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:9079
void readBackTexture(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
Enqueues a texture-to-host copy operation as described by rb.
Definition qrhi.cpp:9186
void readBackBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result)
Enqueues reading back a region of the QRhiBuffer buf.
Definition qrhi.cpp:9063
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:9116
bool hasOptimalCapacity() const
Definition qrhi.cpp:8967
\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:1030
Filter
Specifies the minification, magnification, or mipmap filtering.
Definition qrhi.h:1032
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:4762
AddressMode
Specifies the addressing mode.
Definition qrhi.h:1038
QRhiSampler(QRhiImplementation *rhi, Filter magFilter_, Filter minFilter_, Filter mipmapMode_, AddressMode u_, AddressMode v_, AddressMode w_)
Definition qrhi.cpp:4749
\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:6016
static QRhiShaderResourceBinding imageLoadStore(int binding, StageFlags stage, QRhiTexture *tex, int level)
Definition qrhi.cpp:5913
bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept
Definition qrhi.cpp:6225
size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) noexcept
Definition qrhi.cpp:6235
bool isLayoutCompatible(const QRhiShaderResourceBinding &other) const
Definition qrhi.cpp:5500
static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf)
Definition qrhi.cpp:5946
static QRhiShaderResourceBinding sampledTexture(int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler)
Definition qrhi.cpp:5640
static QRhiShaderResourceBinding imageLoad(int binding, StageFlags stage, QRhiTexture *tex, int level)
Definition qrhi.cpp:5843
static QRhiShaderResourceBinding sampler(int binding, StageFlags stage, QRhiSampler *sampler)
Definition qrhi.cpp:5809
static QRhiShaderResourceBinding texture(int binding, StageFlags stage, QRhiTexture *tex)
Definition qrhi.cpp:5733
bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept
Definition qrhi.cpp:6145
static QRhiShaderResourceBinding textures(int binding, StageFlags stage, int count, QRhiTexture **tex)
Definition qrhi.cpp:5764
static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf)
Definition qrhi.cpp:6086
static QRhiShaderResourceBinding imageStore(int binding, StageFlags stage, QRhiTexture *tex, int level)
Definition qrhi.cpp:5878
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:5686
static QRhiShaderResourceBinding uniformBufferWithDynamicOffset(int binding, StageFlags stage, QRhiBuffer *buf, quint32 size)
Definition qrhi.cpp:5600
static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf)
Definition qrhi.cpp:5526
\inmodule QtGui
Definition qrhi.h:1214
bool isLayoutCompatible(const QRhiShaderResourceBindings *other) const
Definition qrhi.cpp:5348
QVarLengthArray< QRhiShaderResourceBinding, BINDING_PREALLOC > m_bindings
Definition qrhi.h:1246
QRhiShaderResourceBindings(QRhiImplementation *rhi)
Definition qrhi.cpp:5313
const QRhiShaderResourceBinding * cbeginBindings() const
Definition qrhi.h:1225
static constexpr int BINDING_PREALLOC
Definition qrhi.h:1244
QVector< quint32 > m_layoutDesc
Definition qrhi.h:1251
const QRhiShaderResourceBinding * cendBindings() const
Definition qrhi.h:1226
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:5322
\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:5058
QRhiSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain_)
Definition qrhi.cpp:5033
\inmodule QtGui
Definition qrhi.h:1549
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:7321
virtual QRhiRenderTarget * currentFrameRenderTarget()=0
QRhiSwapChain(QRhiImplementation *rhi)
Definition qrhi.cpp:7313
StereoTargetBuffer
Selects the backbuffer to use with a stereoscopic swapchain.
Definition qrhi.h:1568
virtual QRhiSwapChainHdrInfo hdrInfo()
\variable QRhiSwapChainHdrInfo::limitsType
Definition qrhi.cpp:7797
\inmodule QtGui
Definition qrhi.h:739
QRhiTextureRenderTargetDescription()=default
Constructs an empty texture render target description.
\inmodule QtGui
Definition qrhi.h:1184
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:5158
QRhiTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc_, Flags flags_)
Definition qrhi.cpp:5146
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:4420
@ ThreeDimensional
Definition qrhi.h:907
@ OneDimensional
Definition qrhi.h:910
@ TextureArray
Definition qrhi.h:909
QRhiResource::Type resourceType() const override
Definition qrhi.cpp:4431
Format
Specifies the texture format.
Definition qrhi.h:914
@ ASTC_10x8
Definition qrhi.h:959
@ ASTC_12x12
Definition qrhi.h:962
@ ASTC_8x5
Definition qrhi.h:954
@ ASTC_10x5
Definition qrhi.h:957
@ RGBA32F
Definition qrhi.h:926
@ ETC2_RGBA8
Definition qrhi.h:947
@ ASTC_5x5
Definition qrhi.h:951
@ ASTC_4x4
Definition qrhi.h:949
@ ASTC_6x6
Definition qrhi.h:953
@ ASTC_12x10
Definition qrhi.h:961
@ ETC2_RGB8
Definition qrhi.h:945
@ ASTC_5x4
Definition qrhi.h:950
@ RED_OR_ALPHA8
Definition qrhi.h:923
@ ASTC_6x5
Definition qrhi.h:952
@ ASTC_8x8
Definition qrhi.h:956
@ RGBA16F
Definition qrhi.h:925
@ RGB10A2
Definition qrhi.h:930
@ ASTC_10x6
Definition qrhi.h:958
@ ASTC_10x10
Definition qrhi.h:960
@ ETC2_RGB8A1
Definition qrhi.h:946
@ ASTC_8x6
Definition qrhi.h:955
virtual void setNativeLayout(int layout)
With some graphics APIs, such as Vulkan, integrating custom rendering code that uses the graphics API...
Definition qrhi.cpp:4516
virtual bool createFrom(NativeTexture src)
Similar to create(), except that no new native textures are created.
Definition qrhi.cpp:4487
virtual NativeTexture nativeTexture()
Definition qrhi.cpp:4454
\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:1804
QRhiBuffer * newBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size)
Definition qrhi.cpp:10508
bool isClipDepthZeroToOne() const
Definition qrhi.cpp:10069
FrameOpResult endOffscreenFrame(EndFrameFlags flags={})
Ends, submits, and waits for the offscreen frame.
Definition qrhi.cpp:10912
bool makeThreadLocalNativeContextCurrent()
With OpenGL this makes the OpenGL context current on the current thread.
Definition qrhi.cpp:10158
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags={}) const
Definition qrhi.cpp:10102
int ubufAligned(int v) const
Definition qrhi.cpp:9999
QRhiStats statistics() const
Gathers and returns statistics about the timings and allocations of graphics resources.
Definition qrhi.cpp:10456
int resourceLimit(ResourceLimit limit) const
Definition qrhi.cpp:10121
QRhiTexture * newTextureArray(QRhiTexture::Format format, int arraySize, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
Definition qrhi.cpp:10636
QMatrix4x4 clipSpaceCorrMatrix() const
Definition qrhi.cpp:10091
QThread * thread() const
Definition qrhi.cpp:8792
bool isYUpInFramebuffer() const
Definition qrhi.cpp:10030
bool isYUpInNDC() const
Definition qrhi.cpp:10044
static QRhiSwapChainProxyData updateSwapChainProxyData(Implementation impl, QWindow *window)
Generates and returns a QRhiSwapChainProxyData struct containing opaque data specific to the backend ...
Definition qrhi.cpp:8636
bool isFeatureSupported(QRhi::Feature feature) const
Definition qrhi.cpp:10110
void runCleanup()
Invokes all registered cleanup functions.
Definition qrhi.cpp:8849
QRhiShaderResourceBindings * newShaderResourceBindings()
Definition qrhi.cpp:10489
QList< int > supportedSampleCounts() const
Definition qrhi.cpp:10953
QRhiRenderBuffer * newRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount=1, QRhiRenderBuffer::Flags flags={}, QRhiTexture::Format backingFormatHint=QRhiTexture::UnknownFormat)
Definition qrhi.cpp:10535
Implementation backend() const
Definition qrhi.cpp:8651
Implementation
Describes which graphics API-specific backend gets used by a QRhi instance.
Definition qrhi.h:1806
@ Metal
Definition qrhi.h:1811
@ Vulkan
Definition qrhi.h:1808
@ Null
Definition qrhi.h:1807
@ D3D11
Definition qrhi.h:1810
@ D3D12
Definition qrhi.h:1812
@ OpenGLES2
Definition qrhi.h:1809
static int mipLevelsForSize(const QSize &size)
Definition qrhi.cpp:10008
int currentFrameSlot() const
Definition qrhi.cpp:10846
FrameOpResult beginFrame(QRhiSwapChain *swapChain, BeginFrameFlags flags={})
Starts a new frame targeting the next available buffer of swapChain.
Definition qrhi.cpp:10745
QRhi::FrameOpResult finish()
Waits for any work on the graphics queue (where applicable) to complete, then executes all deferred o...
Definition qrhi.cpp:10936
QRhiComputePipeline * newComputePipeline()
Definition qrhi.cpp:10479
QRhiSwapChain * newSwapChain()
Definition qrhi.cpp:10693
FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, BeginFrameFlags flags={})
Starts a new offscreen frame.
Definition qrhi.cpp:10893
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:10665
QRhiTextureRenderTarget * newTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags={})
Definition qrhi.cpp:10682
bool isRecordingFrame() const
Definition qrhi.cpp:10802
void removeCleanupCallback(const void *key)
Deregisters the callback with key.
Definition qrhi.cpp:8836
const char * backendName() const
Definition qrhi.cpp:8683
QRhiGraphicsPipeline * newGraphicsPipeline()
Definition qrhi.cpp:10466
static bool probe(Implementation impl, QRhiInitParams *params)
Definition qrhi.cpp:8577
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:8809
static QRhi * create(Implementation impl, QRhiInitParams *params, Flags flags={}, QRhiNativeHandles *importDevice=nullptr)
Definition qrhi.cpp:8491
QRhi()
Definition qrhi.cpp:8424
QByteArray pipelineCacheData()
Definition qrhi.cpp:10271
~QRhi()
Destructor.
Definition qrhi.cpp:8431
FrameOpResult endFrame(QRhiSwapChain *swapChain, EndFrameFlags flags={})
Ends, commits, and presents a frame that was started in the last beginFrame() on swapChain.
Definition qrhi.cpp:10780
ResourceLimit
Describes the resource limit to query.
Definition qrhi.h:1886
QRhiTexture * newTexture(QRhiTexture::Format format, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
Definition qrhi.cpp:10562
void setPipelineCacheData(const QByteArray &data)
Loads data into the pipeline cache, when applicable.
Definition qrhi.cpp:10325
QRhiDriverInfo driverInfo() const
Definition qrhi.cpp:8784
Feature
Flag values to indicate what features are supported by the backend currently in use.
Definition qrhi.h:1831
const QRhiNativeHandles * nativeHandles()
Definition qrhi.cpp:10137
QRhiResourceUpdateBatch * nextResourceUpdateBatch()
Definition qrhi.cpp:9252
static QSize sizeForMipLevel(int mipLevel, const QSize &baseLevelSize)
Definition qrhi.cpp:10017
int ubufAlignment() const
Definition qrhi.cpp:10968
FrameOpResult
Describes the result of operations that can have a soft failure.
Definition qrhi.h:1824
@ FrameOpSuccess
Definition qrhi.h:1825
bool isDeviceLost() const
Definition qrhi.cpp:10227
void releaseCachedResources()
Attempts to release resources in the backend's caches.
Definition qrhi.cpp:10175
std::function< void(QRhi *)> CleanupCallback
Definition qrhi.h:1917
@ EnableDebugMarkers
Definition qrhi.h:1816
void clear()
Definition qset.h:61
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:166
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
int qFloor(T v)
Definition qmath.h:42
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
constexpr const T & qBound(const T &min, const T &val, const T &max)
Definition qminmax.h:44
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
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:7992
static QRhiPassResourceTracker::BufferStage earlierStage(QRhiPassResourceTracker::BufferStage a, QRhiPassResourceTracker::BufferStage b)
Definition qrhi.cpp:10991
QDebug operator<<(QDebug dbg, const QRhiDepthStencilClearValue &v)
Definition qrhi.cpp:1229
static bool isImageLoadStore(QRhiPassResourceTracker::TextureAccess access)
Definition qrhi.cpp:11029
static const char * deviceTypeStr(QRhiDriverInfo::DeviceType type)
\variable QRhiDriverInfo::deviceName
Definition qrhi.cpp:8749
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:1759
DeviceType
Specifies the graphics device's type, when the information is available.
Definition qrhi.h:1760
@ IntegratedDevice
Definition qrhi.h:1762
\inmodule QtGui
Definition qrhi.h:1800
\variable QRhiReadbackResult::completed
Definition qrhi.h:800
\inmodule QtGui
\inmodule QtGui
Definition qrhi.h:1723
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:1782
\inmodule QtGui
Definition qrhi.h:1511
\inmodule QtGui
Definition qrhi.h:1544
\inmodule QtGui
Definition qrhi.h:965
Definition moc.h:23