aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/vbo
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/vbo')
-rw-r--r--mesalib/src/mesa/vbo/vbo.h25
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.c10
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.h2
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.c12
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.h3
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c66
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c193
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_draw.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_save.c3
-rw-r--r--mesalib/src/mesa/vbo/vbo_save.h17
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_api.c7
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c71
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_loopback.c5
13 files changed, 323 insertions, 93 deletions
diff --git a/mesalib/src/mesa/vbo/vbo.h b/mesalib/src/mesa/vbo/vbo.h
index b24ecfd7c..07d31f6ce 100644
--- a/mesalib/src/mesa/vbo/vbo.h
+++ b/mesalib/src/mesa/vbo/vbo.h
@@ -45,6 +45,7 @@ struct _mesa_prim {
GLuint start;
GLuint count;
GLint basevertex;
+ GLsizei num_instances;
};
/* Would like to call this a "vbo_index_buffer", but this would be
@@ -138,6 +139,30 @@ void GLAPIENTRY
_vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params);
void GLAPIENTRY
+_vbo_Materialf(GLenum face, GLenum pname, GLfloat param);
+
+void GLAPIENTRY
_vbo_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+void GLAPIENTRY
+_vbo_VertexAttrib1f(GLuint indx, GLfloat x);
+
+void GLAPIENTRY
+_vbo_VertexAttrib1fv(GLuint indx, const GLfloat* values);
+
+void GLAPIENTRY
+_vbo_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
+
+void GLAPIENTRY
+_vbo_VertexAttrib2fv(GLuint indx, const GLfloat* values);
+
+void GLAPIENTRY
+_vbo_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+
+void GLAPIENTRY
+_vbo_VertexAttrib3fv(GLuint indx, const GLfloat* values);
+
+void GLAPIENTRY
+_vbo_VertexAttrib4fv(GLuint indx, const GLfloat* values);
+
#endif
diff --git a/mesalib/src/mesa/vbo/vbo_context.c b/mesalib/src/mesa/vbo/vbo_context.c
index e3be39a34..580850574 100644
--- a/mesalib/src/mesa/vbo/vbo_context.c
+++ b/mesalib/src/mesa/vbo/vbo_context.c
@@ -198,9 +198,8 @@ GLboolean _vbo_CreateContext( GLcontext *ctx )
* vtxfmt mechanism can be removed now.
*/
vbo_exec_init( ctx );
-#if FEATURE_dlist
- vbo_save_init( ctx );
-#endif
+ if (ctx->API == API_OPENGL)
+ vbo_save_init( ctx );
_math_init_eval();
@@ -232,9 +231,8 @@ void _vbo_DestroyContext( GLcontext *ctx )
}
vbo_exec_destroy(ctx);
-#if FEATURE_dlist
- vbo_save_destroy(ctx);
-#endif
+ if (ctx->API == API_OPENGL)
+ vbo_save_destroy(ctx);
FREE(vbo);
ctx->swtnl_im = NULL;
}
diff --git a/mesalib/src/mesa/vbo/vbo_context.h b/mesalib/src/mesa/vbo/vbo_context.h
index 8b726dc8a..00cfc522a 100644
--- a/mesalib/src/mesa/vbo/vbo_context.h
+++ b/mesalib/src/mesa/vbo/vbo_context.h
@@ -54,9 +54,7 @@
#include "vbo.h"
#include "vbo_attrib.h"
#include "vbo_exec.h"
-#if FEATURE_dlist
#include "vbo_save.h"
-#endif
struct vbo_context {
diff --git a/mesalib/src/mesa/vbo/vbo_exec.c b/mesalib/src/mesa/vbo/vbo_exec.c
index a057befed..046fa8105 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.c
+++ b/mesalib/src/mesa/vbo/vbo_exec.c
@@ -30,9 +30,10 @@
#include "main/glheader.h"
#include "main/mtypes.h"
#include "main/vtxfmt.h"
-
#include "vbo_context.h"
+
+
void vbo_exec_init( GLcontext *ctx )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
@@ -74,7 +75,9 @@ void vbo_exec_destroy( GLcontext *ctx )
vbo_exec_array_destroy( exec );
}
-/* Really want to install these callbacks to a central facility to be
+
+/**
+ * Really want to install these callbacks to a central facility to be
* invoked according to the state flags. That will have to wait for a
* mesa rework:
*/
@@ -87,8 +90,3 @@ void vbo_exec_invalidate_state( GLcontext *ctx, GLuint new_state )
_ae_invalidate_state(ctx, new_state);
}
-
-
-
-
-
diff --git a/mesalib/src/mesa/vbo/vbo_exec.h b/mesalib/src/mesa/vbo/vbo_exec.h
index 98c1f363d..33494f0ce 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.h
+++ b/mesalib/src/mesa/vbo/vbo_exec.h
@@ -195,7 +195,4 @@ void vbo_exec_do_EvalCoord2f( struct vbo_exec_context *exec,
void vbo_exec_do_EvalCoord1f( struct vbo_exec_context *exec,
GLfloat u);
-extern GLboolean
-vbo_validate_shaders(GLcontext *ctx);
-
#endif
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index e40f5f9dc..9df75a840 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -531,6 +531,7 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
exec->vtx.prim[i].pad = 0;
exec->vtx.prim[i].start = exec->vtx.vert_count;
exec->vtx.prim[i].count = 0;
+ exec->vtx.prim[i].num_instances = 1;
ctx->Driver.CurrentExecPrimitive = mode;
}
@@ -849,8 +850,11 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
NULL);
}
- /* Free the vertex buffer:
+ /* Free the vertex buffer. Unmap first if needed.
*/
+ if (_mesa_bufferobj_mapped(exec->vtx.bufferobj)) {
+ ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, exec->vtx.bufferobj);
+ }
_mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
}
@@ -954,6 +958,7 @@ _vbo_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
vbo_MultiTexCoord4f(target, s, t, r, q);
}
+
void GLAPIENTRY
_vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params)
{
@@ -962,7 +967,66 @@ _vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params)
void GLAPIENTRY
+_vbo_Materialf(GLenum face, GLenum pname, GLfloat param)
+{
+ GLfloat p[4];
+ p[0] = param;
+ p[1] = p[2] = p[3] = 0.0F;
+ vbo_Materialfv(face, pname, p);
+}
+
+
+void GLAPIENTRY
_vbo_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
vbo_VertexAttrib4fARB(index, x, y, z, w);
}
+
+
+void GLAPIENTRY
+_vbo_VertexAttrib1f(GLuint indx, GLfloat x)
+{
+ vbo_VertexAttrib1fARB(indx, x);
+}
+
+
+void GLAPIENTRY
+_vbo_VertexAttrib1fv(GLuint indx, const GLfloat* values)
+{
+ vbo_VertexAttrib1fvARB(indx, values);
+}
+
+
+void GLAPIENTRY
+_vbo_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
+{
+ vbo_VertexAttrib2fARB(indx, x, y);
+}
+
+
+void GLAPIENTRY
+_vbo_VertexAttrib2fv(GLuint indx, const GLfloat* values)
+{
+ vbo_VertexAttrib2fvARB(indx, values);
+}
+
+
+void GLAPIENTRY
+_vbo_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+{
+ vbo_VertexAttrib3fARB(indx, x, y, z);
+}
+
+
+void GLAPIENTRY
+_vbo_VertexAttrib3fv(GLuint indx, const GLfloat* values)
+{
+ vbo_VertexAttrib3fvARB(indx, values);
+}
+
+
+void GLAPIENTRY
+_vbo_VertexAttrib4fv(GLuint indx, const GLfloat* values)
+{
+ vbo_VertexAttrib4fvARB(indx, values);
+}
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index 90474da7c..1759e5788 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -30,7 +30,6 @@
#include "main/context.h"
#include "main/state.h"
#include "main/api_validate.h"
-#include "main/api_noop.h"
#include "main/varray.h"
#include "main/bufferobj.h"
#include "main/enums.h"
@@ -40,7 +39,8 @@
/**
- * Compute min and max elements for glDraw[Range]Elements() calls.
+ * Compute min and max elements by scanning the index buffer for
+ * glDraw[Range]Elements() calls.
*/
void
vbo_get_minmax_index(GLcontext *ctx,
@@ -112,6 +112,7 @@ vbo_get_minmax_index(GLcontext *ctx,
/**
* Check that element 'j' of the array has reasonable data.
* Map VBO if needed.
+ * For debugging purposes; not normally used.
*/
static void
check_array_data(GLcontext *ctx, struct gl_client_array *array,
@@ -172,6 +173,7 @@ unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array)
/**
* Examine the array's data for NaNs, etc.
+ * For debug purposes; not normally used.
*/
static void
check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType,
@@ -249,7 +251,7 @@ check_draw_arrays_data(GLcontext *ctx, GLint start, GLsizei count)
/**
- * Print info/data for glDrawArrays().
+ * Print info/data for glDrawArrays(), for debugging.
*/
static void
print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec,
@@ -295,6 +297,9 @@ print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec,
/**
+ * Bind the VBO executor to the current vertex array object prior
+ * to drawing.
+ *
* Just translate the arrayobj into a sane layout.
*/
static void
@@ -334,6 +339,14 @@ bind_array_obj(GLcontext *ctx)
}
+/**
+ * Set the vbo->exec->inputs[] pointers to point to the enabled
+ * vertex arrays. This depends on the current vertex program/shader
+ * being executed because of whether or not generic vertex arrays
+ * alias the conventional vertex arrays.
+ * For arrays that aren't enabled, we set the input[attrib] pointer
+ * to point at a zero-stride current value "array".
+ */
static void
recalculate_input_bindings(GLcontext *ctx)
{
@@ -453,27 +466,15 @@ recalculate_input_bindings(GLcontext *ctx)
static void
bind_arrays(GLcontext *ctx)
{
-#if 0
- if (ctx->Array.ArrayObj.Name != exec->array.array_obj) {
- bind_array_obj(ctx);
- recalculate_input_bindings(ctx);
- }
- else if (exec->array.program_mode != get_program_mode(ctx) ||
- exec->array.enabled_flags != ctx->Array.ArrayObj->_Enabled) {
- recalculate_input_bindings(ctx);
- }
-#else
bind_array_obj(ctx);
recalculate_input_bindings(ctx);
-#endif
}
-/***********************************************************************
- * API functions.
+/**
+ * Called from glDrawArrays when in immediate mode (not display list mode).
*/
-
static void GLAPIENTRY
vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
{
@@ -520,6 +521,7 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
prim[0].count = count;
prim[0].indexed = 0;
prim[0].basevertex = 0;
+ prim[0].num_instances = 1;
vbo->draw_prims( ctx, exec->array.inputs, prim, 1, NULL,
GL_TRUE, start, start + count - 1 );
@@ -533,7 +535,68 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
/**
+ * Called from glDrawArraysInstanced when in immediate mode (not
+ * display list mode).
+ */
+static void GLAPIENTRY
+vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
+ GLsizei primcount)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct vbo_exec_context *exec = &vbo->exec;
+ struct _mesa_prim prim[1];
+
+ if (MESA_VERBOSE & VERBOSE_DRAW)
+ _mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n",
+ _mesa_lookup_enum_by_nr(mode), start, count, primcount);
+
+ if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count, primcount))
+ return;
+
+ FLUSH_CURRENT( ctx, 0 );
+
+ if (!_mesa_valid_to_render(ctx, "glDrawArraysInstanced")) {
+ return;
+ }
+
+#if 0 /* debug */
+ check_draw_arrays_data(ctx, start, count);
+#endif
+
+ bind_arrays( ctx );
+
+ /* Again... because we may have changed the bitmask of per-vertex varying
+ * attributes. If we regenerate the fixed-function vertex program now
+ * we may be able to prune down the number of vertex attributes which we
+ * need in the shader.
+ */
+ if (ctx->NewState)
+ _mesa_update_state( ctx );
+
+ prim[0].begin = 1;
+ prim[0].end = 1;
+ prim[0].weak = 0;
+ prim[0].pad = 0;
+ prim[0].mode = mode;
+ prim[0].start = start;
+ prim[0].count = count;
+ prim[0].indexed = 0;
+ prim[0].basevertex = 0;
+ prim[0].num_instances = primcount;
+
+ vbo->draw_prims( ctx, exec->array.inputs, prim, 1, NULL,
+ GL_TRUE, start, start + count - 1 );
+
+#if 0 /* debug */
+ print_draw_arrays(ctx, exec, mode, start, count);
+#endif
+}
+
+
+/**
* Map GL_ELEMENT_ARRAY_BUFFER and print contents.
+ * For debugging.
*/
static void
dump_element_buffer(GLcontext *ctx, GLenum type)
@@ -588,14 +651,18 @@ dump_element_buffer(GLcontext *ctx, GLenum type)
}
-/* Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */
+/**
+ * Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements.
+ * Do the rendering for a glDrawElements or glDrawRangeElements call after
+ * we've validated buffer bounds, etc.
+ */
static void
vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode,
GLboolean index_bounds_valid,
GLuint start, GLuint end,
GLsizei count, GLenum type,
const GLvoid *indices,
- GLint basevertex)
+ GLint basevertex, GLint primcount)
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
@@ -628,6 +695,7 @@ vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode,
prim[0].count = count;
prim[0].indexed = 1;
prim[0].basevertex = basevertex;
+ prim[0].num_instances = primcount;
/* Need to give special consideration to rendering a range of
* indices starting somewhere above zero. Typically the
@@ -664,6 +732,10 @@ vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode,
index_bounds_valid, start, end );
}
+
+/**
+ * Called by glDrawRangeElementsBaseVertex() in immediate mode.
+ */
static void GLAPIENTRY
vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
GLuint start, GLuint end,
@@ -713,7 +785,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
start, end, count, type, indices,
ctx->Array.ArrayObj->_MaxElement - 1,
ctx->Array.ElementArrayBufferObj->Name,
- ctx->Array.ElementArrayBufferObj->Size);
+ (int) ctx->Array.ElementArrayBufferObj->Size);
}
if (0)
@@ -739,7 +811,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
start, end, count, type, indices, max,
ctx->Array.ArrayObj->_MaxElement - 1,
ctx->Array.ElementArrayBufferObj->Name,
- ctx->Array.ElementArrayBufferObj->Size);
+ (int) ctx->Array.ElementArrayBufferObj->Size);
}
}
/* XXX we could also find the min index and compare to 'start'
@@ -769,10 +841,13 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
#endif
vbo_validated_drawrangeelements(ctx, mode, GL_TRUE, start, end,
- count, type, indices, basevertex);
+ count, type, indices, basevertex, 1);
}
+/**
+ * Called by glDrawRangeElements() in immediate mode.
+ */
static void GLAPIENTRY
vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end,
GLsizei count, GLenum type, const GLvoid *indices)
@@ -790,6 +865,9 @@ vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end,
}
+/**
+ * Called by glDrawElements() in immediate mode.
+ */
static void GLAPIENTRY
vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices)
@@ -805,10 +883,13 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
return;
vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
- count, type, indices, 0);
+ count, type, indices, 0, 1);
}
+/**
+ * Called by glDrawElementsBaseVertex() in immediate mode.
+ */
static void GLAPIENTRY
vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
@@ -825,11 +906,38 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
return;
vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
- count, type, indices, basevertex);
+ count, type, indices, basevertex, 1);
+}
+
+
+/**
+ * Called by glDrawElementsInstanced() in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices, GLsizei primcount)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_DRAW)
+ _mesa_debug(ctx, "glDrawElementsInstanced(%s, %d, %s, %p, %d)\n",
+ _mesa_lookup_enum_by_nr(mode), count,
+ _mesa_lookup_enum_by_nr(type), indices, primcount);
+
+ if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
+ primcount))
+ return;
+
+ vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+ count, type, indices, 0, primcount);
}
-/** Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */
+/**
+ * Inner support for both _mesa_MultiDrawElements() and
+ * _mesa_MultiDrawRangeElements().
+ * This does the actual rendering after we've checked array indexes, etc.
+ */
static void
vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode,
const GLsizei *count, GLenum type,
@@ -861,7 +969,8 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode,
}
/* Decide if we can do this all as one set of primitives sharing the
- * same index buffer, or if we have to reset the index pointer per primitive.
+ * same index buffer, or if we have to reset the index pointer per
+ * primitive.
*/
bind_arrays( ctx );
@@ -926,6 +1035,7 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode,
prim[i].start = ((uintptr_t)indices[i] - min_index_ptr) / index_type_size;
prim[i].count = count[i];
prim[i].indexed = 1;
+ prim[i].num_instances = 1;
if (basevertex != NULL)
prim[i].basevertex = basevertex[i];
else
@@ -950,6 +1060,7 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode,
prim[0].start = 0;
prim[0].count = count[i];
prim[0].indexed = 1;
+ prim[0].num_instances = 1;
if (basevertex != NULL)
prim[0].basevertex = basevertex[i];
else
@@ -1009,14 +1120,13 @@ vbo_exec_MultiDrawElementsBaseVertex(GLenum mode,
}
-/***********************************************************************
- * Initialization
+/**
+ * Plug in the immediate-mode vertex array drawing commands into the
+ * givven vbo_exec_context object.
*/
-
void
vbo_exec_array_init( struct vbo_exec_context *exec )
{
-#if 1
exec->vtxfmt.DrawArrays = vbo_exec_DrawArrays;
exec->vtxfmt.DrawElements = vbo_exec_DrawElements;
exec->vtxfmt.DrawRangeElements = vbo_exec_DrawRangeElements;
@@ -1024,15 +1134,8 @@ vbo_exec_array_init( struct vbo_exec_context *exec )
exec->vtxfmt.DrawElementsBaseVertex = vbo_exec_DrawElementsBaseVertex;
exec->vtxfmt.DrawRangeElementsBaseVertex = vbo_exec_DrawRangeElementsBaseVertex;
exec->vtxfmt.MultiDrawElementsBaseVertex = vbo_exec_MultiDrawElementsBaseVertex;
-#else
- exec->vtxfmt.DrawArrays = _mesa_noop_DrawArrays;
- exec->vtxfmt.DrawElements = _mesa_noop_DrawElements;
- exec->vtxfmt.DrawRangeElements = _mesa_noop_DrawRangeElements;
- exec->vtxfmt.MultiDrawElementsEXT = _mesa_noop_MultiDrawElements;
- exec->vtxfmt.DrawElementsBaseVertex = _mesa_noop_DrawElementsBaseVertex;
- exec->vtxfmt.DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex;
- exec->vtxfmt.MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex;
-#endif
+ exec->vtxfmt.DrawArraysInstanced = vbo_exec_DrawArraysInstanced;
+ exec->vtxfmt.DrawElementsInstanced = vbo_exec_DrawElementsInstanced;
}
@@ -1043,7 +1146,13 @@ vbo_exec_array_destroy( struct vbo_exec_context *exec )
}
-/* This API entrypoint is not ordinarily used */
+
+/**
+ * The following functions are only used for OpenGL ES 1/2 support.
+ * And some aren't even supported (yet) in ES 1/2.
+ */
+
+
void GLAPIENTRY
_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count)
{
@@ -1051,7 +1160,6 @@ _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count)
}
-/* This API entrypoint is not ordinarily used */
void GLAPIENTRY
_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices)
@@ -1059,6 +1167,7 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
vbo_exec_DrawElements(mode, count, type, indices);
}
+
void GLAPIENTRY
_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
@@ -1067,7 +1176,6 @@ _mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
}
-/* This API entrypoint is not ordinarily used */
void GLAPIENTRY
_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
GLenum type, const GLvoid *indices)
@@ -1086,7 +1194,6 @@ _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
}
-/* GL_EXT_multi_draw_arrays */
void GLAPIENTRY
_mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type,
const GLvoid **indices, GLsizei primcount)
diff --git a/mesalib/src/mesa/vbo/vbo_exec_draw.c b/mesalib/src/mesa/vbo/vbo_exec_draw.c
index 045af46da..84ae1b87f 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_draw.c
@@ -27,7 +27,7 @@
#include "main/glheader.h"
#include "main/bufferobj.h"
-#include "main/context.h"
+#include "main/compiler.h"
#include "main/enums.h"
#include "main/state.h"
diff --git a/mesalib/src/mesa/vbo/vbo_save.c b/mesalib/src/mesa/vbo/vbo_save.c
index fd9a13027..dd5570689 100644
--- a/mesalib/src/mesa/vbo/vbo_save.c
+++ b/mesalib/src/mesa/vbo/vbo_save.c
@@ -33,6 +33,8 @@
#include "vbo_context.h"
+#if FEATURE_dlist
+
static void vbo_save_callback_init( GLcontext *ctx )
{
@@ -117,3 +119,4 @@ void vbo_save_fallback( GLcontext *ctx, GLboolean fallback )
}
+#endif /* FEATURE_dlist */
diff --git a/mesalib/src/mesa/vbo/vbo_save.h b/mesalib/src/mesa/vbo/vbo_save.h
index 86bbd24f7..82ba6c8af 100644
--- a/mesalib/src/mesa/vbo/vbo_save.h
+++ b/mesalib/src/mesa/vbo/vbo_save.h
@@ -153,6 +153,7 @@ struct vbo_save_context {
GLubyte *currentsz[VBO_ATTRIB_MAX];
};
+#if FEATURE_dlist
void vbo_save_init( GLcontext *ctx );
void vbo_save_destroy( GLcontext *ctx );
@@ -181,4 +182,18 @@ void vbo_save_playback_vertex_list( GLcontext *ctx, void *data );
void vbo_save_api_init( struct vbo_save_context *save );
-#endif
+#else /* FEATURE_dlist */
+
+static INLINE void
+vbo_save_init( GLcontext *ctx )
+{
+}
+
+static INLINE void
+vbo_save_destroy( GLcontext *ctx )
+{
+}
+
+#endif /* FEATURE_dlist */
+
+#endif /* VBO_SAVE_H */
diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c
index a5d027982..c3727cb52 100644
--- a/mesalib/src/mesa/vbo/vbo_save_api.c
+++ b/mesalib/src/mesa/vbo/vbo_save_api.c
@@ -83,6 +83,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "vbo_context.h"
+#if FEATURE_dlist
+
+
#ifdef ERROR
#undef ERROR
#endif
@@ -418,6 +421,7 @@ static void _save_wrap_buffers( GLcontext *ctx )
save->prim[0].pad = 0;
save->prim[0].start = 0;
save->prim[0].count = 0;
+ save->prim[0].num_instances = 1;
save->prim_count = 1;
}
@@ -773,6 +777,7 @@ GLboolean vbo_save_NotifyBegin( GLcontext *ctx, GLenum mode )
save->prim[i].pad = 0;
save->prim[i].start = save->vert_count;
save->prim[i].count = 0;
+ save->prim[i].num_instances = 1;
_mesa_install_save_vtxfmt( ctx, &save->vtxfmt );
ctx->Driver.SaveNeedFlush = 1;
@@ -1261,3 +1266,5 @@ void vbo_save_api_init( struct vbo_save_context *save )
_mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
}
+
+#endif /* FEATURE_dlist */
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index a7cf29acd..297fd8705 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -38,12 +38,16 @@
#include "vbo_context.h"
-/*
+#if FEATURE_dlist
+
+
+/**
* After playback, copy everything but the position from the
* last vertex to the saved state
*/
-static void _playback_copy_to_current( GLcontext *ctx,
- const struct vbo_save_vertex_list *node )
+static void
+_playback_copy_to_current(GLcontext *ctx,
+ const struct vbo_save_vertex_list *node)
{
struct vbo_context *vbo = vbo_context(ctx);
GLfloat vertex[VBO_ATTRIB_MAX * 4];
@@ -81,8 +85,7 @@ static void _playback_copy_to_current( GLcontext *ctx,
node->attrsz[i],
data);
- if (memcmp(current, tmp, 4 * sizeof(GLfloat)) != 0)
- {
+ if (memcmp(current, tmp, 4 * sizeof(GLfloat)) != 0) {
memcpy(current, tmp, 4 * sizeof(GLfloat));
vbo->currval[i].Size = node->attrsz[i];
@@ -117,11 +120,12 @@ static void _playback_copy_to_current( GLcontext *ctx,
-/* Treat the vertex storage as a VBO, define vertex arrays pointing
+/**
+ * Treat the vertex storage as a VBO, define vertex arrays pointing
* into it:
*/
-static void vbo_bind_vertex_list( GLcontext *ctx,
- const struct vbo_save_vertex_list *node )
+static void vbo_bind_vertex_list(GLcontext *ctx,
+ const struct vbo_save_vertex_list *node)
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_save_context *save = &vbo->save;
@@ -175,7 +179,7 @@ static void vbo_bind_vertex_list( GLcontext *ctx,
}
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
- GLuint src = map[attr];
+ const GLuint src = map[attr];
if (node_attrsz[src]) {
/* override the default array set above */
@@ -203,21 +207,23 @@ static void vbo_bind_vertex_list( GLcontext *ctx,
_mesa_set_varying_vp_inputs( ctx, varying_inputs );
}
-static void vbo_save_loopback_vertex_list( GLcontext *ctx,
- const struct vbo_save_vertex_list *list )
+
+static void
+vbo_save_loopback_vertex_list(GLcontext *ctx,
+ const struct vbo_save_vertex_list *list)
{
const char *buffer = ctx->Driver.MapBuffer(ctx,
GL_ARRAY_BUFFER_ARB,
GL_READ_ONLY, /* ? */
- list->vertex_store->bufferobj);
+ list->vertex_store->bufferobj);
- vbo_loopback_vertex_list( ctx,
- (const GLfloat *)(buffer + list->buffer_offset),
- list->attrsz,
- list->prim,
- list->prim_count,
- list->wrap_count,
- list->vertex_size);
+ vbo_loopback_vertex_list(ctx,
+ (const GLfloat *)(buffer + list->buffer_offset),
+ list->attrsz,
+ list->prim,
+ list->prim_count,
+ list->wrap_count,
+ list->vertex_size);
ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB,
list->vertex_store->bufferobj);
@@ -226,10 +232,14 @@ static void vbo_save_loopback_vertex_list( GLcontext *ctx,
/**
* Execute the buffer and save copied verts.
+ * This is called from the display list code when executing
+ * a drawing command.
*/
-void vbo_save_playback_vertex_list( GLcontext *ctx, void *data )
+void
+vbo_save_playback_vertex_list(GLcontext *ctx, void *data)
{
- const struct vbo_save_vertex_list *node = (const struct vbo_save_vertex_list *) data;
+ const struct vbo_save_vertex_list *node =
+ (const struct vbo_save_vertex_list *) data;
struct vbo_save_context *save = &vbo_context(ctx)->save;
FLUSH_CURRENT(ctx, 0);
@@ -274,17 +284,20 @@ void vbo_save_playback_vertex_list( GLcontext *ctx, void *data )
if (ctx->NewState)
_mesa_update_state( ctx );
- vbo_context(ctx)->draw_prims( ctx,
- save->inputs,
- node->prim,
- node->prim_count,
- NULL,
- GL_TRUE,
- 0, /* Node is a VBO, so this is ok */
- node->count - 1);
+ vbo_context(ctx)->draw_prims(ctx,
+ save->inputs,
+ node->prim,
+ node->prim_count,
+ NULL,
+ GL_TRUE,
+ 0, /* Node is a VBO, so this is ok */
+ node->count - 1);
}
/* Copy to current?
*/
_playback_copy_to_current( ctx, node );
}
+
+
+#endif /* FEATURE_dlist */
diff --git a/mesalib/src/mesa/vbo/vbo_save_loopback.c b/mesalib/src/mesa/vbo/vbo_save_loopback.c
index 3f581ea02..5d1c7e481 100644
--- a/mesalib/src/mesa/vbo/vbo_save_loopback.c
+++ b/mesalib/src/mesa/vbo/vbo_save_loopback.c
@@ -36,6 +36,8 @@
#include "vbo_context.h"
+#if FEATURE_dlist
+
typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * );
@@ -188,3 +190,6 @@ void vbo_loopback_vertex_list( GLcontext *ctx,
}
}
}
+
+
+#endif /* FEATURE_dlist */