Commit a8ee1fa3 authored by Laszlo Agocs's avatar Laszlo Agocs
Browse files

Store a version field in the serialized baked shader

parent 0efdb544
......@@ -40,6 +40,8 @@
QT_BEGIN_NAMESPACE
static const int QSB_VERSION = 1;
QBakedShader::QBakedShader()
: d(new QBakedShaderPrivate)
{
......@@ -134,6 +136,7 @@ QByteArray QBakedShader::serialized() const
if (!buf.open(QIODevice::WriteOnly))
return QByteArray();
ds << QSB_VERSION;
ds << d->stage;
ds << d->desc.toBinaryJson();
ds << d->shaders.count();
......@@ -164,6 +167,10 @@ QBakedShader QBakedShader::fromSerialized(const QByteArray &data)
QBakedShaderPrivate *d = QBakedShaderPrivate::get(&bs);
Q_ASSERT(d->ref.load() == 1); // must be detached
int intVal;
ds >> intVal;
if (intVal != QSB_VERSION)
return QBakedShader();
ds >> intVal;
d->stage = ShaderStage(intVal);
QByteArray descBin;
......
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