Hotfix for int->qsizetype fallout in QShader
The proper solution is to use qint32 everywhere, but that is left as a separate exercise. Change-Id: Id0c06b102b56a1b3b48dd67c6c29c28da7d1f22d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>bb10
parent
616000ed7f
commit
a206f52acd
|
|
@ -368,7 +368,7 @@ QByteArray QShader::serialized() const
|
|||
ds << QShaderPrivate::QSB_VERSION;
|
||||
ds << int(d->stage);
|
||||
d->desc.serialize(&ds);
|
||||
ds << d->shaders.count();
|
||||
ds << int(d->shaders.count());
|
||||
for (auto it = d->shaders.cbegin(), itEnd = d->shaders.cend(); it != itEnd; ++it) {
|
||||
const QShaderKey &k(it.key());
|
||||
writeShaderKey(&ds, k);
|
||||
|
|
@ -376,12 +376,12 @@ QByteArray QShader::serialized() const
|
|||
ds << shader.shader();
|
||||
ds << shader.entryPoint();
|
||||
}
|
||||
ds << d->bindings.count();
|
||||
ds << int(d->bindings.count());
|
||||
for (auto it = d->bindings.cbegin(), itEnd = d->bindings.cend(); it != itEnd; ++it) {
|
||||
const QShaderKey &k(it.key());
|
||||
writeShaderKey(&ds, k);
|
||||
const NativeResourceBindingMap &map(it.value());
|
||||
ds << map.count();
|
||||
ds << int(map.count());
|
||||
for (auto mapIt = map.cbegin(), mapItEnd = map.cend(); mapIt != mapItEnd; ++mapIt) {
|
||||
ds << mapIt.key();
|
||||
ds << mapIt.value().first;
|
||||
|
|
|
|||
|
|
@ -896,7 +896,7 @@ static void serializeDecorations(QDataStream *stream, const QShaderDescription::
|
|||
(*stream) << v.descriptorSet;
|
||||
(*stream) << int(v.imageFormat);
|
||||
(*stream) << int(v.imageFlags);
|
||||
(*stream) << v.arrayDims.count();
|
||||
(*stream) << int(v.arrayDims.count());
|
||||
for (int dim : v.arrayDims)
|
||||
(*stream) << dim;
|
||||
}
|
||||
|
|
@ -951,13 +951,13 @@ static void serializeBlockMemberVar(QDataStream *stream, const QShaderDescriptio
|
|||
(*stream) << int(v.type);
|
||||
(*stream) << v.offset;
|
||||
(*stream) << v.size;
|
||||
(*stream) << v.arrayDims.count();
|
||||
(*stream) << int(v.arrayDims.count());
|
||||
for (int dim : v.arrayDims)
|
||||
(*stream) << dim;
|
||||
(*stream) << v.arrayStride;
|
||||
(*stream) << v.matrixStride;
|
||||
(*stream) << v.matrixIsRowMajor;
|
||||
(*stream) << v.structMembers.count();
|
||||
(*stream) << int(v.structMembers.count());
|
||||
for (const QShaderDescription::BlockVariable &sv : v.structMembers)
|
||||
serializeBlockMemberVar(stream, sv);
|
||||
}
|
||||
|
|
@ -1062,55 +1062,55 @@ QJsonDocument QShaderDescriptionPrivate::makeDoc()
|
|||
|
||||
void QShaderDescriptionPrivate::writeToStream(QDataStream *stream)
|
||||
{
|
||||
(*stream) << inVars.count();
|
||||
(*stream) << int(inVars.count());
|
||||
for (const QShaderDescription::InOutVariable &v : qAsConst(inVars))
|
||||
serializeInOutVar(stream, v);
|
||||
|
||||
(*stream) << outVars.count();
|
||||
(*stream) << int(outVars.count());
|
||||
for (const QShaderDescription::InOutVariable &v : qAsConst(outVars))
|
||||
serializeInOutVar(stream, v);
|
||||
|
||||
(*stream) << uniformBlocks.count();
|
||||
(*stream) << int(uniformBlocks.count());
|
||||
for (const QShaderDescription::UniformBlock &b : uniformBlocks) {
|
||||
(*stream) << b.blockName;
|
||||
(*stream) << b.structName;
|
||||
(*stream) << b.size;
|
||||
(*stream) << b.binding;
|
||||
(*stream) << b.descriptorSet;
|
||||
(*stream) << b.members.count();
|
||||
(*stream) << int(b.members.count());
|
||||
for (const QShaderDescription::BlockVariable &v : b.members)
|
||||
serializeBlockMemberVar(stream, v);
|
||||
}
|
||||
|
||||
(*stream) << pushConstantBlocks.count();
|
||||
(*stream) << int(pushConstantBlocks.count());
|
||||
for (const QShaderDescription::PushConstantBlock &b : pushConstantBlocks) {
|
||||
(*stream) << b.name;
|
||||
(*stream) << b.size;
|
||||
(*stream) << b.members.count();
|
||||
(*stream) << int(b.members.count());
|
||||
for (const QShaderDescription::BlockVariable &v : b.members)
|
||||
serializeBlockMemberVar(stream, v);
|
||||
}
|
||||
|
||||
(*stream) << storageBlocks.count();
|
||||
(*stream) << int(storageBlocks.count());
|
||||
for (const QShaderDescription::StorageBlock &b : storageBlocks) {
|
||||
(*stream) << b.blockName;
|
||||
(*stream) << b.instanceName;
|
||||
(*stream) << b.knownSize;
|
||||
(*stream) << b.binding;
|
||||
(*stream) << b.descriptorSet;
|
||||
(*stream) << b.members.count();
|
||||
(*stream) << int(b.members.count());
|
||||
for (const QShaderDescription::BlockVariable &v : b.members)
|
||||
serializeBlockMemberVar(stream, v);
|
||||
}
|
||||
|
||||
(*stream) << combinedImageSamplers.count();
|
||||
(*stream) << int(combinedImageSamplers.count());
|
||||
for (const QShaderDescription::InOutVariable &v : qAsConst(combinedImageSamplers)) {
|
||||
(*stream) << v.name;
|
||||
(*stream) << int(v.type);
|
||||
serializeDecorations(stream, v);
|
||||
}
|
||||
|
||||
(*stream) << storageImages.count();
|
||||
(*stream) << int(storageImages.count());
|
||||
for (const QShaderDescription::InOutVariable &v : qAsConst(storageImages)) {
|
||||
(*stream) << v.name;
|
||||
(*stream) << int(v.type);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class tst_QShader : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void serializeDeserialize();
|
||||
void simpleCompileCheckResults();
|
||||
void genVariants();
|
||||
void shaderDescImplicitSharing();
|
||||
|
|
@ -56,6 +57,22 @@ static QShader getShader(const QString &name)
|
|||
return QShader();
|
||||
}
|
||||
|
||||
void tst_QShader::serializeDeserialize()
|
||||
{
|
||||
QShader s = getShader(QLatin1String(":/data/texture_all_v4.frag.qsb"));
|
||||
QVERIFY(s.isValid());
|
||||
|
||||
QByteArray data = s.serialized();
|
||||
QVERIFY(!data.isEmpty());
|
||||
|
||||
QShader s2;
|
||||
QVERIFY(!s2.isValid());
|
||||
QVERIFY(s != s2);
|
||||
s2 = QShader::fromSerialized(data);
|
||||
QVERIFY(s2.isValid());
|
||||
QCOMPARE(s, s2);
|
||||
}
|
||||
|
||||
void tst_QShader::simpleCompileCheckResults()
|
||||
{
|
||||
QShader s = getShader(QLatin1String(":/data/color_spirv_v1.vert.qsb"));
|
||||
|
|
|
|||
Loading…
Reference in New Issue