1 #ifndef __NOUVEAU_UTIL_H__
2 #define __NOUVEAU_UTIL_H__
4 /* Determine how many vertices can be pushed into the command stream.
5 * Where the remaining space isn't large enough to represent all verices,
6 * split the buffer at primitive boundaries.
8 * Returns a count of vertices that can be rendered, and an index to
9 * restart drawing at after a flush.
11 static INLINE
unsigned
12 nouveau_vbuf_split(unsigned remaining
, unsigned overhead
, unsigned vpp
,
13 unsigned mode
, unsigned start
, unsigned count
,
18 max
= remaining
- overhead
;
27 case PIPE_PRIM_POINTS
:
32 case PIPE_PRIM_TRIANGLES
:
33 max
= max
- (max
% 3);
38 case PIPE_PRIM_LINE_LOOP
:
39 case PIPE_PRIM_LINE_STRIP
:
44 case PIPE_PRIM_POLYGON
:
45 case PIPE_PRIM_TRIANGLE_STRIP
:
46 case PIPE_PRIM_TRIANGLE_FAN
:
51 case PIPE_PRIM_QUAD_STRIP
:
60 *restart
= start
+ max
- adj
;
64 /* Integer base-2 logarithm, rounded towards zero. */
65 static INLINE
unsigned log2i(unsigned i
)