Renamed "fake" OpenGL identifiers.

Any identifier that looks like an OpenGL identifier, but isn't, causes a false alarm by the glreport.py tool.  Most of these were in comments so I just rephrased the comments.  There were a couple of static functions/macros that were easy enough to rename.  Only the glTexco and glIndex fields of the DMVertexAttribs struct was public and had non-local uses.
This commit is contained in:
Jason Wilkins 2012-05-04 11:50:11 +00:00
parent df553582e9
commit a0ce240de9
15 changed files with 78 additions and 81 deletions

View File

@ -55,7 +55,7 @@
#endif
// Some more multisample defines
#define WGL_SAMPLE_BUFERS_ARB 0x2041
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
// win64 doesn't define GWL_USERDATA

View File

@ -180,7 +180,7 @@ typedef struct FontBLF {
/* max texture size. */
int max_tex_size;
/* current opengl texture bind, avoids calling glGet */
/* cache current OpenGL texture to save calls into the API */
int tex_bind_state;
/* font options. */

View File

@ -664,22 +664,22 @@ void DM_update_weight_mcol(struct Object *ob, struct DerivedMesh *dm, int const
typedef struct DMVertexAttribs {
struct {
struct MTFace *array;
int emOffset, glIndex, glTexco;
int em_offset, gl_index, gl_texco;
} tface[MAX_MTFACE];
struct {
struct MCol *array;
int emOffset, glIndex;
int em_offset, gl_index;
} mcol[MAX_MCOL];
struct {
float (*array)[4];
int emOffset, glIndex;
int em_offset, gl_index;
} tang;
struct {
float (*array)[3];
int emOffset, glIndex, glTexco;
int em_offset, gl_index, gl_texco;
} orco;
int tottface, totmcol, tottang, totorco;

View File

@ -2786,9 +2786,9 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
a = attribs->tottface++;
attribs->tface[a].array = tfdata->layers[layer].data;
attribs->tface[a].emOffset = tfdata->layers[layer].offset;
attribs->tface[a].glIndex = gattribs->layer[b].glindex;
attribs->tface[a].glTexco = gattribs->layer[b].gltexco;
attribs->tface[a].em_offset = tfdata->layers[layer].offset;
attribs->tface[a].gl_index = gattribs->layer[b].glindex;
attribs->tface[a].gl_texco = gattribs->layer[b].gltexco;
}
}
else {
@ -2802,9 +2802,9 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
a = attribs->tottface++;
attribs->tface[a].array = tfdata->layers[layer].data;
attribs->tface[a].emOffset = tfdata->layers[layer].offset;
attribs->tface[a].glIndex = gattribs->layer[b].glindex;
attribs->tface[a].glTexco = gattribs->layer[b].gltexco;
attribs->tface[a].em_offset = tfdata->layers[layer].offset;
attribs->tface[a].gl_index = gattribs->layer[b].glindex;
attribs->tface[a].gl_texco = gattribs->layer[b].gltexco;
}
}
}
@ -2823,8 +2823,8 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
a = attribs->totmcol++;
attribs->mcol[a].array = tfdata->layers[layer].data;
attribs->mcol[a].emOffset = tfdata->layers[layer].offset;
attribs->mcol[a].glIndex = gattribs->layer[b].glindex;
attribs->mcol[a].em_offset = tfdata->layers[layer].offset;
attribs->mcol[a].gl_index = gattribs->layer[b].glindex;
}
}
else {
@ -2839,8 +2839,8 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
a = attribs->totmcol++;
attribs->mcol[a].array = tfdata->layers[layer].data;
attribs->mcol[a].emOffset = tfdata->layers[layer].offset;
attribs->mcol[a].glIndex = gattribs->layer[b].glindex;
attribs->mcol[a].em_offset = tfdata->layers[layer].offset;
attribs->mcol[a].gl_index = gattribs->layer[b].glindex;
}
}
}
@ -2852,8 +2852,8 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
attribs->tottang = 1;
attribs->tang.array = fdata->layers[layer].data;
attribs->tang.emOffset = fdata->layers[layer].offset;
attribs->tang.glIndex = gattribs->layer[b].glindex;
attribs->tang.em_offset = fdata->layers[layer].offset;
attribs->tang.gl_index = gattribs->layer[b].glindex;
}
}
else if (gattribs->layer[b].type == CD_ORCO) {
@ -2864,9 +2864,9 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
attribs->totorco = 1;
attribs->orco.array = vdata->layers[layer].data;
attribs->orco.emOffset = vdata->layers[layer].offset;
attribs->orco.glIndex = gattribs->layer[b].glindex;
attribs->orco.glTexco = gattribs->layer[b].gltexco;
attribs->orco.em_offset = vdata->layers[layer].offset;
attribs->orco.gl_index = gattribs->layer[b].glindex;
attribs->orco.gl_texco = gattribs->layer[b].gltexco;
}
}
}

View File

@ -989,20 +989,20 @@ static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int
/* orco texture coordinates */
if (attribs->totorco) {
if (attribs->orco.glTexco)
if (attribs->orco.gl_texco)
glTexCoord3fv(attribs->orco.array[index]);
else
glVertexAttrib3fvARB(attribs->orco.glIndex, attribs->orco.array[index]);
glVertexAttrib3fvARB(attribs->orco.gl_index, attribs->orco.array[index]);
}
/* uv texture coordinates */
for (b = 0; b < attribs->tottface; b++) {
MTFace *tf = &attribs->tface[b].array[a];
if (attribs->tface[b].glTexco)
if (attribs->tface[b].gl_texco)
glTexCoord2fv(tf->uv[vert]);
else
glVertexAttrib2fvARB(attribs->tface[b].glIndex, tf->uv[vert]);
glVertexAttrib2fvARB(attribs->tface[b].gl_index, tf->uv[vert]);
}
/* vertex colors */
@ -1010,13 +1010,13 @@ static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int
MCol *cp = &attribs->mcol[b].array[a*4 + vert];
GLubyte col[4];
col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
glVertexAttrib4ubvARB(attribs->mcol[b].glIndex, col);
glVertexAttrib4ubvARB(attribs->mcol[b].gl_index, col);
}
/* tangent for normal mapping */
if (attribs->tottang) {
float *tang = attribs->tang.array[a*4 + vert];
glVertexAttrib4fvARB(attribs->tang.glIndex, tang);
glVertexAttrib4fvARB(attribs->tang.gl_index, tang);
}
/* vertex normal */
@ -1167,25 +1167,25 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
if (attribs.totorco) {
datatypes[numdata].index = attribs.orco.glIndex;
datatypes[numdata].index = attribs.orco.gl_index;
datatypes[numdata].size = 3;
datatypes[numdata].type = GL_FLOAT;
numdata++;
}
for (b = 0; b < attribs.tottface; b++) {
datatypes[numdata].index = attribs.tface[b].glIndex;
datatypes[numdata].index = attribs.tface[b].gl_index;
datatypes[numdata].size = 2;
datatypes[numdata].type = GL_FLOAT;
numdata++;
}
for (b = 0; b < attribs.totmcol; b++) {
datatypes[numdata].index = attribs.mcol[b].glIndex;
datatypes[numdata].index = attribs.mcol[b].gl_index;
datatypes[numdata].size = 4;
datatypes[numdata].type = GL_UNSIGNED_BYTE;
numdata++;
}
if (attribs.tottang) {
datatypes[numdata].index = attribs.tang.glIndex;
datatypes[numdata].index = attribs.tang.gl_index;
datatypes[numdata].size = 4;
datatypes[numdata].type = GL_FLOAT;
numdata++;

View File

@ -1013,21 +1013,21 @@ static void emDM_drawMappedFacesGLSL(
#define PASSATTRIB(loop, eve, vert) { \
if (attribs.totorco) { \
float *orco = attribs.orco.array[BM_elem_index_get(eve)]; \
glVertexAttrib3fvARB(attribs.orco.glIndex, orco); \
glVertexAttrib3fvARB(attribs.orco.gl_index, orco); \
} \
for (b = 0; b < attribs.tottface; b++) { \
MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPUV, b);\
glVertexAttrib2fvARB(attribs.tface[b].glIndex, _luv->uv); \
glVertexAttrib2fvARB(attribs.tface[b].gl_index, _luv->uv); \
} \
for (b = 0; b < attribs.totmcol; b++) { \
MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPCOL, b);\
GLubyte _col[4]; \
_col[0]= _cp->b; _col[1]= _cp->g; _col[2]= _cp->r; _col[3]= _cp->a; \
glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, _col); \
glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, _col); \
} \
if (attribs.tottang) { \
float *tang = attribs.tang.array[i*4 + vert]; \
glVertexAttrib3fvARB(attribs.tang.glIndex, tang); \
glVertexAttrib3fvARB(attribs.tang.gl_index, tang); \
} \
}
@ -1136,27 +1136,27 @@ static void emDM_drawMappedFacesMat(
#define PASSATTRIB(loop, eve, vert) { \
if (attribs.totorco) { \
float *orco = attribs.orco.array[BM_elem_index_get(eve)]; \
if (attribs.orco.glTexco) \
if (attribs.orco.gl_texco) \
glTexCoord3fv(orco); \
else \
glVertexAttrib3fvARB(attribs.orco.glIndex, orco); \
glVertexAttrib3fvARB(attribs.orco.gl_index, orco); \
} \
for (b = 0; b < attribs.tottface; b++) { \
MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPUV, b);\
if (attribs.tface[b].glTexco) \
if (attribs.tface[b].gl_texco) \
glTexCoord2fv(_luv->uv); \
else \
glVertexAttrib2fvARB(attribs.tface[b].glIndex, _luv->uv); \
glVertexAttrib2fvARB(attribs.tface[b].gl_index, _luv->uv); \
} \
for (b = 0; b < attribs.totmcol; b++) { \
MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPCOL, b);\
GLubyte _col[4]; \
_col[0]= _cp->b; _col[1]= _cp->g; _col[2]= _cp->r; _col[3]= _cp->a; \
glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, _col); \
glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, _col); \
} \
if (attribs.tottang) { \
float *tang = attribs.tang.array[i*4 + vert]; \
glVertexAttrib4fvARB(attribs.tang.glIndex, tang); \
glVertexAttrib4fvARB(attribs.tang.gl_index, tang); \
} \
}

View File

@ -1718,21 +1718,21 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
#define PASSATTRIB(dx, dy, vert) { \
if (attribs.totorco) { \
index = getFaceIndex(ss, f, S, x + dx, y + dy, edgeSize, gridSize); \
glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]); \
glVertexAttrib3fvARB(attribs.orco.gl_index, attribs.orco.array[index]); \
} \
for (b = 0; b < attribs.tottface; b++) { \
MTFace *tf = &attribs.tface[b].array[a]; \
glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \
glVertexAttrib2fvARB(attribs.tface[b].gl_index, tf->uv[vert]); \
} \
for (b = 0; b < attribs.totmcol; b++) { \
MCol *cp = &attribs.mcol[b].array[a * 4 + vert]; \
GLubyte col[4]; \
col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a; \
glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col); \
glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, col); \
} \
if (attribs.tottang) { \
float *tang = attribs.tang.array[a * 4 + vert]; \
glVertexAttrib4fvARB(attribs.tang.glIndex, tang); \
glVertexAttrib4fvARB(attribs.tang.gl_index, tang); \
} \
}
@ -1863,27 +1863,27 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
#define PASSATTRIB(dx, dy, vert) { \
if (attribs.totorco) { \
index = getFaceIndex(ss, f, S, x + dx, y + dy, edgeSize, gridSize); \
if (attribs.orco.glTexco) \
if (attribs.orco.gl_texco) \
glTexCoord3fv(attribs.orco.array[index]); \
else \
glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]); \
glVertexAttrib3fvARB(attribs.orco.gl_index, attribs.orco.array[index]); \
} \
for (b = 0; b < attribs.tottface; b++) { \
MTFace *tf = &attribs.tface[b].array[a]; \
if (attribs.tface[b].glTexco) \
if (attribs.tface[b].gl_texco) \
glTexCoord2fv(tf->uv[vert]); \
else \
glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \
glVertexAttrib2fvARB(attribs.tface[b].gl_index, tf->uv[vert]); \
} \
for (b = 0; b < attribs.totmcol; b++) { \
MCol *cp = &attribs.mcol[b].array[a * 4 + vert]; \
GLubyte col[4]; \
col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a; \
glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col); \
glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, col); \
} \
if (attribs.tottang) { \
float *tang = attribs.tang.array[a * 4 + vert]; \
glVertexAttrib4fvARB(attribs.tang.glIndex, tang); \
glVertexAttrib4fvARB(attribs.tang.gl_index, tang); \
} \
}

View File

@ -49,7 +49,8 @@ void fdrawXORcirc(float xofs, float yofs, float rad);
void fdrawcheckerboard(float x1, float y1, float x2, float y2);
/* glStipple defines */
/* OpenGL stipple defines */
/* OpenGL stipple defines */
extern unsigned char stipple_halftone[128];
extern unsigned char stipple_quarttone[128];
extern unsigned char stipple_diag_stripes_pos[128];
@ -147,13 +148,14 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format,
/* 2D Drawing Assistance */
/** Define a 2D area (viewport, scissor, matrices) for OpenGL rendering.
* This routine sets up an OpenGL state appropriate for drawing using
* both vertice (glVertex, etc) and raster (glRasterPos, glRect) commands.
* All coordinates should be at integer positions. There is little to
* no reason to use glVertex2f etc. functions during 2D rendering, and
*
* glwDefine2DArea and glaBegin2DDraw set up an OpenGL state appropriate
* for drawing using both vertice (Vertex, etc) and raster (RasterPos, Rect)
* commands. All coordinates should be at integer positions. There is little
* to no reason to use glVertex2f etc. functions during 2D rendering, and
* thus no reason to +-0.5 the coordinates or perform other silly
* tricks.
*
*
* \param screen_rect The screen rectangle to be defined for 2D drawing.
*/
void glaDefine2DArea (struct rcti *screen_rect);
@ -165,13 +167,8 @@ typedef struct gla2DDrawInfo gla2DDrawInfo;
* to free it and to return OpenGL to its previous state. The
* scissor rectangle is set to match the viewport.
*
* This routine sets up an OpenGL state appropriate for drawing using
* both vertice (glVertex, etc) and raster (glRasterPos, glRect) commands.
* All coordinates should be at integer positions. There is little to
* no reason to use glVertex2f etc. functions during 2D rendering, and
* thus no reason to +-0.5 the coordinates or perform other silly
* tricks.
*
* See glaDefine2DArea for an explanation of why this function uses integers.
*
* \param screen_rect The screen rectangle to be used for 2D drawing.
* \param world_rect The world rectangle that the 2D area represented
* by \a screen_rect is supposed to represent. If NULL it is assumed the

View File

@ -1196,7 +1196,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
ui_get_but_vectorf(but, dir);
dir[3] = 0.0f; /* glLight needs 4 args, 0.0 is sun */
dir[3] = 0.0f; /* glLightfv needs 4 args, 0.0 is sun */
glLightfv(GL_LIGHT7, GL_POSITION, dir);
glLightfv(GL_LIGHT7, GL_DIFFUSE, diffn);
glLightfv(GL_LIGHT7, GL_SPECULAR, vec0);
@ -1281,7 +1281,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
}
static void glColor3ubvShade(unsigned char *col, int shade)
static void gl_shaded_color(unsigned char *col, int shade)
{
glColor3ub(col[0] - shade > 0 ? col[0] - shade : 0,
col[1] - shade > 0 ? col[1] - shade : 0,
@ -1318,7 +1318,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
/* backdrop */
if (cumap->flag & CUMA_DO_CLIP) {
glColor3ubvShade((unsigned char *)wcol->inner, -20);
gl_shaded_color((unsigned char *)wcol->inner, -20);
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
glColor3ubv((unsigned char *)wcol->inner);
glRectf(rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
@ -1332,13 +1332,13 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
}
/* grid, every .25 step */
glColor3ubvShade((unsigned char *)wcol->inner, -16);
gl_shaded_color((unsigned char *)wcol->inner, -16);
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f);
/* grid, every 1.0 step */
glColor3ubvShade((unsigned char *)wcol->inner, -24);
gl_shaded_color((unsigned char *)wcol->inner, -24);
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f);
/* axes */
glColor3ubvShade((unsigned char *)wcol->inner, -50);
gl_shaded_color((unsigned char *)wcol->inner, -50);
glBegin(GL_LINES);
glVertex2f(rect->xmin, rect->ymin + zoomy * (-offsy));
glVertex2f(rect->xmax, rect->ymin + zoomy * (-offsy));

View File

@ -297,13 +297,13 @@ void setlinestyle(int nr)
/* Invert line handling */
#define glToggle(mode, onoff) (((onoff)?glEnable:glDisable)(mode))
#define gl_toggle(mode, onoff) (((onoff)?glEnable:glDisable)(mode))
void set_inverted_drawing(int enable)
{
glLogicOp(enable?GL_INVERT:GL_COPY);
glToggle(GL_COLOR_LOGIC_OP, enable);
glToggle(GL_DITHER, !enable);
gl_toggle(GL_COLOR_LOGIC_OP, enable);
gl_toggle(GL_DITHER, !enable);
}
void sdrawXORline(int x0, int y0, int x1, int y1)
@ -781,7 +781,7 @@ void glaEnd2DDraw(gla2DDrawInfo *di)
}
#endif
/* **************** glPoint hack ************************ */
/* **************** GL_POINT hack ************************ */
static int curmode=0;
static int pointhack=0;

View File

@ -1297,7 +1297,7 @@ static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsign
{
/* Draw a 3d octahedral bone, we use normalized space based on length,
* for glDisplayLists */
* for display-lists */
glScalef(length, length, length);
@ -1996,7 +1996,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* finally names and axes */
if ((arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) && (is_outline == 0)) {
/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
/* patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing */
if ((G.f & G_PICKSEL) == 0) {
float vec[3];
@ -2208,7 +2208,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
/* finally names and axes */
if (arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) {
// patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing
// patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing
if ((G.f & G_PICKSEL) == 0) {
float vec[3];
unsigned char col[4];

View File

@ -6990,7 +6990,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
drawtexspace(ob);
}
if (dtx & OB_DRAWNAME) {
/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
/* patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing */
/* but, we also don't draw names for sets or duplicators */
if (flag == 0) {
float zero[3] = {0, 0, 0};

View File

@ -1304,7 +1304,7 @@ void GPU_end_object_materials(void)
GMS.gmatbuf= NULL;
GMS.alphablend= NULL;
/* resetting the texture matrix after the glScale needed for tiled textures */
/* resetting the texture matrix after the scaling needed for tiled textures */
if (GTS.tilemode) {
glMatrixMode(GL_TEXTURE);
glLoadIdentity();

View File

@ -475,7 +475,7 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
glTexImage2D(triple->target, 0, GL_RGB8, triple->x[x], triple->y[y], 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(triple->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(triple->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// glColor still used with this enabled?
// The current color is ignored if the GL_REPLACE texture environment is used.
// glTexEnvi(triple->target, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(triple->target, 0);

View File

@ -237,7 +237,7 @@ void wm_subwindow_position(wmWindow *win, int swinid, rcti *winrct)
}
}
/* ---------------- WM versions of OpenGL calls, using glBlah() syntax ------------------------ */
/* ---------------- WM versions of OpenGL style API calls ------------------------ */
/* ----------------- exported in WM_api.h ------------------------------------------------------ */
/* internal state, no threaded opengl! XXX */