129# define START_PROFILE \
131 GLdouble t0 = gl_time();
133# define END_PROFILE( TIMER, COUNTER, INCR ) \
134 TIMER += (gl_time() - t0); \
138# define START_PROFILE
139# define END_PROFILE( TIMER, COUNTER, INCR )
156 provoking_vertex =
v2;
166 if (
ctx->Transform.AnyClip) {
184 if (
VB->Clip[
v1][3] != 0.0F) {
186 ndc_x =
VB->Clip[
v1][0] * wInv;
187 ndc_y =
VB->Clip[
v1][1] * wInv;
188 ndc_z =
VB->Clip[
v1][2] * wInv;
192 ndc_x = ndc_y = ndc_z = 0.0F;
196 VB->Win[
v1][0] = ndc_x *
ctx->Viewport.Sx +
ctx->Viewport.Tx;
197 VB->Win[
v1][1] = ndc_y *
ctx->Viewport.Sy +
ctx->Viewport.Ty;
198 VB->Win[
v1][2] = ndc_z *
ctx->Viewport.Sz +
ctx->Viewport.Tz;
201 if (
VB->Clip[
v2][3] != 0.0F) {
203 ndc_x =
VB->Clip[
v2][0] * wInv;
204 ndc_y =
VB->Clip[
v2][1] * wInv;
205 ndc_z =
VB->Clip[
v2][2] * wInv;
209 ndc_x = ndc_y = ndc_z = 0.0F;
213 VB->Win[
v2][0] = ndc_x *
ctx->Viewport.Sx +
ctx->Viewport.Tx;
214 VB->Win[
v2][1] = ndc_y *
ctx->Viewport.Sy +
ctx->Viewport.Ty;
215 VB->Win[
v2][2] = ndc_z *
ctx->Viewport.Sz +
ctx->Viewport.Tz;
217 if (
ctx->Driver.RasterSetup) {
224 (*
ctx->Driver.LineFunc)(
ctx,
v1,
v2, provoking_vertex );
246 if (ac<0.0F) ac = -ac;
251 offset =
m *
ctx->Polygon.OffsetFactor +
ctx->Polygon.OffsetUnits;
254 ctx->PointZoffset =
ctx->Polygon.OffsetPoint ?
offset : 0.0F;
255 ctx->LineZoffset =
ctx->Polygon.OffsetLine ?
offset : 0.0F;
256 ctx->PolygonZoffset =
ctx->Polygon.OffsetFill ?
offset : 0.0F;
287 if (edge ||
VB->Edgeflag[
j]) {
288 (*
ctx->Driver.PointsFunc)(
ctx,
j,
j );
296 ctx->StippleCounter = 0;
309 j0 = (
i==0) ? vlist[
n-1] : vlist[
i-1];
311 if (edge ||
VB->Edgeflag[j0]) {
313 (*
ctx->Driver.LineFunc)(
ctx, j0, j1, pv );
324 (*
ctx->Driver.TriangleFunc)(
ctx, j0, vlist[
i-1], vlist[
i], pv );
382 if ((facing+1) &
ctx->Polygon.CullBits) {
386 if (
ctx->Polygon.OffsetAny) {
391 GLuint j3 = vlist[ (
n==3) ? 0 : 3 ];
404 if (
ctx->LightTwoSide) {
407 VB->Color =
VB->Bcolor;
408 VB->Index =
VB->Bindex;
412 VB->Color =
VB->Fcolor;
413 VB->Index =
VB->Findex;
418 if (
ctx->Polygon.Unfilled) {
427 (*
ctx->Driver.TriangleFunc)(
ctx, j0, vlist[
i-1], vlist[
i], pv );
459 if (
ctx->Transform.AnyClip) {
491 if (
VB->Clip[
i][3] != 0.0F) {
493 win[
i][0] =
VB->Clip[
i][0] * wInv * sx + tx;
494 win[
i][1] =
VB->Clip[
i][1] * wInv * sy +
ty;
495 win[
i][2] =
VB->Clip[
i][2] * wInv * sz +
tz;
502 if (
ctx->Driver.RasterSetup && (
VB->Free >
VB_MAX)) {
512 if (
VB->ClipMask[
j]) {
515 printf(
"CLIPMASK %d %d %02x\n",
i,
j,
VB->ClipMask[
j]);
517 VB->Eye[
j][2],
VB->Eye[
j][3]);
519 VB->Clip[
j][2],
VB->Clip[
j][3]);
542 if ((facing+1) &
ctx->Polygon.CullBits) {
546 if (
ctx->Polygon.OffsetAny) {
551 GLuint j3 = vlist[ (
n==3) ? 0 : 3 ];
564 if (
ctx->LightTwoSide) {
567 VB->Color =
VB->Bcolor;
568 VB->Index =
VB->Bindex;
572 VB->Color =
VB->Fcolor;
573 VB->Index =
VB->Findex;
578 if (
ctx->Polygon.Unfilled) {
587 (*
ctx->Driver.TriangleFunc)(
ctx, j0, vlist[
i-1], vlist[
i], pv );
621 facing = (
c<0.0F) ^ (
ctx->Polygon.FrontFace==
GL_CW);
623 if ((facing+1) &
ctx->Polygon.CullBits) {
627 if (
ctx->Polygon.OffsetAny) {
636 if (
ctx->LightTwoSide) {
639 VB->Color =
VB->Bcolor;
640 VB->Index =
VB->Bindex;
644 VB->Color =
VB->Fcolor;
645 VB->Index =
VB->Findex;
649 if (
ctx->Polygon.Unfilled) {
690 facing = (
c<0.0F) ^ (
ctx->Polygon.FrontFace==
GL_CW);
692 if ((facing+1) &
ctx->Polygon.CullBits) {
696 if (
ctx->Polygon.OffsetAny) {
705 if (
ctx->LightTwoSide) {
708 VB->Color =
VB->Bcolor;
709 VB->Index =
VB->Bindex;
713 VB->Color =
VB->Fcolor;
714 VB->Index =
VB->Findex;
719 if (
ctx->Polygon.Unfilled) {
779 switch (
ctx->Primitive) {
782 (*
ctx->Driver.PointsFunc)(
ctx, 0,
VB->Count-1 );
787 if (
VB->ClipOrMask) {
789 for (
i=1;
i<
VB->Count;
i+=2) {
790 if (
VB->ClipMask[
i-1] |
VB->ClipMask[
i]) {
795 (*
ctx->Driver.LineFunc)(
ctx,
i-1,
i,
i );
798 ctx->StippleCounter = 0;
803 for (
i=1;
i<
VB->Count;
i+=2) {
805 (*
ctx->Driver.LineFunc)(
ctx,
i-1,
i,
i );
807 ctx->StippleCounter = 0;
813 if (
VB->ClipOrMask) {
815 for (
i=1;
i<
VB->Count;
i++) {
816 if (
VB->ClipMask[
i-1] |
VB->ClipMask[
i]) {
821 (*
ctx->Driver.LineFunc)(
ctx,
i-1,
i,
i );
829 for (
i=1;
i<
VB->Count;
i++) {
831 (*
ctx->Driver.LineFunc)(
ctx,
i-1,
i,
i );
846 while (i<VB->
Count) {
847 if (
VB->ClipMask[
i-1] |
VB->ClipMask[
i]) {
852 (*
ctx->Driver.LineFunc)(
ctx,
i-1,
i,
i );
861 if (
VB->ClipOrMask) {
863 for (
i=2;
i<
VB->Count;
i+=3) {
864 if (
VB->ClipMask[
i-2] &
VB->ClipMask[
i-1]
869 else if (
VB->ClipMask[
i-2] |
VB->ClipMask[
i-1] |
VB->ClipMask[
i]) {
876 if (
ctx->DirectTriangles) {
878 (*
ctx->Driver.TriangleFunc)(
ctx,
i-2,
i-1,
i,
i );
890 if (
ctx->DirectTriangles) {
891 for (
i=2;
i<
VB->Count;
i+=3) {
893 (*
ctx->Driver.TriangleFunc)(
ctx,
i-2,
i-1,
i,
i );
898 for (
i=2;
i<
VB->Count;
i+=3) {
906 if (
VB->ClipOrMask) {
908 for (
i=2;
i<
VB->Count;
i++) {
909 if (
VB->ClipMask[
i-2] &
VB->ClipMask[
i-1]
914 else if (
VB->ClipMask[
i-2] |
VB->ClipMask[
i-1] |
VB->ClipMask[
i]) {
930 if (
ctx->DirectTriangles) {
932 (*
ctx->Driver.TriangleFunc)(
ctx,
i-2,
i-1,
i,
i );
947 if (
ctx->DirectTriangles) {
948 for (
i=2;
i<
VB->Count;
i++) {
950 (*
ctx->Driver.TriangleFunc)(
ctx,
i-2,
i-1,
i,
i );
955 for (
i=2;
i<
VB->Count;
i++) {
966 if (
VB->ClipOrMask) {
968 for (
i=2;
i<
VB->Count;
i++) {
969 if (
VB->ClipMask[0] &
VB->ClipMask[
i-1] &
VB->ClipMask[
i]
974 else if (
VB->ClipMask[0] |
VB->ClipMask[
i-1] |
VB->ClipMask[
i]) {
981 if (
ctx->DirectTriangles) {
983 (*
ctx->Driver.TriangleFunc)(
ctx, 0,
i-1,
i,
i );
995 if (
ctx->DirectTriangles) {
996 for (
i=2;
i<
VB->Count;
i++) {
998 (*
ctx->Driver.TriangleFunc)(
ctx, 0,
i-1,
i,
i );
1003 for (
i=2;
i<
VB->Count;
i++) {
1011 if (
VB->ClipOrMask) {
1013 for (
i=3;
i<
VB->Count;
i+=4) {
1014 if (
VB->ClipMask[
i-3] &
VB->ClipMask[
i-2]
1019 else if (
VB->ClipMask[
i-3] |
VB->ClipMask[
i-2]
1020 |
VB->ClipMask[
i-1] |
VB->ClipMask[
i]) {
1028 if (
ctx->DirectTriangles) {
1030 (*
ctx->Driver.QuadFunc)(
ctx,
i-3,
i-2,
i-1,
i,
i );
1042 if (
ctx->DirectTriangles) {
1043 for (
i=3;
i<
VB->Count;
i+=4) {
1045 (*
ctx->Driver.QuadFunc)(
ctx,
i-3,
i-2,
i-1,
i,
i );
1050 for (
i=3;
i<
VB->Count;
i+=4) {
1058 if (
VB->ClipOrMask) {
1060 for (
i=3;
i<
VB->Count;
i+=2) {
1061 if (
VB->ClipMask[
i-2] &
VB->ClipMask[
i-3]
1066 else if (
VB->ClipMask[
i-2] |
VB->ClipMask[
i-3]
1067 |
VB->ClipMask[
i-1] |
VB->ClipMask[
i]) {
1075 if (
ctx->DirectTriangles) {
1077 (*
ctx->Driver.QuadFunc)(
ctx,
i-3,
i-2,
i,
i-1,
i );
1089 if (
ctx->DirectTriangles) {
1090 for (
i=3;
i<
VB->Count;
i+=2) {
1092 (*
ctx->Driver.QuadFunc)(
ctx,
i-3,
i-2,
i,
i-1,
i );
1097 for (
i=3;
i<
VB->Count;
i+=2) {
1110 if (
VB->ClipOrMask) {
1113 for (
i=0;
i<
VB->Count;
i++) {
1144#define CLIP_ALL_BITS 0x3f
1160 int oldCount =
VB->Count;
1163 GLuint vertexSizeMask =
VB->VertexSizeMask;
1167 if (
VB->ClipMask[
VB->Count-1] |
VB->ClipMask[0]) {
1172 (*
ctx->Driver.LineFunc)(
ctx,
VB->Count-1, 0, 0 );
1179 VB->Start =
VB->Count = 0;
1186 if (
VB->TexCoordSize!=2) {
1189 VB->TexCoord[
i][2] = 0.0F;
1190 VB->TexCoord[
i][3] = 1.0F;
1193 if (
ctx->Current.TexCoord[2]==0.0F &&
ctx->Current.TexCoord[3]==1.0F) {
1194 VB->TexCoordSize = 2;
1197 VB->TexCoordSize = 4;
1204 switch (
ctx->Primitive) {
1207 VB->Start =
VB->Count = 0;
1215 VB->Start =
VB->Count = 0;
1223 VB->Start =
VB->Count = 1;
1224 VB->ClipOrMask =
VB->ClipMask[0];
1225 VB->ClipAndMask =
VB->ClipMask[0];
1231 VB->Start =
VB->Count = 2;
1232 VB->ClipOrMask =
VB->ClipMask[0] |
VB->ClipMask[1];
1233 VB->ClipAndMask =
VB->ClipMask[0] &
VB->ClipMask[1];
1234 VB->MonoMaterial = !(
VB->MaterialMask[0] |
VB->MaterialMask[1]);
1238 VB->Start =
VB->Count = 0;
1247 VB->Start =
VB->Count = 2;
1248 VB->ClipOrMask =
VB->ClipMask[0] |
VB->ClipMask[1];
1249 VB->ClipAndMask =
VB->ClipMask[0] &
VB->ClipMask[1];
1250 VB->MonoMaterial = !(
VB->MaterialMask[0] |
VB->MaterialMask[1]);
1254 VB->Start =
VB->Count = 2;
1255 VB->ClipOrMask =
VB->ClipMask[0] |
VB->ClipMask[1];
1256 VB->ClipAndMask =
VB->ClipMask[0] &
VB->ClipMask[1];
1257 VB->MonoMaterial = !(
VB->MaterialMask[0] |
VB->MaterialMask[1]);
1261 VB->Start =
VB->Count = 0;
1270 VB->Start =
VB->Count = 2;
1271 VB->ClipOrMask =
VB->ClipMask[0] |
VB->ClipMask[1];
1272 VB->ClipAndMask =
VB->ClipMask[0] &
VB->ClipMask[1];
1273 VB->MonoMaterial = !(
VB->MaterialMask[0] |
VB->MaterialMask[1]);
1277 VB->Start =
VB->Count = 2;
1278 VB->ClipOrMask =
VB->ClipMask[0] |
VB->ClipMask[1];
1279 VB->ClipAndMask =
VB->ClipMask[0] &
VB->ClipMask[1];
1280 VB->MonoMaterial = !(
VB->MaterialMask[0] |
VB->MaterialMask[1]);
1291 (oldCount -
VB->Start) *
sizeof(
VB->ClipMask[0]) );
1294 if (!monoMaterial) {
1297 (oldCount -
VB->Start) *
sizeof(
VB->MaterialMask[0]) );
1305 n = oldCount -
VB->Start;
1306 for (
i=0;
i<
n;
i++) {
GLuint gl_viewclip_polygon(GLcontext *ctx, GLuint n, GLuint vlist[])
GLuint gl_userclip_line(GLcontext *ctx, GLuint *i, GLuint *j)
GLuint gl_userclip_polygon(GLcontext *ctx, GLuint n, GLuint vlist[])
GLuint gl_viewclip_line(GLcontext *ctx, GLuint *i, GLuint *j)
void gl_problem(const GLcontext *ctx, const char *s)
#define GL_TRIANGLE_STRIP
GLboolean GLboolean GLboolean b
GLfloat GLfloat GLfloat GLfloat v3
GLboolean GLboolean GLboolean GLboolean a
GLfloat GLfloat GLfloat v2
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define MEMSET(DST, VAL, N)
#define COPY_3V(DST, SRC)
#define COPY_4V(DST, SRC)
void gl_update_lighting(GLcontext *ctx)
static Real area(Real A[2], Real B[2], Real C[2])
GLfloat TexCoord[VB_SIZE][4]
GLubyte Bcolor[VB_SIZE][4]
GLuint MaterialMask[VB_SIZE]
GLubyte Fcolor[VB_SIZE][4]
GLboolean Edgeflag[VB_SIZE]
struct gl_material Material[VB_SIZE][2]
GLubyte ClipMask[VB_SIZE]
struct vertex_buffer * VB
static void render_clipped_line(GLcontext *ctx, GLuint v1, GLuint v2)
static void render_polygon(GLcontext *ctx, GLuint n, GLuint vlist[])
static GLfloat polygon_area(const struct vertex_buffer *vb, GLuint n, const GLuint vlist[])
static void unfilled_polygon(GLcontext *ctx, GLuint n, GLuint vlist[], GLuint pv, GLuint facing)
void gl_render_vb(GLcontext *ctx, GLboolean allDone)
static void render_triangle(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
void gl_reset_vb(GLcontext *ctx, GLboolean allDone)
#define END_PROFILE(TIMER, COUNTER, INCR)
static void render_clipped_polygon(GLcontext *ctx, GLuint n, GLuint vlist[])
static void render_quad(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv)
static void copy_vertex(struct vertex_buffer *vb, GLuint dst, GLuint src)
static void offset_polygon(GLcontext *ctx, GLfloat a, GLfloat b, GLfloat c)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1