sKit  0.0.9
sKit::SDL::ShaderBuilder Class Reference

SDL_GPUShader builder class More...

#include <ShaderBuilder.hpp>

Public Member Functions

 ShaderBuilder ()
 
auto path (std::string path) noexcept -> ShaderBuilder &
 
auto vertex () noexcept -> ShaderBuilder &
 Tells the builder that the shader built is a vertex shader. More...
 
auto fragment () noexcept -> ShaderBuilder &
 Tells the builder that the shader built is a fragment shader. More...
 
auto numUniformBuffers (uint32_t n) noexcept -> ShaderBuilder &
 Tells the builder how many uniform bufferms the shader will receive. More...
 
auto build (SDL_GPUDevice *device) -> SDL_GPUShader *
 

Detailed Description

SDL_GPUShader builder class

Example:

.path("./shader.spv")
.numUniformBuffers(1)
.fragment()
.build(device);

Definition at line 20 of file ShaderBuilder.hpp.

Constructor & Destructor Documentation

◆ ShaderBuilder()

sKit::SDL::ShaderBuilder::ShaderBuilder ( )
inline

Definition at line 22 of file ShaderBuilder.hpp.

Member Function Documentation

◆ build()

auto sKit::SDL::ShaderBuilder::build ( SDL_GPUDevice *  device) -> SDL_GPUShader*

By default, builds a vertex shader with no uniform buffers.

Exceptions
std::runtime_errorif shader path is invalid or shader failed to create

Definition at line 30 of file ShaderBuilder.cpp.

◆ fragment()

auto sKit::SDL::ShaderBuilder::fragment ( ) -> ShaderBuilder&
noexcept

Tells the builder that the shader built is a fragment shader.

Definition at line 20 of file ShaderBuilder.cpp.

◆ numUniformBuffers()

auto sKit::SDL::ShaderBuilder::numUniformBuffers ( uint32_t  n) -> ShaderBuilder&
noexcept

Tells the builder how many uniform bufferms the shader will receive.

Definition at line 25 of file ShaderBuilder.cpp.

◆ path()

auto sKit::SDL::ShaderBuilder::path ( std::string  path) -> ShaderBuilder&
noexcept
Parameters
pathpath to the shader in SPIRV format

Definition at line 10 of file ShaderBuilder.cpp.

◆ vertex()

auto sKit::SDL::ShaderBuilder::vertex ( ) -> ShaderBuilder&
noexcept

Tells the builder that the shader built is a vertex shader.

Definition at line 15 of file ShaderBuilder.cpp.


The documentation for this class was generated from the following files:
sKit::SDL::ShaderBuilder
SDL_GPUShader builder class
Definition: ShaderBuilder.hpp:20
sKit::SDL::ShaderBuilder::path
auto path(std::string path) noexcept -> ShaderBuilder &
Definition: ShaderBuilder.cpp:10