summaryrefslogtreecommitdiff
path: root/src/mesa/vbo/vbo_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/vbo/vbo_context.c')
-rw-r--r--src/mesa/vbo/vbo_context.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index a73a46b9c8..75c32e0b9b 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -28,9 +28,12 @@
#include "main/imports.h"
#include "main/mtypes.h"
#include "main/api_arrayelt.h"
+#include "main/bufferobj.h"
+#include "math/m_eval.h"
#include "vbo.h"
#include "vbo_context.h"
+#if 0
/* Reach out and grab this to use as the default:
*/
extern void _tnl_draw_prims( GLcontext *ctx,
@@ -40,6 +43,7 @@ extern void _tnl_draw_prims( GLcontext *ctx,
const struct _mesa_index_buffer *ib,
GLuint min_index,
GLuint max_index );
+#endif
@@ -76,8 +80,10 @@ static void init_legacy_currval(GLcontext *ctx)
cl->StrideB = 0;
cl->Enabled = 1;
cl->Type = GL_FLOAT;
+ cl->Format = GL_RGBA;
cl->Ptr = (const void *)ctx->Current.Attrib[i];
- cl->BufferObj = ctx->Array.NullBufferObj;
+ _mesa_reference_buffer_object(ctx, &cl->BufferObj,
+ ctx->Shared->NullBufferObj);
}
}
@@ -97,11 +103,13 @@ static void init_generic_currval(GLcontext *ctx)
*/
cl->Size = 1;
cl->Type = GL_FLOAT;
+ cl->Format = GL_RGBA;
cl->Ptr = (const void *)ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + i];
cl->Stride = 0;
cl->StrideB = 0;
cl->Enabled = 1;
- cl->BufferObj = ctx->Array.NullBufferObj;
+ _mesa_reference_buffer_object(ctx, &cl->BufferObj,
+ ctx->Shared->NullBufferObj);
}
}
@@ -141,10 +149,12 @@ static void init_mat_currval(GLcontext *ctx)
cl->Ptr = (const void *)ctx->Light.Material.Attrib[i];
cl->Type = GL_FLOAT;
+ cl->Format = GL_RGBA;
cl->Stride = 0;
cl->StrideB = 0;
cl->Enabled = 1;
- cl->BufferObj = ctx->Array.NullBufferObj;
+ _mesa_reference_buffer_object(ctx, &cl->BufferObj,
+ ctx->Shared->NullBufferObj);
}
}
@@ -205,14 +215,16 @@ GLboolean _vbo_CreateContext( GLcontext *ctx )
for (i = 0; i < 4; i++)
vbo->map_vp_none[28+i] = i;
- for (i = 0; i < VERT_ATTRIB_MAX; i++)
+ for (i = 0; i < Elements(vbo->map_vp_arb); i++)
vbo->map_vp_arb[i] = i;
}
/* By default:
*/
+#if 0 /* dead - see vbo_set_draw_func() */
vbo->draw_prims = _tnl_draw_prims;
+#endif
/* Hook our functions into exec and compile dispatch tables. These
* will pretty much be permanently installed, which means that the
@@ -223,6 +235,8 @@ GLboolean _vbo_CreateContext( GLcontext *ctx )
vbo_save_init( ctx );
#endif
+ _math_init_eval();
+
return GL_TRUE;
}
@@ -240,10 +254,20 @@ void _vbo_DestroyContext( GLcontext *ctx )
ctx->aelt_context = NULL;
}
- vbo_exec_destroy(ctx);
+ if (vbo_context(ctx)) {
+ vbo_exec_destroy(ctx);
#if FEATURE_dlist
- vbo_save_destroy(ctx);
+ vbo_save_destroy(ctx);
#endif
- FREE(vbo_context(ctx));
- ctx->swtnl_im = NULL;
+ FREE(vbo_context(ctx));
+ ctx->swtnl_im = NULL;
+ }
}
+
+
+void vbo_set_draw_func(GLcontext *ctx, vbo_draw_func func)
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ vbo->draw_prims = func;
+}
+