Kohi Game Engine
kshader_system.h
Go to the documentation of this file.
1 
14 #pragma once
15 
16 #include <core_render_types.h>
17 #include <defines.h>
18 
20 
22 typedef struct kshader_system_config {
28 
39 b8 kshader_system_initialize(u64* memory_requirement, void* memory, void* config);
40 
46 void kshader_system_shutdown(void* state);
47 
57 
66 KAPI kshader kshader_system_get_from_source(kname name, const char* shader_config_source);
67 
74 
83 KAPI b8 kshader_system_set_wireframe(kshader shader, b8 wireframe_enabled);
84 
91 KAPI b8 kshader_system_use(kshader shader, u8 vertex_layout_index);
92 
101 
102 KAPI void kshader_set_immediate_data(kshader shader, const void* data, u8 size);
103 KAPI void kshader_set_binding_data(kshader shader, u8 binding_set, u32 instance_id, u8 binding_index, u64 offset, void* data, u64 size);
104 KAPI void kshader_set_binding_texture(kshader shader, u8 binding_set, u32 instance_id, u8 binding_index, u8 array_index, ktexture texture);
105 KAPI void kshader_set_binding_sampler(kshader shader, u8 binding_set, u32 instance_id, u8 binding_index, u8 array_index, ksampler_backend sampler);
107 KAPI void kshader_release_binding_set_instance(kshader shader, u8 binding_set, u32 instance_id);
109 KAPI b8 kshader_apply_binding_set(kshader shader, u8 binding_set, u32 instance_id);
primitive_topology_type
Definition: core_render_types.h:30
u16 ktexture
Represents a texture to be used for rendering purposes, stored on the GPU (VRAM)
Definition: core_render_types.h:299
u16 kshader
Definition: core_render_types.h:176
This file contains global type definitions which are used throughout the entire engine and applicatio...
#define KAPI
Import/export qualifier.
Definition: defines.h:209
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:27
_Bool b8
8-bit boolean type
Definition: defines.h:60
unsigned short u16
Unsigned 16-bit integer.
Definition: defines.h:24
unsigned long long u64
Unsigned 64-bit integer.
Definition: defines.h:30
unsigned char u8
Unsigned 8-bit integer.
Definition: defines.h:21
u64 kname
A kname is a string hash made for quick comparisons versus traditional string comparisons.
Definition: kname.h:36
KAPI u32 kshader_acquire_binding_set_instance(kshader shader, u8 binding_set)
KAPI void kshader_set_binding_sampler(kshader shader, u8 binding_set, u32 instance_id, u8 binding_index, u8 array_index, ksampler_backend sampler)
KAPI b8 kshader_system_use(kshader shader, u8 vertex_layout_index)
Uses the shader with the given handle and the shader's default topology.
KAPI void kshader_set_binding_data(kshader shader, u8 binding_set, u32 instance_id, u8 binding_index, u64 offset, void *data, u64 size)
KAPI kshader kshader_system_get_from_source(kname name, const char *shader_config_source)
Returns a handle to a shader with the given name based on the provided config source....
KAPI b8 kshader_apply_binding_set(kshader shader, u8 binding_set, u32 instance_id)
struct kshader_system_config kshader_system_config
Configuration for the shader system.
KAPI void kshader_set_immediate_data(kshader shader, const void *data, u8 size)
b8 kshader_system_initialize(u64 *memory_requirement, void *memory, void *config)
Initializes the shader system using the supplied configuration. NOTE: Call this twice,...
KAPI b8 kshader_system_set_wireframe(kshader shader, b8 wireframe_enabled)
Attempts to set wireframe mode on the given shader. If the renderer backend, or the shader does not s...
KAPI kshader kshader_system_get(kname name, kname package_name)
Returns a handle to a shader with the given name. Attempts to load the shader if not already loaded.
KAPI void kshader_system_destroy(kshader *shader)
Attempts to destroy the shader with the given handle. Handle will be invalidated.
KAPI void kshader_release_binding_set_instance(kshader shader, u8 binding_set, u32 instance_id)
KAPI u32 kshader_binding_set_instance_count_get(kshader shader, u8 binding_set)
KAPI b8 kshader_system_use_with_topology(kshader shader, primitive_topology_type topology, u8 vertex_layout_index)
Uses the shader with the given handle and the provided topology.
void kshader_system_shutdown(void *state)
Shuts down the shader system.
KAPI void kshader_set_binding_texture(kshader shader, u8 binding_set, u32 instance_id, u8 binding_index, u8 array_index, ktexture texture)
u16 ksampler_backend
Definition: renderer_types.h:252
Configuration for the shader system.
Definition: kshader_system.h:22
u8 max_uniform_count
The maximum number of uniforms allowed in a single shader.
Definition: kshader_system.h:26
u16 max_shader_count
The maximum number of shaders held in the system. NOTE: Should be at least 512.
Definition: kshader_system.h:24