ObjectivelyGPU
Object oriented graphics framework for SDL3 and C
Loading...
Searching...
No Matches
Shader Struct Reference

An SDL_GPUShader: one compiled programmable stage of a graphics pipeline. More...

#include <Shader.h>

Inheritance diagram for Shader:

Public Member Functions

ShaderinitWithDevice (Shader *self, RenderDevice *device, const SDL_GPUShaderCreateInfo *info)
 Initializes this Shader from a fully-populated SDL_GPUShaderCreateInfo.
 
Class * _Shader (void)
 The Shader archetype.
 

Data Fields

Object object
 The superclass.
 
SDL_GPUShader * shader
 The underlying SDL shader.
 
SDL_GPUShaderFormat format
 The shader format.
 
SDL_GPUShaderStage stage
 The shader stage (vertex or fragment).
 
ident data
 User data.
 

Protected Attributes

ShaderInterface * interface
 The interface.
 

Detailed Description

An SDL_GPUShader: one compiled programmable stage of a graphics pipeline.

Shader owns its underlying SDL_GPUShader and releases it in dealloc, so a shader is freed with release like any other Objectively object. A shader need only outlive the GraphicsPipeline creation that consumes it, after which it may be released. Pass the shader handle into the pipeline's create info.

Member Function Documentation

◆ _Shader()

Class * _Shader ( void  )

The Shader archetype.

Returns
The Shader Class.

◆ initWithDevice()

Shader * initWithDevice ( Shader self,
RenderDevice device,
const SDL_GPUShaderCreateInfo *  info 
)

Initializes this Shader from a fully-populated SDL_GPUShaderCreateInfo.

The designated (and only) initializer: a thin wrapper over SDL_CreateGPUShader. All fields of info, including code, code_size, format, and entrypoint, must be set by the caller. Prefer RenderDevice::loadShader, which resolves a compiled blob from the Resource system, selects the device-appropriate format, and fills these fields in.

Parameters
selfThe Shader.
deviceThe RenderDevice used to create and release the shader. Retained.
infoThe Shader creation parameters with all fields populated.
Returns
The initialized Shader, or NULL on failure.

Field Documentation

◆ data

ident Shader::data

User data.

◆ format

SDL_GPUShaderFormat Shader::format

The shader format.

◆ interface

ShaderInterface* Shader::interface
protected

The interface.

◆ object

Object Shader::object

The superclass.

◆ shader

SDL_GPUShader* Shader::shader

The underlying SDL shader.

◆ stage

SDL_GPUShaderStage Shader::stage

The shader stage (vertex or fragment).


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