r_program.c File Reference

Shader (GLSL) backend functions. More...

#include "r_local.h"
#include "r_error.h"
#include "../../shared/parse.h"
#include "../../shared/shared.h"
Include dependency graph for r_program.c:

Go to the source code of this file.

Defines

#define SHADER_BUF_SIZE   16384
#define FILTER_SIZE   3
 width of convolution filter (for blur/bloom effects)

Functions

void R_UseProgram (r_program_t *prog)
static r_progvar_tR_ProgramVariable (int type, const char *name)
void R_ProgramParameter1i (const char *name, GLint value)
void R_ProgramParameter1f (const char *name, GLfloat value)
void R_ProgramParameter1fvs (const char *name, GLint size, GLfloat *value)
void R_ProgramParameter2fv (const char *name, GLfloat *value)
void R_ProgramParameter2fvs (const char *name, GLint size, GLfloat *value)
void R_ProgramParameter3fv (const char *name, GLfloat *value)
void R_ProgramParameter4fv (const char *name, GLfloat *value)
void R_AttributePointer (const char *name, GLuint size, const GLvoid *array)
void R_EnableAttribute (const char *name)
void R_DisableAttribute (const char *name)
static void R_ShutdownShader (r_shader_t *sh)
static void R_ShutdownProgram (r_program_t *prog)
void R_ShutdownPrograms (void)
static size_t R_PreprocessShaderAddToShaderBuf (const char *name, const char *in, char **out, size_t *len)
static size_t R_InitializeShader (const char *name, char *out, size_t len)
static size_t R_PreprocessShader (const char *name, const char *in, char *out, int len)
static r_shader_tR_LoadShader (GLenum type, const char *name)
r_program_tR_LoadProgram (const char *name, void *init, void *use)
static void R_InitWorldProgram (r_program_t *prog)
static void R_UseWorldProgram (r_program_t *prog)
static void R_InitWarpProgram (r_program_t *prog)
static void R_UseWarpProgram (r_program_t *prog)
static void R_InitGeoscapeProgram (r_program_t *prog)
static int R_PascalTriangle (int row, int col)
static void R_InitConvolveProgram (r_program_t *prog)
static void R_UseConvolveProgram (r_program_t *prog)
 Use the filter convolution glsl program.
static void R_InitCombine2Program (r_program_t *prog)
static void R_InitAtmosphereProgram (r_program_t *prog)
static void R_InitSimpleGlowProgram (r_program_t *prog)
void R_InitParticleProgram (r_program_t *prog)
void R_UseParticleProgram (r_program_t *prog)
void R_InitPrograms (void)
void R_RestartPrograms_f (void)
 Reloads the glsl shaders.

Detailed Description

Shader (GLSL) backend functions.

Definition in file r_program.c.


Define Documentation

#define FILTER_SIZE   3

width of convolution filter (for blur/bloom effects)

Definition at line 722 of file r_program.c.

Referenced by R_InitConvolveProgram(), R_InitPrograms(), and R_UseConvolveProgram().

#define SHADER_BUF_SIZE   16384

Definition at line 33 of file r_program.c.

Referenced by R_LoadShader(), and R_PreprocessShader().


Function Documentation

void R_AttributePointer ( const char *  name,
GLuint  size,
const GLvoid *  array 
)

pass file-line numbers for debugging

Definition at line 211 of file r_program.c.

References GL_ATTRIBUTE, r_progvar_s::location, and R_ProgramVariable().

Referenced by R_BindArray().

void R_DisableAttribute ( const char *  name  ) 
void R_EnableAttribute ( const char *  name  ) 
static void R_InitAtmosphereProgram ( r_program_t prog  )  [static]

Definition at line 775 of file r_program.c.

References R_ProgramParameter1i(), R_ProgramParameter2fv(), and R_ProgramParameter4fv().

Referenced by R_InitPrograms().

static void R_InitCombine2Program ( r_program_t prog  )  [static]

Definition at line 765 of file r_program.c.

References R_ProgramParameter1i(), and R_ProgramParameter4fv().

Referenced by R_InitPrograms().

static void R_InitConvolveProgram ( r_program_t prog  )  [static]
static void R_InitGeoscapeProgram ( r_program_t prog  )  [static]

Definition at line 695 of file r_program.c.

References R_ProgramParameter1i(), R_ProgramParameter2fv(), and R_ProgramParameter4fv().

Referenced by R_InitPrograms().

static size_t R_InitializeShader ( const char *  name,
char *  out,
size_t  len 
) [static]
void R_InitParticleProgram ( r_program_t prog  ) 

Definition at line 794 of file r_program.c.

References R_ProgramParameter1i().

Referenced by CL_ParseMapParticle(), and CL_ParticleFunction().

void R_InitPrograms ( void   ) 
static void R_InitSimpleGlowProgram ( r_program_t prog  )  [static]

Definition at line 787 of file r_program.c.

References R_ProgramParameter1f(), and R_ProgramParameter1i().

Referenced by R_InitPrograms().

static void R_InitWarpProgram ( r_program_t prog  )  [static]
static void R_InitWorldProgram ( r_program_t prog  )  [static]

Definition at line 647 of file r_program.c.

References cvar_s::integer, r_postprocess, R_ProgramParameter1f(), and R_ProgramParameter1i().

Referenced by R_InitPrograms().

r_program_t* R_LoadProgram ( const char *  name,
void *  init,
void *  use 
)
static r_shader_t* R_LoadShader ( GLenum  type,
const char *  name 
) [static]
static int R_PascalTriangle ( int  row,
int  col 
) [static]
Note:
this is a not-terribly-efficient recursive implementation, but it only happens once and shouldn't have to go very deep.

Definition at line 714 of file r_program.c.

Referenced by R_InitConvolveProgram().

static size_t R_PreprocessShader ( const char *  name,
const char *  in,
char *  out,
int  len 
) [static]

Todo:
(arisian): don't GLSL compilers have built-in preprocessors that can handle this kind of stuff?

Definition at line 339 of file r_program.c.

References byte, Com_Error(), Com_Parse(), Com_Printf(), Com_sprintf(), Cvar_GetValue(), ERR_DROP, ERR_FATAL, f, FS_FreeFile(), FS_LoadFile(), i, MAX_QPATH, Mem_Free, Mem_PoolAlloc, qfalse, qtrue, SHADER_BUF_SIZE, and vid_imagePool.

Referenced by R_LoadShader().

static size_t R_PreprocessShaderAddToShaderBuf ( const char *  name,
const char *  in,
char **  out,
size_t *  len 
) [static]

Definition at line 292 of file r_program.c.

Referenced by R_InitializeShader().

void R_ProgramParameter1f ( const char *  name,
GLfloat  value 
)
void R_ProgramParameter1fvs ( const char *  name,
GLint  size,
GLfloat *  value 
)

Definition at line 141 of file r_program.c.

References GL_UNIFORM, r_progvar_s::location, and R_ProgramVariable().

Referenced by R_InitConvolveProgram().

void R_ProgramParameter1i ( const char *  name,
GLint  value 
)
void R_ProgramParameter2fv ( const char *  name,
GLfloat *  value 
)
void R_ProgramParameter2fvs ( const char *  name,
GLint  size,
GLfloat *  value 
)

Definition at line 169 of file r_program.c.

References GL_UNIFORM, r_progvar_s::location, and R_ProgramVariable().

Referenced by R_UseConvolveProgram().

void R_ProgramParameter3fv ( const char *  name,
GLfloat *  value 
)

Definition at line 183 of file r_program.c.

References GL_UNIFORM, r_progvar_s::location, and R_ProgramVariable().

void R_ProgramParameter4fv ( const char *  name,
GLfloat *  value 
)
static r_progvar_t* R_ProgramVariable ( int  type,
const char *  name 
) [static]
void R_RestartPrograms_f ( void   ) 

Reloads the glsl shaders.

Definition at line 833 of file r_program.c.

References Com_Printf(), R_InitPrograms(), and R_ShutdownPrograms().

Referenced by R_BeginFrame().

static void R_ShutdownProgram ( r_program_t prog  )  [static]
void R_ShutdownPrograms ( void   ) 
static void R_ShutdownShader ( r_shader_t sh  )  [static]

Definition at line 250 of file r_program.c.

References r_shader_s::id.

Referenced by R_ShutdownProgram().

static void R_UseConvolveProgram ( r_program_t prog  )  [static]

Use the filter convolution glsl program.

Definition at line 747 of file r_program.c.

References FILTER_SIZE, i, R_ProgramParameter2fvs(), and r_program_s::userdata.

Referenced by R_InitPrograms().

void R_UseParticleProgram ( r_program_t prog  ) 

Definition at line 799 of file r_program.c.

Referenced by CL_ParseMapParticle(), and CL_ParticleFunction().

void R_UseProgram ( r_program_t prog  ) 
static void R_UseWarpProgram ( r_program_t prog  )  [static]

Definition at line 687 of file r_program.c.

References R_ProgramParameter4fv(), refdef, and rendererData_t::time.

Referenced by R_InitPrograms().

static void R_UseWorldProgram ( r_program_t prog  )  [static]

Definition at line 669 of file r_program.c.

Referenced by R_InitPrograms().


Generated by  doxygen 1.6.2