core | glapi | vbo | math | shader | swrast | swrast_setup | tnl | tnl_dd

prog_execute.c File Reference


Detailed Description

Software interpreter for vertex/fragment programs.

Author:
Brian Paul

#include "main/glheader.h"
#include "main/colormac.h"
#include "main/context.h"
#include "program.h"
#include "prog_execute.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
#include "prog_print.h"
#include "prog_noise.h"

Defines

#define DEBUG_PROG   0
#define SET_POS_INFINITY(x)   x = (GLfloat) HUGE_VAL
 Set x to positive or negative infinity.
#define SET_NEG_INFINITY(x)   x = (GLfloat) -HUGE_VAL
#define SET_FLOAT_BITS(x, bits)   ((fi_type *) (void *) &(x))->i = bits

Functions

static INLINE const GLfloat * get_src_register_pointer (const struct prog_src_register *source, const struct gl_program_machine *machine)
 Return a pointer to the 4-element float vector specified by the given source register.
static INLINE GLfloat * get_dst_register_pointer (const struct prog_dst_register *dest, struct gl_program_machine *machine)
 Return a pointer to the 4-element float vector specified by the given destination register.
static void fetch_vector4 (const struct prog_src_register *source, const struct gl_program_machine *machine, GLfloat result[4])
 Fetch a 4-element float vector from the given source register.
static void fetch_vector4ui (const struct prog_src_register *source, const struct gl_program_machine *machine, GLuint result[4])
 Fetch a 4-element uint vector from the given source register.
static void fetch_vector4_deriv (GLcontext *ctx, const struct prog_src_register *source, const struct gl_program_machine *machine, char xOrY, GLfloat result[4])
 Fetch the derivative with respect to X or Y for the given register.
static void fetch_vector1 (const struct prog_src_register *source, const struct gl_program_machine *machine, GLfloat result[4])
 As above, but only return result[0] element.
static INLINE void fetch_texel (GLcontext *ctx, const struct gl_program_machine *machine, const struct prog_instruction *inst, const GLfloat texcoord[4], GLfloat lodBias, GLfloat color[4])
 Fetch texel from texture.
static INLINE GLuint generate_cc (float value)
 Test value against zero and return GT, LT, EQ or UN if NaN.
static INLINE GLboolean test_cc (GLuint condCode, GLuint ccMaskRule)
 Test if the ccMaskRule is satisfied by the given condition code.
static INLINE GLboolean eval_condition (const struct gl_program_machine *machine, const struct prog_instruction *inst)
 Evaluate the 4 condition codes against a predicate and return GL_TRUE or GL_FALSE to indicate result.
static void store_vector4 (const struct prog_instruction *inst, struct gl_program_machine *machine, const GLfloat value[4])
 Store 4 floats into a register.
static void store_vector4ui (const struct prog_instruction *inst, struct gl_program_machine *machine, const GLuint value[4])
 Store 4 uints into a register.
GLboolean _mesa_execute_program (GLcontext *ctx, const struct gl_program *program, struct gl_program_machine *machine)
 Execute the given vertex/fragment program.

Variables

static const GLfloat ZeroVec [4] = { 0.0F, 0.0F, 0.0F, 0.0F }


Define Documentation

#define DEBUG_PROG   0

#define SET_FLOAT_BITS ( x,
bits   )     ((fi_type *) (void *) &(x))->i = bits

#define SET_NEG_INFINITY (  )     x = (GLfloat) -HUGE_VAL

#define SET_POS_INFINITY (  )     x = (GLfloat) HUGE_VAL

Set x to positive or negative infinity.


Function Documentation

GLboolean _mesa_execute_program ( GLcontext ctx,
const struct gl_program program,
struct gl_program_machine machine 
)

Execute the given vertex/fragment program.

Parameters:
ctx rendering context
program the program to execute
machine machine state (must be initialized)
Returns:
GL_TRUE if program completed or GL_FALSE if program executed KIL.

static INLINE GLboolean eval_condition ( const struct gl_program_machine machine,
const struct prog_instruction inst 
) [static]

Evaluate the 4 condition codes against a predicate and return GL_TRUE or GL_FALSE to indicate result.

static INLINE void fetch_texel ( GLcontext ctx,
const struct gl_program_machine machine,
const struct prog_instruction inst,
const GLfloat  texcoord[4],
GLfloat  lodBias,
GLfloat  color[4] 
) [static]

Fetch texel from texture.

Use partial derivatives when possible.

static void fetch_vector1 ( const struct prog_src_register source,
const struct gl_program_machine machine,
GLfloat  result[4] 
) [static]

As above, but only return result[0] element.

static void fetch_vector4 ( const struct prog_src_register source,
const struct gl_program_machine machine,
GLfloat  result[4] 
) [static]

Fetch a 4-element float vector from the given source register.

Apply swizzling and negating as needed.

static void fetch_vector4_deriv ( GLcontext ctx,
const struct prog_src_register source,
const struct gl_program_machine machine,
char  xOrY,
GLfloat  result[4] 
) [static]

Fetch the derivative with respect to X or Y for the given register.

XXX this currently only works for fragment program input attribs.

static void fetch_vector4ui ( const struct prog_src_register source,
const struct gl_program_machine machine,
GLuint  result[4] 
) [static]

Fetch a 4-element uint vector from the given source register.

Apply swizzling but not negation/abs.

static INLINE GLuint generate_cc ( float  value  )  [static]

Test value against zero and return GT, LT, EQ or UN if NaN.

static INLINE GLfloat* get_dst_register_pointer ( const struct prog_dst_register dest,
struct gl_program_machine machine 
) [static]

Return a pointer to the 4-element float vector specified by the given destination register.

static INLINE const GLfloat* get_src_register_pointer ( const struct prog_src_register source,
const struct gl_program_machine machine 
) [static]

Return a pointer to the 4-element float vector specified by the given source register.

static void store_vector4 ( const struct prog_instruction inst,
struct gl_program_machine machine,
const GLfloat  value[4] 
) [static]

Store 4 floats into a register.

Observe the instructions saturate and set-condition-code flags.

static void store_vector4ui ( const struct prog_instruction inst,
struct gl_program_machine machine,
const GLuint  value[4] 
) [static]

Store 4 uints into a register.

Observe the set-condition-code flags.

static INLINE GLboolean test_cc ( GLuint  condCode,
GLuint  ccMaskRule 
) [static]

Test if the ccMaskRule is satisfied by the given condition code.

Used to mask destination writes according to the current condition code.


Variable Documentation

const GLfloat ZeroVec[4] = { 0.0F, 0.0F, 0.0F, 0.0F } [static]


Generated on Sun Sep 27 06:48:02 2009 for Mesa Vertex and Fragment Program code by  doxygen 1.5.4