Commit fff98e9c authored by Laszlo Agocs's avatar Laszlo Agocs

Handle zero size buffers gracefully in updates

build() handles this already but then doing an uploadStaticBuffer()
should also silently become a no-op.
parent 3e20433e
......@@ -3614,7 +3614,8 @@ void QRhiResourceUpdateBatch::merge(QRhiResourceUpdateBatch *other)
*/
void QRhiResourceUpdateBatch::updateDynamicBuffer(QRhiBuffer *buf, int offset, int size, const void *data)
{
d->dynamicBufferUpdates.append({ buf, offset, size, data });
if (size > 0)
d->dynamicBufferUpdates.append({ buf, offset, size, data });
}
/*!
......@@ -3628,7 +3629,8 @@ void QRhiResourceUpdateBatch::updateDynamicBuffer(QRhiBuffer *buf, int offset, i
*/
void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, int offset, int size, const void *data)
{
d->staticBufferUploads.append({ buf, offset, size, data });
if (size > 0)
d->staticBufferUploads.append({ buf, offset, size, data });
}
/*!
......@@ -3637,7 +3639,8 @@ void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, int offset, in
*/
void QRhiResourceUpdateBatch::uploadStaticBuffer(QRhiBuffer *buf, const void *data)
{
d->staticBufferUploads.append({ buf, 0, 0, data });
if (buf->size() > 0)
d->staticBufferUploads.append({ buf, 0, 0, data });
}
/*!
......
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