summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/ffvertex_prog.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 9021931b352..cc1b44de642 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -26,7 +26,7 @@
**************************************************************************/
/**
- * \file ffvertex_prog.
+ * \file ffvertex_prog.c
*
* Create a vertex program to execute the current fixed function T&L pipeline.
* \author Keith Whitwell
@@ -99,6 +99,7 @@ static GLuint translate_fog_mode( GLenum mode )
}
}
+
#define TXG_NONE 0
#define TXG_OBJ_LINEAR 1
#define TXG_EYE_LINEAR 2
@@ -143,6 +144,7 @@ tnl_get_per_vertex_materials(GLcontext *ctx)
return mask;
}
+
/**
* Should fog be computed per-vertex?
*/
@@ -157,6 +159,7 @@ tnl_get_per_vertex_fog(GLcontext *ctx)
#endif
}
+
static GLboolean check_active_shininess( GLcontext *ctx,
const struct state_key *key,
GLuint side )
@@ -174,8 +177,6 @@ static GLboolean check_active_shininess( GLcontext *ctx,
return GL_FALSE;
}
-
-
static void make_state_key( GLcontext *ctx, struct state_key *key )
@@ -407,11 +408,13 @@ static struct ureg swizzle( struct ureg reg, int x, int y, int z, int w )
return reg;
}
+
static struct ureg swizzle1( struct ureg reg, int x )
{
return swizzle(reg, x, x, x, x);
}
+
static struct ureg get_temp( struct tnl_program *p )
{
int bit = _mesa_ffs( ~p->temp_in_use );
@@ -427,6 +430,7 @@ static struct ureg get_temp( struct tnl_program *p )
return make_ureg(PROGRAM_TEMPORARY, bit-1);
}
+
static struct ureg reserve_temp( struct tnl_program *p )
{
struct ureg temp = get_temp( p );
@@ -434,6 +438,7 @@ static struct ureg reserve_temp( struct tnl_program *p )
return temp;
}
+
static void release_temp( struct tnl_program *p, struct ureg reg )
{
if (reg.file == PROGRAM_TEMPORARY) {
@@ -442,13 +447,13 @@ static void release_temp( struct tnl_program *p, struct ureg reg )
}
}
+
static void release_temps( struct tnl_program *p )
{
p->temp_in_use = p->temp_reserved;
}
-
/**
* \param input one of VERT_ATTRIB_x tokens.
*/
@@ -458,6 +463,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input )
return make_ureg(PROGRAM_INPUT, input);
}
+
/**
* \param input one of VERT_RESULT_x tokens.
*/
@@ -467,6 +473,7 @@ static struct ureg register_output( struct tnl_program *p, GLuint output )
return make_ureg(PROGRAM_OUTPUT, output);
}
+
static struct ureg register_const4f( struct tnl_program *p,
GLfloat s0,
GLfloat s1,
@@ -486,6 +493,7 @@ static struct ureg register_const4f( struct tnl_program *p,
return make_ureg(PROGRAM_CONSTANT, idx);
}
+
#define register_const1f(p, s0) register_const4f(p, s0, 0, 0, 1)
#define register_scalar_const(p, s0) register_const4f(p, s0, s0, s0, s0)
#define register_const2f(p, s0, s1) register_const4f(p, s0, s1, 0, 1)
@@ -496,6 +504,7 @@ static GLboolean is_undef( struct ureg reg )
return reg.file == PROGRAM_UNDEFINED;
}
+
static struct ureg get_identity_param( struct tnl_program *p )
{
if (is_undef(p->identity))
@@ -504,6 +513,7 @@ static struct ureg get_identity_param( struct tnl_program *p )
return p->identity;
}
+
static struct ureg register_param5(struct tnl_program *p,
GLint s0,
GLint s1,
@@ -561,6 +571,7 @@ static void emit_arg( struct prog_src_register *src,
ASSERT(src->Index == reg.idx);
}
+
static void emit_dst( struct prog_dst_register *dst,
struct ureg reg, GLuint mask )
{
@@ -576,6 +587,7 @@ static void emit_dst( struct prog_dst_register *dst,
ASSERT(dst->Index == reg.idx);
}
+
static void debug_insn( struct prog_instruction *inst, const char *fn,
GLuint line )
{
@@ -686,6 +698,7 @@ static void emit_matrix_transform_vec4( struct tnl_program *p,
emit_op2(p, OPCODE_DP4, dest, WRITEMASK_W, src, mat[3]);
}
+
/* This version is much easier to implement if writemasks are not
* supported natively on the target or (like SSE), the target doesn't
* have a clean/obvious dotproduct implementation.
@@ -711,6 +724,7 @@ static void emit_transpose_matrix_transform_vec4( struct tnl_program *p,
release_temp(p, tmp);
}
+
static void emit_matrix_transform_vec3( struct tnl_program *p,
struct ureg dest,
const struct ureg *mat,
@@ -738,6 +752,7 @@ static void emit_normalize_vec3( struct tnl_program *p,
#endif
}
+
static void emit_passthrough( struct tnl_program *p,
GLuint input,
GLuint output )
@@ -746,6 +761,7 @@ static void emit_passthrough( struct tnl_program *p,
emit_op1(p, OPCODE_MOV, out, 0, register_input(p, input));
}
+
static struct ureg get_eye_position( struct tnl_program *p )
{
if (is_undef(p->eye_position)) {
@@ -793,7 +809,6 @@ static struct ureg get_eye_position_z( struct tnl_program *p )
}
-
static struct ureg get_eye_position_normalized( struct tnl_program *p )
{
if (is_undef(p->eye_position_normalized)) {
@@ -855,7 +870,6 @@ static struct ureg get_transformed_normal( struct tnl_program *p )
}
-
static void build_hpos( struct tnl_program *p )
{
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
@@ -881,7 +895,9 @@ static GLuint material_attrib( GLuint side, GLuint property )
side);
}
-/* Get a bitmask of which material values vary on a per-vertex basis.
+
+/**
+ * Get a bitmask of which material values vary on a per-vertex basis.
*/
static void set_material_flags( struct tnl_program *p )
{
@@ -917,7 +933,9 @@ static struct ureg get_material( struct tnl_program *p, GLuint side,
MAT_BIT_FRONT_AMBIENT | \
MAT_BIT_FRONT_DIFFUSE) << (side))
-/* Either return a precalculated constant value or emit code to
+
+/**
+ * Either return a precalculated constant value or emit code to
* calculate these values dynamically in the case where material calls
* are present between begin/end pairs.
*
@@ -960,6 +978,7 @@ static struct ureg get_lightprod( struct tnl_program *p, GLuint light,
return register_param4(p, STATE_LIGHTPROD, light, side, property);
}
+
static struct ureg calculate_light_attenuation( struct tnl_program *p,
GLuint i,
struct ureg VPpli,
@@ -1216,7 +1235,6 @@ static void build_lighting( struct tnl_program *p )
struct ureg res0, res1;
GLuint mask0, mask1;
-
if (count == nr_lights) {
if (separate) {
mask0 = WRITEMASK_XYZ;
@@ -1237,7 +1255,6 @@ static void build_lighting( struct tnl_program *p )
res1 = _col1;
}
-
if (!is_undef(att)) {
/* light is attenuated by distance */
emit_op1(p, OPCODE_LIT, lit, 0, dots);
@@ -1310,7 +1327,6 @@ static void build_lighting( struct tnl_program *p )
emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0);
emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1);
-
/* restore negate flag for next lighting */
dots = negate(dots);
@@ -1385,6 +1401,7 @@ static void build_fog( struct tnl_program *p )
emit_op1(p, useabs ? OPCODE_ABS : OPCODE_MOV, fog, WRITEMASK_X, input);
}
}
+
static void build_reflect_texgen( struct tnl_program *p,
struct ureg dest,
@@ -1404,6 +1421,7 @@ static void build_reflect_texgen( struct tnl_program *p,
release_temp(p, tmp);
}
+
static void build_sphere_texgen( struct tnl_program *p,
struct ureg dest,
GLuint writemask )
@@ -1514,10 +1532,8 @@ static void build_texture_transform( struct tnl_program *p )
case TXG_NONE:
copy_mask |= WRITEMASK_X << j;
}
-
}
-
if (sphere_mask) {
build_sphere_texgen(p, out_texgen, sphere_mask);
}
@@ -1600,6 +1616,7 @@ static void build_atten_pointsize( struct tnl_program *p )
release_temp(p, ut);
}
+
/**
* Emit constant point size.
*/
@@ -1610,6 +1627,7 @@ static void build_constant_pointsize( struct tnl_program *p )
emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, state_size);
}
+
/**
* Pass-though per-vertex point size, from user's point size array.
*/