summaryrefslogtreecommitdiff
path: root/src/mesa/tnl/t_vb_texgen.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2005-01-07 15:27:41 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2005-01-07 15:27:41 +0000
commit5fff0c135da68f58914b926cb73c21d9a6620045 (patch)
tree00f9b5ea6aab7ef2c9debd0fbe3014099f060d3b /src/mesa/tnl/t_vb_texgen.c
parent5911d8731564e6bdadcb011b949dd6cde5b46f64 (diff)
Cope with the possibility that incoming vectors may have
count < VB->Count. Remove code to deal with the (should-be) impossible situation of null input vectors.
Diffstat (limited to 'src/mesa/tnl/t_vb_texgen.c')
-rw-r--r--src/mesa/tnl/t_vb_texgen.c89
1 files changed, 24 insertions, 65 deletions
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index e9719b3b53..a2912cf7af 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -65,7 +65,6 @@ struct texgen_stage_data {
/* Per-texunit derived state.
*/
GLuint TexgenSize[MAX_TEXTURE_COORD_UNITS];
- GLuint TexgenHoles[MAX_TEXTURE_COORD_UNITS];
texgen_func TexgenFunc[MAX_TEXTURE_COORD_UNITS];
/* Temporary values used in texgen.
@@ -247,6 +246,7 @@ static build_f_func build_f_tab[5] = {
};
+
/* Special case texgen functions.
*/
static void texgen_reflection_map_nv( GLcontext *ctx,
@@ -262,19 +262,11 @@ static void texgen_reflection_map_nv( GLcontext *ctx,
VB->NormalPtr,
VB->EyePtr );
- if (in) {
- out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3;
- out->count = in->count;
- out->size = MAX2(in->size, 3);
- if (in->size == 4)
- _mesa_copy_tab[0x8]( out, in );
- }
- else {
- out->flags |= VEC_SIZE_3;
- out->size = 3;
- out->count = in->count;
- }
-
+ out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3;
+ out->count = VB->Count;
+ out->size = MAX2(in->size, 3);
+ if (in->size == 4)
+ _mesa_copy_tab[0x8]( out, in );
}
@@ -299,18 +291,11 @@ static void texgen_normal_map_nv( GLcontext *ctx,
}
- if (in) {
- out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3;
- out->count = in->count;
- out->size = MAX2(in->size, 3);
- if (in->size == 4)
- _mesa_copy_tab[0x8]( out, in );
- }
- else {
- out->flags |= VEC_SIZE_3;
- out->size = 3;
- out->count = in->count;
- }
+ out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3;
+ out->count = count;
+ out->size = MAX2(in->size, 3);
+ if (in->size == 4)
+ _mesa_copy_tab[0x8]( out, in );
}
@@ -332,22 +317,17 @@ static void texgen_sphere_map( GLcontext *ctx,
VB->NormalPtr,
VB->EyePtr );
+ out->size = MAX2(in->size,2);
+
for (i=0;i<count;i++) {
texcoord[i][0] = f[i][0] * m[i] + 0.5F;
texcoord[i][1] = f[i][1] * m[i] + 0.5F;
}
- if (in) {
- out->size = MAX2(in->size,2);
- out->count = in->count;
- out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_2;
- if (in->size > 2)
- _mesa_copy_tab[all_bits[in->size] & ~0x3]( out, in );
- } else {
- out->size = 2;
- out->flags |= VEC_SIZE_2;
- out->count = in->count;
- }
+ out->count = count;
+ out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_2;
+ if (in->size > 2)
+ _mesa_copy_tab[all_bits[in->size] & ~0x3]( out, in );
}
@@ -368,7 +348,7 @@ static void texgen( GLcontext *ctx,
const GLuint count = VB->Count;
GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data;
GLfloat (*f)[3] = store->tmp_f;
- GLuint holes = 0;
+ GLuint copy;
if (texUnit->_GenFlags & TEXGEN_NEED_M) {
build_m_tab[eye->size]( store->tmp_f, store->tmp_m, normal, eye );
@@ -376,34 +356,14 @@ static void texgen( GLcontext *ctx,
build_f_tab[eye->size]( (GLfloat *)store->tmp_f, 3, normal, eye );
}
- if (!in) {
- ASSERT(0);
- in = out;
- in->count = VB->Count;
-
- out->size = store->TexgenSize[unit];
- out->flags |= texUnit->TexGenEnabled;
- out->count = VB->Count;
- holes = store->TexgenHoles[unit];
- }
- else {
- GLuint copy = (all_bits[in->size] & ~texUnit->TexGenEnabled);
- if (copy)
- _mesa_copy_tab[copy]( out, in );
-
- out->size = MAX2(in->size, store->TexgenSize[unit]);
- out->flags |= (in->flags & VEC_SIZE_FLAGS) | texUnit->TexGenEnabled;
- out->count = in->count;
- holes = ~all_bits[in->size] & store->TexgenHoles[unit];
- }
+ out->size = MAX2(in->size, store->TexgenSize[unit]);
+ out->flags |= (in->flags & VEC_SIZE_FLAGS) | texUnit->TexGenEnabled;
+ out->count = count;
- if (holes) {
- if (holes & VEC_DIRTY_3) _mesa_vector4f_clean_elem(out, count, 3);
- if (holes & VEC_DIRTY_2) _mesa_vector4f_clean_elem(out, count, 2);
- if (holes & VEC_DIRTY_1) _mesa_vector4f_clean_elem(out, count, 1);
- if (holes & VEC_DIRTY_0) _mesa_vector4f_clean_elem(out, count, 0);
- }
+ copy = (all_bits[in->size] & ~texUnit->TexGenEnabled);
+ if (copy)
+ _mesa_copy_tab[copy]( out, in );
if (texUnit->TexGenEnabled & S_BIT) {
GLuint i;
@@ -564,7 +524,6 @@ static GLboolean run_validate_texgen_stage( GLcontext *ctx,
sz = 1;
store->TexgenSize[i] = sz;
- store->TexgenHoles[i] = (all_bits[sz] & ~texUnit->TexGenEnabled);
store->TexgenFunc[i] = texgen; /* general solution */
/* look for special texgen cases */