glsl: Expand nested preprocessor macros.
[mesa.git] / src / mesa / tnl / t_vb_lighttmp.h
index 2d33f71a8c0951232e52c4a20470ff93ba760a31..124ca3c74fe258b21616263979db681910ffc267 100644 (file)
@@ -56,8 +56,8 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
 
    const GLuint vstride = input->stride;
    const GLfloat *vertex = (GLfloat *)input->data;
-   const GLuint nstride = VB->NormalPtr->stride;
-   const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
+   const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+   const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
 
    GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
    GLfloat (*Fspec)[4] = (GLfloat (*)[4]) store->LitSecondary[0].data;
@@ -82,10 +82,6 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
    sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
 #endif
 
-   /* Side-effects done, can we finish now?
-    */
-   if (stage->changed_inputs == 0)
-      return;
 
    store->LitColor[0].stride = 16;
    store->LitColor[1].stride = 16;
@@ -145,7 +141,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
 
            /* spotlight attenuation */
            if (light->_Flags & LIGHT_SPOT) {
-              GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection);
+              GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
 
               if (PV_dot_dir<light->_CosCutoff) {
                  continue; /* this light makes no contribution */
@@ -249,8 +245,8 @@ static void TAG(light_rgba)( GLcontext *ctx,
 
    const GLuint vstride = input->stride;
    const GLfloat *vertex = (GLfloat *) input->data;
-   const GLuint nstride = VB->NormalPtr->stride;
-   const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
+   const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+   const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
 
    GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
 #if IDX & LIGHT_TWOSIDE
@@ -271,9 +267,6 @@ static void TAG(light_rgba)( GLcontext *ctx,
    sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
 #endif
 
-   if (stage->changed_inputs == 0)
-      return;
-
    store->LitColor[0].stride = 16;
    store->LitColor[1].stride = 16;
 
@@ -332,7 +325,7 @@ static void TAG(light_rgba)( GLcontext *ctx,
 
            /* spotlight attenuation */
            if (light->_Flags & LIGHT_SPOT) {
-              GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection);
+              GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
 
               if (PV_dot_dir<light->_CosCutoff) {
                  continue; /* this light makes no contribution */
@@ -435,8 +428,8 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
 
 {
    struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
-   const GLuint nstride = VB->NormalPtr->stride;
-   const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
+   const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+   const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
    GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
 #if IDX & LIGHT_TWOSIDE
    GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
@@ -447,7 +440,7 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
 #if IDX & LIGHT_MATERIAL
    const GLuint nr = VB->Count;
 #else
-   const GLuint nr = VB->NormalPtr->count;
+   const GLuint nr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count;
 #endif
 
 #ifdef TRACE
@@ -461,9 +454,6 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
    VB->ColorPtr[1] = &store->LitColor[1];
 #endif
 
-   if (stage->changed_inputs == 0)
-      return;
-
    if (nr > 1) {
       store->LitColor[0].stride = 16;
       store->LitColor[1].stride = 16;
@@ -546,8 +536,8 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
 {
    struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
    GLfloat sumA[2];
-   const GLuint nstride = VB->NormalPtr->stride;
-   const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
+   const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+   const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
    GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
 #if IDX & LIGHT_TWOSIDE
    GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
@@ -556,7 +546,7 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
 #if IDX & LIGHT_MATERIAL
    const GLuint nr = VB->Count;
 #else
-   const GLuint nr = VB->NormalPtr->count;
+   const GLuint nr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->count;
 #endif
    const struct gl_light *light;
 
@@ -574,9 +564,6 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
    VB->ColorPtr[1] = &store->LitColor[1];
 #endif
 
-   if (stage->changed_inputs == 0)
-      return;
-
    if (nr > 1) {
       store->LitColor[0].stride = 16;
       store->LitColor[1].stride = 16;
@@ -669,8 +656,8 @@ static void TAG(light_ci)( GLcontext *ctx,
    GLuint j;
    const GLuint vstride = input->stride;
    const GLfloat *vertex = (GLfloat *) input->data;
-   const GLuint nstride = VB->NormalPtr->stride;
-   const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
+   const GLuint nstride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride;
+   const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
    GLfloat *indexResult[2];
    const GLuint nr = VB->Count;
 
@@ -683,9 +670,6 @@ static void TAG(light_ci)( GLcontext *ctx,
    VB->IndexPtr[1] = &store->LitIndex[1];
 #endif
 
-   if (stage->changed_inputs == 0)
-      return;
-
    indexResult[0] = (GLfloat *)VB->IndexPtr[0]->data;
 #if IDX & LIGHT_TWOSIDE
    indexResult[1] = (GLfloat *)VB->IndexPtr[1]->data;
@@ -737,7 +721,7 @@ static void TAG(light_ci)( GLcontext *ctx,
 
            /* spotlight attenuation */
            if (light->_Flags & LIGHT_SPOT) {
-              GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection);
+              GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
               if (PV_dot_dir < light->_CosCutoff) {
                  continue; /* this light makes no contribution */
               }