diff options
author | marha <marha@users.sourceforge.net> | 2014-08-11 21:22:25 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-08-11 21:22:25 +0200 |
commit | 8e27619ab489dece35cc4bec86950ee7729cd309 (patch) | |
tree | ab59dbc661e00c12ed4777cf9d0d37393c4163aa /mesalib/src/gallium/auxiliary/util/u_prim.h | |
parent | ffc99ce2402fe5c9a6eb8fcf193e8e9472fd993b (diff) | |
parent | fdbedba4d50e1b28b0249c83ba11c029f096e400 (diff) | |
download | vcxsrv-8e27619ab489dece35cc4bec86950ee7729cd309.tar.gz vcxsrv-8e27619ab489dece35cc4bec86950ee7729cd309.tar.bz2 vcxsrv-8e27619ab489dece35cc4bec86950ee7729cd309.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
libxcb/src/c_client.py
mesalib/include/GL/glext.h
mesalib/include/GL/glxext.h
mesalib/src/glsl/.gitignore
mesalib/src/mesa/drivers/dri/common/xmlconfig.h
mesalib/src/mesa/main/.gitignore
xorg-server/Xext/xvmain.c
xorg-server/dix/dispatch.c
xorg-server/hw/xfree86/common/compiler.h
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_prim.h')
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_prim.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_prim.h b/mesalib/src/gallium/auxiliary/util/u_prim.h index fd95c0ba0..cf1a18f42 100644 --- a/mesalib/src/gallium/auxiliary/util/u_prim.h +++ b/mesalib/src/gallium/auxiliary/util/u_prim.h @@ -136,6 +136,21 @@ u_prim_vertex_count(unsigned prim) return (likely(prim < PIPE_PRIM_MAX)) ? &prim_table[prim] : NULL; } +/** + * Given a vertex count, return the number of primitives. + * For polygons, return the number of triangles. + */ +static INLINE unsigned +u_prims_for_vertices(unsigned prim, unsigned num) +{ + const struct u_prim_vertex_count *info = u_prim_vertex_count(prim); + + if (num < info->min) + return 0; + + return 1 + ((num - info->min) / info->incr); +} + static INLINE boolean u_validate_pipe_prim( unsigned pipe_prim, unsigned nr ) { const struct u_prim_vertex_count *count = u_prim_vertex_count(pipe_prim); |