Commit 2db1c14c authored by Laszlo Agocs's avatar Laszlo Agocs

Add a way to combine to res.update batches

parent 085a3bfe
......@@ -420,6 +420,11 @@ void QRhiResourceUpdateBatch::release()
d->free();
}
void QRhiResourceUpdateBatch::merge(QRhiResourceUpdateBatch *other)
{
d->merge(other->d);
}
void QRhiResourceUpdateBatch::updateDynamicBuffer(QRhiBuffer *buf, int offset, int size, const void *data)
{
d->dynamicBufferUpdates.append({ buf, offset, size, data });
......@@ -487,6 +492,14 @@ void QRhiResourceUpdateBatchPrivate::free()
poolIndex = -1;
}
void QRhiResourceUpdateBatchPrivate::merge(QRhiResourceUpdateBatchPrivate *other)
{
dynamicBufferUpdates += other->dynamicBufferUpdates;
staticBufferUploads += other->staticBufferUploads;
textureUploads += other->textureUploads;
texturePrepares += other->texturePrepares;
}
int QRhi::ubufAligned(int v) const
{
const int byteAlign = ubufAlignment();
......
......@@ -267,6 +267,8 @@ struct Q_RHI_EXPORT QRhiTextureUploadDescription
MipLevel(const QByteArray &compressedData_) : compressedData(compressedData_) { }
QImage image;
QByteArray compressedData;
QPointF topLeft; // (0, 0) by default
QSizeF size; // empty = entire image
};
Layer() { }
Layer(const QVector<MipLevel> &mipImages_) : mipImages(mipImages_) { }
......@@ -858,6 +860,12 @@ public:
// Puts the batch back to the pool without any processing.
void release();
// Applications do not have to defer all upload preparation to the first
// frame: an update batch can be prepared in advance during initialization,
// and afterwards, if needed, merged into another that is then submitted to
// beginPass(). (nb the one we merged from must be release()'d manually)
void merge(QRhiResourceUpdateBatch *other);
// None of these execute anything. Deferred to beginPass. What exactly then
// happens underneath is hidden from the applications.
void updateDynamicBuffer(QRhiBuffer *buf, int offset, int size, const void *data);
......
......@@ -188,6 +188,7 @@ struct QRhiResourceUpdateBatchPrivate
int poolIndex = -1;
void free();
void merge(QRhiResourceUpdateBatchPrivate *other);
static QRhiResourceUpdateBatchPrivate *get(QRhiResourceUpdateBatch *b) { return b->d; }
};
......
vk, d3d, gl, mtl: tex upload with rect
copyimage (color, with rect?, no resolve or transforms here)
mtl: rhi without a window, offscreen frame
mtl: readback (tex, backbuffer)
gl, mtl: compressed textures
......@@ -13,7 +15,6 @@ test cubemap face as target
face cubemap readback? (test vk/d3d, impl for gl)
cbuffer alignment rules - some things fail to translate (to hlsl e.g. with structs), which is fine but how to mitigate
resource import/export, what's the co-op story?
copyimage (color and ds, no resolve or transforms here)
does reading back an msaa swapchain buffer work?
msaa offscreen (msaa texture. no readback.)
resolveimage (color and ds, only to resolve samples)
......@@ -46,13 +47,15 @@ vk: subpasses?
more tex: 3d, array?
vk compressed tex: could it consume a complete ktx without any memcpys?
multi-buffer (region) readback?
depth readback?
depth readback
copy image depth
shadertools:
dxc for d3d as an alternative to fxc?
hlsl -> dxc -> spirv -> spirv-cross hmmm...
+++ done
res upd batch combine
gl: offscreen frame, readback
d3d: readback
d3d: offscreen frame
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment