rhi: gl: get rid of a wrapper QByteArray where a raw ptr suffices

This is a visible performance increase actually, given this is on a quite
hot chode path.

Change-Id: I165bfa0d4e490f80078551efb4bf2fe8e72d3596
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
bb10
Laszlo Agocs 2020-09-25 12:59:39 +02:00
parent 80091e0a0f
commit 63e54fbdfe
1 changed files with 2 additions and 3 deletions

View File

@ -2836,15 +2836,14 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC
}
}
QGles2Buffer *bufD = QRHI_RES(QGles2Buffer, b->u.ubuf.buf);
const QByteArray bufView = QByteArray::fromRawData(bufD->ubuf + viewOffset,
b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size);
const char *bufView = bufD->ubuf + viewOffset;
QGles2UniformDescriptionVector &uniforms(maybeGraphicsPs ? QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->uniforms
: QRHI_RES(QGles2ComputePipeline, maybeComputePs)->uniforms);
for (QGles2UniformDescription &uniform : uniforms) {
if (uniform.binding == b->binding) {
// in a uniform buffer everything is at least 4 byte aligned
// so this should not cause unaligned reads
const void *src = bufView.constData() + uniform.offset;
const void *src = bufView + uniform.offset;
if (uniform.arrayDim > 0
&& uniform.type != QShaderDescription::Float