Kore
Loading...
Searching...
No Matches
shader.h File Reference

Provides functions for creating and destroying shaders. More...

#include <kinc/global.h>
#include <kinc/backend/graphics4/shader.h>

Go to the source code of this file.

Data Structures

struct  kinc_g4_shader

Typedefs

typedef enum kinc_g4_shader_type kinc_g4_shader_type_t
typedef struct kinc_g4_shader kinc_g4_shader_t

Enumerations

enum  kinc_g4_shader_type {
  KINC_G4_SHADER_TYPE_FRAGMENT , KINC_G4_SHADER_TYPE_VERTEX , KINC_G4_SHADER_TYPE_COMPUTE , KINC_G4_SHADER_TYPE_GEOMETRY ,
  KINC_G4_SHADER_TYPE_TESSELLATION_CONTROL , KINC_G4_SHADER_TYPE_TESSELLATION_EVALUATION , KINC_G4_SHADER_TYPE_COUNT
}

Functions

KINC_FUNC void kinc_g4_shader_init (kinc_g4_shader_t *shader, const void *data, size_t length, kinc_g4_shader_type_t type)
 Initializes a shader based on system-specific shader-data. The system-specific shader-data is usually created per system by the krafix-shader-compiler which is automatically called by kincmake.
KINC_FUNC int kinc_g4_shader_init_from_source (kinc_g4_shader_t *shader, const char *source, kinc_g4_shader_type_t type)
 Initializes a shader from GLSL-source-code. This only works on some platforms and only if KRAFIX_LIBRARY define has been set and the krafix-shader-compiler was compiled in library-mode and linked into the application.
KINC_FUNC void kinc_g4_shader_destroy (kinc_g4_shader_t *shader)
 Destroys a shader.

Detailed Description

Provides functions for creating and destroying shaders.

Function Documentation

◆ kinc_g4_shader_destroy()

KINC_FUNC void kinc_g4_shader_destroy ( kinc_g4_shader_t * shader)

Destroys a shader.

Parameters
shaderThe shader to destroy

◆ kinc_g4_shader_init()

KINC_FUNC void kinc_g4_shader_init ( kinc_g4_shader_t * shader,
const void * data,
size_t length,
kinc_g4_shader_type_t type )

Initializes a shader based on system-specific shader-data. The system-specific shader-data is usually created per system by the krafix-shader-compiler which is automatically called by kincmake.

Parameters
shaderThe shader to initialize
dataThe system-specific shader-data
lengthThe length of the system-specific shader-data in bytes
typeThe type of the shader

◆ kinc_g4_shader_init_from_source()

KINC_FUNC int kinc_g4_shader_init_from_source ( kinc_g4_shader_t * shader,
const char * source,
kinc_g4_shader_type_t type )

Initializes a shader from GLSL-source-code. This only works on some platforms and only if KRAFIX_LIBRARY define has been set and the krafix-shader-compiler was compiled in library-mode and linked into the application.

Parameters
shaderThe shader to initialize
sourceThe GLSL-shader-source-code
typeThe type of the shader
Returns
The number of errors the compiler encountered - hopefully it's zero.