#pragma once #include #include /*! \file shader.h \brief Provides functions for creating and destroying shaders. */ #ifdef __cplusplus extern "C" { #endif typedef 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 } kinc_g4_shader_type_t; typedef struct kinc_g4_shader { kinc_g4_shader_impl_t impl; } kinc_g4_shader_t; /// /// 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. /// /// The shader to initialize /// The system-specific shader-data /// The length of the system-specific shader-data in bytes /// The type of the shader 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 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. /// /// The shader to initialize /// The GLSL-shader-source-code /// The type of the shader /// The number of errors the compiler encountered - hopefully it's zero. KINC_FUNC int kinc_g4_shader_init_from_source(kinc_g4_shader_t *shader, const char *source, kinc_g4_shader_type_t type); /// /// Destroys a shader. /// /// The shader to destroy KINC_FUNC void kinc_g4_shader_destroy(kinc_g4_shader_t *shader); #ifdef __cplusplus } #endif