RetroArch
Classes | Macros | Typedefs | Functions | Variables
shader_glsl.c File Reference
#include <stdlib.h>
#include <string.h>
#include <compat/strl.h>
#include <compat/posix_string.h>
#include <file/file_path.h>
#include <retro_assert.h>
#include <streams/file_stream.h>
#include <string/stdstring.h>
#include "shader_glsl.h"
#include "../../managers/state_manager.h"
#include "../../core.h"
#include "../drivers/gl_shaders/modern_opaque.glsl.vert.h"
#include "../drivers/gl_shaders/modern_opaque.glsl.frag.h"
#include "../drivers/gl_shaders/core_opaque.glsl.vert.h"
#include "../drivers/gl_shaders/core_opaque.glsl.frag.h"
#include "../drivers/gl_shaders/legacy_opaque.glsl.vert.h"
#include "../drivers/gl_shaders/legacy_opaque.glsl.frag.h"
#include "../drivers/gl_shaders/modern_alpha_blend.glsl.vert.h"
#include "../drivers/gl_shaders/modern_alpha_blend.glsl.frag.h"
#include "../drivers/gl_shaders/core_alpha_blend.glsl.vert.h"
#include "../drivers/gl_shaders/core_alpha_blend.glsl.frag.h"
Include dependency graph for shader_glsl.c:

Classes

struct  cache_vbo
 
struct  shader_program_glsl_data
 
struct  glsl_attrib
 
struct  shader_uniforms_frame
 
struct  shader_uniforms
 
struct  glsl_shader_data
 

Macros

#define PREV_TEXTURES   (GFX_MAX_TEXTURES - 1)
 
#define gl_glsl_set_coord_array(attribs, coord1, coord2, coords, size, multiplier)
 

Typedefs

typedef struct glsl_shader_data glsl_shader_data_t
 

Functions

static bool gl_glsl_add_lut (const struct video_shader *shader, unsigned i, void *textures_data)
 
static bool gl_glsl_load_luts (const struct video_shader *shader, GLuint *textures_lut)
 
static GLint gl_glsl_get_uniform (glsl_shader_data_t *glsl, GLuint prog, const char *base)
 
static GLint gl_glsl_get_attrib (glsl_shader_data_t *glsl, GLuint prog, const char *base)
 
static void gl_glsl_print_shader_log (GLuint obj)
 
static void gl_glsl_print_linker_log (GLuint obj)
 
static bool gl_glsl_compile_shader (glsl_shader_data_t *glsl, GLuint shader, const char *define, const char *program)
 
static bool gl_glsl_link_program (GLuint prog)
 
static bool gl_glsl_compile_program (void *data, unsigned idx, void *program_data, struct shader_program_info *program_info)
 
static void gl_glsl_strip_parameter_pragmas (char *source, const char *str)
 
static bool gl_glsl_load_source_path (struct video_shader_pass *pass, const char *path)
 
static bool gl_glsl_compile_programs (glsl_shader_data_t *glsl, struct shader_program_glsl_data *program)
 
static void gl_glsl_reset_attrib (glsl_shader_data_t *glsl)
 
static void gl_glsl_set_vbo (GLfloat **buffer, size_t *buffer_elems, const GLfloat *data, size_t elems)
 
static INLINE void gl_glsl_set_attribs (glsl_shader_data_t *glsl, GLuint vbo, GLfloat **buffer, size_t *buffer_elems, const GLfloat *data, size_t elems, const struct glsl_attrib *attrs, size_t num_attrs)
 
static void gl_glsl_clear_uniforms_frame (struct shader_uniforms_frame *frame)
 
static void gl_glsl_find_uniforms_frame (glsl_shader_data_t *glsl, GLuint prog, struct shader_uniforms_frame *frame, const char *base)
 
static void gl_glsl_find_uniforms (glsl_shader_data_t *glsl, unsigned pass, GLuint prog, struct shader_uniforms *uni)
 
static void gl_glsl_deinit_shader (glsl_shader_data_t *glsl)
 
static void gl_glsl_destroy_resources (glsl_shader_data_t *glsl)
 
static void gl_glsl_deinit (void *data)
 
static void gl_glsl_init_menu_shaders (void *data)
 
static voidgl_glsl_init (void *data, const char *path)
 
static void gl_glsl_set_uniform_parameter (void *data, struct uniform_info *param, void *uniform_data)
 
static void gl_glsl_set_params (void *dat, void *shader_data)
 
static bool gl_glsl_set_mvp (void *data, void *shader_data, const void *mat_data)
 
static bool gl_glsl_set_coords (void *handle_data, void *shader_data, const struct video_coords *coords)
 
static void gl_glsl_use (void *data, void *shader_data, unsigned idx, bool set_active)
 
static unsigned gl_glsl_num (void *data)
 
static bool gl_glsl_filter_type (void *data, unsigned idx, bool *smooth)
 
static enum gfx_wrap_type gl_glsl_wrap_type (void *data, unsigned idx)
 
static void gl_glsl_shader_scale (void *data, unsigned idx, struct gfx_fbo_scale *scale)
 
static unsigned gl_glsl_get_prev_textures (void *data)
 
static bool gl_glsl_mipmap_input (void *data, unsigned idx)
 
static bool gl_glsl_get_feedback_pass (void *data, unsigned *index)
 
static struct video_shadergl_glsl_get_current_shader (void *data)
 
void gl_glsl_set_get_proc_address (gfx_ctx_proc_t(*proc)(const char *))
 
void gl_glsl_set_context_type (bool core_profile, unsigned major, unsigned minor)
 

Variables

static gfx_ctx_proc_t(* glsl_get_proc_address )(const char *)
 
static const char * glsl_prefixes []
 
static bool glsl_core
 
static unsigned glsl_major
 
static unsigned glsl_minor
 
const shader_backend_t gl_glsl_backend
 

Macro Definition Documentation

◆ gl_glsl_set_coord_array

#define gl_glsl_set_coord_array (   attribs,
  coord1,
  coord2,
  coords,
  size,
  multiplier 
)
Value:
unsigned y; \
attribs[attribs_size].loc = (GLint)coord1; \
attribs[attribs_size].size = (GLsizei)multiplier; \
attribs[attribs_size].offset = (GLsizei)(size * sizeof(GLfloat)); \
for (y = 0; y < (multiplier * coords->vertices); y++) \
buffer[y + size] = coord2[y]; \
size += multiplier * coords->vertices; \
GLsizeiptr size
Definition: glext.h:6559
int GLsizei
Definition: nx_gl.h:49
GLuint coords
Definition: glext.h:8035
float GLfloat
Definition: nx_gl.h:50
GLint GLint GLint GLint GLint GLint y
Definition: glext.h:6295
Definition: video4linux2.c:51
int GLint
Definition: nx_gl.h:45

◆ PREV_TEXTURES

#define PREV_TEXTURES   (GFX_MAX_TEXTURES - 1)

Typedef Documentation

◆ glsl_shader_data_t

Function Documentation

◆ gl_glsl_add_lut()

static bool gl_glsl_add_lut ( const struct video_shader shader,
unsigned  i,
void textures_data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_clear_uniforms_frame()

static void gl_glsl_clear_uniforms_frame ( struct shader_uniforms_frame frame)
static
Here is the caller graph for this function:

◆ gl_glsl_compile_program()

static bool gl_glsl_compile_program ( void data,
unsigned  idx,
void program_data,
struct shader_program_info program_info 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_compile_programs()

static bool gl_glsl_compile_programs ( glsl_shader_data_t glsl,
struct shader_program_glsl_data program 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_compile_shader()

static bool gl_glsl_compile_shader ( glsl_shader_data_t glsl,
GLuint  shader,
const char *  define,
const char *  program 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_deinit()

static void gl_glsl_deinit ( void data)
static
Here is the call graph for this function:

◆ gl_glsl_deinit_shader()

static void gl_glsl_deinit_shader ( glsl_shader_data_t glsl)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_destroy_resources()

static void gl_glsl_destroy_resources ( glsl_shader_data_t glsl)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_filter_type()

static bool gl_glsl_filter_type ( void data,
unsigned  idx,
bool smooth 
)
static

◆ gl_glsl_find_uniforms()

static void gl_glsl_find_uniforms ( glsl_shader_data_t glsl,
unsigned  pass,
GLuint  prog,
struct shader_uniforms uni 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_find_uniforms_frame()

static void gl_glsl_find_uniforms_frame ( glsl_shader_data_t glsl,
GLuint  prog,
struct shader_uniforms_frame frame,
const char *  base 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_get_attrib()

static GLint gl_glsl_get_attrib ( glsl_shader_data_t glsl,
GLuint  prog,
const char *  base 
)
static
Here is the caller graph for this function:

◆ gl_glsl_get_current_shader()

static struct video_shader* gl_glsl_get_current_shader ( void data)
static

◆ gl_glsl_get_feedback_pass()

static bool gl_glsl_get_feedback_pass ( void data,
unsigned *  index 
)
static

◆ gl_glsl_get_prev_textures()

static unsigned gl_glsl_get_prev_textures ( void data)
static

◆ gl_glsl_get_uniform()

static GLint gl_glsl_get_uniform ( glsl_shader_data_t glsl,
GLuint  prog,
const char *  base 
)
static
Here is the caller graph for this function:

◆ gl_glsl_init()

static void* gl_glsl_init ( void data,
const char *  path 
)
static
Here is the call graph for this function:

◆ gl_glsl_init_menu_shaders()

static void gl_glsl_init_menu_shaders ( void data)
static
Here is the call graph for this function:

◆ gl_glsl_link_program()

static bool gl_glsl_link_program ( GLuint  prog)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_load_luts()

static bool gl_glsl_load_luts ( const struct video_shader shader,
GLuint textures_lut 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_load_source_path()

static bool gl_glsl_load_source_path ( struct video_shader_pass pass,
const char *  path 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_mipmap_input()

static bool gl_glsl_mipmap_input ( void data,
unsigned  idx 
)
static

◆ gl_glsl_num()

static unsigned gl_glsl_num ( void data)
static

◆ gl_glsl_print_linker_log()

static void gl_glsl_print_linker_log ( GLuint  obj)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_print_shader_log()

static void gl_glsl_print_shader_log ( GLuint  obj)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_reset_attrib()

static void gl_glsl_reset_attrib ( glsl_shader_data_t glsl)
static
Here is the caller graph for this function:

◆ gl_glsl_set_attribs()

static INLINE void gl_glsl_set_attribs ( glsl_shader_data_t glsl,
GLuint  vbo,
GLfloat **  buffer,
size_t *  buffer_elems,
const GLfloat data,
size_t  elems,
const struct glsl_attrib attrs,
size_t  num_attrs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_set_context_type()

void gl_glsl_set_context_type ( bool  core_profile,
unsigned  major,
unsigned  minor 
)
Here is the caller graph for this function:

◆ gl_glsl_set_coords()

static bool gl_glsl_set_coords ( void handle_data,
void shader_data,
const struct video_coords coords 
)
static
Here is the call graph for this function:

◆ gl_glsl_set_get_proc_address()

void gl_glsl_set_get_proc_address ( gfx_ctx_proc_t(*)(const char *)  proc)
Here is the caller graph for this function:

◆ gl_glsl_set_mvp()

static bool gl_glsl_set_mvp ( void data,
void shader_data,
const void mat_data 
)
static
Here is the call graph for this function:

◆ gl_glsl_set_params()

static void gl_glsl_set_params ( void dat,
void shader_data 
)
static
Here is the call graph for this function:

◆ gl_glsl_set_uniform_parameter()

static void gl_glsl_set_uniform_parameter ( void data,
struct uniform_info param,
void uniform_data 
)
static

◆ gl_glsl_set_vbo()

static void gl_glsl_set_vbo ( GLfloat **  buffer,
size_t *  buffer_elems,
const GLfloat data,
size_t  elems 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_shader_scale()

static void gl_glsl_shader_scale ( void data,
unsigned  idx,
struct gfx_fbo_scale scale 
)
static

◆ gl_glsl_strip_parameter_pragmas()

static void gl_glsl_strip_parameter_pragmas ( char *  source,
const char *  str 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_glsl_use()

static void gl_glsl_use ( void data,
void shader_data,
unsigned  idx,
bool  set_active 
)
static
Here is the call graph for this function:

◆ gl_glsl_wrap_type()

static enum gfx_wrap_type gl_glsl_wrap_type ( void data,
unsigned  idx 
)
static

Variable Documentation

◆ gl_glsl_backend

const shader_backend_t gl_glsl_backend
Initial value:
= {
"glsl"
}
static unsigned gl_glsl_get_prev_textures(void *data)
Definition: shader_glsl.c:1656
static void gl_glsl_set_params(void *dat, void *shader_data)
Definition: shader_glsl.c:1212
static bool gl_glsl_compile_program(void *data, unsigned idx, void *program_data, struct shader_program_info *program_info)
Definition: shader_glsl.c:405
static bool gl_glsl_get_feedback_pass(void *data, unsigned *index)
Definition: shader_glsl.c:1681
static bool gl_glsl_mipmap_input(void *data, unsigned idx)
Definition: shader_glsl.c:1673
Definition: video_shader_parse.h:55
static enum gfx_wrap_type gl_glsl_wrap_type(void *data, unsigned idx)
Definition: shader_glsl.c:1639
static bool gl_glsl_set_coords(void *handle_data, void *shader_data, const struct video_coords *coords)
Definition: shader_glsl.c:1519
static struct video_shader * gl_glsl_get_current_shader(void *data)
Definition: shader_glsl.c:1691
static void gl_glsl_deinit(void *data)
Definition: shader_glsl.c:785
static void gl_glsl_init_menu_shaders(void *data)
Definition: shader_glsl.c:797
static void gl_glsl_use(void *data, void *shader_data, unsigned idx, bool set_active)
Definition: shader_glsl.c:1598
static void gl_glsl_set_uniform_parameter(void *data, struct uniform_info *param, void *uniform_data)
Definition: shader_glsl.c:1160
static unsigned gl_glsl_num(void *data)
Definition: shader_glsl.c:1618
static bool gl_glsl_set_mvp(void *data, void *shader_data, const void *mat_data)
Definition: shader_glsl.c:1481
static void gl_glsl_shader_scale(void *data, unsigned idx, struct gfx_fbo_scale *scale)
Definition: shader_glsl.c:1647
static bool gl_glsl_filter_type(void *data, unsigned idx, bool *smooth)
Definition: shader_glsl.c:1626
static void * gl_glsl_init(void *data, const char *path)
Definition: shader_glsl.c:914

◆ glsl_core

bool glsl_core
static

◆ glsl_get_proc_address

gfx_ctx_proc_t(* glsl_get_proc_address) (const char *)
static

◆ glsl_major

unsigned glsl_major
static

◆ glsl_minor

unsigned glsl_minor
static

◆ glsl_prefixes

const char* glsl_prefixes[]
static
Initial value:
= {
"",
"ruby",
}