aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/vbo/vbo_exec.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-07 12:17:07 +0100
committermarha <marha@users.sourceforge.net>2013-01-07 12:17:07 +0100
commit0e950715b62dcf30ffbf69831bf932fd348537e5 (patch)
tree83fdafc455e9906f029e2e1ad926fb35c98e7be9 /mesalib/src/mesa/vbo/vbo_exec.c
parent506537495e6d808f219361a5b270510c752e7a2e (diff)
parent3f553aaceddc9b09363c73d9bea40eaea8164fc4 (diff)
downloadvcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.tar.gz
vcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.tar.bz2
vcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.zip
Merge remote-tracking branch 'origin/released'
* origin/released: pixman xkbcomp libX11 libXau mesa fontconfig xserver xkeyboard-config git update 7 jan 2013 Conflicts: fontconfig/src/fcatomic.c pixman/pixman/pixman-mmx.c pixman/pixman/pixman-sse2.c xorg-server/dix/dispatch.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/xfixes/cursor.c
Diffstat (limited to 'mesalib/src/mesa/vbo/vbo_exec.c')
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.c34
1 files changed, 19 insertions, 15 deletions
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;
}