sKit  0.0.9
sKit::SDL::PipelineBuilder Class Reference

SDL_GPUGraphicsPipeline builder class More...

#include <PipelineBuilder.hpp>

Public Member Functions

auto shaders (SDL_GPUShader *vertexShader, SDL_GPUShader *fragmentShader) -> PipelineBuilder &
 Tells the builder which shaders it should use to create the pipeline. More...
 
auto addBuffer (Uint32 slot, Uint32 stride, SDL_GPUVertexInputRate inputRate=SDL_GPU_VERTEXINPUTRATE_VERTEX) -> PipelineBuilder &
 
auto addAttribute (Uint32 location, Uint32 bufferSlot, Uint32 offset=0, SDL_GPUVertexElementFormat format=SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3) -> PipelineBuilder &
 
auto addColorTarget (SDL_GPUTextureFormat format) -> PipelineBuilder &
 
auto cullMode (SDL_GPUCullMode cullMode) -> PipelineBuilder &
 
auto build (SDL_GPUDevice *device) -> SDL_GPUGraphicsPipeline *
 

Detailed Description

SDL_GPUGraphicsPipeline builder class

Example usage:

.shaders(vs, fs)
.addBuffer(0, sizeof(float) * 3)
.addColorTarget(SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM)
.build(device);

Definition at line 20 of file PipelineBuilder.hpp.

Member Function Documentation

◆ addAttribute()

auto sKit::SDL::PipelineBuilder::addAttribute ( Uint32  location,
Uint32  bufferSlot,
Uint32  offset = 0,
SDL_GPUVertexElementFormat  format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3 
) -> PipelineBuilder&

Adds a vertex attribute to the pipeline that will be built.

Parameters
locationThe shader input location index
bufferSlotThe binding slot of the associated vertex buffer
offsetThe byte offset of this attribute relative to the start of the vertex element
formatThe size and type of the attribute data
See also

Definition at line 29 of file PipelineBuilder.cpp.

◆ addBuffer()

auto sKit::SDL::PipelineBuilder::addBuffer ( Uint32  slot,
Uint32  stride,
SDL_GPUVertexInputRate  inputRate = SDL_GPU_VERTEXINPUTRATE_VERTEX 
) -> PipelineBuilder&

Adds a vertex buffer description to the pipeline that will be built.

Parameters
slotthe binding slot of the vertex buffer
stridethe number of bytes between consecutive elements in the buffer
inputRateWhether attribute addressing is a function of the vertex index or instance index
See also

Definition at line 18 of file PipelineBuilder.cpp.

◆ addColorTarget()

auto sKit::SDL::PipelineBuilder::addColorTarget ( SDL_GPUTextureFormat  format) -> PipelineBuilder&

Adds a color target to the pipeline that will be built

Parameters
formatpixel format of the texture
See also

Definition at line 44 of file PipelineBuilder.cpp.

◆ build()

auto sKit::SDL::PipelineBuilder::build ( SDL_GPUDevice *  device) -> SDL_GPUGraphicsPipeline*
Returns
a pointer to an SDL_GPUDevice

Definition at line 56 of file PipelineBuilder.cpp.

◆ cullMode()

auto sKit::SDL::PipelineBuilder::cullMode ( SDL_GPUCullMode  cullMode) -> PipelineBuilder&

Definition at line 51 of file PipelineBuilder.cpp.

◆ shaders()

auto sKit::SDL::PipelineBuilder::shaders ( SDL_GPUShader *  vertexShader,
SDL_GPUShader *  fragmentShader 
) -> PipelineBuilder&

Tells the builder which shaders it should use to create the pipeline.

Definition at line 9 of file PipelineBuilder.cpp.


The documentation for this class was generated from the following files:
sKit::SDL::PipelineBuilder::shaders
auto shaders(SDL_GPUShader *vertexShader, SDL_GPUShader *fragmentShader) -> PipelineBuilder &
Tells the builder which shaders it should use to create the pipeline.
Definition: PipelineBuilder.cpp:9
sKit::SDL::PipelineBuilder
SDL_GPUGraphicsPipeline builder class
Definition: PipelineBuilder.hpp:20