vbo: remove dead code in vbo_can_merge_prims
[mesa.git] / src / mesa / vbo / vbo_exec.c
index 357ec1da767ca2c5060c26f069e2773c7dd46717..f1b1f8bff955dc37351d4ad3e47bc4f9a909b87a 100644 (file)
@@ -109,23 +109,17 @@ _vbo_attribute_alias_map[VP_MODE_MAX][VERT_ATTRIB_MAX] = {
 
 
 void
-vbo_exec_init(struct gl_context *ctx)
+vbo_exec_init(struct gl_context *ctx, bool use_buffer_objects)
 {
    struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
 
    exec->ctx = ctx;
 
-   /* aelt_context should have been created by the caller */
-   assert(ctx->aelt_context);
-
-   vbo_exec_vtx_init(exec);
+   vbo_exec_vtx_init(exec, use_buffer_objects);
 
    ctx->Driver.NeedFlush = 0;
    ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
 
-   /* The aelt_context state should still be dirty from its creation */
-   assert(_ae_is_state_dirty(ctx));
-
    exec->eval.recalculate_maps = GL_TRUE;
 }
 
@@ -134,11 +128,6 @@ void vbo_exec_destroy( struct gl_context *ctx )
 {
    struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
 
-   if (ctx->aelt_context) {
-      _ae_destroy_context( ctx );
-      ctx->aelt_context = NULL;
-   }
-
    vbo_exec_vtx_destroy( exec );
 }
 
@@ -202,10 +191,9 @@ vbo_can_merge_prims(const struct _mesa_prim *p0, const struct _mesa_prim *p1)
    if (p0->start + p0->count != p1->start)
       return false;
 
-   if (p0->basevertex != p1->basevertex ||
-       p0->num_instances != p1->num_instances ||
-       p0->base_instance != p1->base_instance)
-      return false;
+   assert(p0->basevertex == p1->basevertex &&
+          p0->num_instances == p1->num_instances &&
+          p0->base_instance == p1->base_instance);
 
    /* can always merge subsequent GL_POINTS primitives */
    if (p0->mode == GL_POINTS)
@@ -239,89 +227,3 @@ vbo_merge_prims(struct _mesa_prim *p0, const struct _mesa_prim *p1)
    p0->count += p1->count;
    p0->end = p1->end;
 }
-
-
-void
-_vbo_init_inputs(struct vbo_inputs *inputs)
-{
-   inputs->current = 0;
-   inputs->vertex_processing_mode = VP_MODE_FF;
-}
-
-
-/**
- * Update the vbo_inputs's arrays to point to the vao->_VertexArray arrays
- * according to the 'enable' bitmask.
- * \param enable  bitfield of VERT_BIT_x flags.
- */
-static inline void
-update_vao_inputs(struct gl_context *ctx,
-                  struct vbo_inputs *inputs, GLbitfield enable)
-{
-   const struct gl_vertex_array_object *vao = ctx->Array._DrawVAO;
-
-   /* Make sure we process only arrays enabled in the VAO */
-   assert((enable & ~_mesa_get_vao_vp_inputs(vao)) == 0);
-
-   /* Fill in the client arrays from the VAO */
-   const GLubyte *const map = _mesa_vao_attribute_map[vao->_AttributeMapMode];
-   const struct gl_array_attributes *attribs = &vao->VertexAttrib[0];
-   const struct gl_vertex_buffer_binding *bindings = &vao->BufferBinding[0];
-   while (enable) {
-      const int attr = u_bit_scan(&enable);
-      struct gl_vertex_array *input = &inputs->inputs[attr];
-      const struct gl_array_attributes *attrib = &attribs[map[attr]];
-      input->VertexAttrib = attrib;
-      input->BufferBinding = &bindings[attrib->BufferBindingIndex];
-   }
-}
-
-
-/**
- * Update the vbo_inputs's arrays to point to the vbo->currval arrays
- * according to the 'current' bitmask.
- * \param current  bitfield of VERT_BIT_x flags.
- */
-static inline void
-update_current_inputs(struct gl_context *ctx,
-                      struct vbo_inputs *inputs, GLbitfield current)
-{
-   gl_vertex_processing_mode mode = ctx->VertexProgram._VPMode;
-
-   /* All previously non current array pointers need update. */
-   GLbitfield mask = current & ~inputs->current;
-   /* On mode change, the slots aliasing with materials need update too */
-   if (mode != inputs->vertex_processing_mode)
-      mask |= current & VERT_BIT_MAT_ALL;
-
-   struct vbo_context *vbo = vbo_context(ctx);
-   const struct gl_array_attributes *const currval = &vbo->current[0];
-   const GLubyte *const map = _vbo_attribute_alias_map[mode];
-   while (mask) {
-      const int attr = u_bit_scan(&mask);
-      struct gl_vertex_array *input = &inputs->inputs[attr];
-      input->VertexAttrib = &currval[map[attr]];
-      input->BufferBinding = &vbo->binding;
-   }
-
-   inputs->current = current;
-   inputs->vertex_processing_mode = mode;
-}
-
-
-/**
- * Update the vbo_inputs's arrays to point to the vao->_VertexArray and
- * vbo->currval arrays according to Array._DrawVAO and
- * Array._DrawVAOEnableAttribs.
- */
-void
-_vbo_update_inputs(struct gl_context *ctx, struct vbo_inputs *inputs)
-{
-   const GLbitfield enable = ctx->Array._DrawVAOEnabledAttribs;
-
-   /* Update array input pointers */
-   update_vao_inputs(ctx, inputs, enable);
-
-   /* The rest must be current inputs. */
-   update_current_inputs(ctx, inputs, ~enable & VERT_BIT_ALL);
-}