rhi doc: Make getShader in the snippets more compact
One line is better than three. Pick-to: 6.6 Change-Id: Ib738ec18b51accead3897b450b26207b3fba87d8 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
ec2faefbc2
commit
bcf14392df
@ -82,9 +82,7 @@ int main(int argc, char **argv)
|
||||
ps->setTargetBlends({ premulAlphaBlend });
|
||||
static auto getShader = [](const QString &name) {
|
||||
QFile f(name);
|
||||
if (f.open(QIODevice::ReadOnly))
|
||||
return QShader::fromSerialized(f.readAll());
|
||||
return QShader();
|
||||
return f.open(QIODevice::ReadOnly) ? QShader::fromSerialized(f.readAll()) : QShader();
|
||||
};
|
||||
ps->setShaderStages({
|
||||
{ QRhiShaderStage::Vertex, getShader(QLatin1String("color.vert.qsb")) },
|
||||
|
@ -2029,9 +2029,7 @@ QDebug operator<<(QDebug dbg, const QRhiVertexInputLayout &v)
|
||||
QShader getShader(const QString &name)
|
||||
{
|
||||
QFile f(name);
|
||||
if (f.open(QIODevice::ReadOnly))
|
||||
return QShader::fromSerialized(f.readAll());
|
||||
return QShader();
|
||||
return f.open(QIODevice::ReadOnly) ? QShader::fromSerialized(f.readAll()) : QShader();
|
||||
}
|
||||
|
||||
QShader vs = getShader("material.vert.qsb");
|
||||
|
Loading…
Reference in New Issue
Block a user