summaryrefslogtreecommitdiff
path: root/src/mesa/tnl/t_vb_lighttmp.h
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2005-01-05 18:06:05 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2005-01-05 18:06:05 +0000
commitdd9666bc1def9e99a5050545ab71d24037cf5af0 (patch)
tree0d5f0b91399159768aa9ed35384dc1cb1d107d1b /src/mesa/tnl/t_vb_lighttmp.h
parent30f64862766c573505fb7cd03a1c10bbf584c183 (diff)
Give attributes with zero-stride a count of 1 to make it easier
to avoid transforming the same attribute multiple times. Don't light a single normal multiple times in light_fast_rgba*
Diffstat (limited to 'src/mesa/tnl/t_vb_lighttmp.h')
-rw-r--r--src/mesa/tnl/t_vb_lighttmp.h45
1 files changed, 32 insertions, 13 deletions
diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h
index d8094e29c3..2d33f71a8c 100644
--- a/src/mesa/tnl/t_vb_lighttmp.h
+++ b/src/mesa/tnl/t_vb_lighttmp.h
@@ -68,9 +68,6 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
const GLuint nr = VB->Count;
- (void) nstride;
- (void) vstride;
-
#ifdef TRACE
fprintf(stderr, "%s\n", __FUNCTION__ );
#endif
@@ -90,6 +87,9 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
if (stage->changed_inputs == 0)
return;
+ store->LitColor[0].stride = 16;
+ store->LitColor[1].stride = 16;
+
for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) {
GLfloat sum[2][3], spec[2][3];
struct gl_light *light;
@@ -263,9 +263,6 @@ static void TAG(light_rgba)( GLcontext *ctx,
fprintf(stderr, "%s\n", __FUNCTION__ );
#endif
- (void) nstride;
- (void) vstride;
-
VB->ColorPtr[0] = &store->LitColor[0];
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
@@ -277,6 +274,9 @@ static void TAG(light_rgba)( GLcontext *ctx,
if (stage->changed_inputs == 0)
return;
+ store->LitColor[0].stride = 16;
+ store->LitColor[1].stride = 16;
+
for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) {
GLfloat sum[2][3];
struct gl_light *light;
@@ -444,15 +444,17 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
const struct gl_light *light = ctx->Light.EnabledList.next;
GLuint j = 0;
GLfloat base[2][4];
+#if IDX & LIGHT_MATERIAL
const GLuint nr = VB->Count;
+#else
+ const GLuint nr = VB->NormalPtr->count;
+#endif
#ifdef TRACE
fprintf(stderr, "%s\n", __FUNCTION__ );
#endif
(void) input; /* doesn't refer to Eye or Obj */
- (void) nr;
- (void) nstride;
VB->ColorPtr[0] = &store->LitColor[0];
#if IDX & LIGHT_TWOSIDE
@@ -462,6 +464,15 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
if (stage->changed_inputs == 0)
return;
+ if (nr > 1) {
+ store->LitColor[0].stride = 16;
+ store->LitColor[1].stride = 16;
+ }
+ else {
+ store->LitColor[0].stride = 0;
+ store->LitColor[1].stride = 0;
+ }
+
for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) {
GLfloat n_dot_VP;
@@ -542,7 +553,11 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
#endif
GLuint j = 0;
+#if IDX & LIGHT_MATERIAL
const GLuint nr = VB->Count;
+#else
+ const GLuint nr = VB->NormalPtr->count;
+#endif
const struct gl_light *light;
#ifdef TRACE
@@ -550,8 +565,6 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
#endif
(void) input;
- (void) nr;
- (void) nstride;
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
@@ -564,6 +577,15 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
if (stage->changed_inputs == 0)
return;
+ if (nr > 1) {
+ store->LitColor[0].stride = 16;
+ store->LitColor[1].stride = 16;
+ }
+ else {
+ store->LitColor[0].stride = 0;
+ store->LitColor[1].stride = 0;
+ }
+
for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) {
GLfloat sum[2][3];
@@ -656,9 +678,6 @@ static void TAG(light_ci)( GLcontext *ctx,
fprintf(stderr, "%s\n", __FUNCTION__ );
#endif
- (void) nstride;
- (void) vstride;
-
VB->IndexPtr[0] = &store->LitIndex[0];
#if IDX & LIGHT_TWOSIDE
VB->IndexPtr[1] = &store->LitIndex[1];