Remove QShaderDescription::toBinaryJson(), deprecated fromBinaryJson()
Binary Json is deprecated and we should not use it. We can already serialize shaders to CBOR. Push the deprecation warning mechanism to the only user of fromBinaryJson(). Change-Id: I1d56157ab92f74eaab49400be647317e7833e35e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
0de6c26ac1
commit
69e7dfdb28
@ -439,10 +439,19 @@ QShader QShader::fromSerialized(const QByteArray &data)
|
||||
d->stage = Stage(intVal);
|
||||
QByteArray descBin;
|
||||
ds >> descBin;
|
||||
if (d->qsbVersion > QShaderPrivate::QSB_VERSION_WITH_BINARY_JSON)
|
||||
if (d->qsbVersion > QShaderPrivate::QSB_VERSION_WITH_BINARY_JSON) {
|
||||
d->desc = QShaderDescription::fromCbor(descBin);
|
||||
else
|
||||
} else {
|
||||
#if QT_CONFIG(binaryjson) && QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
d->desc = QShaderDescription::fromBinaryJson(descBin);
|
||||
QT_WARNING_POP
|
||||
#else
|
||||
qWarning("Cannot load QShaderDescription from binary JSON due to disabled binaryjson feature");
|
||||
d->desc = QShaderDescription();
|
||||
#endif
|
||||
}
|
||||
int count;
|
||||
ds >> count;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
|
@ -102,8 +102,8 @@ QT_BEGIN_NAMESPACE
|
||||
float \c opacity at offset 64.
|
||||
|
||||
All this is described by a QShaderDescription object. QShaderDescription
|
||||
can also be serialized to JSON and binary JSON, and can be deserialized
|
||||
from binary JSON. In practice this is rarely needed since QShader
|
||||
can also be serialized to JSON and CBOR, and can be deserialized
|
||||
from CBOR. In practice this is rarely needed since QShader
|
||||
takes care of the associated QShaderDescription automatically, but if the
|
||||
QShaderDescription of the above shader would be written out as JSON, it
|
||||
would look like the following:
|
||||
@ -335,29 +335,11 @@ bool QShaderDescription::isValid() const
|
||||
|| !d->combinedImageSamplers.isEmpty() || !d->storageImages.isEmpty();
|
||||
}
|
||||
|
||||
/*!
|
||||
\return a serialized binary version of the data.
|
||||
|
||||
\sa toJson(), toCbor()
|
||||
*/
|
||||
QByteArray QShaderDescription::toBinaryJson() const
|
||||
{
|
||||
#if QT_CONFIG(binaryjson) && QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
return d->makeDoc().toBinaryData();
|
||||
QT_WARNING_POP
|
||||
#else
|
||||
qWarning("Cannot generate binary JSON from QShaderDescription due to disabled binaryjson feature");
|
||||
return QByteArray();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
\return a serialized binary version of the data in CBOR (Concise Binary
|
||||
Object Representation) format.
|
||||
|
||||
\sa QCborValue, toBinaryJson(), toJson()
|
||||
\sa QCborValue, toJson()
|
||||
*/
|
||||
QByteArray QShaderDescription::toCbor() const
|
||||
{
|
||||
@ -369,14 +351,17 @@ QByteArray QShaderDescription::toCbor() const
|
||||
|
||||
\note There is no deserialization method provided for JSON text.
|
||||
|
||||
\sa toBinaryJson(), toCbor()
|
||||
\sa toCbor()
|
||||
*/
|
||||
QByteArray QShaderDescription::toJson() const
|
||||
{
|
||||
return d->makeDoc().toJson();
|
||||
}
|
||||
|
||||
#if QT_CONFIG(binaryjson) && QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\deprecated
|
||||
|
||||
Deserializes the given binary JSON \a data and returns a new
|
||||
QShaderDescription.
|
||||
|
||||
@ -385,22 +370,16 @@ QByteArray QShaderDescription::toJson() const
|
||||
QShaderDescription QShaderDescription::fromBinaryJson(const QByteArray &data)
|
||||
{
|
||||
QShaderDescription desc;
|
||||
#if QT_CONFIG(binaryjson) && QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
QShaderDescriptionPrivate::get(&desc)->loadDoc(QJsonDocument::fromBinaryData(data));
|
||||
QT_WARNING_POP
|
||||
#else
|
||||
Q_UNUSED(data);
|
||||
qWarning("Cannot load QShaderDescription from binary JSON due to disabled binaryjson feature");
|
||||
#endif
|
||||
return desc;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Deserializes the given CBOR \a data and returns a new QShaderDescription.
|
||||
|
||||
\sa fromBinaryJson()
|
||||
*/
|
||||
QShaderDescription QShaderDescription::fromCbor(const QByteArray &data)
|
||||
{
|
||||
|
@ -68,11 +68,13 @@ public:
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
QByteArray toBinaryJson() const;
|
||||
QByteArray toCbor() const;
|
||||
QByteArray toJson() const;
|
||||
|
||||
#if QT_CONFIG(binaryjson) && QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use CBOR format instead")
|
||||
static QShaderDescription fromBinaryJson(const QByteArray &data);
|
||||
#endif
|
||||
static QShaderDescription fromCbor(const QByteArray &data);
|
||||
|
||||
enum VariableType {
|
||||
|
Loading…
Reference in New Issue
Block a user