aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/vbo
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-07 11:56:06 +0100
committermarha <marha@users.sourceforge.net>2013-01-07 11:56:06 +0100
commit3f553aaceddc9b09363c73d9bea40eaea8164fc4 (patch)
treeb112d1ad761f8621106f8930daaf97fafed339fb /mesalib/src/mesa/vbo
parent293fd0043af7e861c9c540bebc44630d0da0bf9b (diff)
downloadvcxsrv-3f553aaceddc9b09363c73d9bea40eaea8164fc4.tar.gz
vcxsrv-3f553aaceddc9b09363c73d9bea40eaea8164fc4.tar.bz2
vcxsrv-3f553aaceddc9b09363c73d9bea40eaea8164fc4.zip
pixman xkbcomp libX11 libXau mesa fontconfig xserver xkeyboard-config git update 7 jan 2013
fontconfig: 17eda89ed2e24a3fc5f68538dd7fd9ada8efb087 xserver: bd91b05b631f13afd1f7a9d6cbc4f0c5408b523a xkeyboard-config: 4779e2745094ebe0c06364b4099d7067ae750d07 libX11: cd25cab4b5b957641183ce72dd1ae0424aff1663 libXau: e04364efccbb3bb4cfc5f4cb491ffa1faaaacbdb mesa: afec10df373f342f058aab66c622237964a4a147 pixman: 35cc965514ca6e665c18411fcf66db826d559c2a xkbcomp: e4f767913338052527538d429931e8abd8c3fb88
Diffstat (limited to 'mesalib/src/mesa/vbo')
-rw-r--r--mesalib/src/mesa/vbo/vbo.h3
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.c34
2 files changed, 21 insertions, 16 deletions
diff --git a/mesalib/src/mesa/vbo/vbo.h b/mesalib/src/mesa/vbo/vbo.h
index 04930b971..49dab2314 100644
--- a/mesalib/src/mesa/vbo/vbo.h
+++ b/mesalib/src/mesa/vbo/vbo.h
@@ -156,7 +156,8 @@ void vbo_check_buffers_are_unmapped(struct gl_context *ctx);
void vbo_bind_arrays(struct gl_context *ctx);
size_t
-vbo_count_tessellated_primitives(const struct _mesa_prim *prim);
+vbo_count_tessellated_primitives(GLenum mode, GLuint count,
+ GLuint num_instances);
void
vbo_sw_primitive_restart(struct gl_context *ctx,
diff --git a/mesalib/src/mesa/vbo/vbo_exec.c b/mesalib/src/mesa/vbo/vbo_exec.c
index 361d7a3e4..5827f90c3 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.c
+++ b/mesalib/src/mesa/vbo/vbo_exec.c
@@ -94,47 +94,51 @@ void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state )
/**
* Figure out the number of transform feedback primitives that will be output
- * by the given _mesa_prim command, assuming that no geometry shading is done
- * and primitive restart is not used.
+ * considering the drawing mode, number of vertices, and instance count,
+ * assuming that no geometry shading is done and primitive restart is not
+ * used.
*
- * This is intended for use by driver back-ends in implementing the
- * PRIMITIVES_GENERATED and TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN queries.
+ * This is used by driver back-ends in implementing the PRIMITIVES_GENERATED
+ * and TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN queries. It is also used to
+ * pre-validate draw calls in GLES3 (where draw calls only succeed if there is
+ * enough room in the transform feedback buffer for the result).
*/
size_t
-vbo_count_tessellated_primitives(const struct _mesa_prim *prim)
+vbo_count_tessellated_primitives(GLenum mode, GLuint count,
+ GLuint num_instances)
{
size_t num_primitives;
- switch (prim->mode) {
+ switch (mode) {
case GL_POINTS:
- num_primitives = prim->count;
+ num_primitives = count;
break;
case GL_LINE_STRIP:
- num_primitives = prim->count >= 2 ? prim->count - 1 : 0;
+ num_primitives = count >= 2 ? count - 1 : 0;
break;
case GL_LINE_LOOP:
- num_primitives = prim->count >= 2 ? prim->count : 0;
+ num_primitives = count >= 2 ? count : 0;
break;
case GL_LINES:
- num_primitives = prim->count / 2;
+ num_primitives = count / 2;
break;
case GL_TRIANGLE_STRIP:
case GL_TRIANGLE_FAN:
case GL_POLYGON:
- num_primitives = prim->count >= 3 ? prim->count - 2 : 0;
+ num_primitives = count >= 3 ? count - 2 : 0;
break;
case GL_TRIANGLES:
- num_primitives = prim->count / 3;
+ num_primitives = count / 3;
break;
case GL_QUAD_STRIP:
- num_primitives = prim->count >= 4 ? ((prim->count / 2) - 1) * 2 : 0;
+ num_primitives = count >= 4 ? ((count / 2) - 1) * 2 : 0;
break;
case GL_QUADS:
- num_primitives = (prim->count / 4) * 2;
+ num_primitives = (count / 4) * 2;
break;
default:
assert(!"Unexpected primitive type in count_tessellated_primitives");
num_primitives = 0;
break;
}
- return num_primitives * prim->num_instances;
+ return num_primitives * num_instances;
}