#pragma once #include #include #ifdef KINC_OPENGL #include #include #endif #include /*! \file compute.h \brief Provides support for running compute-shaders. */ #ifdef __cplusplus extern "C" { #endif struct kinc_g4_texture; struct kinc_g4_render_target; typedef struct kinc_g4_compute_shader { kinc_g4_compute_shader_impl impl; } kinc_g4_compute_shader; /// /// Initialize a compute-shader from system-specific shader-data. /// /// The shader-object to initialize /// A pointer to system-specific shader-data /// Length of the shader-data in bytes KINC_FUNC void kinc_g4_compute_shader_init(kinc_g4_compute_shader *shader, void *source, int length); /// /// Destroy a shader-object /// /// The shader-object to destroy KINC_FUNC void kinc_g4_compute_shader_destroy(kinc_g4_compute_shader *shader); #ifndef KINC_KONG /// /// Finds the location of a constant/uniform inside of a shader. /// /// The shader to look into /// The constant/uniform-name to look for /// The found constant-location KINC_FUNC kinc_g4_constant_location_t kinc_g4_compute_shader_get_constant_location(kinc_g4_compute_shader *shader, const char *name); /// /// Finds a texture-unit inside of a shader. /// /// The shader to look into /// The texture-name to look for /// The found texture-unit KINC_FUNC kinc_g4_texture_unit_t kinc_g4_compute_shader_get_texture_unit(kinc_g4_compute_shader *shader, const char *name); #endif #ifdef KINC_OPENGL typedef struct kinc_shader_storage_buffer { kinc_compute_shader_storage_buffer_impl_t impl; } kinc_shader_storage_buffer_t; KINC_FUNC void kinc_shader_storage_buffer_init(kinc_shader_storage_buffer_t *buffer, int count, kinc_g4_vertex_data_t type); KINC_FUNC void kinc_shader_storage_buffer_destroy(kinc_shader_storage_buffer_t *buffer); KINC_FUNC int *kinc_shader_storage_buffer_lock(kinc_shader_storage_buffer_t *buffer); KINC_FUNC void kinc_shader_storage_buffer_unlock(kinc_shader_storage_buffer_t *buffer); KINC_FUNC int kinc_shader_storage_buffer_count(kinc_shader_storage_buffer_t *buffer); KINC_FUNC void kinc_shader_storage_buffer_internal_set(kinc_shader_storage_buffer_t *buffer); #endif #ifdef __cplusplus } #endif