Untitled
Loading...
Searching...
No Matches
shaders.c File Reference
#include "load/init.h"
#include "utilities/types.h"
#include "core/shaders.h"
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Functions

char * read_file (const char *filename)
 Reads a file into raw bytes.
GLuint create_compute_shader (const char *filename)
 Creates a compute shader.
GLuint compile_shader (GLenum type, const char *filename)
 Compiles a non-compute shader.
GLuint compile_gbuffer_frag_shader (GLenum type, const char *filename, int i)
GLuint compile_uber_frag_shader (GLenum type, const char *filename, int i)
GLuint compile_postprocess_shader (GLenum type, const char *filename, uint32_t PP_OPTIONS, bool is_dview, PostprocessDView dview)
GLuint create_shader_program (const char *vertex_path, const char *fragment_path)
 Compiles and links vert and frag pairs.
GLuint create_geometry_shader_program (const char *vertexPath, const char *geometryPath, const char *fragmentPath)
GLuint create_gbuffer_program (const char *vertexPath, const char *fragmentPath, int i)
GLuint create_ubershader_program (const char *vertexPath, const char *geometryPath, const char *fragmentPath, int i)
GLuint create_postprocess_program (const char *vertexPath, const char *fragmentPath, int i, bool is_dview, PostprocessDView dview)
void init_dynamic_shader ()
void init_shadow_map_shader ()
void init_wireframe_shader ()
void init_postprocess_shader ()
void init_brdf_shader ()
void init_sky_shader ()
void init_lightmap_shader ()
void init_text_shader ()
void init_ui_shader ()
void init_SSR_shader ()
void init_lightmap_bounce_compute_shader ()
void init_cull_clusers_compute_shader ()
void init_cull_draw_calls_compute_shader ()
void init_audio_shader ()
void init_depth_pre_pass_shader ()
void init_ssao_shader ()
void init_dof_shader ()
void init_bloom_shader ()
void SHADERS_INIT ()
 Deletes and then recompiles and links all engine shaders.

Function Documentation

◆ read_file()

char * read_file ( const char * filename)

Reads a file into raw bytes.

Parameters
filenameThe file to read.
Returns
The byte buffer.
Warning
Must be freed.

Definition at line 10 of file shaders.c.

References read_file(), and size.

Referenced by compile_gbuffer_frag_shader(), compile_postprocess_shader(), compile_shader(), compile_uber_frag_shader(), create_compute_shader(), and read_file().

◆ create_compute_shader()

GLuint create_compute_shader ( const char * filename)

Creates a compute shader.

Parameters
filenameThe path to file.
Returns
The handle for the shader.

Definition at line 34 of file shaders.c.

References create_compute_shader(), and read_file().

Referenced by create_compute_shader(), init_audio_shader(), init_cull_clusers_compute_shader(), init_cull_draw_calls_compute_shader(), init_dof_shader(), and init_lightmap_bounce_compute_shader().

◆ compile_shader()

GLuint compile_shader ( GLenum type,
const char * filename )

Compiles a non-compute shader.

Parameters
typeThe type of shader to compile.
filenameThe path to the shader.
Returns
The handle for the shader.

Definition at line 77 of file shaders.c.

References compile_shader(), and read_file().

Referenced by compile_shader(), create_gbuffer_program(), create_geometry_shader_program(), create_postprocess_program(), create_shader_program(), and create_ubershader_program().

◆ compile_gbuffer_frag_shader()

◆ compile_uber_frag_shader()

◆ compile_postprocess_shader()

GLuint compile_postprocess_shader ( GLenum type,
const char * filename,
uint32_t PP_OPTIONS,
bool is_dview,
PostprocessDView dview )

◆ create_shader_program()

GLuint create_shader_program ( const char * vertex_path,
const char * fragment_path )

Compiles and links vert and frag pairs.

Parameters
vertex_pathThe path to the vert shader.
fragment_pathThe path to the frag shader.
Returns
The handle to the linked shader.

Definition at line 377 of file shaders.c.

References compile_shader(), and create_shader_program().

Referenced by create_shader_program(), init_bloom_shader(), init_brdf_shader(), init_depth_pre_pass_shader(), init_dof_shader(), init_lightmap_shader(), init_shadow_map_shader(), init_sky_shader(), init_ssao_shader(), init_text_shader(), init_ui_shader(), and init_wireframe_shader().

◆ create_geometry_shader_program()

GLuint create_geometry_shader_program ( const char * vertexPath,
const char * geometryPath,
const char * fragmentPath )

◆ create_gbuffer_program()

GLuint create_gbuffer_program ( const char * vertexPath,
const char * fragmentPath,
int i )

◆ create_ubershader_program()

GLuint create_ubershader_program ( const char * vertexPath,
const char * geometryPath,
const char * fragmentPath,
int i )

◆ create_postprocess_program()

GLuint create_postprocess_program ( const char * vertexPath,
const char * fragmentPath,
int i,
bool is_dview,
PostprocessDView dview )

◆ init_dynamic_shader()

◆ init_shadow_map_shader()

◆ init_wireframe_shader()

◆ init_postprocess_shader()

◆ init_brdf_shader()

◆ init_sky_shader()

◆ init_lightmap_shader()

◆ init_text_shader()

◆ init_ui_shader()

◆ init_SSR_shader()

void init_SSR_shader ( )

Definition at line 825 of file shaders.c.

References init_SSR_shader().

Referenced by init_SSR_shader(), and SHADERS_INIT().

◆ init_lightmap_bounce_compute_shader()

◆ init_cull_clusers_compute_shader()

◆ init_cull_draw_calls_compute_shader()

◆ init_audio_shader()

void init_audio_shader ( )

Definition at line 961 of file shaders.c.

References AUDIO_PROBE_BAKE_SHADER, create_compute_shader(), and init_audio_shader().

Referenced by init_audio_shader(), and SHADERS_INIT().

◆ init_depth_pre_pass_shader()

◆ init_ssao_shader()

◆ init_dof_shader()

◆ init_bloom_shader()

◆ SHADERS_INIT()