Commit 8599a2b5 authored by Laszlo Agocs's avatar Laszlo Agocs
Browse files

QBakedShader -> QRhiShader, examples -> manual tests

parent 702404fe
TEMPLATE = subdirs
SUBDIRS += \
rhi
......@@ -90,9 +90,9 @@ libraries, all shaders are expected to be written in a single language which is
then compiled into SPIR-V. Versions for various shading language are then
generated from that, together with reflection information (inputs, outputs,
shader resources). This is then packed into easily and efficiently serializable
QBakedShader instances. The compilers and tools to generate such shaders are not
QRhiShader instances. The compilers and tools to generate such shaders are not
part of the Rhi module, but the core classes for using such shaders,
QBakedShader and QShaderDescription, are.
QRhiShader and QRhiShaderDescription, are.
\section1 Table of Contents
......
......@@ -1160,12 +1160,12 @@ QRhiGraphicsShaderStage::QRhiGraphicsShaderStage()
Constructs a shader stage description with the \a type of the stage and the
\a shader.
The shader variant \a v defaults to QBakedShaderKey::StandardShader. A
QBakedShader pack contains multiple source and binary versions of a shader.
The shader variant \a v defaults to QRhiShaderKey::StandardShader. A
QRhiShader pack contains multiple source and binary versions of a shader.
In addition, it can also contain variants of the shader with slightly
modified code. \a v can then be used to select the desired variant.
*/
QRhiGraphicsShaderStage::QRhiGraphicsShaderStage(Type type, const QBakedShader &shader, QBakedShaderKey::ShaderVariant v)
QRhiGraphicsShaderStage::QRhiGraphicsShaderStage(Type type, const QRhiShader &shader, QRhiShaderKey::ShaderVariant v)
: m_type(type),
m_shader(shader),
m_shaderVariant(v)
......
......@@ -45,7 +45,7 @@
#include <QVector>
#include <QThread>
#include <QImage>
#include <QtRhi/QBakedShader>
#include <QtRhi/QRhiShader>
#include <functional>
QT_BEGIN_NAMESPACE
......@@ -282,22 +282,22 @@ public:
};
QRhiGraphicsShaderStage();
QRhiGraphicsShaderStage(Type type, const QBakedShader &shader,
QBakedShaderKey::ShaderVariant v = QBakedShaderKey::StandardShader);
QRhiGraphicsShaderStage(Type type, const QRhiShader &shader,
QRhiShaderKey::ShaderVariant v = QRhiShaderKey::StandardShader);
Type type() const { return m_type; }
void setType(Type t) { m_type = t; }
QBakedShader shader() const { return m_shader; }
void setShader(const QBakedShader &s) { m_shader = s; }
QRhiShader shader() const { return m_shader; }
void setShader(const QRhiShader &s) { m_shader = s; }
QBakedShaderKey::ShaderVariant shaderVariant() const { return m_shaderVariant; }
void setShaderVariant(QBakedShaderKey::ShaderVariant v) { m_shaderVariant = v; }
QRhiShaderKey::ShaderVariant shaderVariant() const { return m_shaderVariant; }
void setShaderVariant(QRhiShaderKey::ShaderVariant v) { m_shaderVariant = v; }
private:
Type m_type;
QBakedShader m_shader;
QBakedShaderKey::ShaderVariant m_shaderVariant = QBakedShaderKey::StandardShader;
QRhiShader m_shader;
QRhiShaderKey::ShaderVariant m_shaderVariant = QRhiShaderKey::StandardShader;
Q_DECL_UNUSED_MEMBER quint64 m_reserved;
};
......
......@@ -36,7 +36,7 @@
#include "qrhid3d11_p.h"
#include <QWindow>
#include <QBakedShader>
#include <QRhiShader>
#include <qmath.h>
#include <d3dcompiler.h>
......@@ -2745,13 +2745,13 @@ static inline D3D11_BLEND_OP toD3DBlendOp(QRhiGraphicsPipeline::BlendOp op)
}
}
static QByteArray compileHlslShaderSource(const QBakedShader &shader, QBakedShaderKey::ShaderVariant shaderVariant, QString *error)
static QByteArray compileHlslShaderSource(const QRhiShader &shader, QRhiShaderKey::ShaderVariant shaderVariant, QString *error)
{
QBakedShaderCode dxbc = shader.shader({ QBakedShaderKey::DxbcShader, 50, shaderVariant });
QRhiShaderCode dxbc = shader.shader({ QRhiShaderKey::DxbcShader, 50, shaderVariant });
if (!dxbc.shader().isEmpty())
return dxbc.shader();
QBakedShaderCode hlslSource = shader.shader({ QBakedShaderKey::HlslShader, 50, shaderVariant });
QRhiShaderCode hlslSource = shader.shader({ QRhiShaderKey::HlslShader, 50, shaderVariant });
if (hlslSource.shader().isEmpty()) {
qWarning() << "No HLSL (shader model 5.0) code found in baked shader" << shader;
return QByteArray();
......@@ -2759,22 +2759,22 @@ static QByteArray compileHlslShaderSource(const QBakedShader &shader, QBakedShad
const char *target;
switch (shader.stage()) {
case QBakedShader::VertexStage:
case QRhiShader::VertexStage:
target = "vs_5_0";
break;
case QBakedShader::TessControlStage:
case QRhiShader::TessControlStage:
target = "hs_5_0";
break;
case QBakedShader::TessEvaluationStage:
case QRhiShader::TessEvaluationStage:
target = "ds_5_0";
break;
case QBakedShader::GeometryStage:
case QRhiShader::GeometryStage:
target = "gs_5_0";
break;
case QBakedShader::FragmentStage:
case QRhiShader::FragmentStage:
target = "ps_5_0";
break;
case QBakedShader::ComputeStage:
case QRhiShader::ComputeStage:
target = "cs_5_0";
break;
default:
......
......@@ -43,7 +43,7 @@
#include "qrhid3d11.h"
#include "qrhi_p.h"
#include <QShaderDescription>
#include <QRhiShaderDescription>
#include <QWindow>
#include <d3d11_1.h>
......
......@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
OpenGL ES 2.0 (3.0) + GLSL 100/120 backend. Binding vertex attribute
locations and decomposing uniform buffers into uniforms (as expected by the
GLSL 1xx shader generated by SPIRV-Cross) are handled transparently to the
application via the reflection data (QShaderDescription). Textures and
application via the reflection data (QRhiShaderDescription). Textures and
buffers feature no special logic, it's all just glTexSubImage2D and
glBufferSubData (with "dynamic" buffers set to GL_DYNAMIC_DRAW). The
swapchain and the associated renderbuffer for depth-stencil will be dummies
......@@ -1737,37 +1737,37 @@ void QRhiGles2::setChangedUniforms(QRhiGraphicsPipeline *ps, QRhiShaderResourceB
memcpy(uniform.data.data(), bufView.constData() + uniform.offset, uniform.data.size());
switch (uniform.type) {
case QShaderDescription::Float:
case QRhiShaderDescription::Float:
f->glUniform1f(uniform.glslLocation, *reinterpret_cast<const float *>(uniform.data.constData()));
break;
case QShaderDescription::Vec2:
case QRhiShaderDescription::Vec2:
f->glUniform2fv(uniform.glslLocation, 1, reinterpret_cast<const float *>(uniform.data.constData()));
break;
case QShaderDescription::Vec3:
case QRhiShaderDescription::Vec3:
f->glUniform3fv(uniform.glslLocation, 1, reinterpret_cast<const float *>(uniform.data.constData()));
break;
case QShaderDescription::Vec4:
case QRhiShaderDescription::Vec4:
f->glUniform4fv(uniform.glslLocation, 1, reinterpret_cast<const float *>(uniform.data.constData()));
break;
case QShaderDescription::Mat2:
case QRhiShaderDescription::Mat2:
f->glUniformMatrix2fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast<const float *>(uniform.data.constData()));
break;
case QShaderDescription::Mat3:
case QRhiShaderDescription::Mat3:
f->glUniformMatrix3fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast<const float *>(uniform.data.constData()));
break;
case QShaderDescription::Mat4:
case QRhiShaderDescription::Mat4:
f->glUniformMatrix4fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast<const float *>(uniform.data.constData()));
break;
case QShaderDescription::Int:
case QRhiShaderDescription::Int:
f->glUniform1i(uniform.glslLocation, *reinterpret_cast<const qint32 *>(uniform.data.constData()));
break;
case QShaderDescription::Int2:
case QRhiShaderDescription::Int2:
f->glUniform2iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(uniform.data.constData()));
break;
case QShaderDescription::Int3:
case QRhiShaderDescription::Int3:
f->glUniform3iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(uniform.data.constData()));
break;
case QShaderDescription::Int4:
case QRhiShaderDescription::Int4:
f->glUniform4iv(uniform.glslLocation, 1, reinterpret_cast<const qint32 *>(uniform.data.constData()));
break;
// ### more types
......@@ -2558,13 +2558,13 @@ bool QGles2GraphicsPipeline::build()
continue;
GLuint shader = rhiD->f->glCreateShader(isVertex ? GL_VERTEX_SHADER : GL_FRAGMENT_SHADER);
QBakedShaderVersion ver;
QRhiShaderVersion ver;
if (rhiD->ctx->isOpenGLES())
ver = { 100, QBakedShaderVersion::GlslEs };
ver = { 100, QRhiShaderVersion::GlslEs };
else
ver = { 120 };
const QBakedShader bakedShader = shaderStage.shader();
const QByteArray source = bakedShader.shader({ QBakedShaderKey::GlslShader, ver, shaderStage.shaderVariant() }).shader();
const QRhiShader bakedShader = shaderStage.shader();
const QByteArray source = bakedShader.shader({ QRhiShaderKey::GlslShader, ver, shaderStage.shaderVariant() }).shader();
if (source.isEmpty()) {
qWarning() << "No GLSL" << ver.version() << "shader code found in baked shader" << bakedShader;
return false;
......@@ -2618,9 +2618,9 @@ bool QGles2GraphicsPipeline::build()
return false;
}
auto lookupUniforms = [this, rhiD](const QShaderDescription::UniformBlock &ub) {
auto lookupUniforms = [this, rhiD](const QRhiShaderDescription::UniformBlock &ub) {
const QByteArray prefix = ub.structName.toUtf8() + '.';
for (const QShaderDescription::BlockVariable &blockMember : ub.members) {
for (const QRhiShaderDescription::BlockVariable &blockMember : ub.members) {
// ### no array support for now
Uniform uniform;
uniform.type = blockMember.type;
......@@ -2635,13 +2635,13 @@ bool QGles2GraphicsPipeline::build()
}
};
for (const QShaderDescription::UniformBlock &ub : vsDesc.uniformBlocks())
for (const QRhiShaderDescription::UniformBlock &ub : vsDesc.uniformBlocks())
lookupUniforms(ub);
for (const QShaderDescription::UniformBlock &ub : fsDesc.uniformBlocks())
for (const QRhiShaderDescription::UniformBlock &ub : fsDesc.uniformBlocks())
lookupUniforms(ub);
auto lookupSamplers = [this, rhiD](const QShaderDescription::InOutVariable &v) {
auto lookupSamplers = [this, rhiD](const QRhiShaderDescription::InOutVariable &v) {
Sampler sampler;
const QByteArray name = v.name.toUtf8();
sampler.glslLocation = rhiD->f->glGetUniformLocation(program, name.constData());
......@@ -2651,10 +2651,10 @@ bool QGles2GraphicsPipeline::build()
}
};
for (const QShaderDescription::InOutVariable &v : vsDesc.combinedImageSamplers())
for (const QRhiShaderDescription::InOutVariable &v : vsDesc.combinedImageSamplers())
lookupSamplers(v);
for (const QShaderDescription::InOutVariable &v : fsDesc.combinedImageSamplers())
for (const QRhiShaderDescription::InOutVariable &v : fsDesc.combinedImageSamplers())
lookupSamplers(v);
generation += 1;
......
......@@ -45,7 +45,7 @@
#include "qrhi_p.h"
#include <qopengl.h>
#include <QSurface>
#include <QShaderDescription>
#include <QRhiShaderDescription>
QT_BEGIN_NAMESPACE
......@@ -202,11 +202,11 @@ struct QGles2GraphicsPipeline : public QRhiGraphicsPipeline
GLuint program = 0;
GLenum drawMode = GL_TRIANGLES;
QShaderDescription vsDesc;
QShaderDescription fsDesc;
QRhiShaderDescription vsDesc;
QRhiShaderDescription fsDesc;
struct Uniform {
QShaderDescription::VarType type;
QRhiShaderDescription::VarType type;
int glslLocation;
int binding;
uint offset;
......
......@@ -38,7 +38,7 @@
#include <QGuiApplication>
#include <QWindow>
#include <qmath.h>
#include <QBakedShader>
#include <QRhiShader>
#include <AppKit/AppKit.h>
#include <Metal/Metal.h>
#include <QuartzCore/CAMetalLayer.h>
......@@ -129,7 +129,7 @@ struct QRhiMetalData
const QRhiColorClearValue &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
int colorAttCount);
id<MTLLibrary> createMetalLib(const QBakedShader &shader, QBakedShaderKey::ShaderVariant shaderVariant,
id<MTLLibrary> createMetalLib(const QRhiShader &shader, QRhiShaderKey::ShaderVariant shaderVariant,
QString *error, QByteArray *entryPoint);
id<MTLFunction> createMSLShaderFunction(id<MTLLibrary> lib, const QByteArray &entryPoint);
......@@ -2722,10 +2722,10 @@ static inline MTLCullMode toMetalCullMode(QRhiGraphicsPipeline::CullMode c)
}
}
id<MTLLibrary> QRhiMetalData::createMetalLib(const QBakedShader &shader, QBakedShaderKey::ShaderVariant shaderVariant,
id<MTLLibrary> QRhiMetalData::createMetalLib(const QRhiShader &shader, QRhiShaderKey::ShaderVariant shaderVariant,
QString *error, QByteArray *entryPoint)
{
QBakedShaderCode mtllib = shader.shader({ QBakedShaderKey::MetalLibShader, 12, shaderVariant });
QRhiShaderCode mtllib = shader.shader({ QRhiShaderKey::MetalLibShader, 12, shaderVariant });
if (!mtllib.shader().isEmpty()) {
dispatch_data_t data = dispatch_data_create(mtllib.shader().constData(),
mtllib.shader().size(),
......@@ -2743,7 +2743,7 @@ id<MTLLibrary> QRhiMetalData::createMetalLib(const QBakedShader &shader, QBakedS
}
}
QBakedShaderCode mslSource = shader.shader({ QBakedShaderKey::MslShader, 12, shaderVariant });
QRhiShaderCode mslSource = shader.shader({ QRhiShaderKey::MslShader, 12, shaderVariant });
if (mslSource.shader().isEmpty()) {
qWarning() << "No MSL 1.2 code found in baked shader" << shader;
return nil;
......
......@@ -43,7 +43,7 @@
#include "qrhimetal.h"
#include "qrhi_p.h"
#include <QShaderDescription>
#include <QRhiShaderDescription>
#include <QWindow>
QT_BEGIN_NAMESPACE
......
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt RHI module
......@@ -34,26 +34,26 @@
**
****************************************************************************/
#include "qbakedshader_p.h"
#include "qrhishader_p.h"
#include <QDataStream>
#include <QBuffer>
QT_BEGIN_NAMESPACE
/*!
\class QBakedShader
\class QRhiShader
\inmodule QtRhi
\brief Contains multiple versions of a shader translated to multiple shading languages,
together with reflection metadata.
QBakedShader is the entry point to shader code in the graphics API agnostic
QRhiShader is the entry point to shader code in the graphics API agnostic
Qt world. Instead of using GLSL shader sources, as was the custom with Qt
5.x, new graphics systems with backends for multiple graphics APIs, such
as, Vulkan, Metal, Direct3D, and OpenGL, take QBakedShader as their input
as, Vulkan, Metal, Direct3D, and OpenGL, take QRhiShader as their input
whenever a shader needs to be specified.
A QBakedShader instance is empty and thus invalid by default. To get a useful
A QRhiShader instance is empty and thus invalid by default. To get a useful
instance, the two typical methods are:
\list
......@@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
When used together with the Qt Rendering Hardware Interface and its
classes, like QRhiGraphicsPipeline, no further action is needed from the
application's side as these classes are prepared to consume a QBakedShader
application's side as these classes are prepared to consume a QRhiShader
whenever a shader needs to be specified for a given stage of the graphics
pipeline.
......@@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE
\list
\li the source or byte code for any of the shading language versions that
are included in the QBakedShader,
are included in the QRhiShader,
\li the name of the entry point for the shader,
......@@ -92,15 +92,15 @@ QT_BEGIN_NAMESPACE
\endlist
QBakedShader makes no assumption about the shading language that was used
QRhiShader makes no assumption about the shading language that was used
as the source for generating the various versions and variants that are
included in it.
QBakedShader uses implicit sharing similarly to many core Qt types, and so
QRhiShader uses implicit sharing similarly to many core Qt types, and so
can be returned or passed by value. Detach happens implicitly when calling
a setter.
For reference, QRhi expects that a QBakedShader suitable for all its
For reference, QRhi expects that a QRhiShader suitable for all its
backends contains at least the following:
\list
......@@ -121,7 +121,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
\enum QBakedShader::ShaderStage
\enum QRhiShader::ShaderStage
Describes the stage of the graphics pipeline the shader is suitable for.
\value VertexStage Vertex shader
......@@ -133,7 +133,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
\class QBakedShaderVersion
\class QRhiShaderVersion
\inmodule QtRhi
\brief Specifies the shading language version.
......@@ -157,12 +157,12 @@ QT_BEGIN_NAMESPACE
\li Metal: 12, 20
\endlist
A default constructed QBakedShaderVersion contains a version of 100 and no
A default constructed QRhiShaderVersion contains a version of 100 and no
flags set.
*/
/*!
\enum QBakedShaderVersion::Flag
\enum QRhiShaderVersion::Flag
Describes the flags that can be set.
......@@ -170,17 +170,17 @@ QT_BEGIN_NAMESPACE
*/
/*!
\class QBakedShaderKey
\class QRhiShaderKey
\inmodule QtRhi
\brief Specifies the shading language, the version with flags, and the variant.
A default constructed QBakedShaderKey has source set to SpirvShader and
A default constructed QRhiShaderKey has source set to SpirvShader and
sourceVersion set to 100. sourceVariant defaults to StandardShader.
*/
/*!
\enum QBakedShaderKey::ShaderSource
\enum QRhiShaderKey::ShaderSource
Describes what kind of shader code an entry contains.
\value SpirvShader SPIR-V
......@@ -193,7 +193,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
\enum QBakedShaderKey::ShaderVariant
\enum QRhiShaderKey::ShaderVariant
Describes what kind of shader code an entry contains.
\value StandardShader The normal, unmodified version of the shader code.
......@@ -201,29 +201,29 @@ QT_BEGIN_NAMESPACE
*/
/*!
\class QBakedShaderCode
\class QRhiShaderCode
\inmodule QtRhi
\brief Contains source or binary code for a shader and additional metadata.
When shader() is empty after retrieving a QBakedShaderCode instance from
QBakedShader, it indicates no shader code was found for the requested key.
When shader() is empty after retrieving a QRhiShaderCode instance from
QRhiShader, it indicates no shader code was found for the requested key.
*/
static const int QSB_VERSION = 1;
/*!
Constructs a new, empty (and thus invalid) QBakedShader instance.
Constructs a new, empty (and thus invalid) QRhiShader instance.
*/
QBakedShader::QBakedShader()
: d(new QBakedShaderPrivate)
QRhiShader::QRhiShader()
: d(new QRhiShaderPrivate)
{
}
/*!
\internal
*/
void QBakedShader::detach()
void QRhiShader::detach()
{
qAtomicDetach(d);
}
......@@ -231,7 +231,7 @@ void QBakedShader::detach()
/*!
\internal
*/
QBakedShader::QBakedShader(const QBakedShader &other)
QRhiShader::QRhiShader(const QRhiShader &other)
: d(other.d)
{
d->ref.ref();
......@@ -240,7 +240,7 @@ QBakedShader::QBakedShader(const QBakedShader &other)
/*!
\internal
*/
QBakedShader &QBakedShader::operator=(const QBakedShader &other)
QRhiShader &QRhiShader::operator=(const QRhiShader &other)
{
qAtomicAssign(d, other.d);
return *this;
......@@ -249,16 +249,16 @@ QBakedShader &QBakedShader::operator=(const QBakedShader &other)
/*!
Destructor.
*/
QBakedShader::~QBakedShader()
QRhiShader::~QRhiShader()
{
if (!d->ref.deref())
delete d;
}
/*!
\return true if the QBakedShader contains at least one shader version.
\return true if the QRhiShader contains at least one shader version.
*/
bool QBakedShader::isValid() const
bool QRhiShader::isValid() const
{
return !d->shaders.isEmpty();
}
......@@ -266,7 +266,7 @@ bool QBakedShader::isValid() const
/*!
\return the pipeline stage the shader is meant for.
*/
QBakedShader::ShaderStage QBakedShader::stage() const
QRhiShader::ShaderStage QRhiShader::stage() const
{
return d->stage;
}
......@@ -274,7 +274,7 @@ QBakedShader::ShaderStage QBakedShader::stage() const
/*!
Sets the pipeline \a stage.
*/
void QBakedShader::setStage(ShaderStage stage)
void QRhiShader::setStage(ShaderStage stage)
{
if (stage != d->stage) {
detach();
......@@ -285,7 +285,7 @@ void QBakedShader::setStage(ShaderStage stage)
/*!
\return the reflection metadata for the shader.
*/
QShaderDescription QBakedShader::description() const
QRhiShaderDescription QRhiShader::description() const
{
return d->desc;
}
......@@ -293,7 +293,7 @@ QShaderDescription QBakedShader::description() const
/*!
Sets the reflection metadata to \a desc.
*/
void QBakedShader::setDescription(const QShaderDescription &desc)
void QRhiShader::setDescription(const QRhiShaderDescription &desc)
{
detach();
d->desc = desc;
......@@ -302,7 +302,7 @@ void QBakedShader::setDescription(const QShaderDescription &desc)
/*!
\return the list of available shader versions
*/
QList<QBakedShaderKey> QBakedShader::availableShaders() const
QList<QRhiShaderKey> QRhiShader::availableShaders() const
{
return d->shaders.keys();
}
......@@ -310,7 +310,7 @@ QList<QBakedShaderKey> QBakedShader::availableShaders() const
/*!
\return the source or binary code for a given shader version specified by \a key.
*/
QBakedShaderCode QBakedShader::shader(const QBakedShaderKey &key) const
QRhiShaderCode QRhiShader::shader(const QRhiShaderKey &key) const
{
return d->shaders.value(key);
}
......@@ -318,7 +318,7 @@ QBakedShaderCode QBakedShader::shader(const QBakedShaderKey &key) const
/*!
Stores the source or binary \a shader code for a given shader version specified by \a key.
*/
void QBakedShader::setShader(const QBakedShaderKey &key, const QBakedShaderCode &shader)
void QRhiShader::setShader(const QRhiShaderKey &key, const QRhiShaderCode &shader)
{
if (d->shaders.value(key) == shader)
return;
......@@ -331,7 +331,7 @@ void QBakedShader::setShader(const QBakedShaderKey &key, const QBakedShaderCode
Removes the source or binary shader code for a given \a key.
Does nothing when not found.
*/
void QBakedShader::removeShader(const QBakedShaderKey &key)
void QRhiShader::removeShader(const QRhiShaderKey &key)
{
auto it = d->shaders.find(key);
if (it == d->shaders.end())
......@@ -343,11 +343,11 @@ void QBakedShader::removeShader(const QBakedShaderKey &key)
/*!
\return a serialized binary version of all the data held by the
QBakedShader, suitable for writing to files or other I/O devices.
QRhiShader, suitable for writing to files or other I/O devices.
\sa fromSerialized()
*/
QByteArray QBakedShader::serialized() const
QByteArray QRhiShader::serialized() const
{
QBuffer buf;
QDataStream ds(&buf);
......@@ -360,12 +360,12 @@ QByteArray QBakedShader::serialized() const
ds << d->desc.toBinaryJson();
ds << d->shaders.count();
for (auto it = d->shaders.cbegin(), itEnd = d->shaders.cend(); it != itEnd; ++it) {
const QBakedShaderKey &k(it.key());
const QRhiShaderKey &k(it.key());
ds << k.source();
ds << k.sourceVersion().version();