class ShaderModule
Defined at line 37 of file ../../src/ui/lib/escher/vk/shader_module.h
Base class that knows hows to wrap SPIR-V code into a vk::ShaderModule and
notify listeners so that e.g. vk::Pipelines can be invalidated/regenerated.
Subclasses should call RecreateModuleFromSpirvAndNotifyListeners() whenever
the input SPIR-V code changes.
The primary design goal is to decouple use of binary SPIR-V code (i.e. to
build vk::Pipelines), from how the SPIR-V code is produced. For example,
see ShaderModuleTemplate, which generates variants of the template by
compiling GLSL code with different preprocessor definitions.
Public Methods
void ShaderModule (vk::Device device, ShaderStage shader_stage)
Defined at line 12 of file ../../src/ui/lib/escher/vk/shader_module.cc
void ~ShaderModule ()
Defined at line 15 of file ../../src/ui/lib/escher/vk/shader_module.cc
void AddShaderModuleListener (ShaderModuleListener * listener)
Add a listener. If is_valid(), then listener->OnShaderModuleUpdated() will
be called immediately.
Defined at line 23 of file ../../src/ui/lib/escher/vk/shader_module.cc
void RemoveShaderModuleListener (ShaderModuleListener * listener)
Listeners are responsible for removing themselves before the ShaderModule
is destroyed.
Defined at line 33 of file ../../src/ui/lib/escher/vk/shader_module.cc
ShaderStage shader_stage ()
Return the shader stage that this module should be used for.
Defined at line 43 of file ../../src/ui/lib/escher/vk/shader_module.h
bool is_valid ()
Return true if a valid vk::ShaderModule is available, and false otherwise.
Defined at line 46 of file ../../src/ui/lib/escher/vk/shader_module.h
const vk::ShaderModule & vk ()
Return the most up-to-date vk::ShaderModule. Clients must ensure that the
module is_valid() before calling.
Defined at line 50 of file ../../src/ui/lib/escher/vk/shader_module.h
const impl::ShaderModuleResourceLayout & shader_module_resource_layout ()
Return the module's resource layout. Escher clients never need to call
this; it is used internally by ShaderProgram.
Defined at line 65 of file ../../src/ui/lib/escher/vk/shader_module.h
Protected Methods
void RecreateModuleFromSpirvAndNotifyListeners (std::vector<uint32_t> spirv)
Subclasses should call this when new SPIR-V is available.
Defined at line 40 of file ../../src/ui/lib/escher/vk/shader_module.cc