diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index b269e950535..94367fbcd5b 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -1767,7 +1767,7 @@ QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription \a data can safely be destroyed or changed once this function returns. */ -QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription(const void *data, int size) +QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription(const void *data, quint32 size) : m_data(reinterpret_cast(data), size) { } @@ -2238,7 +2238,7 @@ quint64 QRhiResource::globalResourceId() const /*! \internal */ -QRhiBuffer::QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, int size_) +QRhiBuffer::QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, quint32 size_) : QRhiResource(rhi), m_type(type_), m_usage(usage_), m_size(size_) { @@ -3399,7 +3399,7 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBuffer( unexpected errors may occur. */ QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBuffer( - int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size) + int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size) { Q_ASSERT(size > 0); QRhiShaderResourceBinding b; @@ -3436,7 +3436,7 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBuffer( unexpected errors may occur. */ QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBufferWithDynamicOffset( - int binding, StageFlags stage, QRhiBuffer *buf, int size) + int binding, StageFlags stage, QRhiBuffer *buf, quint32 size) { Q_ASSERT(size > 0); QRhiShaderResourceBinding b; @@ -3762,7 +3762,7 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoad( resources present passed to QRhiCommandBuffer::setShaderResources(). */ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoad( - int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size) + int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size) { Q_ASSERT(size > 0); QRhiShaderResourceBinding b; @@ -3818,7 +3818,7 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferStore( resources present passed to QRhiCommandBuffer::setShaderResources(). */ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferStore( - int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size) + int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size) { Q_ASSERT(size > 0); QRhiShaderResourceBinding b; @@ -3874,7 +3874,7 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoadStore( resources present passed to QRhiCommandBuffer::setShaderResources(). */ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoadStore( - int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size) + int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size) { Q_ASSERT(size > 0); QRhiShaderResourceBinding b; @@ -5760,7 +5760,7 @@ bool QRhiResourceUpdateBatch::hasOptimalCapacity() const multiple native underneath can be safely ignored when using the QRhi and QRhiResourceUpdateBatch. */ -void QRhiResourceUpdateBatch::updateDynamicBuffer(QRhiBuffer *buf, int offset, int size, const void *data) +void QRhiResourceUpdateBatch::updateDynamicBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data) { if (size > 0) { const int idx = d->activeBufferOpCount++; @@ -5780,7 +5780,7 @@ void QRhiResourceUpdateBatch::updateDynamicBuffer(QRhiBuffer *buf, int offset, i are specified by \a data which must have at least \a size bytes available. \a data can safely be destroyed or changed once this function returns. */ -void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, int offset, int size, const void *data) +void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data) { if (size > 0) { const int idx = d->activeBufferOpCount++; @@ -5830,7 +5830,7 @@ void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, const void *da \sa readBackTexture(), QRhi::isFeatureSupported(), QRhi::resourceLimit() */ -void QRhiResourceUpdateBatch::readBackBuffer(QRhiBuffer *buf, int offset, int size, QRhiBufferReadbackResult *result) +void QRhiResourceUpdateBatch::readBackBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiBufferReadbackResult *result) { const int idx = d->activeBufferOpCount++; if (idx < d->bufferOps.size()) @@ -7076,7 +7076,7 @@ QRhiShaderResourceBindings *QRhi::newShaderResourceBindings() */ QRhiBuffer *QRhi::newBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, - int size) + quint32 size) { return d->createBuffer(type, usage, size); } diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index ea1e6b312d3..1d0dce97c5a 100644 --- a/src/gui/rhi/qrhi_p.h +++ b/src/gui/rhi/qrhi_p.h @@ -328,8 +328,8 @@ public: bool isLayoutCompatible(const QRhiShaderResourceBinding &other) const; static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf); - static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size); - static QRhiShaderResourceBinding uniformBufferWithDynamicOffset(int binding, StageFlags stage, QRhiBuffer *buf, int size); + static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size); + static QRhiShaderResourceBinding uniformBufferWithDynamicOffset(int binding, StageFlags stage, QRhiBuffer *buf, quint32 size); static QRhiShaderResourceBinding sampledTexture(int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler); @@ -348,11 +348,11 @@ public: static QRhiShaderResourceBinding imageLoadStore(int binding, StageFlags stage, QRhiTexture *tex, int level); static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf); - static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size); + static QRhiShaderResourceBinding bufferLoad(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size); static QRhiShaderResourceBinding bufferStore(int binding, StageFlags stage, QRhiBuffer *buf); - static QRhiShaderResourceBinding bufferStore(int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size); + static QRhiShaderResourceBinding bufferStore(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size); static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf); - static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf, int offset, int size); + static QRhiShaderResourceBinding bufferLoadStore(int binding, StageFlags stage, QRhiBuffer *buf, quint32 offset, quint32 size); struct Data { @@ -361,8 +361,8 @@ public: QRhiShaderResourceBinding::Type type; struct UniformBufferData { QRhiBuffer *buf; - int offset; - int maybeSize; + quint32 offset; + quint32 maybeSize; bool hasDynamicOffset; }; static const int MAX_TEX_SAMPLER_ARRAY_SIZE = 16; @@ -376,8 +376,8 @@ public: }; struct StorageBufferData { QRhiBuffer *buf; - int offset; - int maybeSize; + quint32 offset; + quint32 maybeSize; }; union { UniformBufferData ubuf; @@ -512,7 +512,7 @@ class Q_GUI_EXPORT QRhiTextureSubresourceUploadDescription public: QRhiTextureSubresourceUploadDescription() = default; explicit QRhiTextureSubresourceUploadDescription(const QImage &image); - QRhiTextureSubresourceUploadDescription(const void *data, int size); + QRhiTextureSubresourceUploadDescription(const void *data, quint32 size); explicit QRhiTextureSubresourceUploadDescription(const QByteArray &data); QImage image() const { return m_image; } @@ -723,8 +723,8 @@ public: UsageFlags usage() const { return m_usage; } void setUsage(UsageFlags u) { m_usage = u; } - int size() const { return m_size; } - void setSize(int sz) { m_size = sz; } + quint32 size() const { return m_size; } + void setSize(quint32 sz) { m_size = sz; } virtual bool create() = 0; @@ -734,10 +734,10 @@ public: virtual void endFullDynamicBufferUpdateForCurrentFrame(); protected: - QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, int size_); + QRhiBuffer(QRhiImplementation *rhi, Type type_, UsageFlags usage_, quint32 size_); Type m_type; UsageFlags m_usage; - int m_size; + quint32 m_size; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QRhiBuffer::UsageFlags) @@ -1542,10 +1542,10 @@ public: void merge(QRhiResourceUpdateBatch *other); bool hasOptimalCapacity() const; - void updateDynamicBuffer(QRhiBuffer *buf, int offset, int size, const void *data); - void uploadStaticBuffer(QRhiBuffer *buf, int offset, int size, const void *data); + void updateDynamicBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data); + void uploadStaticBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data); void uploadStaticBuffer(QRhiBuffer *buf, const void *data); - void readBackBuffer(QRhiBuffer *buf, int offset, int size, QRhiBufferReadbackResult *result); + void readBackBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiBufferReadbackResult *result); void uploadTexture(QRhiTexture *tex, const QRhiTextureUploadDescription &desc); void uploadTexture(QRhiTexture *tex, const QImage &image); void copyTexture(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc = QRhiTextureCopyDescription()); @@ -1719,7 +1719,7 @@ public: QRhiBuffer *newBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, - int size); + quint32 size); QRhiRenderBuffer *newRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, diff --git a/src/gui/rhi/qrhi_p_p.h b/src/gui/rhi/qrhi_p_p.h index 516536575c3..d7490f07c0b 100644 --- a/src/gui/rhi/qrhi_p_p.h +++ b/src/gui/rhi/qrhi_p_p.h @@ -43,7 +43,7 @@ public: virtual QRhiShaderResourceBindings *createShaderResourceBindings() = 0; virtual QRhiBuffer *createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, - int size) = 0; + quint32 size) = 0; virtual QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, @@ -288,10 +288,10 @@ struct QRhiBufferDataPrivate QRhiBufferDataPrivate() { } ~QRhiBufferDataPrivate() { delete[] largeData; } int ref = 1; - int size = 0; - int largeAlloc = 0; + quint32 size = 0; + quint32 largeAlloc = 0; char *largeData = nullptr; - static constexpr int SMALL_DATA_SIZE = 1024; + static constexpr quint32 SMALL_DATA_SIZE = 1024; char data[SMALL_DATA_SIZE]; }; @@ -326,11 +326,11 @@ public: { return d->size <= QRhiBufferDataPrivate::SMALL_DATA_SIZE ? d->data : d->largeData; } - int size() const + quint32 size() const { return d->size; } - void assign(const char *s, int size) + void assign(const char *s, quint32 size) { if (!d) { d = new QRhiBufferDataPrivate; @@ -367,12 +367,12 @@ public: }; Type type; QRhiBuffer *buf; - int offset; + quint32 offset; QRhiBufferData data; - int readSize; + quint32 readSize; QRhiBufferReadbackResult *result; - static BufferOp dynamicUpdate(QRhiBuffer *buf, int offset, int size, const void *data) + static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data) { BufferOp op = {}; op.type = DynamicUpdate; @@ -383,7 +383,7 @@ public: return op; } - static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, int offset, int size, const void *data) + static void changeToDynamicUpdate(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data) { op->type = DynamicUpdate; op->buf = buf; @@ -392,7 +392,7 @@ public: op->data.assign(reinterpret_cast(data), effectiveSize); } - static BufferOp staticUpload(QRhiBuffer *buf, int offset, int size, const void *data) + static BufferOp staticUpload(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data) { BufferOp op = {}; op.type = StaticUpload; @@ -403,7 +403,7 @@ public: return op; } - static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, int offset, int size, const void *data) + static void changeToStaticUpload(BufferOp *op, QRhiBuffer *buf, quint32 offset, quint32 size, const void *data) { op->type = StaticUpload; op->buf = buf; @@ -412,7 +412,7 @@ public: op->data.assign(reinterpret_cast(data), effectiveSize); } - static BufferOp read(QRhiBuffer *buf, int offset, int size, QRhiBufferReadbackResult *result) + static BufferOp read(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiBufferReadbackResult *result) { BufferOp op = {}; op.type = Read; diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index 4a5c9093920..3b96b295195 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -435,7 +435,7 @@ QRhiSwapChain *QRhiD3D11::createSwapChain() return new QD3D11SwapChain(this); } -QRhiBuffer *QRhiD3D11::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size) +QRhiBuffer *QRhiD3D11::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) { return new QD3D11Buffer(this, type, usage, size); } @@ -1000,8 +1000,8 @@ void QRhiD3D11::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind for (int i = 0; i < dynamicOffsetCount; ++i) { const QRhiCommandBuffer::DynamicOffset &dynOfs(dynamicOffsets[i]); const uint binding = uint(dynOfs.first); - Q_ASSERT(aligned(dynOfs.second, quint32(256)) == dynOfs.second); - const uint offsetInConstants = dynOfs.second / 16; + Q_ASSERT(aligned(dynOfs.second, 256u) == dynOfs.second); + const quint32 offsetInConstants = dynOfs.second / 16; *p++ = binding; *p++ = offsetInConstants; } @@ -1628,10 +1628,10 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate // since the ID3D11Buffer's size is rounded up to be a multiple of 256 // while the data we have has the original size. D3D11_BOX box; - box.left = UINT(u.offset); + box.left = u.offset; box.top = box.front = 0; box.back = box.bottom = 1; - box.right = UINT(u.offset + u.data.size()); // no -1: right, bottom, back are exclusive, see D3D11_BOX doc + box.right = u.offset + u.data.size(); // no -1: right, bottom, back are exclusive, see D3D11_BOX doc cmd.args.updateSubRes.hasDstBox = true; cmd.args.updateSubRes.dstBox = box; } else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::Read) { @@ -1666,10 +1666,10 @@ void QRhiD3D11::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate cmd.args.copySubRes.srcSubRes = 0; cmd.args.copySubRes.hasSrcBox = true; D3D11_BOX box; - box.left = UINT(u.offset); + box.left = u.offset; box.top = box.front = 0; box.back = box.bottom = 1; - box.right = UINT(u.offset + u.readSize); + box.right = u.offset + u.readSize; cmd.args.copySubRes.srcBox = box; activeBufferReadbacks.append(readback); @@ -2165,7 +2165,7 @@ void QRhiD3D11::updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD, case QRhiShaderResourceBinding::UniformBuffer: { QD3D11Buffer *bufD = QRHI_RES(QD3D11Buffer, b->u.ubuf.buf); - Q_ASSERT(aligned(b->u.ubuf.offset, 256) == b->u.ubuf.offset); + Q_ASSERT(aligned(b->u.ubuf.offset, 256u) == b->u.ubuf.offset); bd.ubuf.id = bufD->m_id; bd.ubuf.generation = bufD->generation; // Dynamic ubuf offsets are not considered here, those are baked in @@ -2174,11 +2174,11 @@ void QRhiD3D11::updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD, // Metal) are different in this respect since those do not store // per-srb vsubufoffsets etc. data so life's a bit easier for them. // But here we have to defer baking in the dynamic offset. - const uint offsetInConstants = uint(b->u.ubuf.offset) / 16; + const quint32 offsetInConstants = b->u.ubuf.offset / 16; // size must be 16 mult. (in constants, i.e. multiple of 256 bytes). // We can round up if needed since the buffers's actual size // (ByteWidth) is always a multiple of 256. - const uint sizeInConstants = uint(aligned(b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size, 256) / 16); + const quint32 sizeInConstants = aligned(b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size, 256u) / 16; if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) { QPair nativeBinding = mapBinding(b->binding, RBM_VERTEX, nativeResourceBindingMaps); if (nativeBinding.first >= 0) @@ -2378,7 +2378,7 @@ void QRhiD3D11::executeBufferHostWrites(QD3D11Buffer *bufD) D3D11_MAPPED_SUBRESOURCE mp; HRESULT hr = context->Map(bufD->buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mp); if (SUCCEEDED(hr)) { - memcpy(mp.pData, bufD->dynBuf, size_t(bufD->m_size)); + memcpy(mp.pData, bufD->dynBuf, bufD->m_size); context->Unmap(bufD->buffer, 0); } else { qWarning("Failed to map buffer: %s", qPrintable(comErrorMessage(hr))); @@ -2814,7 +2814,7 @@ void QRhiD3D11::executeCommandBuffer(QD3D11CommandBuffer *cbD, QD3D11SwapChain * } } -QD3D11Buffer::QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size) +QD3D11Buffer::QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size) : QRhiBuffer(rhi, type, usage, size) { } @@ -2874,12 +2874,12 @@ bool QD3D11Buffer::create() return false; } - const int nonZeroSize = m_size <= 0 ? 256 : m_size; - const int roundedSize = aligned(nonZeroSize, m_usage.testFlag(QRhiBuffer::UniformBuffer) ? 256 : 4); + const quint32 nonZeroSize = m_size <= 0 ? 256 : m_size; + const quint32 roundedSize = aligned(nonZeroSize, m_usage.testFlag(QRhiBuffer::UniformBuffer) ? 256u : 4u); D3D11_BUFFER_DESC desc; memset(&desc, 0, sizeof(desc)); - desc.ByteWidth = UINT(roundedSize); + desc.ByteWidth = roundedSize; desc.Usage = m_type == Dynamic ? D3D11_USAGE_DYNAMIC : D3D11_USAGE_DEFAULT; desc.BindFlags = toD3DBufferUsage(m_usage); desc.CPUAccessFlags = m_type == Dynamic ? D3D11_CPU_ACCESS_WRITE : 0; @@ -2950,7 +2950,7 @@ ID3D11UnorderedAccessView *QD3D11Buffer::unorderedAccessView() desc.Format = DXGI_FORMAT_R32_TYPELESS; desc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER; desc.Buffer.FirstElement = 0; - desc.Buffer.NumElements = UINT(aligned(m_size, 4) / 4); + desc.Buffer.NumElements = aligned(m_size, 4u) / 4; desc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_RAW; QRHI_RES_RHI(QRhiD3D11); diff --git a/src/gui/rhi/qrhid3d11_p_p.h b/src/gui/rhi/qrhid3d11_p_p.h index 3dcaf209284..46e8d658f3b 100644 --- a/src/gui/rhi/qrhid3d11_p_p.h +++ b/src/gui/rhi/qrhid3d11_p_p.h @@ -27,7 +27,7 @@ QT_BEGIN_NAMESPACE struct QD3D11Buffer : public QRhiBuffer { - QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size); + QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size); ~QD3D11Buffer(); void destroy() override; bool create() override; @@ -566,7 +566,7 @@ public: QRhiShaderResourceBindings *createShaderResourceBindings() override; QRhiBuffer *createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, - int size) override; + quint32 size) override; QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 11f56b945e5..7cc2a01ef7b 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -982,7 +982,7 @@ QRhiSwapChain *QRhiGles2::createSwapChain() return new QGles2SwapChain(this); } -QRhiBuffer *QRhiGles2::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size) +QRhiBuffer *QRhiGles2::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) { return new QGles2Buffer(this, type, usage, size); } @@ -4680,7 +4680,7 @@ void QRhiGles2::trySaveToPipelineCache(GLuint program, const QByteArray &cacheKe } } -QGles2Buffer::QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size) +QGles2Buffer::QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size) : QRhiBuffer(rhi, type, usage, size) { } diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h index 7a1576f0c7c..9efa659863f 100644 --- a/src/gui/rhi/qrhigles2_p_p.h +++ b/src/gui/rhi/qrhigles2_p_p.h @@ -30,7 +30,7 @@ class QOpenGLExtensions; struct QGles2Buffer : public QRhiBuffer { - QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size); + QGles2Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size); ~QGles2Buffer(); void destroy() override; bool create() override; @@ -38,7 +38,7 @@ struct QGles2Buffer : public QRhiBuffer char *beginFullDynamicBufferUpdateForCurrentFrame() override; void endFullDynamicBufferUpdateForCurrentFrame() override; - int nonZeroSize = 0; + quint32 nonZeroSize = 0; GLuint buffer = 0; GLenum targetForDataOps; QByteArray data; @@ -232,8 +232,8 @@ struct QGles2UniformDescription QShaderDescription::VariableType type; int glslLocation; int binding; - uint offset; - int size; + quint32 offset; + quint32 size; int arrayDim; }; @@ -717,7 +717,7 @@ public: QRhiShaderResourceBindings *createShaderResourceBindings() override; QRhiBuffer *createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, - int size) override; + quint32 size) override; QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index 1a9ae651a37..ed416feb7c1 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -192,7 +192,7 @@ struct QMetalBufferData bool slotted; id buf[QMTL_FRAMES_IN_FLIGHT]; struct BufferUpdate { - int offset; + quint32 offset; QRhiBufferData data; }; QVarLengthArray pendingUpdates[QMTL_FRAMES_IN_FLIGHT]; @@ -472,7 +472,7 @@ QRhiSwapChain *QRhiMetal::createSwapChain() return new QMetalSwapChain(this); } -QRhiBuffer *QRhiMetal::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size) +QRhiBuffer *QRhiMetal::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) { return new QMetalBuffer(this, type, usage, size); } @@ -772,7 +772,7 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD struct Buffer { int nativeBinding; id mtlbuf; - uint offset; + quint32 offset; }; struct Texture { int nativeBinding; @@ -799,7 +799,7 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD { QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, b->u.ubuf.buf); id mtlbuf = bufD->d->buf[bufD->d->slotted ? currentFrameSlot : 0]; - uint offset = uint(b->u.ubuf.offset); + quint32 offset = b->u.ubuf.offset; for (int i = 0; i < dynamicOffsetCount; ++i) { const QRhiCommandBuffer::DynamicOffset &dynOfs(dynamicOffsets[i]); if (dynOfs.first == b->binding) { @@ -895,7 +895,7 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD { QMetalBuffer *bufD = QRHI_RES(QMetalBuffer, b->u.sbuf.buf); id mtlbuf = bufD->d->buf[0]; - uint offset = uint(b->u.sbuf.offset); + quint32 offset = b->u.sbuf.offset; if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) { const int nativeBinding = mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Buffer); if (nativeBinding >= 0) @@ -1365,7 +1365,7 @@ void QRhiMetal::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, return; const quint32 indexOffset = cbD->currentIndexOffset + firstIndex * (cbD->currentIndexFormat == QRhiCommandBuffer::IndexUInt16 ? 2 : 4); - Q_ASSERT(indexOffset == aligned(indexOffset, 4)); + Q_ASSERT(indexOffset == aligned(indexOffset, 4u)); QMetalBuffer *ibufD = QRHI_RES(QMetalBuffer, cbD->currentIndexBuffer); id mtlbuf = ibufD->d->buf[ibufD->d->slotted ? currentFrameSlot : 0]; @@ -1971,17 +1971,17 @@ void QRhiMetal::executeBufferHostWritesForSlot(QMetalBuffer *bufD, int slot) return; void *p = [bufD->d->buf[slot] contents]; - int changeBegin = -1; - int changeEnd = -1; + quint32 changeBegin = UINT32_MAX; + quint32 changeEnd = 0; for (const QMetalBufferData::BufferUpdate &u : qAsConst(bufD->d->pendingUpdates[slot])) { memcpy(static_cast(p) + u.offset, u.data.constData(), size_t(u.data.size())); - if (changeBegin == -1 || u.offset < changeBegin) + if (u.offset < changeBegin) changeBegin = u.offset; - if (changeEnd == -1 || u.offset + u.data.size() > changeEnd) + if (u.offset + u.data.size() > changeEnd) changeEnd = u.offset + u.data.size(); } #ifdef Q_OS_MACOS - if (changeBegin >= 0 && bufD->d->managed) + if (changeBegin < UINT32_MAX && changeBegin < changeEnd && bufD->d->managed) [bufD->d->buf[slot] didModifyRange: NSMakeRange(NSUInteger(changeBegin), NSUInteger(changeEnd - changeBegin))]; #endif @@ -2254,7 +2254,7 @@ void QRhiMetal::finishActiveReadbacks(bool forced) f(); } -QMetalBuffer::QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size) +QMetalBuffer::QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size) : QRhiBuffer(rhi, type, usage, size), d(new QMetalBufferData) { @@ -2300,8 +2300,8 @@ bool QMetalBuffer::create() return false; } - const uint nonZeroSize = m_size <= 0 ? 256 : uint(m_size); - const uint roundedSize = m_usage.testFlag(QRhiBuffer::UniformBuffer) ? aligned(nonZeroSize, 256) : nonZeroSize; + const quint32 nonZeroSize = m_size <= 0 ? 256 : m_size; + const quint32 roundedSize = m_usage.testFlag(QRhiBuffer::UniformBuffer) ? aligned(nonZeroSize, 256u) : nonZeroSize; d->managed = false; MTLResourceOptions opts = MTLResourceStorageModeShared; diff --git a/src/gui/rhi/qrhimetal_p_p.h b/src/gui/rhi/qrhimetal_p_p.h index 6ac91159e98..6694d3b8097 100644 --- a/src/gui/rhi/qrhimetal_p_p.h +++ b/src/gui/rhi/qrhimetal_p_p.h @@ -28,7 +28,7 @@ struct QMetalBufferData; struct QMetalBuffer : public QRhiBuffer { - QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size); + QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size); ~QMetalBuffer(); void destroy() override; bool create() override; @@ -327,7 +327,7 @@ public: QRhiShaderResourceBindings *createShaderResourceBindings() override; QRhiBuffer *createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, - int size) override; + quint32 size) override; QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, diff --git a/src/gui/rhi/qrhinull.cpp b/src/gui/rhi/qrhinull.cpp index bd66f33c831..b20a0944004 100644 --- a/src/gui/rhi/qrhinull.cpp +++ b/src/gui/rhi/qrhinull.cpp @@ -59,7 +59,7 @@ QRhiSwapChain *QRhiNull::createSwapChain() return new QNullSwapChain(this); } -QRhiBuffer *QRhiNull::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size) +QRhiBuffer *QRhiNull::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) { return new QNullBuffer(this, type, usage, size); } @@ -550,7 +550,7 @@ void QRhiNull::endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *re resourceUpdate(cb, resourceUpdates); } -QNullBuffer::QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size) +QNullBuffer::QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size) : QRhiBuffer(rhi, type, usage, size) { } diff --git a/src/gui/rhi/qrhinull_p_p.h b/src/gui/rhi/qrhinull_p_p.h index a6ec4752c5d..2ace5a36b6a 100644 --- a/src/gui/rhi/qrhinull_p_p.h +++ b/src/gui/rhi/qrhinull_p_p.h @@ -22,7 +22,7 @@ QT_BEGIN_NAMESPACE struct QNullBuffer : public QRhiBuffer { - QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size); + QNullBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size); ~QNullBuffer(); void destroy() override; bool create() override; @@ -183,7 +183,7 @@ public: QRhiShaderResourceBindings *createShaderResourceBindings() override; QRhiBuffer *createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, - int size) override; + quint32 size) override; QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 72e32fd01a9..b1fc8d222c2 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -2668,8 +2668,8 @@ void QRhiVulkan::updateShaderResourceBindings(QRhiShaderResourceBindings *srb, i bd.ubuf.generation = bufD->generation; VkDescriptorBufferInfo bufInfo; bufInfo.buffer = bufD->m_type == QRhiBuffer::Dynamic ? bufD->buffers[frameSlot] : bufD->buffers[0]; - bufInfo.offset = VkDeviceSize(b->u.ubuf.offset); - bufInfo.range = VkDeviceSize(b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size); + bufInfo.offset = b->u.ubuf.offset; + bufInfo.range = b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size; // be nice and assert when we know the vulkan device would die a horrible death due to non-aligned reads Q_ASSERT(aligned(bufInfo.offset, ubufAlign) == bufInfo.offset); bufferInfoIndex = bufferInfos.count(); @@ -2764,8 +2764,8 @@ void QRhiVulkan::updateShaderResourceBindings(QRhiShaderResourceBindings *srb, i bd.sbuf.generation = bufD->generation; VkDescriptorBufferInfo bufInfo; bufInfo.buffer = bufD->m_type == QRhiBuffer::Dynamic ? bufD->buffers[frameSlot] : bufD->buffers[0]; - bufInfo.offset = VkDeviceSize(b->u.ubuf.offset); - bufInfo.range = VkDeviceSize(b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size); + bufInfo.offset = b->u.ubuf.offset; + bufInfo.range = b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size; bufferInfoIndex = bufferInfos.count(); bufferInfos.append(bufInfo); } @@ -3089,7 +3089,7 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; // must cover the entire buffer - this way multiple, partial updates per frame // are supported even when the staging buffer is reused (Static) - bufferInfo.size = VkDeviceSize(bufD->m_size); + bufferInfo.size = bufD->m_size; bufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT; VmaAllocationCreateInfo allocInfo; @@ -3102,7 +3102,7 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat if (err == VK_SUCCESS) { bufD->stagingAllocations[currentFrameSlot] = allocation; } else { - qWarning("Failed to create staging buffer of size %d: %d", bufD->m_size, err); + qWarning("Failed to create staging buffer of size %u: %d", bufD->m_size, err); continue; } } @@ -3114,18 +3114,18 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat qWarning("Failed to map buffer: %d", err); continue; } - memcpy(static_cast(p) + u.offset, u.data.constData(), size_t(u.data.size())); + memcpy(static_cast(p) + u.offset, u.data.constData(), u.data.size()); vmaUnmapMemory(toVmaAllocator(allocator), a); - vmaFlushAllocation(toVmaAllocator(allocator), a, VkDeviceSize(u.offset), VkDeviceSize(u.data.size())); + vmaFlushAllocation(toVmaAllocator(allocator), a, u.offset, u.data.size()); trackedBufferBarrier(cbD, bufD, 0, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT); VkBufferCopy copyInfo; memset(©Info, 0, sizeof(copyInfo)); - copyInfo.srcOffset = VkDeviceSize(u.offset); - copyInfo.dstOffset = VkDeviceSize(u.offset); - copyInfo.size = VkDeviceSize(u.data.size()); + copyInfo.srcOffset = u.offset; + copyInfo.dstOffset = u.offset; + copyInfo.size = u.data.size(); QVkCommandBuffer::Command &cmd(cbD->commands.get()); cmd.cmd = QVkCommandBuffer::Command::CopyBuffer; @@ -3161,7 +3161,7 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat VkResult err = vmaMapMemory(toVmaAllocator(allocator), a, &p); if (err == VK_SUCCESS) { u.result->data.resize(u.readSize); - memcpy(u.result->data.data(), reinterpret_cast(p) + u.offset, size_t(u.readSize)); + memcpy(u.result->data.data(), reinterpret_cast(p) + u.offset, u.readSize); vmaUnmapMemory(toVmaAllocator(allocator), a); } if (u.result->completed) @@ -3181,7 +3181,7 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat VkBufferCreateInfo bufferInfo; memset(&bufferInfo, 0, sizeof(bufferInfo)); bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; - bufferInfo.size = VkDeviceSize(readback.byteSize); + bufferInfo.size = readback.byteSize; bufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT; VmaAllocationCreateInfo allocInfo; @@ -3201,8 +3201,8 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat VkBufferCopy copyInfo; memset(©Info, 0, sizeof(copyInfo)); - copyInfo.srcOffset = VkDeviceSize(u.offset); - copyInfo.size = VkDeviceSize(u.readSize); + copyInfo.srcOffset = u.offset; + copyInfo.size = u.readSize; QVkCommandBuffer::Command &cmd(cbD->commands.get()); cmd.cmd = QVkCommandBuffer::Command::CopyBuffer; @@ -3573,18 +3573,18 @@ void QRhiVulkan::executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot) qWarning("Failed to map buffer: %d", err); return; } - int changeBegin = -1; - int changeEnd = -1; + quint32 changeBegin = UINT32_MAX; + quint32 changeEnd = 0; for (const QVkBuffer::DynamicUpdate &u : qAsConst(bufD->pendingDynamicUpdates[slot])) { - memcpy(static_cast(p) + u.offset, u.data.constData(), size_t(u.data.size())); - if (changeBegin == -1 || u.offset < changeBegin) + memcpy(static_cast(p) + u.offset, u.data.constData(), u.data.size()); + if (u.offset < changeBegin) changeBegin = u.offset; - if (changeEnd == -1 || u.offset + u.data.size() > changeEnd) + if (u.offset + u.data.size() > changeEnd) changeEnd = u.offset + u.data.size(); } vmaUnmapMemory(toVmaAllocator(allocator), a); - if (changeBegin >= 0) - vmaFlushAllocation(toVmaAllocator(allocator), a, VkDeviceSize(changeBegin), VkDeviceSize(changeEnd - changeBegin)); + if (changeBegin < UINT32_MAX && changeBegin < changeEnd) + vmaFlushAllocation(toVmaAllocator(allocator), a, changeBegin, changeEnd - changeBegin); bufD->pendingDynamicUpdates[slot].clear(); } @@ -3712,7 +3712,7 @@ void QRhiVulkan::finishActiveReadbacks(bool forced) VkResult err = vmaMapMemory(toVmaAllocator(allocator), a, &p); if (err == VK_SUCCESS && p) { readback.result->data.resize(readback.byteSize); - memcpy(readback.result->data.data(), p, size_t(readback.byteSize)); + memcpy(readback.result->data.data(), p, readback.byteSize); vmaUnmapMemory(toVmaAllocator(allocator), a); } else { qWarning("Failed to map buffer readback buffer of size %d: %d", readback.byteSize, err); @@ -4159,7 +4159,7 @@ QRhiSwapChain *QRhiVulkan::createSwapChain() return new QVkSwapChain(this); } -QRhiBuffer *QRhiVulkan::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, int size) +QRhiBuffer *QRhiVulkan::createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) { return new QVkBuffer(this, type, usage, size); } @@ -5575,7 +5575,7 @@ static inline VkCompareOp toVkTextureCompareOp(QRhiSampler::CompareOp op) } } -QVkBuffer::QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size) +QVkBuffer::QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size) : QRhiBuffer(rhi, type, usage, size) { for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) { @@ -5631,12 +5631,12 @@ bool QVkBuffer::create() return false; } - const int nonZeroSize = m_size <= 0 ? 256 : m_size; + const quint32 nonZeroSize = m_size <= 0 ? 256 : m_size; VkBufferCreateInfo bufferInfo; memset(&bufferInfo, 0, sizeof(bufferInfo)); bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; - bufferInfo.size = uint32_t(nonZeroSize); + bufferInfo.size = nonZeroSize; bufferInfo.usage = toVkBufferUsage(m_usage); VmaAllocationCreateInfo allocInfo; diff --git a/src/gui/rhi/qrhivulkan_p_p.h b/src/gui/rhi/qrhivulkan_p_p.h index ad3c6bc05bf..940cec7a580 100644 --- a/src/gui/rhi/qrhivulkan_p_p.h +++ b/src/gui/rhi/qrhivulkan_p_p.h @@ -39,7 +39,7 @@ typedef void * QVkAllocator; struct QVkBuffer : public QRhiBuffer { - QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size); + QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size); ~QVkBuffer(); void destroy() override; bool create() override; @@ -50,7 +50,7 @@ struct QVkBuffer : public QRhiBuffer VkBuffer buffers[QVK_FRAMES_IN_FLIGHT]; QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT]; struct DynamicUpdate { - int offset; + quint32 offset; QRhiBufferData data; }; QVarLengthArray pendingDynamicUpdates[QVK_FRAMES_IN_FLIGHT]; @@ -640,7 +640,7 @@ public: QRhiShaderResourceBindings *createShaderResourceBindings() override; QRhiBuffer *createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, - int size) override; + quint32 size) override; QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, @@ -913,7 +913,7 @@ public: struct BufferReadback { int activeFrameSlot = -1; QRhiBufferReadbackResult *result; - int byteSize; + quint32 byteSize; VkBuffer stagingBuf; QVkAlloc stagingAlloc; }; diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp index 1c15c81eb8a..2b4bf4a9715 100644 --- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp +++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp @@ -1051,7 +1051,7 @@ void tst_QRhi::resourceUpdateBatchRGBATextureUpload() QRhiResourceUpdateBatch *batch = rhi->nextResourceUpdateBatch(); - QRhiTextureUploadEntry upload(0, 0, { image.constBits(), int(image.sizeInBytes()) }); + QRhiTextureUploadEntry upload(0, 0, { image.constBits(), quint32(image.sizeInBytes()) }); QRhiTextureUploadDescription uploadDesc(upload); batch->uploadTexture(texture.data(), uploadDesc); @@ -1139,8 +1139,8 @@ void tst_QRhi::resourceUpdateBatchRGBATextureUpload() // SourceTopLeft is not supported for non-QImage-based uploads. const QImage im = image.copy(QRect(greenRectPos, copySize)); QRhiTextureSubresourceUploadDescription desc; - desc.setData(QByteArray::fromRawData(reinterpret_cast(im.constBits()), - int(im.sizeInBytes()))); + desc.setData(QByteArray::fromRawData(reinterpret_cast(im.constBits()), im.sizeInBytes())); + desc.setSourceSize(copySize); desc.setDestinationTopLeft(QPoint(gap, gap)); diff --git a/tests/manual/rhi/compressedtexture_bc1_subupload/compressedtexture_bc1_subupload.cpp b/tests/manual/rhi/compressedtexture_bc1_subupload/compressedtexture_bc1_subupload.cpp index d719bb7a20e..a916cd77421 100644 --- a/tests/manual/rhi/compressedtexture_bc1_subupload/compressedtexture_bc1_subupload.cpp +++ b/tests/manual/rhi/compressedtexture_bc1_subupload/compressedtexture_bc1_subupload.cpp @@ -123,7 +123,7 @@ void Window::customRender() } if (!d.compressedData.isEmpty()) { { - QRhiTextureUploadDescription desc({ 0, 0, { d.compressedData[0].constData(), int(d.compressedData[0].size()) } }); + QRhiTextureUploadDescription desc({ 0, 0, { d.compressedData[0].constData(), quint32(d.compressedData[0].size()) } }); u->uploadTexture(d.tex, desc); d.compressedData.clear(); } diff --git a/tests/manual/rhi/floattexture/floattexture.cpp b/tests/manual/rhi/floattexture/floattexture.cpp index 8996b86b74a..d580f933d91 100644 --- a/tests/manual/rhi/floattexture/floattexture.cpp +++ b/tests/manual/rhi/floattexture/floattexture.cpp @@ -242,7 +242,7 @@ void Window::customInit() qint32 flip = 1; d.initialUpdates->updateDynamicBuffer(d.ubuf, 64, 4, &flip); - QRhiTextureUploadDescription desc({ 0, 0, { floatData.constData(), int(floatData.size()) } }); + QRhiTextureUploadDescription desc({ 0, 0, { floatData.constData(), quint32(floatData.size()) } }); d.initialUpdates->uploadTexture(d.tex, desc); }