NDEVR
API Documentation
VulkanShaderManager

Manages all active shaders in a VulkanSession. More...

Collaboration diagram for VulkanShaderManager:
[legend]

Public Types

enum  ShaderType {
  e_simple_points , e_points , e_linework , e_solid ,
  e_solid_grid , e_solid_texture , e_tbn_texture , e_shader_type_size ,
  e_all
}
 The types of shaders available for rendering different primitives. More...

Public Member Functions

 VulkanShaderManager (const ConstPointer< VulkanDevice > &device)
 Constructs a shader manager for the given device.
void addShader (const StringView &name, ShaderType type, const Buffer< char > &data)
 Adds a shader from raw bytecode.
void addShader (const StringView &name, ShaderType type, File &file)
 Adds a shader from a file.
void ensureCreated (const StringView &name)
 Ensures all shader types for the named shader set are created.
void ensureCreated (ShaderType type, const StringView &name)
 Ensures a specific shader type for the named shader set is created.
ConstPointer< VulkanShadergetShader (const StringView &file, ShaderType type)
 Retrieves a shader of the given type from the named set.
void setInstance (const ConstPointer< VulkanDevice > &device)
 Sets the Vulkan device for all managed shaders.

Static Public Attributes

static const StringView formats [ShaderType::e_shader_type_size] = { "points_s", "points", "linework", "solid", "solid_grid", "solid_texture","tbn" }
 File name suffixes for each shader type.

Protected Attributes

Dictionary< String, Buffer< char >[ShaderType::e_shader_type_size]> m_data
 Raw SPIR-V data keyed by name.
ConstPointer< VulkanDevicem_device
 The Vulkan device.
Dictionary< String, DynamicPointer< VulkanShader >[ShaderType::e_shader_type_size]> m_shader_map
 Compiled shader modules keyed by name.

Detailed Description

Manages all active shaders in a VulkanSession.


Definition at line 88 of file VulkanShader.h.

Member Enumeration Documentation

◆ ShaderType

The types of shaders available for rendering different primitives.


Enumerator
e_simple_points 

Simplified point rendering shader.

e_points 

Full point rendering shader.

e_linework 

Line rendering shader.

e_solid 

Solid surface rendering shader.

e_solid_grid 

Solid surface with grid overlay shader.

e_solid_texture 

Solid surface with texture mapping shader.

e_tbn_texture 

Tangent-bitangent-normal texture mapping shader.

e_shader_type_size 

The number of shader types (sentinel).

e_all 

Represents all shader types.

Definition at line 94 of file VulkanShader.h.

Constructor & Destructor Documentation

◆ VulkanShaderManager()

VulkanShaderManager::VulkanShaderManager ( const ConstPointer< VulkanDevice > & device)

Constructs a shader manager for the given device.

Parameters
[in]deviceThe Vulkan device.

Member Function Documentation

◆ addShader() [1/2]

void VulkanShaderManager::addShader ( const StringView & name,
ShaderType type,
const Buffer< char > & data )

Adds a shader from raw bytecode.

Parameters
[in]nameThe shader set name.
[in]typeThe shader type.
[in]dataThe SPIR-V bytecode.

◆ addShader() [2/2]

void VulkanShaderManager::addShader ( const StringView & name,
ShaderType type,
File & file )

Adds a shader from a file.

Parameters
[in]nameThe shader set name.
[in]typeThe shader type.
[in]fileThe SPIR-V file.

◆ ensureCreated() [1/2]

void VulkanShaderManager::ensureCreated ( const StringView & name)

Ensures all shader types for the named shader set are created.

Parameters
[in]nameThe shader set name.

◆ ensureCreated() [2/2]

void VulkanShaderManager::ensureCreated ( ShaderType type,
const StringView & name )

Ensures a specific shader type for the named shader set is created.

Parameters
[in]typeThe shader type.
[in]nameThe shader set name.

◆ getShader()

ConstPointer< VulkanShader > VulkanShaderManager::getShader ( const StringView & file,
ShaderType type )

Retrieves a shader of the given type from the named set.

Parameters
[in]fileThe shader set name.
[in]typeThe shader type.
Returns
A const pointer to the shader.

◆ setInstance()

void VulkanShaderManager::setInstance ( const ConstPointer< VulkanDevice > & device)

Sets the Vulkan device for all managed shaders.

Parameters
[in]deviceThe Vulkan device.

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