SDEngine
Game Engine
Loading...
Searching...
No Matches
sd::ShaderLibrary Class Reference

Compiles HLSL → SPIR-V and caches VkShaderModules. More...

#include <ShaderLibrary.hpp>

+ Collaboration diagram for sd::ShaderLibrary:

Classes

struct  ShaderEntry
 

Public Member Functions

 ShaderLibrary (VkDevice device)
 
 ~ShaderLibrary ()
 
VkShaderModule load (const std::string &hlsl_path, const std::string &profile)
 
std::set< std::string > check_for_changes ()
 
void clear_cache ()
 Destroys all shader modules and clears the cache.
 
 ShaderLibrary (const ShaderLibrary &)=delete
 
ShaderLibraryoperator= (const ShaderLibrary &)=delete
 

Private Attributes

VkDevice m_device
 
std::unordered_map< std::string, ShaderEntrym_cache
 
ShaderCompiler m_compiler
 

Detailed Description

Compiles HLSL → SPIR-V and caches VkShaderModules.

Constructor & Destructor Documentation

◆ ShaderLibrary() [1/2]

sd::ShaderLibrary::ShaderLibrary ( VkDevice  device)
explicit

◆ ~ShaderLibrary()

sd::ShaderLibrary::~ShaderLibrary ( )
default

◆ ShaderLibrary() [2/2]

sd::ShaderLibrary::ShaderLibrary ( const ShaderLibrary )
delete

Member Function Documentation

◆ check_for_changes()

std::set< std::string > sd::ShaderLibrary::check_for_changes ( )

Checks if any cached shaders have changed on disk. Returns a set of paths that have been modified.

◆ clear_cache()

void sd::ShaderLibrary::clear_cache ( )

Destroys all shader modules and clears the cache.

◆ load()

VkShaderModule sd::ShaderLibrary::load ( const std::string &  hlsl_path,
const std::string &  profile 
)

◆ operator=()

ShaderLibrary & sd::ShaderLibrary::operator= ( const ShaderLibrary )
delete

Member Data Documentation

◆ m_cache

std::unordered_map<std::string, ShaderEntry> sd::ShaderLibrary::m_cache
private

◆ m_compiler

ShaderCompiler sd::ShaderLibrary::m_compiler
private

◆ m_device

VkDevice sd::ShaderLibrary::m_device
private

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