ref: 5b98f618678c287e4c66e29bbb41694b4a6659db
parent: d1a3af46aec4aa092151fb978f4c20d3fff5e644
author: David <gek@katherine>
date: Tue Feb 23 10:37:25 EST 2021
Minor perf boost by disabling GL_POLYGON
--- a/SDL_Examples/gears.c
+++ b/SDL_Examples/gears.c
@@ -197,7 +197,7 @@
glPushMatrix();
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
- // glRotatef( view_rotz, 0.0, 0.0, 1.0 );
+ //glRotatef( view_rotz, 0.0, 0.0, 1.0 );
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
@@ -273,15 +273,6 @@
// glEnable( GL_NORMALIZE );
}
-static inline GLfloat TEST_fastInvSqrt(float x){
- GLint i; GLfloat y;
- memcpy(&i, &x, 4);
- i = 0x5f3759df - (i>>1);
- //y = (union{GLint l; GLfloat f; }){i}.f;
- memcpy(&y, &i, 4);
- return y * (1.5F - 0.5F * x * y * y);
-}
-
int main(int argc, char** argv) {
// initialize SDL video:
int winSizeX = 640;
@@ -371,7 +362,7 @@
// initialize TinyGL:
// unsigned int pitch;
- int mode;
+ //int mode;
if(!noSDL)
switch (screen->format->BitsPerPixel) {
case 8:
@@ -381,18 +372,18 @@
case 16:
// pitch = screen->pitch;
// fprintf(stderr,"\nUnsupported by maintainer!!!");
- mode = ZB_MODE_5R6G5B;
+ //mode = ZB_MODE_5R6G5B;
// return 1;
break;
case 24:
// pitch = ( screen->pitch * 2 ) / 3;
fprintf(stderr, "\nUnsupported by maintainer!!!");
- mode = ZB_MODE_RGB24;
+ //mode = ZB_MODE_RGB24;
return 1;
break;
case 32:
// pitch = screen->pitch / 2;
- mode = ZB_MODE_RGBA;
+ //mode = ZB_MODE_RGBA;
break;
default:
return 1;
--- a/config.mk
+++ b/config.mk
@@ -2,8 +2,9 @@
# C compiler
CC= gcc
-#CFLAGS= -Wall -O3 -g -std=c99 -mtune=native -DNDEBUG
-CFLAGS= -Wall -O3 -g -std=c99 -march=native -DNDEBUG
+#CFLAGS= -Wall -w -O3 -g -std=c99 -mtune=native -DNDEBUG
+#CFLAGS= -Wall -w -O3 -g -std=c99 -march=native -DNDEBUG
+CFLAGS= -Wall -w -O3 -g -std=c99 -DNDEBUG
#CFLAGS= -Wall -O1 -g -std=c99 -Wno-undef -DNDEBUG
LFLAGS=
--- a/include/zbuffer.h
+++ b/include/zbuffer.h
@@ -36,7 +36,7 @@
#define COLOR_MULT_MASK (0xff0000)
#define COLOR_CORRECTED_MULT_MASK (0xfe0000)
#define COLOR_MASK (0xffffff)
-#define COLOR_MIN_MULT (COLOR_MASK & ~COLOR_MULT_MASK)
+#define COLOR_MIN_MULT (0x00ffff)
#define COLOR_SHIFT 16
#define COLOR_R_GET32(r) ((r) & 0xff0000)
@@ -82,13 +82,13 @@
/* 32 bit mode */
-#define GET_REDDER(p) ((p & COLOR_MULT_MASK))
+#define GET_REDDER(p) ((p & 0xff0000))
#define GET_GREENER(p) ((p & 0xff00)<<8)
#define GET_BLUEER(p) ((p & 0xff)<<16)
-//These never change, DO NOT CHANGE THESE!!!
-#define GET_RED(p) ((p & 0xff0000)>>16)
-#define GET_GREEN(p) ((p & 0xff00)>>8)
-#define GET_BLUE(p) (p & 0xff)
+//These never change, DO NOT CHANGE THESE BASED ON COLOR INTERP BIT DEPTH
+#define GET_RED(p) ((p>>16)&0xff)
+#define GET_GREEN(p) ((p>>8)&0xff)
+#define GET_BLUE(p) (p&0xff)
typedef GLuint PIXEL;
#define PSZB 4
#define PSZSH 5
@@ -111,9 +111,7 @@
#else
-
-#error "wrong TGL_FEATURE_RENDER_BITS buddy"
-
+#error "wrong TGL_FEATURE_RENDER_BITS"
#endif
#if TGL_FEATURE_LIT_TEXTURES == 1
--- a/include/zfeatures.h
+++ b/include/zfeatures.h
@@ -27,6 +27,11 @@
#define TGL_FEATURE_POLYGON_OFFSET 1
//Enable the patternized "discard"-ing of pixels.
#define TGL_FEATURE_POLYGON_STIPPLE 0
+//Enable the rendering of arbitrarily large polygons (they are rendered as triangles)- it slows down glopVertex and glopBegin.
+//It also enables the rendering of line loops of arbitrary size- without it,
+//line loops beyond a certain size will cause a crash.
+//so don't enable it if you don't need it.
+#define TGL_FEATURE_GL_POLYGON 0
//Enable GL_BLEND functionality
#define TGL_FEATURE_BLEND 1
//The width of textures as a power of 2. The default is 8, or 256x256 textures.
--- a/src/api.c
+++ b/src/api.c
@@ -222,10 +222,28 @@
void glBegin(GLint mode) {
GLParam p[2];
+#define NEED_CONTEXT
#include "error_check_no_context.h"
p[0].op = OP_Begin;
p[1].i = mode;
-
+#if TGL_FEATURE_ERROR_CHECK ==1
+//Check for compatibility of selection
+if(mode != GL_POINTS &&
+mode != GL_LINES &&
+mode != GL_LINE_LOOP &&
+mode != GL_LINE_STRIP &&
+#if TGL_FEATURE_GL_POLYGON == 1
+mode != GL_POLYGON &&
+#endif
+mode != GL_TRIANGLES &&
+mode != GL_TRIANGLE_FAN &&
+mode != GL_TRIANGLE_STRIP &&
+mode != GL_QUADS &&
+mode != GL_QUAD_STRIP
+)
+#define ERROR_FLAG GL_INVALID_ENUM
+#include "error_check.h"
+#endif
gl_add_op(p);
}
--- a/src/get.c
+++ b/src/get.c
@@ -93,8 +93,9 @@
#if TGL_FEATURE_POLYGON_STIPPLE == 1
"TGL_FEATURE_POLYGON_STIPPLE "
#endif
-
-
+#if TGL_FEATURE_GL_POLYGON == 1
+"TGL_FEATURE_GL_POLYGON "
+#endif
#if TGL_FEATURE_NO_COPY_COLOR == 1
"TGL_FEATURE_NO_COPY_COLOR "
#endif
--- a/src/list.c
+++ b/src/list.c
@@ -20,10 +20,10 @@
#include "opinfo.h"
};
-GLContext* gl_get_context(void) { return gl_ctx; }
-static GLList* find_list(GLContext* c, GLuint list) { return c->shared_state.lists[list]; }
+static inline GLList* find_list(GLContext* c, GLuint list) { return c->shared_state.lists[list]; }
+
static void delete_list(GLContext* c, GLint list) {
GLParamBuffer *pb, *pb1;
GLList* l;
@@ -30,7 +30,7 @@
l = find_list(c, list);
if (l == NULL) {
- tgl_warning("\nAttempted to delete NULL list!!!!\n");
+ //tgl_warning("\nAttempted to delete NULL list!!!!\n");
return;
}
//assert(l != NULL);
@@ -167,25 +167,6 @@
}
c->current_op_buffer_index = index;
}
-/*
-void gl_add_op(GLParam* p) {
- GLContext* c = gl_get_context();
-#include "error_check.h"
- GLint op;
- op = p[0].op;
- if (c->exec_flag) {
- op_table_func[op](c, p);
-#include "error_check.h"
- }
- if (c->compile_flag) {
- gl_compile_op(c, p);
-#include "error_check.h"
- }
- if (c->print_flag) {
- // gl_print_op(stderr, p);
- }
-}
-*/
/* this opcode is never called directly */
void glopEndList(GLContext* c, GLParam* p) { assert(0); }
@@ -194,7 +175,7 @@
void glopCallList(GLContext* c, GLParam* p) {
GLList* l;
- GLint list, op;
+ GLint list;
#include "error_check.h"
list = p[1].ui;
l = find_list(c, list);
@@ -208,7 +189,7 @@
while (1) {
#include "error_check.h"
- op = p[0].op;
+ GLint op = p[0].op;
if (op == OP_EndList)
break;
if (op == OP_NextBuffer) {
--- a/src/vertex.c
+++ b/src/vertex.c
@@ -133,10 +133,10 @@
}
}
}
-
+/*
static inline void gl_transform_to_viewport_vertex_c(GLContext* c, GLVertex* v) {
- /* coordinates */
+
{
GLfloat winv = 1.0 / v->pc.W;
v->zp.x = (GLint)(v->pc.X * winv * c->viewport.scale.X + c->viewport.trans.X);
@@ -143,12 +143,12 @@
v->zp.y = (GLint)(v->pc.Y * winv * c->viewport.scale.Y + c->viewport.trans.Y);
v->zp.z = (GLint)(v->pc.Z * winv * c->viewport.scale.Z + c->viewport.trans.Z);
}
- /* color */
+
v->zp.r = (GLuint)(v->color.v[0] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
v->zp.g = (GLuint)(v->color.v[1] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
v->zp.b = (GLuint)(v->color.v[2] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
- /* texture */
+
if (c->texture_2d_enabled) {
v->zp.s = (GLint)(v->tex_coord.X * (ZB_POINT_S_MAX - ZB_POINT_S_MIN) + ZB_POINT_S_MIN); //MARKED
@@ -155,10 +155,7 @@
v->zp.t = (GLint)(v->tex_coord.Y * (ZB_POINT_T_MAX - ZB_POINT_T_MIN) + ZB_POINT_T_MIN); //MARKED
}
}
-
-
-/* coords, tranformation , clip code and projection */
-/* TODO : handle all cases */
+*/
static inline void gl_vertex_transform(GLContext* c, GLVertex* v) {
GLfloat* m;
@@ -225,6 +222,7 @@
c->vertex_cnt = cnt;
/* quick fix to avoid crashes on large polygons */
+#if TGL_FEATURE_GL_POLYGON == 1
if (n >= c->vertex_max) {
GLVertex* newarray;
c->vertex_max <<= 1; /* just double size */
@@ -233,14 +231,14 @@
if (!newarray)
#define ERROR_FLAG GL_OUT_OF_MEMORY
#include "error_check.h"
-
#else
- assert(0);
+ if (!newarray) exit(1);
#endif
memcpy(newarray, c->vertex, n * sizeof(GLVertex));
gl_free(c->vertex);
c->vertex = newarray;
}
+#endif
/* new vertex entry */
v = &c->vertex[n];
n++;
@@ -276,89 +274,102 @@
}
/* precompute the mapping to the viewport */
if (v->clip_code == 0)
- gl_transform_to_viewport_vertex_c(c, v);
+ gl_transform_to_viewport_clip_c(c, v);
/* edge flag */
-
v->edge_flag = c->current_edge_flag;
switch (c->begin_type) {
- case GL_POINTS:
- gl_draw_point(c, &c->vertex[0]);
- n = 0;
- break;
-
- case GL_LINES:
- if (n == 2) {
- gl_draw_line(c, &c->vertex[0], &c->vertex[1]);
+ case GL_POINTS:
+ gl_draw_point(c, &c->vertex[0]);
n = 0;
- }
- break;
- case GL_LINE_STRIP:
- case GL_LINE_LOOP:
- if (n == 1) {
- c->vertex[2] = c->vertex[0];
- } else if (n == 2) {
- gl_draw_line(c, &c->vertex[0], &c->vertex[1]);
- c->vertex[0] = c->vertex[1];
- n = 1;
- }
- break;
+ break;
- case GL_TRIANGLES:
- if (n == 3) {
- gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]);
- n = 0;
- }
- break;
- case GL_TRIANGLE_STRIP:
- if (cnt >= 3) {
- if (n == 3)
+ case GL_LINES:
+ if (n == 2) {
+ gl_draw_line(c, &c->vertex[0], &c->vertex[1]);
n = 0;
- /* needed to respect triangle orientation */
- switch (cnt & 1) {
- case 0:
- gl_draw_triangle(c, &c->vertex[2], &c->vertex[1], &c->vertex[0]);
- break;
- default:
- case 1:
+ }
+ break;
+ case GL_LINE_STRIP:
+ case GL_LINE_LOOP:
+ switch(n){
+ case 1:
+ {
+ c->vertex[2] = c->vertex[0];
+ }
+ break;
+ case 2:
+ {
+ gl_draw_line(c, &c->vertex[0], &c->vertex[1]);
+ c->vertex[0] = c->vertex[1];
+ n = 1;
+ }
+ break;
+ default:
+ break;
+ };
+ break;
+ case GL_TRIANGLES:
+ if (n == 3) {
gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]);
- break;
+ n = 0;
}
- }
- break;
- case GL_TRIANGLE_FAN:
- if (n == 3) {
- gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]);
- c->vertex[1] = c->vertex[2];
- n = 2;
- }
- break;
+ break;
+ case GL_TRIANGLE_STRIP:
+ if (cnt >= 3) {
+ if (n == 3)
+ n = 0;
+ /* needed to respect triangle orientation */
+ switch (cnt & 1) {
+ case 0:
+ gl_draw_triangle(c, &c->vertex[2], &c->vertex[1], &c->vertex[0]);
+ break;
+ default:
+ case 1:
+ gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]);
+ break;
+ }
+ }
+ break;
+ case GL_TRIANGLE_FAN:
+ if (n == 3) {
+ gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]);
+ c->vertex[1] = c->vertex[2];
+ n = 2;
+ }
+ break;
- case GL_QUADS:
- if (n == 4) {
- c->vertex[2].edge_flag = 0;
- gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]);
- c->vertex[2].edge_flag = 1;
- c->vertex[0].edge_flag = 0;
- gl_draw_triangle(c, &c->vertex[0], &c->vertex[2], &c->vertex[3]);
- n = 0;
- }
- break;
+ case GL_QUADS:
+ if (n == 4) {
+ c->vertex[2].edge_flag = 0;
+ gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]);
+ c->vertex[2].edge_flag = 1;
+ c->vertex[0].edge_flag = 0;
+ gl_draw_triangle(c, &c->vertex[0], &c->vertex[2], &c->vertex[3]);
+ n = 0;
+ }
+ break;
- case GL_QUAD_STRIP:
- if (n == 4) {
- gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]);
- gl_draw_triangle(c, &c->vertex[1], &c->vertex[3], &c->vertex[2]);
- for (i = 0; i < 2; i++)
- c->vertex[i] = c->vertex[i + 2];
- n = 2;
- }
- break;
- case GL_POLYGON:
- break;
- default:
- gl_fatal_error("glBegin: type %x not handled\n", c->begin_type);
+ case GL_QUAD_STRIP:
+ if (n == 4) {
+ gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]);
+ gl_draw_triangle(c, &c->vertex[1], &c->vertex[3], &c->vertex[2]);
+ for (i = 0; i < 2; i++)
+ c->vertex[i] = c->vertex[i + 2];
+ n = 2;
+ }
+ break;
+
+#if TGL_FEATURE_GL_POLYGON == 1
+ case GL_POLYGON:break;
+#endif
+#if TGL_FEATURE_ERROR_CHECK == 1
+ default:
+ gl_fatal_error("glBegin: type %x not handled\n", c->begin_type);
+#else
+ default:break;
+#endif
}
c->vertex_n = n;
@@ -373,11 +384,15 @@
//assert(c->in_begin == 1);
//Assume it went alright.
#endif
+//#if TGL_FEATURE_GL_POLYGON == 1
if (c->begin_type == GL_LINE_LOOP) {
if (c->vertex_cnt >= 3) {
gl_draw_line(c, &c->vertex[0], &c->vertex[2]);
}
- } else if (c->begin_type == GL_POLYGON) {
+ }
+//#endif
+#if TGL_FEATURE_GL_POLYGON == 1
+ else if (c->begin_type == GL_POLYGON) {
GLint i = c->vertex_cnt;
while (i >= 3) {
i--;
@@ -384,5 +399,6 @@
gl_draw_triangle(c, &c->vertex[i], &c->vertex[0], &c->vertex[i - 1]);
}
}
+#endif
c->in_begin = 0;
}
--- a/src/zgl.h
+++ b/src/zgl.h
@@ -25,9 +25,14 @@
};
/* initially # of allocated GLVertexes (will grow when necessary) */
-/* Just large enough to hold a quad... because most users will never render anything larger. */
+//
+#if TGL_FEATURE_GL_POLYGON == 1
+//Large enough for your nice juicy GL_POLYGONs
+#define POLYGON_MAX_VERTEX 16
+#else
+//Just large enough for a quad!
#define POLYGON_MAX_VERTEX 4
-
+#endif
/* Max # of specular light pow buffers */
#define MAX_SPECULAR_BUFFERS 32
//#define MAX_SPECULAR_BUFFERS 16
@@ -323,12 +328,12 @@
} GLContext;
extern GLContext* gl_ctx;
-
+static inline GLContext* gl_get_context(void) { return gl_ctx; }
//void gl_add_op(GLParam* p);
extern void (*op_table_func[])(GLContext*, GLParam*);
extern GLint op_table_size[];
extern void gl_compile_op(GLContext* c, GLParam* p);
-inline void gl_add_op(GLParam* p) {
+static inline void gl_add_op(GLParam* p) {
GLContext* c = gl_ctx;
#include "error_check.h"
GLint op;
@@ -341,9 +346,9 @@
gl_compile_op(c, p);
#include "error_check.h"
}
- if (c->print_flag) {
+ //if (c->print_flag) {
// gl_print_op(stderr, p);
- }
+ //}
}
/* select.c */
@@ -747,7 +752,7 @@
void gl_resizeImage(GLubyte* dest, GLint xsize_dest, GLint ysize_dest, GLubyte* src, GLint xsize_src, GLint ysize_src);
void gl_resizeImageNoInterpolate(GLubyte* dest, GLint xsize_dest, GLint ysize_dest, GLubyte* src, GLint xsize_src, GLint ysize_src);
-GLContext* gl_get_context(void);
+//static GLContext* gl_get_context(void);
void gl_fatal_error(char* format, ...);
--- a/src/ztriangle.c
+++ b/src/ztriangle.c
@@ -36,7 +36,7 @@
#endif
#define ZCMP(z, zpix, _a, c) ( ((!zbdt) || (z >= zpix)) && STIPTEST(_a) && NODRAWTEST(c))
-#define ZCMPSIMP(z, zpix, _a, c) ( ((!zbdt) || (z >= zpix)) && STIPTEST(_a) )
+#define ZCMPSIMP(z, zpix, _a, crabapple) ( ((!zbdt) || (z >= zpix)) && STIPTEST(_a) )
void ZB_fillTriangleFlat(ZBuffer* zb, ZBufferPoint* p0, ZBufferPoint* p1, ZBufferPoint* p2) {
@@ -56,11 +56,11 @@
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
if (ZCMPSIMP(zz, pz[_a], _a, color)) { \
TGL_BLEND_FUNC(color, (pp[_a])) /*pp[_a] = color;*/ \
if(zbdw)pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
}
@@ -75,7 +75,6 @@
#undef INTERP_RGB
#undef INTERP_ST
#undef INTERP_STZ
-// {printf("\nzbdostipple = %d",zbdostipple);} //TODO: remove this after debugging is complete.
#define INTERP_Z
//#define INTERP_RGB
#define DRAW_INIT() { }
@@ -82,11 +81,11 @@
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
if (ZCMPSIMP(zz, pz[_a], _a, 0)) { \
pp[_a] = color; \
if(zbdw)pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
}
@@ -131,7 +130,7 @@
}
#else
#define PUT_PIXEL(_a) \
- { \
+ { { \
register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
/*c = RGB_TO_PIXEL(or1, og1, ob1);*/ \
if (ZCMPSIMP(zz, pz[_a], _a, 0)) { \
@@ -138,7 +137,7 @@
/*pp[_a] = c;*/ \
TGL_BLEND_FUNC_RGB(or1, og1, ob1, (pp[_a])); \
if(zbdw)pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
og1 += dgdx; \
or1 += drdx; \
@@ -156,13 +155,13 @@
#if TGL_FEATURE_NO_DRAW_COLOR != 1
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
if (ZCMPSIMP(zz, pz[_a], _a, 0)) { \
/*pp[_a] = RGB_TO_PIXEL(or1, og1, ob1);*/ \
TGL_BLEND_FUNC_RGB(or1, og1, ob1, (pp[_a])); \
\
if(zbdw)pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
og1 += dgdx; \
or1 += drdx; \
@@ -171,13 +170,13 @@
#else
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
/*c = RGB_TO_PIXEL(or1, og1, ob1);*/ \
if (ZCMPSIMP(zz, pz[_a], _a, 0)) { \
/*pp[_a] = c;*/ \
TGL_BLEND_FUNC_RGB(or1, og1, ob1, (pp[_a])); \
if(zbdw) pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
og1 += dgdx; \
or1 += drdx; \
@@ -213,11 +212,11 @@
#if TGL_FEATURE_NO_DRAW_COLOR != 1
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
if (ZCMPSIMP(zz, pz[_a], _a, 0)) { \
pp[_a] = RGB_TO_PIXEL(or1, og1, ob1); \
if(zbdw)pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
og1 += dgdx; \
or1 += drdx; \
@@ -226,12 +225,12 @@
#else
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
/*c = RGB_TO_PIXEL(or1, og1, ob1);*/ \
if (ZCMPSIMP(zz, pz[_a], _a, 0)) { \
pp[_a] = RGB_TO_PIXEL(or1,og1,ob1); \
if(zbdw)pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
og1 += dgdx; \
or1 += drdx; \
@@ -248,12 +247,12 @@
#if TGL_FEATURE_NO_DRAW_COLOR != 1
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
if (ZCMPSIMP(zz, pz[_a], _a, 0)) { \
pp[_a] = RGB_TO_PIXEL(or1, og1, ob1); \
\
if(zbdw)pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
og1 += dgdx; \
or1 += drdx; \
@@ -262,13 +261,13 @@
#else
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
/*c = RGB_TO_PIXEL(or1, og1, ob1);*/ \
if (ZCMPSIMP(zz, pz[_a], _a, 0)) { \
/*pp[_a] = c;*/ \
pp[_a] = RGB_TO_PIXEL(or1, og1, ob1); \
if(zbdw) pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
og1 += dgdx; \
or1 += drdx; \
@@ -460,12 +459,12 @@
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
if (ZCMPSIMP(zz, pz[_a], _a, 0)) { \
/*pp[_a] = RGB_MIX_FUNC(or1, og1, ob1, TEXTURE_SAMPLE(texture, s, t));*/ \
TGL_BLEND_FUNC(RGB_MIX_FUNC(or1, og1, ob1, (TEXTURE_SAMPLE(texture, s, t))), (pp[_a]) ); \
if(zbdw) pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
s += dsdx; \
t += dtdx; \
@@ -488,12 +487,12 @@
#else
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
c = TEXTURE_SAMPLE(texture, s, t); \
if (ZCMP(zz, pz[_a], _a, c)) { \
TGL_BLEND_FUNC(RGB_MIX_FUNC(or1, og1, ob1, c), (pp[_a])); \
if(zbdw) pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
s += dsdx; \
t += dtdx; \
@@ -554,11 +553,11 @@
#if TGL_FEATURE_NO_DRAW_COLOR != 1
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
if (ZCMPSIMP(zz, pz[_a], _a, 0)) { \
pp[_a] = RGB_MIX_FUNC(or1, og1, ob1, TEXTURE_SAMPLE(texture, s, t)); \
if(zbdw) pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
s += dsdx; \
t += dtdx; \
@@ -567,13 +566,13 @@
#else
#define PUT_PIXEL(_a) \
{ \
- register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
+ {register GLuint zz =z >> ZB_POINT_Z_FRAC_BITS; \
c = TEXTURE_SAMPLE(texture, s, t); \
if (ZCMP(zz, pz[_a], _a, c)) { \
pp[_a] = RGB_MIX_FUNC(or1, og1, ob1, c); \
/*TGL_BLEND_FUNC(RGB_MIX_FUNC(or1, og1, ob1, c), (pp[_a]));*/ \
if(zbdw) pz[_a] = zz; \
- } \
+ }} \
z += dzdx; \
s += dsdx; \
t += dtdx; \