|
Untitled
|
#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. | |
| char * read_file | ( | const char * | filename | ) |
Reads a file into raw bytes.
| filename | The file to read. |
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().
| GLuint create_compute_shader | ( | const char * | filename | ) |
Creates a compute shader.
| filename | The path to file. |
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().
| GLuint compile_shader | ( | GLenum | type, |
| const char * | filename ) |
Compiles a non-compute shader.
| type | The type of shader to compile. |
| filename | The path to 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().
| GLuint compile_gbuffer_frag_shader | ( | GLenum | type, |
| const char * | filename, | ||
| int | i ) |
Definition at line 105 of file shaders.c.
References compile_gbuffer_frag_shader(), DVIEW_ALBEDO, DVIEW_AO, DVIEW_ARM, DVIEW_CLUSTERS, DVIEW_DEFAULT, DVIEW_DIRECT, DVIEW_EMISSIVE, DVIEW_INDIRECT, DVIEW_LM_DIRECTIONAL, DVIEW_LM_IRRADIANCE, DVIEW_MAX, DVIEW_NORMAL, DVIEW_ORIGINAL_NORMAL, DVIEW_POM_VDIR, DVIEW_RPROBE, DVIEW_SPECULAR, DVIEW_UV, and read_file().
Referenced by compile_gbuffer_frag_shader(), and create_gbuffer_program().
| GLuint compile_uber_frag_shader | ( | GLenum | type, |
| const char * | filename, | ||
| int | i ) |
Definition at line 198 of file shaders.c.
References compile_uber_frag_shader(), DVIEW_ALBEDO, DVIEW_AO, DVIEW_ARM, DVIEW_CLUSTERS, DVIEW_DEFAULT, DVIEW_DIRECT, DVIEW_EMISSIVE, DVIEW_INDIRECT, DVIEW_LM_DIRECTIONAL, DVIEW_LM_IRRADIANCE, DVIEW_MAX, DVIEW_NORMAL, DVIEW_ORIGINAL_NORMAL, DVIEW_POM_VDIR, DVIEW_RPROBE, DVIEW_SPECULAR, DVIEW_UV, and read_file().
Referenced by compile_uber_frag_shader(), and create_ubershader_program().
| GLuint compile_postprocess_shader | ( | GLenum | type, |
| const char * | filename, | ||
| uint32_t | PP_OPTIONS, | ||
| bool | is_dview, | ||
| PostprocessDView | dview ) |
Definition at line 291 of file shaders.c.
References compile_postprocess_shader(), PP_ACES, PP_BLOOM, PP_DOF, PP_LUT, PP_MBLUR, PP_NOISE, PPDVIEW_BOKEH, PPDVIEW_DEPTH, PPDVIEW_LM, PPDVIEW_VEL, and read_file().
Referenced by compile_postprocess_shader(), and create_postprocess_program().
| GLuint create_shader_program | ( | const char * | vertex_path, |
| const char * | fragment_path ) |
Compiles and links vert and frag pairs.
| vertex_path | The path to the vert shader. |
| fragment_path | The path to the frag 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().
| GLuint create_geometry_shader_program | ( | const char * | vertexPath, |
| const char * | geometryPath, | ||
| const char * | fragmentPath ) |
Definition at line 409 of file shaders.c.
References compile_shader(), and create_geometry_shader_program().
Referenced by create_geometry_shader_program(), and init_shadow_map_shader().
| GLuint create_gbuffer_program | ( | const char * | vertexPath, |
| const char * | fragmentPath, | ||
| int | i ) |
Definition at line 445 of file shaders.c.
References compile_gbuffer_frag_shader(), compile_shader(), and create_gbuffer_program().
Referenced by create_gbuffer_program(), and init_depth_pre_pass_shader().
| GLuint create_ubershader_program | ( | const char * | vertexPath, |
| const char * | geometryPath, | ||
| const char * | fragmentPath, | ||
| int | i ) |
Definition at line 478 of file shaders.c.
References compile_shader(), compile_uber_frag_shader(), and create_ubershader_program().
Referenced by create_ubershader_program(), and init_dynamic_shader().
| GLuint create_postprocess_program | ( | const char * | vertexPath, |
| const char * | fragmentPath, | ||
| int | i, | ||
| bool | is_dview, | ||
| PostprocessDView | dview ) |
Definition at line 511 of file shaders.c.
References compile_postprocess_shader(), compile_shader(), and create_postprocess_program().
Referenced by create_postprocess_program(), and init_postprocess_shader().
| void init_dynamic_shader | ( | ) |
Definition at line 543 of file shaders.c.
References create_ubershader_program(), DVIEW_ALBEDO, DVIEW_AO, DVIEW_ARM, DVIEW_CLUSTERS, DVIEW_DEFAULT, DVIEW_DIRECT, DVIEW_EMISSIVE, DVIEW_INDIRECT, DVIEW_LM_DIRECTIONAL, DVIEW_LM_IRRADIANCE, DVIEW_MAX, DVIEW_NORMAL, DVIEW_ORIGINAL_NORMAL, DVIEW_POM_VDIR, DVIEW_RPROBE, DVIEW_SPECULAR, DVIEW_UV, DYNAMIC_SHADER, ShaderProgram::frag_path, ShaderProgram::geom_path, init_dynamic_shader(), Uniform::location, Uniform::name, ShaderProgram::program, UBERSHADER_VERSIONS, ShaderProgram::uniforms, and ShaderProgram::vert_path.
Referenced by init_dynamic_shader(), and SHADERS_INIT().
| void init_shadow_map_shader | ( | ) |
Definition at line 635 of file shaders.c.
References create_geometry_shader_program(), create_shader_program(), ShaderProgram::frag_path, ShaderProgram::geom_path, init_shadow_map_shader(), Uniform::location, Uniform::name, POINT_LIGHT_SHADOW_SHADER, ShaderProgram::program, SHADOW_MAP_SHADER, ShaderProgram::uniforms, and ShaderProgram::vert_path.
Referenced by init_shadow_map_shader(), and SHADERS_INIT().
| void init_wireframe_shader | ( | ) |
Definition at line 665 of file shaders.c.
References create_shader_program(), ShaderProgram::frag_path, init_wireframe_shader(), ShaderProgram::program, ShaderProgram::vert_path, and WIREFRAME_SHADER.
Referenced by init_wireframe_shader(), and SHADERS_INIT().
| void init_postprocess_shader | ( | ) |
Definition at line 675 of file shaders.c.
References create_postprocess_program(), init_postprocess_shader(), Uniform::location, ShaderProgram::perm, POSTPROCESS_SHADER, PP_MAX, PP_SHADER_VERSIONS, PPDVIEW_MAX, ShaderProgram::program, and ShaderProgram::uniforms.
Referenced by init_postprocess_shader(), and SHADERS_INIT().
| void init_brdf_shader | ( | ) |
Definition at line 762 of file shaders.c.
References BRDF_SHADER, create_shader_program(), ShaderProgram::frag_path, init_brdf_shader(), Uniform::location, Uniform::name, ShaderProgram::program, ShaderProgram::uniforms, and ShaderProgram::vert_path.
Referenced by init_brdf_shader(), and SHADERS_INIT().
| void init_sky_shader | ( | ) |
Definition at line 775 of file shaders.c.
References create_shader_program(), ShaderProgram::frag_path, init_sky_shader(), Uniform::location, Uniform::name, ShaderProgram::program, SKY_SHADER, ShaderProgram::uniforms, and ShaderProgram::vert_path.
Referenced by init_sky_shader(), and SHADERS_INIT().
| void init_lightmap_shader | ( | ) |
Definition at line 786 of file shaders.c.
References create_shader_program(), ShaderProgram::frag_path, init_lightmap_shader(), LIGHTMAP_SHADER, ShaderProgram::program, and ShaderProgram::vert_path.
Referenced by init_lightmap_shader(), and SHADERS_INIT().
| void init_text_shader | ( | ) |
Definition at line 795 of file shaders.c.
References create_shader_program(), ShaderProgram::frag_path, init_text_shader(), Uniform::location, Uniform::name, ShaderProgram::program, TEXT_SHADER, ShaderProgram::uniforms, and ShaderProgram::vert_path.
Referenced by init_text_shader(), and SHADERS_INIT().
| void init_ui_shader | ( | ) |
Definition at line 811 of file shaders.c.
References create_shader_program(), ShaderProgram::frag_path, init_ui_shader(), Uniform::location, Uniform::name, ShaderProgram::program, UI_SHADER, ShaderProgram::uniforms, and ShaderProgram::vert_path.
Referenced by init_ui_shader(), and SHADERS_INIT().
| void init_SSR_shader | ( | ) |
Definition at line 825 of file shaders.c.
References init_SSR_shader().
Referenced by init_SSR_shader(), and SHADERS_INIT().
| void init_lightmap_bounce_compute_shader | ( | ) |
Definition at line 878 of file shaders.c.
References create_compute_shader(), DIRECTIONAL_MAP_NORMALIZE_SHADER, init_lightmap_bounce_compute_shader(), LIGHTMAP_BOUNCE_SHADER, LIGHTMAP_DENOISE_SHADER, LIGHTMAP_DILATE_SHADER, PROBE_BAKE_SHADER, and PROBE_UNPACK_SHADER.
Referenced by init_lightmap_bounce_compute_shader(), and SHADERS_INIT().
| void init_cull_clusers_compute_shader | ( | ) |
Definition at line 890 of file shaders.c.
References create_compute_shader(), CULL_CLUSTERS_SHADER, INIT_CLUSTER_AABBS_SHADER, init_cull_clusers_compute_shader(), Uniform::location, Uniform::name, ShaderProgram::program, and ShaderProgram::uniforms.
Referenced by init_cull_clusers_compute_shader(), and SHADERS_INIT().
| void init_cull_draw_calls_compute_shader | ( | ) |
Definition at line 909 of file shaders.c.
References create_compute_shader(), CULL_DRAW_CALLS_SHADER, CULL_POINT_LIGHT_SHADOWS_SHADER, ELEMENTS_PREFIX_SHADER, INDIRECT_PREFIX_SHADER, init_cull_draw_calls_compute_shader(), Uniform::location, Uniform::name, ShaderProgram::program, ShaderProgram::uniforms, and ShaderProgram::vert_path.
Referenced by init_cull_draw_calls_compute_shader(), and SHADERS_INIT().
| 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().
| void init_depth_pre_pass_shader | ( | ) |
Definition at line 967 of file shaders.c.
References create_gbuffer_program(), create_shader_program(), DEPTH_DOWNSAMPLE_SHADER, DEPTH_PRE_PASS_SHADER, DEPTH_PRE_PASS_SHADER_MSAA, ShaderProgram::frag_path, GBUFFER_VERSIONS, init_depth_pre_pass_shader(), Uniform::location, Uniform::name, ShaderProgram::program, ShaderProgram::uniforms, and ShaderProgram::vert_path.
Referenced by init_depth_pre_pass_shader(), and SHADERS_INIT().
| void init_ssao_shader | ( | ) |
Definition at line 998 of file shaders.c.
References create_shader_program(), ShaderProgram::frag_path, init_ssao_shader(), Uniform::location, Uniform::name, ShaderProgram::program, SSAO_BLUR_SHADER, SSAO_SHADER, ShaderProgram::uniforms, and ShaderProgram::vert_path.
Referenced by init_ssao_shader(), and SHADERS_INIT().
| void init_dof_shader | ( | ) |
Definition at line 1027 of file shaders.c.
References BOKEH_SHADER, COC_SHADER, create_compute_shader(), create_shader_program(), FOCAL_DISTANCE_SHADER, ShaderProgram::frag_path, init_dof_shader(), Uniform::location, Uniform::name, ShaderProgram::program, ShaderProgram::uniforms, and ShaderProgram::vert_path.
Referenced by init_dof_shader(), and SHADERS_INIT().
| void init_bloom_shader | ( | ) |
Definition at line 1086 of file shaders.c.
References BLOOM_BLUR_SHADER, BLOOM_DOWNSCALE_SHADER, BLOOM_SHADER, BLOOM_UPSCALE_SHADER, create_shader_program(), ShaderProgram::frag_path, init_bloom_shader(), Uniform::location, Uniform::name, ShaderProgram::program, ShaderProgram::uniforms, and ShaderProgram::vert_path.
Referenced by init_bloom_shader(), and SHADERS_INIT().
| void SHADERS_INIT | ( | ) |
Deletes and then recompiles and links all engine shaders.
Definition at line 1131 of file shaders.c.
References AUDIO_PROBE_BAKE_SHADER, BLOOM_BLUR_SHADER, BLOOM_DOWNSCALE_SHADER, BLOOM_SHADER, BLOOM_UPSCALE_SHADER, BOKEH_SHADER, BRDF_SHADER, COC_SHADER, CULL_CLUSTERS_SHADER, CULL_DRAW_CALLS_SHADER, CULL_POINT_LIGHT_SHADOWS_SHADER, DEPTH_PRE_PASS_SHADER, DIRECTIONAL_MAP_NORMALIZE_SHADER, DYNAMIC_SHADER, ELEMENTS_PREFIX_SHADER, FOCAL_DISTANCE_SHADER, GBUFFER_VERSIONS, INDIRECT_PREFIX_SHADER, init_audio_shader(), init_bloom_shader(), init_brdf_shader(), INIT_CLUSTER_AABBS_SHADER, init_cull_clusers_compute_shader(), init_cull_draw_calls_compute_shader(), init_depth_pre_pass_shader(), init_dof_shader(), init_dynamic_shader(), init_lightmap_bounce_compute_shader(), init_lightmap_shader(), init_postprocess_shader(), init_shadow_map_shader(), init_sky_shader(), init_ssao_shader(), init_SSR_shader(), init_text_shader(), init_ui_shader(), init_wireframe_shader(), LIGHTMAP_BOUNCE_SHADER, LIGHTMAP_DENOISE_SHADER, LIGHTMAP_DILATE_SHADER, LIGHTMAP_SHADER, POINT_LIGHT_SHADOW_SHADER, POSTPROCESS_SHADER, PP_SHADER_VERSIONS, PROBE_BAKE_SHADER, PROBE_UNPACK_SHADER, ShaderProgram::program, SHADERS_INIT(), SHADOW_MAP_SHADER, SKY_SHADER, SSAO_BLUR_SHADER, SSAO_SHADER, SSR_BLUR_SHADER, SSR_HISTORY_SHADER, SSR_SHADER, TEXT_SHADER, UBERSHADER_VERSIONS, UI_SHADER, and WIREFRAME_SHADER.
Referenced by init(), process_input(), and SHADERS_INIT().