candlewick 0.1.0
A renderer
Loading...
Searching...
No Matches
candlewick::Shader Struct Reference

RAII wrapper around SDL_GPUShader, with loading utilities. More...

#include <candlewick/core/Shader.h>

Classes

struct  Config
 Shader configuration: number of uniforms, texture samplers, storage textures and storage buffers. More...
 

Public Member Functions

 Shader (const Device &device, const char *filename, const Config &config)
 Load a shader to device provided the shader name and configuration.
 
 Shader (const Shader &)=delete
 Deleted copy constructor.
 
 Shader (Shader &&other) noexcept
 Move constructor.
 
 operator SDL_GPUShader * () const noexcept
 
void release () noexcept
 
 ~Shader () noexcept
 

Static Public Member Functions

static Shader fromMetadata (const Device &device, const char *filename)
 Load shader from metadata.
 

Detailed Description

RAII wrapper around SDL_GPUShader, with loading utilities.

The Shader class wrap around the SDL GPU shader handle. It creates it upon construction of the class, and will release it upon destruction.

Constructor & Destructor Documentation

◆ Shader() [1/3]

candlewick::Shader::Shader ( const Device & device,
const char * filename,
const Config & config )

Load a shader to device provided the shader name and configuration.

Parameters
deviceGPU device
filenameFilename of the shader text source, as in the assets/shaders/src
configConfiguration struct

◆ Shader() [2/3]

candlewick::Shader::Shader ( const Shader & )
delete

Deleted copy constructor.

◆ Shader() [3/3]

candlewick::Shader::Shader ( Shader && other)
inlinenoexcept

Move constructor.

◆ ~Shader()

candlewick::Shader::~Shader ( )
inlinenoexcept

Member Function Documentation

◆ fromMetadata()

Shader candlewick::Shader::fromMetadata ( const Device & device,
const char * filename )
inlinestatic

Load shader from metadata.

◆ operator SDL_GPUShader *()

candlewick::Shader::operator SDL_GPUShader * ( ) const
inlinenoexcept

◆ release()

void candlewick::Shader::release ( )
noexcept

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