u_prim.h File Reference

Include dependency graph for u_prim.h:

Go to the source code of this file.

Functions

static boolean u_validate_pipe_prim (unsigned pipe_prim, unsigned nr)
static boolean u_trim_pipe_prim (unsigned pipe_prim, unsigned *nr)


Function Documentation

static boolean u_trim_pipe_prim ( unsigned  pipe_prim,
unsigned *  nr 
) [static]

Definition at line 77 of file u_prim.h.

References PIPE_PRIM_LINE_LOOP, PIPE_PRIM_LINE_STRIP, PIPE_PRIM_LINES, PIPE_PRIM_POINTS, PIPE_PRIM_POLYGON, PIPE_PRIM_QUAD_STRIP, PIPE_PRIM_QUADS, PIPE_PRIM_TRIANGLE_FAN, PIPE_PRIM_TRIANGLE_STRIP, PIPE_PRIM_TRIANGLES, and TRUE.

00078 {
00079    boolean ok = TRUE;
00080 
00081    switch (pipe_prim) {
00082    case PIPE_PRIM_POINTS:
00083       ok = (*nr >= 1);
00084       break;
00085    case PIPE_PRIM_LINES:
00086       ok = (*nr >= 2);
00087       *nr -= (*nr % 2);
00088       break;
00089    case PIPE_PRIM_LINE_STRIP:
00090    case PIPE_PRIM_LINE_LOOP:
00091       ok = (*nr >= 2);
00092       break;
00093    case PIPE_PRIM_TRIANGLES:
00094       ok = (*nr >= 3);
00095       *nr -= (*nr % 3);
00096       break;
00097    case PIPE_PRIM_TRIANGLE_STRIP:
00098    case PIPE_PRIM_TRIANGLE_FAN:
00099    case PIPE_PRIM_POLYGON:
00100       ok = (*nr >= 3);
00101       break;
00102    case PIPE_PRIM_QUADS:
00103       ok = (*nr >= 4);
00104       *nr -= (*nr % 4);
00105       break;
00106    case PIPE_PRIM_QUAD_STRIP:
00107       ok = (*nr >= 4);
00108       *nr -= (*nr % 2);
00109       break;
00110    default:
00111       ok = 0;
00112       break;
00113    }
00114 
00115    if (!ok)
00116       *nr = 0;
00117 
00118    return ok;
00119 }

static boolean u_validate_pipe_prim ( unsigned  pipe_prim,
unsigned  nr 
) [static]

Definition at line 39 of file u_prim.h.

References PIPE_PRIM_LINE_LOOP, PIPE_PRIM_LINE_STRIP, PIPE_PRIM_LINES, PIPE_PRIM_POINTS, PIPE_PRIM_POLYGON, PIPE_PRIM_QUAD_STRIP, PIPE_PRIM_QUADS, PIPE_PRIM_TRIANGLE_FAN, PIPE_PRIM_TRIANGLE_STRIP, PIPE_PRIM_TRIANGLES, and TRUE.

00040 {
00041    boolean ok = TRUE;
00042 
00043    switch (pipe_prim) {
00044    case PIPE_PRIM_POINTS:
00045       ok = (nr >= 1);
00046       break;
00047    case PIPE_PRIM_LINES:
00048       ok = (nr >= 2);
00049       break;
00050    case PIPE_PRIM_LINE_STRIP:
00051    case PIPE_PRIM_LINE_LOOP:
00052       ok = (nr >= 2);
00053       break;
00054    case PIPE_PRIM_TRIANGLES:
00055       ok = (nr >= 3);
00056       break;
00057    case PIPE_PRIM_TRIANGLE_STRIP:
00058    case PIPE_PRIM_TRIANGLE_FAN:
00059    case PIPE_PRIM_POLYGON:
00060       ok = (nr >= 3);
00061       break;
00062    case PIPE_PRIM_QUADS:
00063       ok = (nr >= 4);
00064       break;
00065    case PIPE_PRIM_QUAD_STRIP:
00066       ok = (nr >= 4);
00067       break;
00068    default:
00069       ok = 0;
00070       break;
00071    }
00072 
00073    return ok;
00074 }


Generated on Tue Sep 29 06:25:29 2009 for Gallium3D by  doxygen 1.5.4