RetroArch
Classes | Macros | Typedefs | Functions | Variables
shader_gl_cg.c File Reference
#include <stdint.h>
#include <string.h>
#include <compat/strl.h>
#include <compat/posix_string.h>
#include <file/config_file.h>
#include <file/file_path.h>
#include <retro_assert.h>
#include <string/stdstring.h>
#include "../include/Cg/cg.h"
#include "../video_driver.h"
#include "../video_shader_parse.h"
#include "../../core.h"
#include "../../managers/state_manager.h"
#include "../drivers/gl_shaders/opaque.cg.h"
Include dependency graph for shader_gl_cg.c:

Classes

struct  cg_fbo_params
 
struct  shader_program_cg
 
struct  cg_shader_data
 
struct  uniform_cg
 

Macros

#define PREV_TEXTURES   (GFX_MAX_TEXTURES - 1)
 
#define set_param_2f(param, x, y)   if (param) cgGLSetParameter2f(param, x, y)
 
#define cg_gl_set_param_1f(param, x)   if (param) cgGLSetParameter1f(param, x)
 
#define gl_cg_set_coord_array(param, cg, ptr, len)
 
#define cg_gl_set_texture_parameter(param, texture)
 

Typedefs

typedef struct cg_shader_data cg_shader_data_t
 

Functions

static void gl_cg_set_uniform_parameter (void *data, struct uniform_info *param, void *uniform_data)
 
static void gl_cg_reset_attrib (void *data)
 
static bool gl_cg_set_mvp (void *data, void *shader_data, const void *mat_data)
 
static bool gl_cg_set_coords (void *handle_data, void *shader_data, const struct video_coords *coords)
 
static void gl_cg_set_texture_info (cg_shader_data_t *cg, const struct cg_fbo_params *params, const struct video_tex_info *info)
 
static void gl_cg_set_params (void *dat, void *shader_data)
 
static void gl_cg_deinit_progs (void *data)
 
static void gl_cg_destroy_resources (void *data)
 
static void gl_cg_deinit_context_state (void *data)
 
static void gl_cg_deinit (void *data)
 
static bool gl_cg_compile_program (void *data, unsigned idx, void *program_data, struct shader_program_info *program_info)
 
static void gl_cg_set_program_base_attrib (void *data, unsigned i)
 
static bool gl_cg_load_stock (void *data)
 
static bool gl_cg_load_plain (void *data, const char *path)
 
static bool gl_cg_load_imports (void *data)
 
static bool gl_cg_load_shader (void *data, unsigned i)
 
static bool gl_cg_add_lut (const struct video_shader *shader, unsigned i, void *textures_data)
 
static bool gl_cg_load_luts (const struct video_shader *shader, GLuint *textures_lut)
 
static bool gl_cg_load_preset (void *data, const char *path)
 
static void gl_cg_set_pass_attrib (struct shader_program_cg *program, struct cg_fbo_params *fbo, const char *attr)
 
static INLINE void gl_cg_set_shaders (CGprogram frag, CGprogram vert)
 
static void gl_cg_set_program_attributes (void *data, unsigned i)
 
static void gl_cg_init_menu_shaders (void *data)
 
static voidgl_cg_init (void *data, const char *path)
 
static void gl_cg_use (void *data, void *shader_data, unsigned idx, bool set_active)
 
static unsigned gl_cg_num (void *data)
 
static bool gl_cg_filter_type (void *data, unsigned idx, bool *smooth)
 
static enum gfx_wrap_type gl_cg_wrap_type (void *data, unsigned idx)
 
static void gl_cg_shader_scale (void *data, unsigned idx, struct gfx_fbo_scale *scale)
 
static unsigned gl_cg_get_prev_textures (void *data)
 
static bool gl_cg_get_feedback_pass (void *data, unsigned *pass)
 
static bool gl_cg_mipmap_input (void *data, unsigned idx)
 
static struct video_shadergl_cg_get_current_shader (void *data)
 

Variables

const shader_backend_t gl_cg_backend
 

Macro Definition Documentation

◆ cg_gl_set_param_1f

#define cg_gl_set_param_1f (   param,
  x 
)    if (param) cgGLSetParameter1f(param, x)

◆ cg_gl_set_texture_parameter

#define cg_gl_set_texture_parameter (   param,
  texture 
)
Value:
if (param) \
{ \
cgGLSetTextureParameter(param, texture); \
cgGLEnableTextureParameter(param); \
}
GLfloat param
Definition: glext.h:6480
Definition: metal_common.m:516

◆ gl_cg_set_coord_array

#define gl_cg_set_coord_array (   param,
  cg,
  ptr,
  len 
)
Value:
{ \
cgGLSetParameterPointer(param, len, GL_FLOAT, 0, ptr); \
cgGLEnableClientState(param); \
cg->attribs_elems[cg->attribs_index++] = param; \
}
const GLvoid * ptr
Definition: nx_glsym.h:242
GLenum GLsizei len
Definition: glext.h:7389
GLfloat param
Definition: glext.h:6480
#define GL_FLOAT
Definition: gl_types.h:26

◆ PREV_TEXTURES

#define PREV_TEXTURES   (GFX_MAX_TEXTURES - 1)

◆ set_param_2f

#define set_param_2f (   param,
  x,
  y 
)    if (param) cgGLSetParameter2f(param, x, y)

Typedef Documentation

◆ cg_shader_data_t

Function Documentation

◆ gl_cg_add_lut()

static bool gl_cg_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_cg_compile_program()

static bool gl_cg_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_cg_deinit()

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

◆ gl_cg_deinit_context_state()

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

◆ gl_cg_deinit_progs()

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

◆ gl_cg_destroy_resources()

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

◆ gl_cg_filter_type()

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

◆ gl_cg_get_current_shader()

static struct video_shader* gl_cg_get_current_shader ( void data)
static

◆ gl_cg_get_feedback_pass()

static bool gl_cg_get_feedback_pass ( void data,
unsigned *  pass 
)
static

◆ gl_cg_get_prev_textures()

static unsigned gl_cg_get_prev_textures ( void data)
static

◆ gl_cg_init()

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

◆ gl_cg_init_menu_shaders()

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

◆ gl_cg_load_imports()

static bool gl_cg_load_imports ( void data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_cg_load_luts()

static bool gl_cg_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_cg_load_plain()

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

◆ gl_cg_load_preset()

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

◆ gl_cg_load_shader()

static bool gl_cg_load_shader ( void data,
unsigned  i 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_cg_load_stock()

static bool gl_cg_load_stock ( void data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_cg_mipmap_input()

static bool gl_cg_mipmap_input ( void data,
unsigned  idx 
)
static

◆ gl_cg_num()

static unsigned gl_cg_num ( void data)
static

◆ gl_cg_reset_attrib()

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

◆ gl_cg_set_coords()

static bool gl_cg_set_coords ( void handle_data,
void shader_data,
const struct video_coords coords 
)
static

◆ gl_cg_set_mvp()

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

◆ gl_cg_set_params()

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

◆ gl_cg_set_pass_attrib()

static void gl_cg_set_pass_attrib ( struct shader_program_cg program,
struct cg_fbo_params fbo,
const char *  attr 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_cg_set_program_attributes()

static void gl_cg_set_program_attributes ( void data,
unsigned  i 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_cg_set_program_base_attrib()

static void gl_cg_set_program_base_attrib ( void data,
unsigned  i 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_cg_set_shaders()

static INLINE void gl_cg_set_shaders ( CGprogram  frag,
CGprogram  vert 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_cg_set_texture_info()

static void gl_cg_set_texture_info ( cg_shader_data_t cg,
const struct cg_fbo_params params,
const struct video_tex_info info 
)
static
Here is the caller graph for this function:

◆ gl_cg_set_uniform_parameter()

static void gl_cg_set_uniform_parameter ( void data,
struct uniform_info param,
void uniform_data 
)
static
Here is the call graph for this function:

◆ gl_cg_shader_scale()

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

◆ gl_cg_use()

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

◆ gl_cg_wrap_type()

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

Variable Documentation

◆ gl_cg_backend

const shader_backend_t gl_cg_backend
Initial value:
= {
"gl_cg"
}
static void gl_cg_deinit(void *data)
Definition: shader_gl_cg.c:492
static bool gl_cg_set_coords(void *handle_data, void *shader_data, const struct video_coords *coords)
Definition: shader_gl_cg.c:262
static bool gl_cg_compile_program(void *data, unsigned idx, void *program_data, struct shader_program_info *program_info)
Definition: shader_gl_cg.c:504
static bool gl_cg_filter_type(void *data, unsigned idx, bool *smooth)
Definition: shader_gl_cg.c:1207
static bool gl_cg_mipmap_input(void *data, unsigned idx)
Definition: shader_gl_cg.c:1265
static enum gfx_wrap_type gl_cg_wrap_type(void *data, unsigned idx)
Definition: shader_gl_cg.c:1221
static bool gl_cg_set_mvp(void *data, void *shader_data, const void *mat_data)
Definition: shader_gl_cg.c:248
static bool gl_cg_get_feedback_pass(void *data, unsigned *pass)
Definition: shader_gl_cg.c:1255
static unsigned gl_cg_num(void *data)
Definition: shader_gl_cg.c:1199
static unsigned gl_cg_get_prev_textures(void *data)
Definition: shader_gl_cg.c:1238
static void * gl_cg_init(void *data, const char *path)
Definition: shader_gl_cg.c:1097
static void gl_cg_shader_scale(void *data, unsigned idx, struct gfx_fbo_scale *scale)
Definition: shader_gl_cg.c:1229
Definition: video_shader_parse.h:53
static void gl_cg_set_params(void *dat, void *shader_data)
Definition: shader_gl_cg.c:310
static void gl_cg_use(void *data, void *shader_data, unsigned idx, bool set_active)
Definition: shader_gl_cg.c:1184
static struct video_shader * gl_cg_get_current_shader(void *data)
Definition: shader_gl_cg.c:1273
static void gl_cg_init_menu_shaders(void *data)
Definition: shader_gl_cg.c:1056
static void gl_cg_set_uniform_parameter(void *data, struct uniform_info *param, void *uniform_data)
Definition: shader_gl_cg.c:137