From 1b33ee95e5c6e5e27f732fd273920861fdae486a Mon Sep 17 00:00:00 2001 From: Jonas Karlsson Date: Wed, 27 May 2020 12:34:29 +0200 Subject: [PATCH] Use QByteArray instead of QString Since the variable names in QShaderDescription are later compared to QByteArrays we can gain some performance from not having to convert them to QByteArrays later. Task-Id: QTBUG-83706 Change-Id: Iaf80d0966f45cbb09e7c1000b7854bc488e57bb3 Reviewed-by: Laszlo Agocs --- src/gui/rhi/qrhigles2.cpp | 21 +++-- src/gui/rhi/qshaderdescription.cpp | 93 +++++++++++++--------- src/gui/rhi/qshaderdescription_p.h | 14 ++-- tests/auto/gui/rhi/qshader/tst_qshader.cpp | 38 ++++----- 4 files changed, 92 insertions(+), 74 deletions(-) diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index b59e6d98b1..ebe66f302b 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -3378,17 +3378,17 @@ void QRhiGles2::registerUniformIfActive(const QShaderDescription::BlockVariable { if (var.type == QShaderDescription::Struct) { qWarning("Nested structs are not supported at the moment. '%s' ignored.", - qPrintable(var.name)); + var.name.constData()); return; } QGles2UniformDescription uniform; uniform.type = var.type; - const QByteArray name = namePrefix + var.name.toUtf8(); + const QByteArray name = namePrefix + var.name; uniform.glslLocation = f->glGetUniformLocation(program, name.constData()); if (uniform.glslLocation >= 0) { if (var.arrayDims.count() > 1) { qWarning("Array '%s' has more than one dimension. This is not supported.", - qPrintable(var.name)); + var.name.constData()); return; } uniform.binding = binding; @@ -3403,10 +3403,10 @@ void QRhiGles2::gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub, QVector *dst) { - QByteArray prefix = ub.structName.toUtf8() + '.'; + QByteArray prefix = ub.structName + '.'; for (const QShaderDescription::BlockVariable &blockMember : ub.members) { if (blockMember.type == QShaderDescription::Struct) { - QByteArray structPrefix = prefix + blockMember.name.toUtf8(); + QByteArray structPrefix = prefix + blockMember.name; const int baseOffset = blockMember.offset; if (blockMember.arrayDims.isEmpty()) { @@ -3414,8 +3414,9 @@ void QRhiGles2::gatherUniforms(GLuint program, registerUniformIfActive(structMember, structPrefix, ub.binding, baseOffset, program, dst); } else { if (blockMember.arrayDims.count() > 1) { - qWarning("Array of struct '%s' has more than one dimension. Only the first dimension is used.", - qPrintable(blockMember.name)); + qWarning("Array of struct '%s' has more than one dimension. Only the first " + "dimension is used.", + blockMember.name.constData()); } const int dim = blockMember.arrayDims.first(); const int elemSize = blockMember.size / dim; @@ -3437,8 +3438,7 @@ void QRhiGles2::gatherSamplers(GLuint program, const QShaderDescription::InOutVa QVector *dst) { QGles2SamplerDescription sampler; - const QByteArray name = v.name.toUtf8(); - sampler.glslLocation = f->glGetUniformLocation(program, name.constData()); + sampler.glslLocation = f->glGetUniformLocation(program, v.name.constData()); if (sampler.glslLocation >= 0) { sampler.binding = v.binding; dst->append(sampler); @@ -4202,8 +4202,7 @@ bool QGles2GraphicsPipeline::create() } for (auto inVar : vsDesc.inputVariables()) { - const QByteArray name = inVar.name.toUtf8(); - rhiD->f->glBindAttribLocation(program, GLuint(inVar.location), name.constData()); + rhiD->f->glBindAttribLocation(program, GLuint(inVar.location), inVar.name); } if (needsCompile && !rhiD->linkProgram(program)) diff --git a/src/gui/rhi/qshaderdescription.cpp b/src/gui/rhi/qshaderdescription.cpp index bd8676c57c..81f3a03b55 100644 --- a/src/gui/rhi/qshaderdescription.cpp +++ b/src/gui/rhi/qshaderdescription.cpp @@ -812,7 +812,8 @@ QDebug operator<<(QDebug dbg, const QShaderDescription::BlockVariable &var) QDebug operator<<(QDebug dbg, const QShaderDescription::UniformBlock &blk) { QDebugStateSaver saver(dbg); - dbg.nospace() << "UniformBlock(" << blk.blockName << ' ' << blk.structName << " size=" << blk.size; + dbg.nospace() << "UniformBlock(" << blk.blockName << ' ' << blk.structName + << " size=" << blk.size; if (blk.binding >= 0) dbg.nospace() << " binding=" << blk.binding; if (blk.descriptorSet >= 0) @@ -824,14 +825,16 @@ QDebug operator<<(QDebug dbg, const QShaderDescription::UniformBlock &blk) QDebug operator<<(QDebug dbg, const QShaderDescription::PushConstantBlock &blk) { QDebugStateSaver saver(dbg); - dbg.nospace() << "PushConstantBlock(" << blk.name << " size=" << blk.size << ' ' << blk.members << ')'; + dbg.nospace() << "PushConstantBlock(" << blk.name << " size=" << blk.size << ' ' << blk.members + << ')'; return dbg; } QDebug operator<<(QDebug dbg, const QShaderDescription::StorageBlock &blk) { QDebugStateSaver saver(dbg); - dbg.nospace() << "StorageBlock(" << blk.blockName << ' ' << blk.instanceName << " knownSize=" << blk.knownSize; + dbg.nospace() << "StorageBlock(" << blk.blockName << ' ' << blk.instanceName + << " knownSize=" << blk.knownSize; if (blk.binding >= 0) dbg.nospace() << " binding=" << blk.binding; if (blk.descriptorSet >= 0) @@ -904,7 +907,7 @@ static void serializeDecorations(QDataStream *stream, const QShaderDescription:: static QJsonObject inOutObject(const QShaderDescription::InOutVariable &v) { QJsonObject obj; - obj[nameKey] = v.name; + obj[nameKey] = QString::fromUtf8(v.name); obj[typeKey] = typeStr(v.type); addDeco(&obj, v); return obj; @@ -912,7 +915,7 @@ static QJsonObject inOutObject(const QShaderDescription::InOutVariable &v) static void serializeInOutVar(QDataStream *stream, const QShaderDescription::InOutVariable &v) { - (*stream) << v.name; + (*stream) << QString::fromUtf8(v.name); (*stream) << int(v.type); serializeDecorations(stream, v); } @@ -920,7 +923,7 @@ static void serializeInOutVar(QDataStream *stream, const QShaderDescription::InO static QJsonObject blockMemberObject(const QShaderDescription::BlockVariable &v) { QJsonObject obj; - obj[nameKey] = v.name; + obj[nameKey] = QString::fromUtf8(v.name); obj[typeKey] = typeStr(v.type); obj[offsetKey] = v.offset; obj[sizeKey] = v.size; @@ -947,7 +950,7 @@ static QJsonObject blockMemberObject(const QShaderDescription::BlockVariable &v) static void serializeBlockMemberVar(QDataStream *stream, const QShaderDescription::BlockVariable &v) { - (*stream) << v.name; + (*stream) << QString::fromUtf8(v.name); (*stream) << int(v.type); (*stream) << v.offset; (*stream) << v.size; @@ -981,8 +984,8 @@ QJsonDocument QShaderDescriptionPrivate::makeDoc() QJsonArray juniformBlocks; for (const QShaderDescription::UniformBlock &b : uniformBlocks) { QJsonObject juniformBlock; - juniformBlock[blockNameKey] = b.blockName; - juniformBlock[structNameKey] = b.structName; + juniformBlock[blockNameKey] = QString::fromUtf8(b.blockName); + juniformBlock[structNameKey] = QString::fromUtf8(b.structName); juniformBlock[sizeKey] = b.size; if (b.binding >= 0) juniformBlock[bindingKey] = b.binding; @@ -1000,7 +1003,7 @@ QJsonDocument QShaderDescriptionPrivate::makeDoc() QJsonArray jpushConstantBlocks; for (const QShaderDescription::PushConstantBlock &b : pushConstantBlocks) { QJsonObject jpushConstantBlock; - jpushConstantBlock[nameKey] = b.name; + jpushConstantBlock[nameKey] = QString::fromUtf8(b.name); jpushConstantBlock[sizeKey] = b.size; QJsonArray members; for (const QShaderDescription::BlockVariable &v : b.members) @@ -1014,8 +1017,8 @@ QJsonDocument QShaderDescriptionPrivate::makeDoc() QJsonArray jstorageBlocks; for (const QShaderDescription::StorageBlock &b : storageBlocks) { QJsonObject jstorageBlock; - jstorageBlock[blockNameKey] = b.blockName; - jstorageBlock[instanceNameKey] = b.instanceName; + jstorageBlock[blockNameKey] = QString::fromUtf8(b.blockName); + jstorageBlock[instanceNameKey] = QString::fromUtf8(b.instanceName); jstorageBlock[knownSizeKey] = b.knownSize; if (b.binding >= 0) jstorageBlock[bindingKey] = b.binding; @@ -1033,7 +1036,7 @@ QJsonDocument QShaderDescriptionPrivate::makeDoc() QJsonArray jcombinedSamplers; for (const QShaderDescription::InOutVariable &v : qAsConst(combinedImageSamplers)) { QJsonObject sampler; - sampler[nameKey] = v.name; + sampler[nameKey] = QString::fromUtf8(v.name); sampler[typeKey] = typeStr(v.type); addDeco(&sampler, v); jcombinedSamplers.append(sampler); @@ -1044,7 +1047,7 @@ QJsonDocument QShaderDescriptionPrivate::makeDoc() QJsonArray jstorageImages; for (const QShaderDescription::InOutVariable &v : qAsConst(storageImages)) { QJsonObject image; - image[nameKey] = v.name; + image[nameKey] = QString::fromUtf8(v.name); image[typeKey] = typeStr(v.type); addDeco(&image, v); jstorageImages.append(image); @@ -1072,8 +1075,8 @@ void QShaderDescriptionPrivate::writeToStream(QDataStream *stream) (*stream) << int(uniformBlocks.count()); for (const QShaderDescription::UniformBlock &b : uniformBlocks) { - (*stream) << b.blockName; - (*stream) << b.structName; + (*stream) << QString::fromUtf8(b.blockName); + (*stream) << QString::fromUtf8(b.structName); (*stream) << b.size; (*stream) << b.binding; (*stream) << b.descriptorSet; @@ -1084,7 +1087,7 @@ void QShaderDescriptionPrivate::writeToStream(QDataStream *stream) (*stream) << int(pushConstantBlocks.count()); for (const QShaderDescription::PushConstantBlock &b : pushConstantBlocks) { - (*stream) << b.name; + (*stream) << QString::fromUtf8(b.name); (*stream) << b.size; (*stream) << int(b.members.count()); for (const QShaderDescription::BlockVariable &v : b.members) @@ -1093,8 +1096,8 @@ void QShaderDescriptionPrivate::writeToStream(QDataStream *stream) (*stream) << int(storageBlocks.count()); for (const QShaderDescription::StorageBlock &b : storageBlocks) { - (*stream) << b.blockName; - (*stream) << b.instanceName; + (*stream) << QString::fromUtf8(b.blockName); + (*stream) << QString::fromUtf8(b.instanceName); (*stream) << b.knownSize; (*stream) << b.binding; (*stream) << b.descriptorSet; @@ -1105,14 +1108,14 @@ void QShaderDescriptionPrivate::writeToStream(QDataStream *stream) (*stream) << int(combinedImageSamplers.count()); for (const QShaderDescription::InOutVariable &v : qAsConst(combinedImageSamplers)) { - (*stream) << v.name; + (*stream) << QString::fromUtf8(v.name); (*stream) << int(v.type); serializeDecorations(stream, v); } (*stream) << int(storageImages.count()); for (const QShaderDescription::InOutVariable &v : qAsConst(storageImages)) { - (*stream) << v.name; + (*stream) << QString::fromUtf8(v.name); (*stream) << int(v.type); serializeDecorations(stream, v); } @@ -1124,7 +1127,7 @@ void QShaderDescriptionPrivate::writeToStream(QDataStream *stream) static QShaderDescription::InOutVariable inOutVar(const QJsonObject &obj) { QShaderDescription::InOutVariable var; - var.name = obj[nameKey].toString(); + var.name = obj[nameKey].toString().toUtf8(); var.type = mapType(obj[typeKey].toString()); if (obj.contains(locationKey)) var.location = obj[locationKey].toInt(); @@ -1166,7 +1169,9 @@ static void deserializeDecorations(QDataStream *stream, int version, QShaderDesc static QShaderDescription::InOutVariable deserializeInOutVar(QDataStream *stream, int version) { QShaderDescription::InOutVariable var; - (*stream) >> var.name; + QString tmp; + (*stream) >> tmp; + var.name = tmp.toUtf8(); int t; (*stream) >> t; var.type = QShaderDescription::VariableType(t); @@ -1177,7 +1182,7 @@ static QShaderDescription::InOutVariable deserializeInOutVar(QDataStream *stream static QShaderDescription::BlockVariable blockVar(const QJsonObject &obj) { QShaderDescription::BlockVariable var; - var.name = obj[nameKey].toString(); + var.name = obj[nameKey].toString().toUtf8(); var.type = mapType(obj[typeKey].toString()); var.offset = obj[offsetKey].toInt(); var.size = obj[sizeKey].toInt(); @@ -1203,7 +1208,9 @@ static QShaderDescription::BlockVariable blockVar(const QJsonObject &obj) static QShaderDescription::BlockVariable deserializeBlockMemberVar(QDataStream *stream, int version) { QShaderDescription::BlockVariable var; - (*stream) >> var.name; + QString tmp; + (*stream) >> tmp; + var.name = tmp.toUtf8(); int t; (*stream) >> t; var.type = QShaderDescription::VariableType(t); @@ -1260,8 +1267,8 @@ void QShaderDescriptionPrivate::loadDoc(const QJsonDocument &doc) for (int i = 0; i < ubs.count(); ++i) { QJsonObject ubObj = ubs[i].toObject(); QShaderDescription::UniformBlock ub; - ub.blockName = ubObj[blockNameKey].toString(); - ub.structName = ubObj[structNameKey].toString(); + ub.blockName = ubObj[blockNameKey].toString().toUtf8(); + ub.structName = ubObj[structNameKey].toString().toUtf8(); ub.size = ubObj[sizeKey].toInt(); if (ubObj.contains(bindingKey)) ub.binding = ubObj[bindingKey].toInt(); @@ -1279,7 +1286,7 @@ void QShaderDescriptionPrivate::loadDoc(const QJsonDocument &doc) for (int i = 0; i < pcs.count(); ++i) { QJsonObject pcObj = pcs[i].toObject(); QShaderDescription::PushConstantBlock pc; - pc.name = pcObj[nameKey].toString(); + pc.name = pcObj[nameKey].toString().toUtf8(); pc.size = pcObj[sizeKey].toInt(); QJsonArray members = pcObj[membersKey].toArray(); for (const QJsonValue &member : members) @@ -1293,8 +1300,8 @@ void QShaderDescriptionPrivate::loadDoc(const QJsonDocument &doc) for (int i = 0; i < ubs.count(); ++i) { QJsonObject sbObj = ubs[i].toObject(); QShaderDescription::StorageBlock sb; - sb.blockName = sbObj[blockNameKey].toString(); - sb.instanceName = sbObj[instanceNameKey].toString(); + sb.blockName = sbObj[blockNameKey].toString().toUtf8(); + sb.instanceName = sbObj[instanceNameKey].toString().toUtf8(); sb.knownSize = sbObj[knownSizeKey].toInt(); if (sbObj.contains(bindingKey)) sb.binding = sbObj[bindingKey].toInt(); @@ -1346,8 +1353,11 @@ void QShaderDescriptionPrivate::loadFromStream(QDataStream *stream, int version) (*stream) >> count; uniformBlocks.resize(count); for (int i = 0; i < count; ++i) { - (*stream) >> uniformBlocks[i].blockName; - (*stream) >> uniformBlocks[i].structName; + QString tmp; + (*stream) >> tmp; + uniformBlocks[i].blockName = tmp.toUtf8(); + (*stream) >> tmp; + uniformBlocks[i].structName = tmp.toUtf8(); (*stream) >> uniformBlocks[i].size; (*stream) >> uniformBlocks[i].binding; (*stream) >> uniformBlocks[i].descriptorSet; @@ -1361,7 +1371,9 @@ void QShaderDescriptionPrivate::loadFromStream(QDataStream *stream, int version) (*stream) >> count; pushConstantBlocks.resize(count); for (int i = 0; i < count; ++i) { - (*stream) >> pushConstantBlocks[i].name; + QString tmp; + (*stream) >> tmp; + pushConstantBlocks[i].name = tmp.toUtf8(); (*stream) >> pushConstantBlocks[i].size; int memberCount; (*stream) >> memberCount; @@ -1373,8 +1385,11 @@ void QShaderDescriptionPrivate::loadFromStream(QDataStream *stream, int version) (*stream) >> count; storageBlocks.resize(count); for (int i = 0; i < count; ++i) { - (*stream) >> storageBlocks[i].blockName; - (*stream) >> storageBlocks[i].instanceName; + QString tmp; + (*stream) >> tmp; + storageBlocks[i].blockName = tmp.toUtf8(); + (*stream) >> tmp; + storageBlocks[i].instanceName = tmp.toUtf8(); (*stream) >> storageBlocks[i].knownSize; (*stream) >> storageBlocks[i].binding; (*stream) >> storageBlocks[i].descriptorSet; @@ -1388,7 +1403,9 @@ void QShaderDescriptionPrivate::loadFromStream(QDataStream *stream, int version) (*stream) >> count; combinedImageSamplers.resize(count); for (int i = 0; i < count; ++i) { - (*stream) >> combinedImageSamplers[i].name; + QString tmp; + (*stream) >> tmp; + combinedImageSamplers[i].name = tmp.toUtf8(); int t; (*stream) >> t; combinedImageSamplers[i].type = QShaderDescription::VariableType(t); @@ -1398,7 +1415,9 @@ void QShaderDescriptionPrivate::loadFromStream(QDataStream *stream, int version) (*stream) >> count; storageImages.resize(count); for (int i = 0; i < count; ++i) { - (*stream) >> storageImages[i].name; + QString tmp; + (*stream) >> tmp; + storageImages[i].name = tmp.toUtf8(); int t; (*stream) >> t; storageImages[i].type = QShaderDescription::VariableType(t); diff --git a/src/gui/rhi/qshaderdescription_p.h b/src/gui/rhi/qshaderdescription_p.h index e5650ed921..45ef36e80f 100644 --- a/src/gui/rhi/qshaderdescription_p.h +++ b/src/gui/rhi/qshaderdescription_p.h @@ -209,7 +209,7 @@ public: // Optional data (like decorations) usually default to an otherwise invalid value (-1 or 0). This is intentional. struct InOutVariable { - QString name; + QByteArray name; VariableType type = Unknown; int location = -1; int binding = -1; @@ -220,7 +220,7 @@ public: }; struct BlockVariable { - QString name; + QByteArray name; VariableType type = Unknown; int offset = 0; int size = 0; @@ -232,8 +232,8 @@ public: }; struct UniformBlock { - QString blockName; - QString structName; // instanceName + QByteArray blockName; + QByteArray structName; // instanceName int size = 0; int binding = -1; int descriptorSet = -1; @@ -241,14 +241,14 @@ public: }; struct PushConstantBlock { - QString name; + QByteArray name; int size = 0; QVector members; }; struct StorageBlock { - QString blockName; - QString instanceName; + QByteArray blockName; + QByteArray instanceName; int knownSize = 0; int binding = -1; int descriptorSet = -1; diff --git a/tests/auto/gui/rhi/qshader/tst_qshader.cpp b/tests/auto/gui/rhi/qshader/tst_qshader.cpp index 22173d6d1a..d12efa90dc 100644 --- a/tests/auto/gui/rhi/qshader/tst_qshader.cpp +++ b/tests/auto/gui/rhi/qshader/tst_qshader.cpp @@ -91,11 +91,11 @@ void tst_QShader::simpleCompileCheckResults() for (const QShaderDescription::InOutVariable &v : desc.inputVariables()) { switch (v.location) { case 0: - QCOMPARE(v.name, QLatin1String("position")); + QCOMPARE(v.name, QByteArrayLiteral("position")); QCOMPARE(v.type, QShaderDescription::Vec4); break; case 1: - QCOMPARE(v.name, QLatin1String("color")); + QCOMPARE(v.name, QByteArrayLiteral("color")); QCOMPARE(v.type, QShaderDescription::Vec3); break; default: @@ -107,7 +107,7 @@ void tst_QShader::simpleCompileCheckResults() for (const QShaderDescription::InOutVariable &v : desc.outputVariables()) { switch (v.location) { case 0: - QCOMPARE(v.name, QLatin1String("v_color")); + QCOMPARE(v.name, QByteArrayLiteral("v_color")); QCOMPARE(v.type, QShaderDescription::Vec3); break; default: @@ -117,8 +117,8 @@ void tst_QShader::simpleCompileCheckResults() } QCOMPARE(desc.uniformBlocks().count(), 1); const QShaderDescription::UniformBlock blk = desc.uniformBlocks().first(); - QCOMPARE(blk.blockName, QLatin1String("buf")); - QCOMPARE(blk.structName, QLatin1String("ubuf")); + QCOMPARE(blk.blockName, QByteArrayLiteral("buf")); + QCOMPARE(blk.structName, QByteArrayLiteral("ubuf")); QCOMPARE(blk.size, 68); QCOMPARE(blk.binding, 0); QCOMPARE(blk.descriptorSet, 0); @@ -129,14 +129,14 @@ void tst_QShader::simpleCompileCheckResults() case 0: QCOMPARE(v.offset, 0); QCOMPARE(v.size, 64); - QCOMPARE(v.name, QLatin1String("mvp")); + QCOMPARE(v.name, QByteArrayLiteral("mvp")); QCOMPARE(v.type, QShaderDescription::Mat4); QCOMPARE(v.matrixStride, 16); break; case 1: QCOMPARE(v.offset, 64); QCOMPARE(v.size, 4); - QCOMPARE(v.name, QLatin1String("opacity")); + QCOMPARE(v.name, QByteArrayLiteral("opacity")); QCOMPARE(v.type, QShaderDescription::Float); break; default: @@ -314,7 +314,7 @@ void tst_QShader::loadV3() for (const QShaderDescription::InOutVariable &v : desc.inputVariables()) { switch (v.location) { case 0: - QCOMPARE(v.name, QLatin1String("qt_TexCoord")); + QCOMPARE(v.name, QByteArrayLiteral("qt_TexCoord")); QCOMPARE(v.type, QShaderDescription::Vec2); break; default: @@ -326,7 +326,7 @@ void tst_QShader::loadV3() for (const QShaderDescription::InOutVariable &v : desc.outputVariables()) { switch (v.location) { case 0: - QCOMPARE(v.name, QLatin1String("fragColor")); + QCOMPARE(v.name, QByteArrayLiteral("fragColor")); QCOMPARE(v.type, QShaderDescription::Vec4); break; default: @@ -336,8 +336,8 @@ void tst_QShader::loadV3() } QCOMPARE(desc.uniformBlocks().count(), 1); const QShaderDescription::UniformBlock blk = desc.uniformBlocks().first(); - QCOMPARE(blk.blockName, QLatin1String("buf")); - QCOMPARE(blk.structName, QLatin1String("ubuf")); + QCOMPARE(blk.blockName, QByteArrayLiteral("buf")); + QCOMPARE(blk.structName, QByteArrayLiteral("ubuf")); QCOMPARE(blk.size, 68); QCOMPARE(blk.binding, 0); QCOMPARE(blk.descriptorSet, 0); @@ -348,14 +348,14 @@ void tst_QShader::loadV3() case 0: QCOMPARE(v.offset, 0); QCOMPARE(v.size, 64); - QCOMPARE(v.name, QLatin1String("qt_Matrix")); + QCOMPARE(v.name, QByteArrayLiteral("qt_Matrix")); QCOMPARE(v.type, QShaderDescription::Mat4); QCOMPARE(v.matrixStride, 16); break; case 1: QCOMPARE(v.offset, 64); QCOMPARE(v.size, 4); - QCOMPARE(v.name, QLatin1String("opacity")); + QCOMPARE(v.name, QByteArrayLiteral("opacity")); QCOMPARE(v.type, QShaderDescription::Float); break; default: @@ -477,7 +477,7 @@ void tst_QShader::loadV4() for (const QShaderDescription::InOutVariable &v : desc.inputVariables()) { switch (v.location) { case 0: - QCOMPARE(v.name, QLatin1String("qt_TexCoord")); + QCOMPARE(v.name, QByteArrayLiteral("qt_TexCoord")); QCOMPARE(v.type, QShaderDescription::Vec2); break; default: @@ -489,7 +489,7 @@ void tst_QShader::loadV4() for (const QShaderDescription::InOutVariable &v : desc.outputVariables()) { switch (v.location) { case 0: - QCOMPARE(v.name, QLatin1String("fragColor")); + QCOMPARE(v.name, QByteArrayLiteral("fragColor")); QCOMPARE(v.type, QShaderDescription::Vec4); break; default: @@ -499,8 +499,8 @@ void tst_QShader::loadV4() } QCOMPARE(desc.uniformBlocks().count(), 1); const QShaderDescription::UniformBlock blk = desc.uniformBlocks().first(); - QCOMPARE(blk.blockName, QLatin1String("buf")); - QCOMPARE(blk.structName, QLatin1String("ubuf")); + QCOMPARE(blk.blockName, QByteArrayLiteral("buf")); + QCOMPARE(blk.structName, QByteArrayLiteral("ubuf")); QCOMPARE(blk.size, 68); QCOMPARE(blk.binding, 0); QCOMPARE(blk.descriptorSet, 0); @@ -511,14 +511,14 @@ void tst_QShader::loadV4() case 0: QCOMPARE(v.offset, 0); QCOMPARE(v.size, 64); - QCOMPARE(v.name, QLatin1String("qt_Matrix")); + QCOMPARE(v.name, QByteArrayLiteral("qt_Matrix")); QCOMPARE(v.type, QShaderDescription::Mat4); QCOMPARE(v.matrixStride, 16); break; case 1: QCOMPARE(v.offset, 64); QCOMPARE(v.size, 4); - QCOMPARE(v.name, QLatin1String("opacity")); + QCOMPARE(v.name, QByteArrayLiteral("opacity")); QCOMPARE(v.type, QShaderDescription::Float); break; default: