Class Shader

Inheritance Relationships

Base Type

Class Documentation

class Shader : public Cacao::Asset

Asset type for GPU shaders.

Public Functions

virtual void Realize()

Convert the shader data into a form suitable for rendering.

Throws:
  • BadRealizeStateException – If the shader is already realized

  • BadInitStateException – If the graphics backend is not initialized or connected

virtual void DropRealized()

Destroy the realized representation of the asset.

Throws:
  • BadRealizeStateException – If the shader is not realized

  • BadInitStateException – If the graphics backend is not initialized or connected

~Shader()

Public Static Functions

static inline std::shared_ptr<Shader> Create(std::vector<unsigned char> &&shaderIR, ShaderDescription desc, const std::string &addr)

Create a new shader from IR code.

Parameters:
  • shaderIR – The Slang IR code to create the shader with

  • descShader behavior and input information

  • addr – The resource address to associate with the shader

Throws:
  • BadValueException – If the IR code buffer is empty

  • BadValueException – If the shader description contains invalid data

  • BadValueException – If the address is malformed