intel: Transition intel_region_map() to being a miptree operation.
[mesa.git] / src / mesa / tnl / t_vb_normals.c
index 0f91784e8094050528f868d99f3b79757c67312f..c19b48e51ee027a380f9142e7cb6f368f9161eba 100644 (file)
  */
 
 
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
 
 #include "math/m_xform.h"
 
@@ -48,7 +47,7 @@ struct normal_stage_data {
 
 
 static GLboolean
-run_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+run_normal_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
 {
    struct normal_stage_data *store = NORMAL_STAGE_DATA(stage);
    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
@@ -79,7 +78,6 @@ run_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
    }
 
    VB->AttribPtr[_TNL_ATTRIB_NORMAL] = &store->normal;
-   VB->NormalPtr = &store->normal;
 
    VB->NormalLengthPtr = NULL; /* no longer valid */
    return GL_TRUE;
@@ -91,16 +89,11 @@ run_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
  * to point to the appropriate normal transformation routine.
  */
 static void
-validate_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+validate_normal_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
 {
    struct normal_stage_data *store = NORMAL_STAGE_DATA(stage);
 
-   if (ctx->ShaderObjects._VertexShaderPresent) {
-      store->NormalTransform = NULL;
-      return;
-   }
-
-   if (ctx->VertexProgram._Enabled ||
+   if (ctx->VertexProgram._Current ||
        (!ctx->Light.Enabled &&
        !(ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS))) {
       store->NormalTransform = NULL;
@@ -153,12 +146,12 @@ validate_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
  * Allocate stage's private data (storage for transformed normals).
  */
 static GLboolean
-alloc_normal_data(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+alloc_normal_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    struct normal_stage_data *store;
 
-   stage->privatePtr = _mesa_malloc(sizeof(*store));
+   stage->privatePtr = malloc(sizeof(*store));
    store = NORMAL_STAGE_DATA(stage);
    if (!store)
       return GL_FALSE;
@@ -177,7 +170,7 @@ free_normal_data(struct tnl_pipeline_stage *stage)
    struct normal_stage_data *store = NORMAL_STAGE_DATA(stage);
    if (store) {
       _mesa_vector4f_free( &store->normal );
-      _mesa_free( store );
+      free( store );
       stage->privatePtr = NULL;
    }
 }