rhi: Remove readback result type alias

Change-Id: I1b14d3230ab4011506892c64ea03d5431d82a90d
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Laszlo Agocs 2023-04-03 19:27:13 +02:00
parent 33b7a3b846
commit 82112db29d
10 changed files with 17 additions and 19 deletions

View File

@ -6056,7 +6056,7 @@ void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, const void *da
A readback is asynchronous. \a result contains a callback that is invoked
when the operation has completed. The data is provided in
QRhiBufferReadbackResult::data. Upon successful completion that QByteArray
QRhiReadbackResult::data. Upon successful completion that QByteArray
will have a size equal to \a size. On failure the QByteArray will be empty.
\note Reading buffers with a usage different than QRhiBuffer::UniformBuffer
@ -6073,7 +6073,7 @@ void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, const void *da
\sa readBackTexture(), QRhi::isFeatureSupported(), QRhi::resourceLimit()
*/
void QRhiResourceUpdateBatch::readBackBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiBufferReadbackResult *result)
void QRhiResourceUpdateBatch::readBackBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result)
{
const int idx = d->activeBufferOpCount++;
if (idx < d->bufferOps.size())

View File

@ -1680,8 +1680,6 @@ struct Q_GUI_EXPORT QRhiReadbackResult
QByteArray data;
};
using QRhiBufferReadbackResult = QRhiReadbackResult;
class Q_GUI_EXPORT QRhiResourceUpdateBatch
{
public:
@ -1695,7 +1693,7 @@ public:
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, quint32 offset, quint32 size, QRhiBufferReadbackResult *result);
void readBackBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *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());

View File

@ -399,7 +399,7 @@ public:
quint32 offset;
QRhiBufferData data;
quint32 readSize;
QRhiBufferReadbackResult *result;
QRhiReadbackResult *result;
static BufferOp dynamicUpdate(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
{
@ -441,7 +441,7 @@ public:
op->data.assign(reinterpret_cast<const char *>(data), effectiveSize);
}
static BufferOp read(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiBufferReadbackResult *result)
static BufferOp read(QRhiBuffer *buf, quint32 offset, quint32 size, QRhiReadbackResult *result)
{
BufferOp op = {};
op.type = Read;

View File

@ -774,7 +774,7 @@ public:
};
QVarLengthArray<TextureReadback, 2> activeTextureReadbacks;
struct BufferReadback {
QRhiBufferReadbackResult *result;
QRhiReadbackResult *result;
quint32 byteSize;
ID3D11Buffer *stagingBuf;
};

View File

@ -3141,7 +3141,7 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
break;
case QGles2CommandBuffer::Command::GetBufferSubData:
{
QRhiBufferReadbackResult *result = cmd.args.getBufferSubData.result;
QRhiReadbackResult *result = cmd.args.getBufferSubData.result;
bindVertexIndexBufferWithStateReset(&state, f, cmd.args.getBufferSubData.target, cmd.args.getBufferSubData.buffer);
if (caps.gles) {
if (caps.properMapBuffer) {

View File

@ -414,7 +414,7 @@ struct QGles2CommandBuffer : public QRhiCommandBuffer
const void *data; // must come from retainData()
} bufferSubData;
struct {
QRhiBufferReadbackResult *result;
QRhiReadbackResult *result;
GLenum target;
GLuint buffer;
int offset;

View File

@ -211,7 +211,7 @@ struct QRhiMetalData
struct BufferReadback
{
int activeFrameSlot = -1;
QRhiBufferReadbackResult *result;
QRhiReadbackResult *result;
quint32 offset;
quint32 readSize;
id<MTLBuffer> buf;

View File

@ -456,7 +456,7 @@ void QRhiNull::resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *re
QNullBuffer *bufD = QRHI_RES(QNullBuffer, u.buf);
memcpy(bufD->data + u.offset, u.data.constData(), size_t(u.data.size()));
} else if (u.type == QRhiResourceUpdateBatchPrivate::BufferOp::Read) {
QRhiBufferReadbackResult *result = u.result;
QRhiReadbackResult *result = u.result;
result->data.resize(u.readSize);
QNullBuffer *bufD = QRHI_RES(QNullBuffer, u.buf);
memcpy(result->data.data(), bufD->data + u.offset, size_t(u.readSize));

View File

@ -918,7 +918,7 @@ public:
QVarLengthArray<TextureReadback, 2> activeTextureReadbacks;
struct BufferReadback {
int activeFrameSlot = -1;
QRhiBufferReadbackResult *result;
QRhiReadbackResult *result;
quint32 byteSize;
VkBuffer stagingBuf;
QVkAlloc stagingAlloc;

View File

@ -983,7 +983,7 @@ void tst_QRhi::resourceUpdateBatchBuffer()
batch->updateDynamicBuffer(dynamicBuffer.data(), 10, bufferSize - 10, a.constData());
batch->updateDynamicBuffer(dynamicBuffer.data(), 0, 12, b.constData());
QRhiBufferReadbackResult readResult;
QRhiReadbackResult readResult;
bool readCompleted = false;
readResult.completed = [&readCompleted] { readCompleted = true; };
batch->readBackBuffer(dynamicBuffer.data(), 5, 10, &readResult);
@ -1010,7 +1010,7 @@ void tst_QRhi::resourceUpdateBatchBuffer()
batch->uploadStaticBuffer(dynamicBuffer.data(), 10, bufferSize - 10, a.constData());
batch->uploadStaticBuffer(dynamicBuffer.data(), 0, 12, b.constData());
QRhiBufferReadbackResult readResult;
QRhiReadbackResult readResult;
bool readCompleted = false;
readResult.completed = [&readCompleted] { readCompleted = true; };
@ -3872,7 +3872,7 @@ void tst_QRhi::resourceUpdateBatchBufferTextureWithSwapchainFrames()
const char *b = "abcdefghi";
bool readCompleted = false;
QRhiBufferReadbackResult readResult;
QRhiReadbackResult readResult;
readResult.completed = [&readCompleted] { readCompleted = true; };
QRhiReadbackResult texReadResult;
texReadResult.completed = [&readCompleted] { readCompleted = true; };
@ -5937,7 +5937,7 @@ void tst_QRhi::tessellationInterfaceBlocks()
QRhiResourceUpdateBatch *readbackBatch = rhi->nextResourceUpdateBatch();
readbackBatch->readBackTexture({ texture.data() }, &readResult);
QRhiBufferReadbackResult bufferReadResult;
QRhiReadbackResult bufferReadResult;
bufferReadResult.completed = []() {};
readbackBatch->readBackBuffer(buffer.data(), 0, 1024, &bufferReadResult);
@ -6213,7 +6213,7 @@ void tst_QRhi::storageBuffer()
QVERIFY(u);
int readCompletedNotifications = 0;
QRhiBufferReadbackResult result;
QRhiReadbackResult result;
result.completed = [&readCompletedNotifications]() { readCompletedNotifications++; };
u->readBackBuffer(fromGpuBuffer.data(), 0, blocks["fromGpu"].knownSize, &result);
@ -6338,7 +6338,7 @@ void tst_QRhi::storageBuffer()
u = rhi->nextResourceUpdateBatch();
QVERIFY(u);
int readbackCompleted = 0;
QRhiBufferReadbackResult result;
QRhiReadbackResult result;
result.completed = [&readbackCompleted]() { readbackCompleted++; };
u->readBackBuffer(fromGpuBuffer.data(), 0, fromGpuBuffer->size(), &result);