mightymandel v16

GPU-based Mandelbrot set explorer

shader.c File Reference

(v16)

Compile and link OpenGL shader programs. More...

#include <stdlib.h>
#include "shader.h"
#include "logging.h"
#include "mightymandel.h"
+ Include dependency graph for shader.c:

Go to the source code of this file.

Functions

void debug_program (GLuint program, const char *name)
 Check program link status and output shader compile logs.
void compile_shader (GLint program, GLenum type, const GLchar *source)
 Compile a shader.
GLint compile_program_tf (const char *name, const GLchar *vert, const GLchar *geom, const GLchar *frag, int nvaryings, const GLchar **varyings)
 Compile a program with transform feedback.
GLint compile_program (const char *name, const GLchar *vert, const GLchar *geom, const GLchar *frag)
 Compile a program without transform feedback.

Variables

const char * fp32_preamble
 fp32_preamble.glsl
const char * fp64_preamble
 fp64_preamble.glsl
const char * fp32_complex
 fp32_complex.glsl
const char * fp64_complex
 fp64_complex.glsl
const char * config
 config.glsl

Detailed Description

Compile and link OpenGL shader programs.

Definition in file shader.c.

Function Documentation

GLint compile_program ( const char *  name,
const GLchar *  vert,
const GLchar *  geom,
const GLchar *  frag 
)

Compile a program without transform feedback.

Parameters
nameThe name of the program for log messages.
vertThe vertex shader source, or null.
geomThe geometry shader source, or null.
fragThe fragment shader source, or null.
Returns
The compiled program.

Definition at line 105 of file shader.c.

References compile_program_tf().

Referenced by fp32_colour_begin(), fp32_escaped_begin(), fp32_fillc_begin(), fp64_escaped_begin(), and fpxx_escaped_begin().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GLint compile_program_tf ( const char *  name,
const GLchar *  vert,
const GLchar *  geom,
const GLchar *  frag,
int  nvaryings,
const GLchar **  varyings 
)

Compile a program with transform feedback.

Parameters
nameThe name of the program for log messages.
vertThe vertex shader source, or null.
geomThe geometry shader source, or null.
fragThe fragment shader source, or null.
nvaryingsThe number of varyings to capture in transform feedback, or 0.
varyingsThe names of the varyings to capture in transform feedback, or 0.
Returns
The compiled program.

Definition at line 83 of file shader.c.

References compile_shader(), D, and debug_program().

Referenced by compile_program(), fp32_init_begin(), fp32_step_begin(), fp32_unescaped_begin(), fp64_init_begin(), fp64_step_begin(), fp64_unescaped_begin(), fpxx_approx_begin(), fpxx_init_begin(), fpxx_step_begin(), and fpxx_unescaped_begin().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void compile_shader ( GLint  program,
GLenum  type,
const GLchar *  source 
)

Compile a shader.

Automatically adds extra sources (preamble, complex number functions, define for DE).

Parameters
programThe program to link the shader to.
typeThe type of shader.
sourceThe glsl source code.

Definition at line 62 of file shader.c.

References config, D, DE, fp32_complex, fp32_preamble, FP64, fp64_complex, and fp64_preamble.

Referenced by compile_program_tf().

+ Here is the caller graph for this function:

void debug_program ( GLuint  program,
const char *  name 
)

Check program link status and output shader compile logs.

Parameters
programThe program to debug.
nameThe name of the progam for log messages.

Definition at line 28 of file shader.c.

References D, LOG_ERROR, log_level, log_message, log_target, and LOG_WARN.

Referenced by compile_program_tf().

+ Here is the caller graph for this function:

Variable Documentation

const char* config

config.glsl

Referenced by compile_shader().

const char* fp32_complex
const char* fp32_preamble
const char* fp64_complex
const char* fp64_preamble