Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QSSGShaderCache Class Reference

#include <qssgrendershadercache_p.h>

+ Collaboration diagram for QSSGShaderCache:

Public Types

enum class  ShaderType { Vertex = 0 , Fragment = 1 }
 
using InitBakerFunc = void(*)(QShaderBaker *baker, QRhi *rhi)
 

Public Member Functions

 QSSGShaderCache (QSSGRhiContext &ctx, const InitBakerFunc initBakeFn=nullptr)
 
 ~QSSGShaderCache ()
 
void releaseCachedResources ()
 
QQsbInMemoryCollectionpersistentShaderBakingCache ()
 
QSSGRhiShaderPipelinePtr tryGetRhiShaderPipeline (const QByteArray &inKey, const QSSGShaderFeatures &inFeatures)
 
QSSGRhiShaderPipelinePtr tryNewPipelineFromPersistentCache (const QByteArray &qsbcKey, const QByteArray &inKey, const QSSGShaderFeatures &inFeatures, QSSGRhiShaderPipeline::StageFlags stageFlags={})
 
QSSGRhiShaderPipelinePtr newPipelineFromPregenerated (const QByteArray &inKey, const QSSGShaderFeatures &inFeatures, QQsbCollection::Entry entry, const QSSGRenderGraphObject &obj, QSSGRhiShaderPipeline::StageFlags stageFlags={})
 
QSSGRhiShaderPipelinePtr compileForRhi (const QByteArray &inKey, const QByteArray &inVert, const QByteArray &inFrag, const QSSGShaderFeatures &inFeatures, QSSGRhiShaderPipeline::StageFlags stageFlags)
 
QSSGRhiShaderPipelinePtr loadBuiltinForRhi (const QByteArray &inKey)
 

Static Public Member Functions

static QByteArray resourceFolder ()
 
static QByteArray shaderCollectionFile ()
 

Detailed Description

Definition at line 160 of file qssgrendershadercache_p.h.

Member Typedef Documentation

◆ InitBakerFunc

using QSSGShaderCache::InitBakerFunc = void (*)(QShaderBaker *baker, QRhi *rhi)

Definition at line 170 of file qssgrendershadercache_p.h.

Member Enumeration Documentation

◆ ShaderType

enum class QSSGShaderCache::ShaderType
strong
Enumerator
Vertex 
Fragment 

Definition at line 164 of file qssgrendershadercache_p.h.

Constructor & Destructor Documentation

◆ QSSGShaderCache()

QSSGShaderCache::QSSGShaderCache ( QSSGRhiContext ctx,
const InitBakerFunc  initBakeFn = nullptr 
)

◆ ~QSSGShaderCache()

QSSGShaderCache::~QSSGShaderCache ( )

Definition at line 283 of file qssgrendershadercache.cpp.

References QString::isEmpty(), and QQsbInMemoryCollection::save().

+ Here is the call graph for this function:

Member Function Documentation

◆ compileForRhi()

QSSGRhiShaderPipelinePtr QSSGShaderCache::compileForRhi ( const QByteArray inKey,
const QByteArray inVert,
const QByteArray inFrag,
const QSSGShaderFeatures inFeatures,
QSSGRhiShaderPipeline::StageFlags  stageFlags 
)

◆ loadBuiltinForRhi()

◆ newPipelineFromPregenerated()

QSSGRhiShaderPipelinePtr QSSGShaderCache::newPipelineFromPregenerated ( const QByteArray inKey,
const QSSGShaderFeatures inFeatures,
QQsbCollection::Entry  entry,
const QSSGRenderGraphObject obj,
QSSGRhiShaderPipeline::StageFlags  stageFlags = {} 
)

◆ persistentShaderBakingCache()

QQsbInMemoryCollection & QSSGShaderCache::persistentShaderBakingCache ( )
inline

Definition at line 192 of file qssgrendershadercache_p.h.

◆ releaseCachedResources()

void QSSGShaderCache::releaseCachedResources ( )

Definition at line 289 of file qssgrendershadercache.cpp.

References QHash< Key, T >::clear().

+ Here is the call graph for this function:

◆ resourceFolder()

QByteArray QSSGShaderCache::resourceFolder ( )
static

Definition at line 350 of file qssgrendershadercache.cpp.

References QByteArrayLiteral.

Referenced by loadBuiltinForRhi(), QSSGShaderLibraryManager::loadPregeneratedShaderInfo(), and newPipelineFromPregenerated().

+ Here is the caller graph for this function:

◆ shaderCollectionFile()

QByteArray QSSGShaderCache::shaderCollectionFile ( )
static

Definition at line 355 of file qssgrendershadercache.cpp.

References QByteArrayLiteral.

Referenced by QSSGShaderLibraryManager::loadPregeneratedShaderInfo(), and newPipelineFromPregenerated().

+ Here is the caller graph for this function:

◆ tryGetRhiShaderPipeline()

QSSGRhiShaderPipelinePtr QSSGShaderCache::tryGetRhiShaderPipeline ( const QByteArray inKey,
const QSSGShaderFeatures inFeatures 
)

Definition at line 297 of file qssgrendershadercache.cpp.

References QHash< Key, T >::cend(), QHash< Key, T >::constFind(), QSSGShaderCacheKey::m_features, and QSSGShaderCacheKey::updateHashCode().

Referenced by compileForRhi(), QSSGRenderer::generateRhiShaderPipelineImpl(), and loadBuiltinForRhi().

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

◆ tryNewPipelineFromPersistentCache()

QSSGRhiShaderPipelinePtr QSSGShaderCache::tryNewPipelineFromPersistentCache ( const QByteArray qsbcKey,
const QByteArray inKey,
const QSSGShaderFeatures inFeatures,
QSSGRhiShaderPipeline::StageFlags  stageFlags = {} 
)

Definition at line 545 of file qssgrendershadercache.cpp.

References QByteArray::constData(), QSSGRhiContext::editorMode(), QQsbInMemoryCollection::extractEntry(), QRhiShaderStage::Fragment, QQsbCollection::EntryDesc::fragShader, QHash< Key, T >::insert(), QShader::isValid(), QSSGShaderCacheKey::m_features, qDebug, QSSGRhiContext::shaderDebuggingEnabled(), QSSGShaderCacheKey::updateHashCode(), QRhiShaderStage::Vertex, and QQsbCollection::EntryDesc::vertShader.

Referenced by QSSGRenderer::generateRhiShaderPipelineImpl().

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

The documentation for this class was generated from the following files: