Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qssgrendershadercache.cpp File Reference
#include "graphobjects/qssgrendergraphobject_p.h"
#include "qssgrendershadercache_p.h"
#include "qssgrendercontextcore_p.h"
#include <QtQuick3DUtils/private/qssgutils_p.h>
#include <QtQuick3DUtils/private/qquick3dprofiler_p.h>
#include <QtQuick3DRuntimeRender/private/qssgruntimerenderlogging_p.h>
#include <qtquick3d_tracepoints_p.h>
#include <QCoreApplication>
#include <QStandardPaths>
#include <QString>
#include <QFile>
#include <QDir>
#include <QtGui/qsurfaceformat.h>
#include <QtCore/qmutex.h>
+ Include dependency graph for qssgrendershadercache.cpp:

Go to the source code of this file.

Classes

struct  DefineEntry
 

Namespaces

namespace  QtQuick3DEditorHelpers
 

Functions

 Q_GLOBAL_STATIC (QMutex, s_statusMutex)
 
size_t qHash (QSSGShaderFeatures features) noexcept
 
static QString dumpFilename (QShader::Stage stage)
 
static void initBakerForNonPersistentUse (QShaderBaker *, QRhi *)
 
static void initBakerForPersistentUse (QShaderBaker *, QRhi *)
 
static bool isAutoDiskCacheEnabled ()
 
static bool ensureWritableDir (const QString &name)
 
static QString persistentQsbcDir ()
 
static QString persistentQsbcFileName ()
 

Variables

static QT_BEGIN_NAMESPACE QtQuick3DEditorHelpers::ShaderBaker::StatusCallback s_statusCallback = nullptr
 
static constexpr DefineEntry DefineTable []
 
static bool s_autoDiskCacheEnabled = true
 

Function Documentation

◆ dumpFilename()

static QString dumpFilename ( QShader::Stage  stage)
static

Definition at line 42 of file qssgrendershadercache.cpp.

References QShader::FragmentStage, QStringLiteral, and QShader::VertexStage.

Referenced by QSSGShaderCache::compileForRhi().

+ Here is the caller graph for this function:

◆ ensureWritableDir()

static bool ensureWritableDir ( const QString name)
inlinestatic

Definition at line 211 of file qssgrendershadercache.cpp.

References QFileInfo::isWritable(), QDir::mkpath(), and QDir::root().

Referenced by persistentQsbcDir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initBakerForNonPersistentUse()

static void initBakerForNonPersistentUse ( QShaderBaker *  ,
QRhi  
)
static

Definition at line 190 of file qssgrendershadercache.cpp.

Referenced by QSSGShaderCache::QSSGShaderCache().

+ Here is the caller graph for this function:

◆ initBakerForPersistentUse()

static void initBakerForPersistentUse ( QShaderBaker *  ,
QRhi  
)
static

Definition at line 194 of file qssgrendershadercache.cpp.

Referenced by QSSGShaderCache::QSSGShaderCache().

+ Here is the caller graph for this function:

◆ isAutoDiskCacheEnabled()

static bool isAutoDiskCacheEnabled ( )
static

Definition at line 201 of file qssgrendershadercache.cpp.

References Qt::AA_DisableShaderDiskCache, qApp, qEnvironmentVariableIntValue(), and s_autoDiskCacheEnabled.

Referenced by QSSGShaderCache::QSSGShaderCache().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ persistentQsbcDir()

static QString persistentQsbcDir ( )
static

Definition at line 217 of file qssgrendershadercache.cpp.

References QSysInfo::buildAbi(), QStandardPaths::CacheLocation, ensureWritableDir(), QString::isEmpty(), subPath(), and QStandardPaths::writableLocation().

Referenced by persistentQsbcFileName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ persistentQsbcFileName()

static QString persistentQsbcFileName ( )
inlinestatic

Definition at line 238 of file qssgrendershadercache.cpp.

References QString::isEmpty(), and persistentQsbcDir().

Referenced by QSSGShaderCache::QSSGShaderCache().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Q_GLOBAL_STATIC()

Q_GLOBAL_STATIC ( QMutex  ,
s_statusMutex   
)

◆ qHash()

size_t qHash ( QSSGShaderFeatures  features)
noexcept

Definition at line 40 of file qssgrendershadercache.cpp.

References QSSGShaderFeatures::IndexMask.

Referenced by QSSGShaderCacheKey::generateHashCode().

+ Here is the caller graph for this function:

Variable Documentation

◆ DefineTable

constexpr DefineEntry DefineTable[]
staticconstexpr
Initial value:
{
{ "QSSG_ENABLE_LIGHT_PROBE", QSSGShaderFeatures::Feature::LightProbe },
{ "QSSG_ENABLE_IBL_ORIENTATION", QSSGShaderFeatures::Feature::IblOrientation },
{ "QSSG_ENABLE_SSM", QSSGShaderFeatures::Feature::Ssm },
{ "QSSG_ENABLE_SSAO", QSSGShaderFeatures::Feature::Ssao },
{ "QSSG_ENABLE_DEPTH_PASS", QSSGShaderFeatures::Feature::DepthPass },
{ "QSSG_ENABLE_ORTHO_SHADOW_PASS", QSSGShaderFeatures::Feature::OrthoShadowPass },
{ "QSSG_ENABLE_CUBE_SHADOW_PASS", QSSGShaderFeatures::Feature::CubeShadowPass },
{ "QSSG_ENABLE_LINEAR_TONEMAPPING", QSSGShaderFeatures::Feature::LinearTonemapping },
{ "QSSG_ENABLE_ACES_TONEMAPPING", QSSGShaderFeatures::Feature::AcesTonemapping },
{ "QSSG_ENABLE_HEJLDAWSON_TONEMAPPING", QSSGShaderFeatures::Feature::HejlDawsonTonemapping },
{ "QSSG_ENABLE_FILMIC_TONEMAPPING", QSSGShaderFeatures::Feature::FilmicTonemapping },
{ "QSSG_ENABLE_RGBE_LIGHT_PROBE", QSSGShaderFeatures::Feature::RGBELightProbe },
{ "QSSG_ENABLE_OPAQUE_DEPTH_PRE_PASS", QSSGShaderFeatures::Feature::OpaqueDepthPrePass },
{ "QSSG_ENABLE_REFLECTION_PROBE", QSSGShaderFeatures::Feature::ReflectionProbe },
{ "QSSG_REDUCE_MAX_NUM_LIGHTS", QSSGShaderFeatures::Feature::ReduceMaxNumLights },
{ "QSSG_ENABLE_LIGHTMAP", QSSGShaderFeatures::Feature::Lightmap }
}

Definition at line 62 of file qssgrendershadercache.cpp.

Referenced by QSSGShaderFeatures::asDefineString(), and QSSGShaderFeatures::fromIndex().

◆ s_autoDiskCacheEnabled

bool s_autoDiskCacheEnabled = true
static

◆ s_statusCallback