diff options
Diffstat (limited to 'mesalib/src/mesa/swrast')
25 files changed, 387 insertions, 387 deletions
diff --git a/mesalib/src/mesa/swrast/s_aaline.c b/mesalib/src/mesa/swrast/s_aaline.c index d36d87697..dcc9e3a5c 100644 --- a/mesalib/src/mesa/swrast/s_aaline.c +++ b/mesalib/src/mesa/swrast/s_aaline.c @@ -63,10 +63,10 @@ struct LineInfo GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; /* DO_ATTRIBS */ GLfloat wPlane[4]; - GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4]; - GLfloat lambda[FRAG_ATTRIB_MAX]; - GLfloat texWidth[FRAG_ATTRIB_MAX]; - GLfloat texHeight[FRAG_ATTRIB_MAX]; + GLfloat attrPlane[VARYING_SLOT_MAX][4][4]; + GLfloat lambda[VARYING_SLOT_MAX]; + GLfloat texWidth[VARYING_SLOT_MAX]; + GLfloat texHeight[VARYING_SLOT_MAX]; SWspan span; }; diff --git a/mesalib/src/mesa/swrast/s_aalinetemp.h b/mesalib/src/mesa/swrast/s_aalinetemp.h index 6cfd3bc28..75e28f417 100644 --- a/mesalib/src/mesa/swrast/s_aalinetemp.h +++ b/mesalib/src/mesa/swrast/s_aalinetemp.h @@ -66,10 +66,10 @@ NAME(plot)(struct gl_context *ctx, struct LineInfo *line, int ix, int iy) #if defined(DO_ATTRIBS) ATTRIB_LOOP_BEGIN GLfloat (*attribArray)[4] = line->span.array->attribs[attr]; - if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0 + if (attr >= VARYING_SLOT_TEX0 && attr < VARYING_SLOT_VAR0 && !_swrast_use_fragment_program(ctx)) { /* texcoord w/ divide by Q */ - const GLuint unit = attr - FRAG_ATTRIB_TEX0; + const GLuint unit = attr - VARYING_SLOT_TEX0; const GLfloat invQ = solve_plane_recip(fx, fy, line->attrPlane[attr][3]); GLuint c; for (c = 0; c < 3; c++) { @@ -112,10 +112,10 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) /* Init the LineInfo struct */ struct LineInfo line; - line.x0 = v0->attrib[FRAG_ATTRIB_WPOS][0]; - line.y0 = v0->attrib[FRAG_ATTRIB_WPOS][1]; - line.x1 = v1->attrib[FRAG_ATTRIB_WPOS][0]; - line.y1 = v1->attrib[FRAG_ATTRIB_WPOS][1]; + line.x0 = v0->attrib[VARYING_SLOT_POS][0]; + line.y0 = v0->attrib[VARYING_SLOT_POS][1]; + line.x1 = v1->attrib[VARYING_SLOT_POS][0]; + line.y1 = v1->attrib[VARYING_SLOT_POS][1]; line.dx = line.x1 - line.x0; line.dy = line.y1 - line.y0; line.len = sqrtf(line.dx * line.dx + line.dy * line.dy); @@ -135,7 +135,7 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) #ifdef DO_Z line.span.arrayMask |= SPAN_Z; compute_plane(line.x0, line.y0, line.x1, line.y1, - v0->attrib[FRAG_ATTRIB_WPOS][2], v1->attrib[FRAG_ATTRIB_WPOS][2], line.zPlane); + v0->attrib[VARYING_SLOT_POS][2], v1->attrib[VARYING_SLOT_POS][2], line.zPlane); #endif line.span.arrayMask |= SPAN_RGBA; if (ctx->Light.ShadeModel == GL_SMOOTH) { @@ -156,8 +156,8 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) } #if defined(DO_ATTRIBS) { - const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invW1 = v1->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invW0 = v0->attrib[VARYING_SLOT_POS][3]; + const GLfloat invW1 = v1->attrib[VARYING_SLOT_POS][3]; line.span.arrayMask |= SPAN_LAMBDA; compute_plane(line.x0, line.y0, line.x1, line.y1, invW0, invW1, line.wPlane); ATTRIB_LOOP_BEGIN @@ -176,8 +176,8 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) } } line.span.arrayAttribs |= BITFIELD64_BIT(attr); - if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0) { - const GLuint u = attr - FRAG_ATTRIB_TEX0; + if (attr >= VARYING_SLOT_TEX0 && attr < VARYING_SLOT_VAR0) { + const GLuint u = attr - VARYING_SLOT_TEX0; const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; line.texWidth[attr] = (GLfloat) texImage->Width; diff --git a/mesalib/src/mesa/swrast/s_aatritemp.h b/mesalib/src/mesa/swrast/s_aatritemp.h index 9cdb35fd2..4581248fd 100644 --- a/mesalib/src/mesa/swrast/s_aatritemp.h +++ b/mesalib/src/mesa/swrast/s_aatritemp.h @@ -39,9 +39,9 @@ /*void triangle( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/ { const SWcontext *swrast = SWRAST_CONTEXT(ctx); - const GLfloat *p0 = v0->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *p1 = v1->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *p2 = v2->attrib[FRAG_ATTRIB_WPOS]; + const GLfloat *p0 = v0->attrib[VARYING_SLOT_POS]; + const GLfloat *p1 = v1->attrib[VARYING_SLOT_POS]; + const GLfloat *p2 = v2->attrib[VARYING_SLOT_POS]; const SWvertex *vMin, *vMid, *vMax; GLint iyMin, iyMax; GLfloat yMin, yMax; @@ -55,7 +55,7 @@ #endif GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; #if defined(DO_ATTRIBS) - GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4]; + GLfloat attrPlane[VARYING_SLOT_MAX][4][4]; GLfloat wPlane[4]; /* win[3] */ #endif GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceCullSign; @@ -67,9 +67,9 @@ /* determine bottom to top order of vertices */ { - GLfloat y0 = v0->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat y1 = v1->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat y2 = v2->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat y0 = v0->attrib[VARYING_SLOT_POS][1]; + GLfloat y1 = v1->attrib[VARYING_SLOT_POS][1]; + GLfloat y2 = v2->attrib[VARYING_SLOT_POS][1]; if (y0 <= y1) { if (y1 <= y2) { vMin = v0; vMid = v1; vMax = v2; /* y0<=y1<=y2 */ @@ -94,13 +94,13 @@ } } - majDx = vMax->attrib[FRAG_ATTRIB_WPOS][0] - vMin->attrib[FRAG_ATTRIB_WPOS][0]; - majDy = vMax->attrib[FRAG_ATTRIB_WPOS][1] - vMin->attrib[FRAG_ATTRIB_WPOS][1]; + majDx = vMax->attrib[VARYING_SLOT_POS][0] - vMin->attrib[VARYING_SLOT_POS][0]; + majDy = vMax->attrib[VARYING_SLOT_POS][1] - vMin->attrib[VARYING_SLOT_POS][1]; /* front/back-face determination and cullling */ { - const GLfloat botDx = vMid->attrib[FRAG_ATTRIB_WPOS][0] - vMin->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat botDy = vMid->attrib[FRAG_ATTRIB_WPOS][1] - vMin->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat botDx = vMid->attrib[VARYING_SLOT_POS][0] - vMin->attrib[VARYING_SLOT_POS][0]; + const GLfloat botDy = vMid->attrib[VARYING_SLOT_POS][1] - vMin->attrib[VARYING_SLOT_POS][1]; const GLfloat area = majDx * botDy - botDx * majDy; /* Do backface culling */ if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area)) @@ -134,12 +134,12 @@ span.arrayMask |= SPAN_RGBA; #if defined(DO_ATTRIBS) { - const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invW1 = v1->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invW2 = v2->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invW0 = v0->attrib[VARYING_SLOT_POS][3]; + const GLfloat invW1 = v1->attrib[VARYING_SLOT_POS][3]; + const GLfloat invW2 = v2->attrib[VARYING_SLOT_POS][3]; compute_plane(p0, p1, p2, invW0, invW1, invW2, wPlane); - span.attrStepX[FRAG_ATTRIB_WPOS][3] = plane_dx(wPlane); - span.attrStepY[FRAG_ATTRIB_WPOS][3] = plane_dy(wPlane); + span.attrStepX[VARYING_SLOT_POS][3] = plane_dx(wPlane); + span.attrStepY[VARYING_SLOT_POS][3] = plane_dy(wPlane); ATTRIB_LOOP_BEGIN GLuint c; if (swrast->_InterpMode[attr] == GL_FLAT) { @@ -169,16 +169,16 @@ * edges, stopping when we find that coverage = 0. If the long edge * is on the left we scan left-to-right. Else, we scan right-to-left. */ - yMin = vMin->attrib[FRAG_ATTRIB_WPOS][1]; - yMax = vMax->attrib[FRAG_ATTRIB_WPOS][1]; + yMin = vMin->attrib[VARYING_SLOT_POS][1]; + yMax = vMax->attrib[VARYING_SLOT_POS][1]; iyMin = (GLint) yMin; iyMax = (GLint) yMax + 1; if (ltor) { /* scan left to right */ - const GLfloat *pMin = vMin->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMid = vMid->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMax = vMax->attrib[FRAG_ATTRIB_WPOS]; + const GLfloat *pMin = vMin->attrib[VARYING_SLOT_POS]; + const GLfloat *pMid = vMid->attrib[VARYING_SLOT_POS]; + const GLfloat *pMax = vMax->attrib[VARYING_SLOT_POS]; const GLfloat dxdy = majDx / majDy; const GLfloat xAdj = dxdy < 0.0F ? -dxdy : 0.0F; GLint iy; @@ -208,7 +208,7 @@ #if defined(DO_ATTRIBS) /* compute attributes at left-most fragment */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane); + span.attrStart[VARYING_SLOT_POS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane); ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { @@ -245,9 +245,9 @@ } else { /* scan right to left */ - const GLfloat *pMin = vMin->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMid = vMid->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMax = vMax->attrib[FRAG_ATTRIB_WPOS]; + const GLfloat *pMin = vMin->attrib[VARYING_SLOT_POS]; + const GLfloat *pMid = vMid->attrib[VARYING_SLOT_POS]; + const GLfloat *pMax = vMax->attrib[VARYING_SLOT_POS]; const GLfloat dxdy = majDx / majDy; const GLfloat xAdj = dxdy > 0 ? dxdy : 0.0F; GLint iy; @@ -300,7 +300,7 @@ #if defined(DO_ATTRIBS) /* compute attributes at left-most fragment */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5F, iy + 0.5F, wPlane); + span.attrStart[VARYING_SLOT_POS][3] = solve_plane(ix + 1.5F, iy + 0.5F, wPlane); ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { diff --git a/mesalib/src/mesa/swrast/s_alpha.c b/mesalib/src/mesa/swrast/s_alpha.c index df2181ba9..1ceda531c 100644 --- a/mesalib/src/mesa/swrast/s_alpha.c +++ b/mesalib/src/mesa/swrast/s_alpha.c @@ -123,7 +123,7 @@ _swrast_alpha_test(const struct gl_context *ctx, SWspan *span) ALPHA_TEST(rgba[i][ACOMP], ;); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; const GLfloat ref = ctx->Color.AlphaRef; ALPHA_TEST(rgba[i][ACOMP], ;); } diff --git a/mesalib/src/mesa/swrast/s_atifragshader.c b/mesalib/src/mesa/swrast/s_atifragshader.c index c5abaa0d4..1e91e2bee 100644 --- a/mesalib/src/mesa/swrast/s_atifragshader.c +++ b/mesalib/src/mesa/swrast/s_atifragshader.c @@ -248,7 +248,7 @@ handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst, if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) { pass_tex -= GL_TEXTURE0_ARB; COPY_4V(machine->Registers[idx], - span->array->attribs[FRAG_ATTRIB_TEX0 + pass_tex][column]); + span->array->attribs[VARYING_SLOT_TEX0 + pass_tex][column]); } else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) { pass_tex -= GL_REG_0_ATI; @@ -271,7 +271,7 @@ handle_sample_op(struct gl_context * ctx, struct atifs_machine *machine, if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) { coord_source -= GL_TEXTURE0_ARB; COPY_4V(tex_coords, - span->array->attribs[FRAG_ATTRIB_TEX0 + coord_source][column]); + span->array->attribs[VARYING_SLOT_TEX0 + coord_source][column]); } else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) { coord_source -= GL_REG_0_ATI; @@ -554,8 +554,8 @@ init_machine(struct gl_context * ctx, struct atifs_machine *machine, machine->Registers[i][j] = 0.0; } - COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[FRAG_ATTRIB_COL0][col]); - COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[FRAG_ATTRIB_COL1][col]); + COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[VARYING_SLOT_COL0][col]); + COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[VARYING_SLOT_COL1][col]); } @@ -584,7 +584,7 @@ _swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span) const GLfloat *colOut = machine.Registers[0]; /*fprintf(stderr,"outputs %f %f %f %f\n", colOut[0], colOut[1], colOut[2], colOut[3]); */ - COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], colOut); + COPY_4V(span->array->attribs[VARYING_SLOT_COL0][i], colOut); } } } diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c index ef7ca2e15..11e906436 100644 --- a/mesalib/src/mesa/swrast/s_context.c +++ b/mesalib/src/mesa/swrast/s_context.c @@ -502,7 +502,7 @@ _swrast_update_active_attribs(struct gl_context *ctx) if (_swrast_use_fragment_program(ctx)) { /* fragment program/shader */ attribsMask = ctx->FragmentProgram._Current->Base.InputsRead; - attribsMask &= ~FRAG_BIT_WPOS; /* WPOS is always handled specially */ + attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */ } else if (ctx->ATIFragmentShader._Enabled) { attribsMask = ~0; /* XXX fix me */ @@ -512,19 +512,19 @@ _swrast_update_active_attribs(struct gl_context *ctx) attribsMask = 0x0; #if CHAN_TYPE == GL_FLOAT - attribsMask |= FRAG_BIT_COL0; + attribsMask |= VARYING_BIT_COL0; #endif if (ctx->Fog.ColorSumEnabled || (ctx->Light.Enabled && ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) { - attribsMask |= FRAG_BIT_COL1; + attribsMask |= VARYING_BIT_COL1; } if (swrast->_FogEnabled) - attribsMask |= FRAG_BIT_FOGC; + attribsMask |= VARYING_BIT_FOGC; - attribsMask |= (ctx->Texture._EnabledUnits << FRAG_ATTRIB_TEX0); + attribsMask |= (ctx->Texture._EnabledUnits << VARYING_SLOT_TEX0); } swrast->_ActiveAttribMask = attribsMask; @@ -532,11 +532,11 @@ _swrast_update_active_attribs(struct gl_context *ctx) /* Update _ActiveAttribs[] list */ { GLuint i, num = 0; - for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { if (attribsMask & BITFIELD64_BIT(i)) { swrast->_ActiveAttribs[num++] = i; /* how should this attribute be interpolated? */ - if (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1) + if (i == VARYING_SLOT_COL0 || i == VARYING_SLOT_COL1) swrast->_InterpMode[i] = ctx->Light.ShadeModel; else swrast->_InterpMode[i] = GL_SMOOTH; @@ -785,7 +785,7 @@ _swrast_CreateContext( struct gl_context *ctx ) #elif CHAN_TYPE == GL_UNSIGNED_SHORT swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].rgba16; #else - swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].attribs[FRAG_ATTRIB_COL0]; + swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].attribs[VARYING_SLOT_COL0]; #endif } @@ -918,18 +918,18 @@ _swrast_print_vertex( struct gl_context *ctx, const SWvertex *v ) if (SWRAST_DEBUG_VERTICES) { _mesa_debug(ctx, "win %f %f %f %f\n", - v->attrib[FRAG_ATTRIB_WPOS][0], - v->attrib[FRAG_ATTRIB_WPOS][1], - v->attrib[FRAG_ATTRIB_WPOS][2], - v->attrib[FRAG_ATTRIB_WPOS][3]); + v->attrib[VARYING_SLOT_POS][0], + v->attrib[VARYING_SLOT_POS][1], + v->attrib[VARYING_SLOT_POS][2], + v->attrib[VARYING_SLOT_POS][3]); for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) if (ctx->Texture.Unit[i]._ReallyEnabled) _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i, - v->attrib[FRAG_ATTRIB_TEX0 + i][0], - v->attrib[FRAG_ATTRIB_TEX0 + i][1], - v->attrib[FRAG_ATTRIB_TEX0 + i][2], - v->attrib[FRAG_ATTRIB_TEX0 + i][3]); + v->attrib[VARYING_SLOT_TEX0 + i][0], + v->attrib[VARYING_SLOT_TEX0 + i][1], + v->attrib[VARYING_SLOT_TEX0 + i][2], + v->attrib[VARYING_SLOT_TEX0 + i][3]); #if CHAN_TYPE == GL_FLOAT _mesa_debug(ctx, "color %f %f %f %f\n", @@ -939,12 +939,12 @@ _swrast_print_vertex( struct gl_context *ctx, const SWvertex *v ) v->color[0], v->color[1], v->color[2], v->color[3]); #endif _mesa_debug(ctx, "spec %g %g %g %g\n", - v->attrib[FRAG_ATTRIB_COL1][0], - v->attrib[FRAG_ATTRIB_COL1][1], - v->attrib[FRAG_ATTRIB_COL1][2], - v->attrib[FRAG_ATTRIB_COL1][3]); - _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]); - _mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]); + v->attrib[VARYING_SLOT_COL1][0], + v->attrib[VARYING_SLOT_COL1][1], + v->attrib[VARYING_SLOT_COL1][2], + v->attrib[VARYING_SLOT_COL1][3]); + _mesa_debug(ctx, "fog %f\n", v->attrib[VARYING_SLOT_FOGC][0]); + _mesa_debug(ctx, "index %f\n", v->attrib[VARYING_SLOT_CI][0]); _mesa_debug(ctx, "pointsize %f\n", v->pointSize); _mesa_debug(ctx, "\n"); } diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h index f3f188e47..2f7a2b531 100644 --- a/mesalib/src/mesa/swrast/s_context.h +++ b/mesalib/src/mesa/swrast/s_context.h @@ -224,13 +224,13 @@ typedef struct GLboolean _DeferredTexture; /** List/array of the fragment attributes to interpolate */ - GLuint _ActiveAttribs[FRAG_ATTRIB_MAX]; - /** Same info, but as a bitmask of FRAG_BIT_x bits */ + GLuint _ActiveAttribs[VARYING_SLOT_MAX]; + /** Same info, but as a bitmask of VARYING_BIT_x bits */ GLbitfield64 _ActiveAttribMask; /** Number of fragment attributes to interpolate */ GLuint _NumActiveAttribs; /** Indicates how each attrib is to be interpolated (lines/tris) */ - GLenum _InterpMode[FRAG_ATTRIB_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */ + GLenum _InterpMode[VARYING_SLOT_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */ /* Working values: */ diff --git a/mesalib/src/mesa/swrast/s_copypix.c b/mesalib/src/mesa/swrast/s_copypix.c index bbd1f228c..1d8926179 100644 --- a/mesalib/src/mesa/swrast/s_copypix.c +++ b/mesalib/src/mesa/swrast/s_copypix.c @@ -136,7 +136,7 @@ copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, INIT_SPAN(span, GL_BITMAP); _swrast_span_default_attribs(ctx, &span); span.arrayMask = SPAN_RGBA; - span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */ + span.arrayAttribs = VARYING_BIT_COL0; /* we'll fill in COL0 attrib values */ if (overlapping) { tmpImage = malloc(width * height * sizeof(GLfloat) * 4); @@ -161,7 +161,7 @@ copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, ASSERT(width < SWRAST_MAX_WIDTH); for (row = 0; row < height; row++, sy += stepy, dy += stepy) { - GLvoid *rgba = span.array->attribs[FRAG_ATTRIB_COL0]; + GLvoid *rgba = span.array->attribs[VARYING_SLOT_COL0]; /* Get row/span of source pixels */ if (overlapping) { diff --git a/mesalib/src/mesa/swrast/s_drawpix.c b/mesalib/src/mesa/swrast/s_drawpix.c index 7665408fd..3d23f912f 100644 --- a/mesalib/src/mesa/swrast/s_drawpix.c +++ b/mesalib/src/mesa/swrast/s_drawpix.c @@ -429,7 +429,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, INIT_SPAN(span, GL_BITMAP); _swrast_span_default_attribs(ctx, &span); span.arrayMask = SPAN_RGBA; - span.arrayAttribs = FRAG_BIT_COL0; /* we're fill in COL0 attrib values */ + span.arrayAttribs = VARYING_BIT_COL0; /* we're fill in COL0 attrib values */ if (ctx->DrawBuffer->_NumColorDrawBuffers > 0) { GLenum datatype = _mesa_get_format_datatype( @@ -451,7 +451,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, = _mesa_image_row_stride(unpack, width, format, type); GLint skipPixels = 0; /* use span array for temp color storage */ - GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0]; + GLfloat *rgba = (GLfloat *) span.array->attribs[VARYING_SLOT_COL0]; /* if the span is wider than SWRAST_MAX_WIDTH we have to do it in chunks */ while (skipPixels < width) { diff --git a/mesalib/src/mesa/swrast/s_feedback.c b/mesalib/src/mesa/swrast/s_feedback.c index 00f92d463..00467e54f 100644 --- a/mesalib/src/mesa/swrast/s_feedback.c +++ b/mesalib/src/mesa/swrast/s_feedback.c @@ -37,13 +37,13 @@ static void feedback_vertex(struct gl_context * ctx, const SWvertex * v, const SWvertex * pv) { GLfloat win[4]; - const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0]; - const GLfloat *color = v->attrib[FRAG_ATTRIB_COL0]; + const GLfloat *vtc = v->attrib[VARYING_SLOT_TEX0]; + const GLfloat *color = v->attrib[VARYING_SLOT_COL0]; - win[0] = v->attrib[FRAG_ATTRIB_WPOS][0]; - win[1] = v->attrib[FRAG_ATTRIB_WPOS][1]; - win[2] = v->attrib[FRAG_ATTRIB_WPOS][2] / ctx->DrawBuffer->_DepthMaxF; - win[3] = 1.0F / v->attrib[FRAG_ATTRIB_WPOS][3]; + win[0] = v->attrib[VARYING_SLOT_POS][0]; + win[1] = v->attrib[VARYING_SLOT_POS][1]; + win[2] = v->attrib[VARYING_SLOT_POS][2] / ctx->DrawBuffer->_DepthMaxF; + win[3] = 1.0F / v->attrib[VARYING_SLOT_POS][3]; _mesa_feedback_vertex(ctx, win, color, vtc); } @@ -114,9 +114,9 @@ _swrast_select_triangle(struct gl_context *ctx, const SWvertex *v0, if (!_swrast_culltriangle(ctx, v0, v1, v2)) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v2->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v0->attrib[VARYING_SLOT_POS][2] * zs ); + _mesa_update_hitflag( ctx, v1->attrib[VARYING_SLOT_POS][2] * zs ); + _mesa_update_hitflag( ctx, v2->attrib[VARYING_SLOT_POS][2] * zs ); } } @@ -125,8 +125,8 @@ void _swrast_select_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v0->attrib[VARYING_SLOT_POS][2] * zs ); + _mesa_update_hitflag( ctx, v1->attrib[VARYING_SLOT_POS][2] * zs ); } @@ -134,5 +134,5 @@ void _swrast_select_point(struct gl_context *ctx, const SWvertex *v) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v->attrib[VARYING_SLOT_POS][2] * zs ); } diff --git a/mesalib/src/mesa/swrast/s_fog.c b/mesalib/src/mesa/swrast/s_fog.c index ea59de160..57a6a8e61 100644 --- a/mesalib/src/mesa/swrast/s_fog.c +++ b/mesalib/src/mesa/swrast/s_fog.c @@ -87,10 +87,10 @@ do { \ * \param COMPUTE_F code to compute the fog blend factor, f. */ #define FOG_LOOP(TYPE, FOG_FUNC) \ -if (span->arrayAttribs & FRAG_BIT_FOGC) { \ +if (span->arrayAttribs & VARYING_BIT_FOGC) { \ GLuint i; \ for (i = 0; i < span->end; i++) { \ - const GLfloat fogCoord = span->array->attribs[FRAG_ATTRIB_FOGC][i][0]; \ + const GLfloat fogCoord = span->array->attribs[VARYING_SLOT_FOGC][i][0]; \ const GLfloat c = FABSF(fogCoord); \ GLfloat f, oneMinusF; \ FOG_FUNC(f, c); \ @@ -102,10 +102,10 @@ if (span->arrayAttribs & FRAG_BIT_FOGC) { \ } \ } \ else { \ - const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0]; \ - GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0]; \ - const GLfloat wStep = span->attrStepX[FRAG_ATTRIB_WPOS][3]; \ - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3]; \ + const GLfloat fogStep = span->attrStepX[VARYING_SLOT_FOGC][0]; \ + GLfloat fogCoord = span->attrStart[VARYING_SLOT_FOGC][0]; \ + const GLfloat wStep = span->attrStepX[VARYING_SLOT_POS][3]; \ + GLfloat w = span->attrStart[VARYING_SLOT_POS][3]; \ GLuint i; \ for (i = 0; i < span->end; i++) { \ const GLfloat c = FABSF(fogCoord) / w; \ @@ -173,7 +173,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, LINEAR_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, LINEAR_FOG); } @@ -192,7 +192,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, EXP_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, EXP_FOG); } @@ -211,7 +211,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, EXP2_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, EXP2_FOG); } @@ -236,7 +236,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, BLEND_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, BLEND_FOG); } diff --git a/mesalib/src/mesa/swrast/s_fragprog.c b/mesalib/src/mesa/swrast/s_fragprog.c index 9b60893db..1ce2ee452 100644 --- a/mesalib/src/mesa/swrast/s_fragprog.c +++ b/mesalib/src/mesa/swrast/s_fragprog.c @@ -162,7 +162,7 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine, const struct gl_fragment_program *program, const SWspan *span, GLuint col) { - GLfloat *wpos = span->array->attribs[FRAG_ATTRIB_WPOS][col]; + GLfloat *wpos = span->array->attribs[VARYING_SLOT_POS][col]; /* ARB_fragment_coord_conventions */ if (program->OriginUpperLeft) @@ -177,14 +177,14 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine, machine->DerivX = (GLfloat (*)[4]) span->attrStepX; machine->DerivY = (GLfloat (*)[4]) span->attrStepY; - machine->NumDeriv = FRAG_ATTRIB_MAX; + machine->NumDeriv = VARYING_SLOT_MAX; machine->Samplers = program->Base.SamplerUnits; /* if running a GLSL program (not ARB_fragment_program) */ if (ctx->Shader.CurrentFragmentProgram) { /* Store front/back facing value */ - machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0F - span->facing; + machine->Attribs[VARYING_SLOT_FACE][col][0] = 1.0F - span->facing; } machine->CurElement = col; @@ -223,7 +223,7 @@ run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end) /* Store result color */ if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) { - COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], + COPY_4V(span->array->attribs[VARYING_SLOT_COL0][i], machine->Outputs[FRAG_RESULT_COLOR]); } else { @@ -234,7 +234,7 @@ run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end) GLuint buf; for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) { if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DATA0 + buf)) { - COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0 + buf][i], + COPY_4V(span->array->attribs[VARYING_SLOT_COL0 + buf][i], machine->Outputs[FRAG_RESULT_DATA0 + buf]); } } @@ -272,7 +272,7 @@ _swrast_exec_fragment_program( struct gl_context *ctx, SWspan *span ) const struct gl_fragment_program *program = ctx->FragmentProgram._Current; /* incoming colors should be floats */ - if (program->Base.InputsRead & FRAG_BIT_COL0) { + if (program->Base.InputsRead & VARYING_BIT_COL0) { ASSERT(span->array->ChanType == GL_FLOAT); } diff --git a/mesalib/src/mesa/swrast/s_lines.c b/mesalib/src/mesa/swrast/s_lines.c index cfd3e6fa9..7364dd965 100644 --- a/mesalib/src/mesa/swrast/s_lines.c +++ b/mesalib/src/mesa/swrast/s_lines.c @@ -172,16 +172,16 @@ _swrast_add_spec_terms_line(struct gl_context *ctx, COPY_CHAN4(cSave[0], ncv0->color); COPY_CHAN4(cSave[1], ncv1->color); /* sum v0 */ - rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum); /* sum v1 */ - rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[2], bSum); diff --git a/mesalib/src/mesa/swrast/s_linetemp.h b/mesalib/src/mesa/swrast/s_linetemp.h index 1668f7db9..8feb8b120 100644 --- a/mesalib/src/mesa/swrast/s_linetemp.h +++ b/mesalib/src/mesa/swrast/s_linetemp.h @@ -68,10 +68,10 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) const SWcontext *swrast = SWRAST_CONTEXT(ctx); SWspan span; GLuint interpFlags = 0; - GLint x0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0]; - GLint x1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0]; - GLint y0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1]; - GLint y1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1]; + GLint x0 = (GLint) vert0->attrib[VARYING_SLOT_POS][0]; + GLint x1 = (GLint) vert1->attrib[VARYING_SLOT_POS][0]; + GLint y0 = (GLint) vert0->attrib[VARYING_SLOT_POS][1]; + GLint y1 = (GLint) vert1->attrib[VARYING_SLOT_POS][1]; GLint dx, dy; GLint numPixels; GLint xstep, ystep; @@ -99,8 +99,8 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) /* Cull primitives with malformed coordinates. */ { - GLfloat tmp = vert0->attrib[FRAG_ATTRIB_WPOS][0] + vert0->attrib[FRAG_ATTRIB_WPOS][1] - + vert1->attrib[FRAG_ATTRIB_WPOS][0] + vert1->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat tmp = vert0->attrib[VARYING_SLOT_POS][0] + vert0->attrib[VARYING_SLOT_POS][1] + + vert1->attrib[VARYING_SLOT_POS][0] + vert1->attrib[VARYING_SLOT_POS][1]; if (IS_INF_OR_NAN(tmp)) return; } @@ -108,12 +108,12 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) /* printf("%s():\n", __FUNCTION__); printf(" (%f, %f, %f) -> (%f, %f, %f)\n", - vert0->attrib[FRAG_ATTRIB_WPOS][0], - vert0->attrib[FRAG_ATTRIB_WPOS][1], - vert0->attrib[FRAG_ATTRIB_WPOS][2], - vert1->attrib[FRAG_ATTRIB_WPOS][0], - vert1->attrib[FRAG_ATTRIB_WPOS][1], - vert1->attrib[FRAG_ATTRIB_WPOS][2]); + vert0->attrib[VARYING_SLOT_POS][0], + vert0->attrib[VARYING_SLOT_POS][1], + vert0->attrib[VARYING_SLOT_POS][2], + vert1->attrib[VARYING_SLOT_POS][0], + vert1->attrib[VARYING_SLOT_POS][1], + vert1->attrib[VARYING_SLOT_POS][2]); printf(" (%d, %d, %d) -> (%d, %d, %d)\n", vert0->color[0], vert0->color[1], vert0->color[2], vert1->color[0], vert1->color[1], vert1->color[2]); @@ -155,14 +155,14 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) /* printf("%s %d,%d %g %g %g %g %g %g %g %g\n", __FUNCTION__, dx, dy, - vert0->attrib[FRAG_ATTRIB_COL1][0], - vert0->attrib[FRAG_ATTRIB_COL1][1], - vert0->attrib[FRAG_ATTRIB_COL1][2], - vert0->attrib[FRAG_ATTRIB_COL1][3], - vert1->attrib[FRAG_ATTRIB_COL1][0], - vert1->attrib[FRAG_ATTRIB_COL1][1], - vert1->attrib[FRAG_ATTRIB_COL1][2], - vert1->attrib[FRAG_ATTRIB_COL1][3]); + vert0->attrib[VARYING_SLOT_COL1][0], + vert0->attrib[VARYING_SLOT_COL1][1], + vert0->attrib[VARYING_SLOT_COL1][2], + vert0->attrib[VARYING_SLOT_COL1][3], + vert1->attrib[VARYING_SLOT_COL1][0], + vert1->attrib[VARYING_SLOT_COL1][1], + vert1->attrib[VARYING_SLOT_COL1][2], + vert1->attrib[VARYING_SLOT_COL1][3]); */ #ifdef DEPTH_TYPE @@ -245,27 +245,27 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) interpFlags |= SPAN_Z; { if (depthBits <= 16) { - span.z = FloatToFixed(vert0->attrib[FRAG_ATTRIB_WPOS][2]) + FIXED_HALF; - span.zStep = FloatToFixed( vert1->attrib[FRAG_ATTRIB_WPOS][2] - - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels; + span.z = FloatToFixed(vert0->attrib[VARYING_SLOT_POS][2]) + FIXED_HALF; + span.zStep = FloatToFixed( vert1->attrib[VARYING_SLOT_POS][2] + - vert0->attrib[VARYING_SLOT_POS][2]) / numPixels; } else { /* don't use fixed point */ - span.z = (GLuint) vert0->attrib[FRAG_ATTRIB_WPOS][2]; - span.zStep = (GLint) (( vert1->attrib[FRAG_ATTRIB_WPOS][2] - - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels); + span.z = (GLuint) vert0->attrib[VARYING_SLOT_POS][2]; + span.zStep = (GLint) (( vert1->attrib[VARYING_SLOT_POS][2] + - vert0->attrib[VARYING_SLOT_POS][2]) / numPixels); } } #endif #if defined(INTERP_ATTRIBS) { const GLfloat invLen = 1.0F / numPixels; - const GLfloat invw0 = vert0->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invw1 = vert1->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invw0 = vert0->attrib[VARYING_SLOT_POS][3]; + const GLfloat invw1 = vert1->attrib[VARYING_SLOT_POS][3]; - span.attrStart[FRAG_ATTRIB_WPOS][3] = invw0; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = (invw1 - invw0) * invLen; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0; + span.attrStart[VARYING_SLOT_POS][3] = invw0; + span.attrStepX[VARYING_SLOT_POS][3] = (invw1 - invw0) * invLen; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0; ATTRIB_LOOP_BEGIN if (swrast->_InterpMode[attr] == GL_FLAT) { diff --git a/mesalib/src/mesa/swrast/s_logic.c b/mesalib/src/mesa/swrast/s_logic.c index 8791630a4..93388d720 100644 --- a/mesalib/src/mesa/swrast/s_logic.c +++ b/mesalib/src/mesa/swrast/s_logic.c @@ -212,7 +212,7 @@ _swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, } else { logicop_uint4(ctx, 4 * span->end, - (GLuint *) span->array->attribs[FRAG_ATTRIB_COL0], + (GLuint *) span->array->attribs[VARYING_SLOT_COL0], (const GLuint *) rbPixels, span->array->mask); } } diff --git a/mesalib/src/mesa/swrast/s_masking.c b/mesalib/src/mesa/swrast/s_masking.c index 4f262fa97..8f5344650 100644 --- a/mesalib/src/mesa/swrast/s_masking.c +++ b/mesalib/src/mesa/swrast/s_masking.c @@ -90,7 +90,7 @@ _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, const GLuint bMask = ctx->Color.ColorMask[buf][BCOMP] ? ~0x0 : 0x0; const GLuint aMask = ctx->Color.ColorMask[buf][ACOMP] ? ~0x0 : 0x0; const GLuint (*dst)[4] = (const GLuint (*)[4]) rbPixels; - GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[FRAG_ATTRIB_COL0]; + GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[VARYING_SLOT_COL0]; GLuint i; for (i = 0; i < n; i++) { src[i][RCOMP] = (src[i][RCOMP] & rMask) | (dst[i][RCOMP] & ~rMask); diff --git a/mesalib/src/mesa/swrast/s_points.c b/mesalib/src/mesa/swrast/s_points.c index acbdb2d42..80693be8e 100644 --- a/mesalib/src/mesa/swrast/s_points.c +++ b/mesalib/src/mesa/swrast/s_points.c @@ -37,8 +37,8 @@ */ #define CULL_INVALID(V) \ do { \ - float tmp = (V)->attrib[FRAG_ATTRIB_WPOS][0] \ - + (V)->attrib[FRAG_ATTRIB_WPOS][1]; \ + float tmp = (V)->attrib[VARYING_SLOT_POS][0] \ + + (V)->attrib[VARYING_SLOT_POS][1]; \ if (IS_INF_OR_NAN(tmp)) \ return; \ } while(0) @@ -93,9 +93,9 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) /* z coord */ if (ctx->DrawBuffer->Visual.depthBits <= 16) - span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F); else - span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span.zStep = 0; size = get_size(ctx, vert, GL_FALSE); @@ -116,9 +116,9 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) span.alphaStep = 0; /* need these for fragment programs */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span.attrStart[VARYING_SLOT_POS][3] = 1.0F; + span.attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0F; { GLfloat s, r, dsdx; @@ -137,9 +137,9 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) } ATTRIB_LOOP_BEGIN - if (attr >= FRAG_ATTRIB_TEX0 && attr <= FRAG_ATTRIB_TEX7) { + if (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) { /* a texcoord attribute */ - const GLuint u = attr - FRAG_ATTRIB_TEX0; + const GLuint u = attr - VARYING_SLOT_TEX0; ASSERT(u < Elements(ctx->Point.CoordReplace)); if (ctx->Point.CoordReplace[u]) { tCoords[numTcoords++] = attr; @@ -169,15 +169,15 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) continue; } } - else if (attr == FRAG_ATTRIB_PNTC) { + else if (attr == VARYING_SLOT_PNTC) { /* GLSL gl_PointCoord.xy (.zw undefined) */ - span.attrStart[FRAG_ATTRIB_PNTC][0] = 0.0; - span.attrStart[FRAG_ATTRIB_PNTC][1] = 0.0; /* t0 set below */ - span.attrStepX[FRAG_ATTRIB_PNTC][0] = dsdx; - span.attrStepX[FRAG_ATTRIB_PNTC][1] = 0.0; - span.attrStepY[FRAG_ATTRIB_PNTC][0] = 0.0; - span.attrStepY[FRAG_ATTRIB_PNTC][1] = dtdy; - tCoords[numTcoords++] = FRAG_ATTRIB_PNTC; + span.attrStart[VARYING_SLOT_PNTC][0] = 0.0; + span.attrStart[VARYING_SLOT_PNTC][1] = 0.0; /* t0 set below */ + span.attrStepX[VARYING_SLOT_PNTC][0] = dsdx; + span.attrStepX[VARYING_SLOT_PNTC][1] = 0.0; + span.attrStepY[VARYING_SLOT_PNTC][0] = 0.0; + span.attrStepY[VARYING_SLOT_PNTC][1] = dtdy; + tCoords[numTcoords++] = VARYING_SLOT_PNTC; continue; } /* use vertex's texcoord/attrib */ @@ -189,8 +189,8 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) /* compute pos, bounds and render */ { - const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat x = vert->attrib[VARYING_SLOT_POS][0]; + const GLfloat y = vert->attrib[VARYING_SLOT_POS][1]; GLint iSize = (GLint) (size + 0.5F); GLint xmin, xmax, ymin, ymax, iy; GLint iRadius; @@ -250,9 +250,9 @@ smooth_point(struct gl_context *ctx, const SWvertex *vert) /* z coord */ if (ctx->DrawBuffer->Visual.depthBits <= 16) - span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F); else - span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span.zStep = 0; size = get_size(ctx, vert, GL_TRUE); @@ -289,9 +289,9 @@ smooth_point(struct gl_context *ctx, const SWvertex *vert) span.alphaStep = 0; /* need these for fragment programs */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span.attrStart[VARYING_SLOT_POS][3] = 1.0F; + span.attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0F; ATTRIB_LOOP_BEGIN COPY_4V(span.attrStart[attr], vert->attrib[attr]); @@ -301,8 +301,8 @@ smooth_point(struct gl_context *ctx, const SWvertex *vert) /* compute pos, bounds and render */ { - const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat x = vert->attrib[VARYING_SLOT_POS][0]; + const GLfloat y = vert->attrib[VARYING_SLOT_POS][1]; const GLfloat radius = 0.5F * size; const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ const GLfloat rmax = radius + 0.7071F; @@ -370,9 +370,9 @@ large_point(struct gl_context *ctx, const SWvertex *vert) /* z coord */ if (ctx->DrawBuffer->Visual.depthBits <= 16) - span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F); else - span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span.zStep = 0; size = get_size(ctx, vert, GL_FALSE); @@ -393,9 +393,9 @@ large_point(struct gl_context *ctx, const SWvertex *vert) span.alphaStep = 0; /* need these for fragment programs */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span.attrStart[VARYING_SLOT_POS][3] = 1.0F; + span.attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0F; ATTRIB_LOOP_BEGIN COPY_4V(span.attrStart[attr], vert->attrib[attr]); @@ -405,8 +405,8 @@ large_point(struct gl_context *ctx, const SWvertex *vert) /* compute pos, bounds and render */ { - const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat x = vert->attrib[VARYING_SLOT_POS][0]; + const GLfloat y = vert->attrib[VARYING_SLOT_POS][1]; GLint iSize = (GLint) (size + 0.5F); GLint xmin, xmax, ymin, ymax, ix, iy; GLint iRadius; @@ -470,9 +470,9 @@ pixel_point(struct gl_context *ctx, const SWvertex *vert) span->arrayAttribs = swrast->_ActiveAttribMask; /* we'll produce these vals */ /* need these for fragment programs */ - span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span->attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span->attrStart[VARYING_SLOT_POS][3] = 1.0F; + span->attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span->attrStepY[VARYING_SLOT_POS][3] = 0.0F; /* check if we need to flush */ if (span->end >= SWRAST_MAX_WIDTH || @@ -499,9 +499,9 @@ pixel_point(struct gl_context *ctx, const SWvertex *vert) ATTRIB_LOOP_END /* fragment position */ - span->array->x[count] = (GLint) vert->attrib[FRAG_ATTRIB_WPOS][0]; - span->array->y[count] = (GLint) vert->attrib[FRAG_ATTRIB_WPOS][1]; - span->array->z[count] = (GLint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span->array->x[count] = (GLint) vert->attrib[VARYING_SLOT_POS][0]; + span->array->y[count] = (GLint) vert->attrib[VARYING_SLOT_POS][1]; + span->array->z[count] = (GLint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span->end = count + 1; ASSERT(span->end <= SWRAST_MAX_WIDTH); @@ -522,9 +522,9 @@ _swrast_add_spec_terms_point(struct gl_context *ctx, const SWvertex *v0) /* save */ COPY_CHAN4(cSave, ncv0->color); /* sum */ - rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum); diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c index ff653a622..7bb3b1f2b 100644 --- a/mesalib/src/mesa/swrast/s_span.c +++ b/mesalib/src/mesa/swrast/s_span.c @@ -79,9 +79,9 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) } /* W (for perspective correction) */ - span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0; - span->attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0; - span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0; + span->attrStart[VARYING_SLOT_POS][3] = 1.0; + span->attrStepX[VARYING_SLOT_POS][3] = 0.0; + span->attrStepY[VARYING_SLOT_POS][3] = 0.0; /* primary color, or color index */ UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]); @@ -105,16 +105,16 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) span->alphaStep = 0; span->interpMask |= SPAN_RGBA; - COPY_4V(span->attrStart[FRAG_ATTRIB_COL0], ctx->Current.RasterColor); - ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0); - ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0); + COPY_4V(span->attrStart[VARYING_SLOT_COL0], ctx->Current.RasterColor); + ASSIGN_4V(span->attrStepX[VARYING_SLOT_COL0], 0.0, 0.0, 0.0, 0.0); + ASSIGN_4V(span->attrStepY[VARYING_SLOT_COL0], 0.0, 0.0, 0.0, 0.0); /* Secondary color */ if (ctx->Light.Enabled || ctx->Fog.ColorSumEnabled) { - COPY_4V(span->attrStart[FRAG_ATTRIB_COL1], ctx->Current.RasterSecondaryColor); - ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0); - ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0); + COPY_4V(span->attrStart[VARYING_SLOT_COL1], ctx->Current.RasterSecondaryColor); + ASSIGN_4V(span->attrStepX[VARYING_SLOT_COL1], 0.0, 0.0, 0.0, 0.0); + ASSIGN_4V(span->attrStepY[VARYING_SLOT_COL1], 0.0, 0.0, 0.0, 0.0); } /* fog */ @@ -129,16 +129,16 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) /* fog blend factor should be computed from fogcoord now */ fogVal = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance); } - span->attrStart[FRAG_ATTRIB_FOGC][0] = fogVal; - span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0; - span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0; + span->attrStart[VARYING_SLOT_FOGC][0] = fogVal; + span->attrStepX[VARYING_SLOT_FOGC][0] = 0.0; + span->attrStepY[VARYING_SLOT_FOGC][0] = 0.0; } /* texcoords */ { GLuint i; for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { - const GLuint attr = FRAG_ATTRIB_TEX0 + i; + const GLuint attr = VARYING_SLOT_TEX0 + i; const GLfloat *tc = ctx->Current.RasterTexCoords[i]; if (_swrast_use_fragment_program(ctx) || ctx->ATIFragmentShader._Enabled) { @@ -165,7 +165,7 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) * Interpolate the active attributes (and'd with attrMask) to * fill in span->array->attribs[]. * Perspective correction will be done. The point/line/triangle function - * should have computed attrStart/Step values for FRAG_ATTRIB_WPOS[3]! + * should have computed attrStart/Step values for VARYING_SLOT_POS[3]! */ static inline void interpolate_active_attribs(struct gl_context *ctx, SWspan *span, @@ -181,8 +181,8 @@ interpolate_active_attribs(struct gl_context *ctx, SWspan *span, ATTRIB_LOOP_BEGIN if (attrMask & BITFIELD64_BIT(attr)) { - const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3]; + const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3]; + GLfloat w = span->attrStart[VARYING_SLOT_POS][3]; const GLfloat dv0dx = span->attrStepX[attr][0]; const GLfloat dv1dx = span->attrStepX[attr][1]; const GLfloat dv2dx = span->attrStepX[attr][2]; @@ -302,7 +302,7 @@ interpolate_int_colors(struct gl_context *ctx, SWspan *span) break; #endif case GL_FLOAT: - interpolate_active_attribs(ctx, span, FRAG_BIT_COL0); + interpolate_active_attribs(ctx, span, VARYING_BIT_COL0); break; default: _mesa_problem(ctx, "bad datatype 0x%x in interpolate_int_colors", @@ -313,16 +313,16 @@ interpolate_int_colors(struct gl_context *ctx, SWspan *span) /** - * Populate the FRAG_ATTRIB_COL0 array. + * Populate the VARYING_SLOT_COL0 array. */ static inline void interpolate_float_colors(SWspan *span) { - GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*col0)[4] = span->array->attribs[VARYING_SLOT_COL0]; const GLuint n = span->end; GLuint i; - assert(!(span->arrayAttribs & FRAG_BIT_COL0)); + assert(!(span->arrayAttribs & VARYING_BIT_COL0)); if (span->arrayMask & SPAN_RGBA) { /* convert array of int colors */ @@ -367,7 +367,7 @@ interpolate_float_colors(SWspan *span) } } - span->arrayAttribs |= FRAG_BIT_COL0; + span->arrayAttribs |= VARYING_BIT_COL0; span->array->ChanType = GL_FLOAT; } @@ -456,7 +456,7 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, /** - * Fill in the span.array->attrib[FRAG_ATTRIB_TEXn] arrays from the + * Fill in the span.array->attrib[VARYING_SLOT_TEXn] arrays from the * using the attrStart/Step values. * * This function only used during fixed-function fragment processing. @@ -476,7 +476,7 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) /* XXX CoordUnits vs. ImageUnits */ for (u = 0; u < maxUnit; u++) { if (ctx->Texture._EnabledCoordUnits & (1 << u)) { - const GLuint attr = FRAG_ATTRIB_TEX0 + u; + const GLuint attr = VARYING_SLOT_TEX0 + u; const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; GLfloat texW, texH; GLboolean needLambda; @@ -524,8 +524,8 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) if (_swrast_use_fragment_program(ctx) || ctx->ATIFragmentShader._Enabled) { /* do perspective correction but don't divide s, t, r by q */ - const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dwdx; + const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3]; + GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; @@ -565,8 +565,8 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) if (_swrast_use_fragment_program(ctx) || ctx->ATIFragmentShader._Enabled) { /* do perspective correction but don't divide s, t, r by q */ - const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dwdx; + const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3]; + GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; @@ -616,12 +616,12 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) /** - * Fill in the arrays->attribs[FRAG_ATTRIB_WPOS] array. + * Fill in the arrays->attribs[VARYING_SLOT_POS] array. */ static inline void interpolate_wpos(struct gl_context *ctx, SWspan *span) { - GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS]; + GLfloat (*wpos)[4] = span->array->attribs[VARYING_SLOT_POS]; GLuint i; const GLfloat zScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; GLfloat w, dw; @@ -639,8 +639,8 @@ interpolate_wpos(struct gl_context *ctx, SWspan *span) } } - dw = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dw; + dw = span->attrStepX[VARYING_SLOT_POS][3]; + w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dw; for (i = 0; i < span->end; i++) { wpos[i][2] = (GLfloat) span->array->z[i] * zScale; wpos[i][3] = w; @@ -764,7 +764,7 @@ clip_span( struct gl_context *ctx, SWspan *span ) * fragment attributes. * For arrays of values, shift them left. */ - for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { if (span->interpMask & (1 << i)) { GLuint j; for (j = 0; j < 4; j++) { @@ -785,7 +785,7 @@ clip_span( struct gl_context *ctx, SWspan *span ) #define SHIFT_ARRAY(ARRAY, SHIFT, LEN) \ memmove(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0])) - for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { if (span->arrayAttribs & (1 << i)) { /* shift array elements left by 'leftClip' */ SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip); @@ -825,41 +825,41 @@ clip_span( struct gl_context *ctx, SWspan *span ) /** * Add specular colors to primary colors. * Only called during fixed-function operation. - * Result is float color array (FRAG_ATTRIB_COL0). + * Result is float color array (VARYING_SLOT_COL0). */ static inline void add_specular(struct gl_context *ctx, SWspan *span) { const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLubyte *mask = span->array->mask; - GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; - GLfloat (*col1)[4] = span->array->attribs[FRAG_ATTRIB_COL1]; + GLfloat (*col0)[4] = span->array->attribs[VARYING_SLOT_COL0]; + GLfloat (*col1)[4] = span->array->attribs[VARYING_SLOT_COL1]; GLuint i; ASSERT(!_swrast_use_fragment_program(ctx)); ASSERT(span->arrayMask & SPAN_RGBA); - ASSERT(swrast->_ActiveAttribMask & FRAG_BIT_COL1); + ASSERT(swrast->_ActiveAttribMask & VARYING_BIT_COL1); (void) swrast; /* silence warning */ if (span->array->ChanType == GL_FLOAT) { - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { - interpolate_active_attribs(ctx, span, FRAG_BIT_COL0); + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { + interpolate_active_attribs(ctx, span, VARYING_BIT_COL0); } } else { /* need float colors */ - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { interpolate_float_colors(span); } } - if ((span->arrayAttribs & FRAG_BIT_COL1) == 0) { + if ((span->arrayAttribs & VARYING_BIT_COL1) == 0) { /* XXX could avoid this and interpolate COL1 in the loop below */ - interpolate_active_attribs(ctx, span, FRAG_BIT_COL1); + interpolate_active_attribs(ctx, span, VARYING_BIT_COL1); } - ASSERT(span->arrayAttribs & FRAG_BIT_COL0); - ASSERT(span->arrayAttribs & FRAG_BIT_COL1); + ASSERT(span->arrayAttribs & VARYING_BIT_COL0); + ASSERT(span->arrayAttribs & VARYING_BIT_COL1); for (i = 0; i < span->end; i++) { if (mask[i]) { @@ -898,7 +898,7 @@ apply_aa_coverage(SWspan *span) } } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; for (i = 0; i < span->end; i++) { rgba[i][ACOMP] = rgba[i][ACOMP] * coverage[i]; /* clamp later */ @@ -913,7 +913,7 @@ apply_aa_coverage(SWspan *span) static inline void clamp_colors(SWspan *span) { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; GLuint i; ASSERT(span->array->ChanType == GL_FLOAT); for (i = 0; i < span->end; i++) { @@ -937,7 +937,7 @@ convert_color_type(SWspan *span, GLenum newType, GLuint output) GLvoid *src, *dst; if (output > 0 || span->array->ChanType == GL_FLOAT) { - src = span->array->attribs[FRAG_ATTRIB_COL0 + output]; + src = span->array->attribs[VARYING_SLOT_COL0 + output]; span->array->ChanType = GL_FLOAT; } else if (span->array->ChanType == GL_UNSIGNED_BYTE) { @@ -955,7 +955,7 @@ convert_color_type(SWspan *span, GLenum newType, GLuint output) dst = span->array->rgba16; } else { - dst = span->array->attribs[FRAG_ATTRIB_COL0]; + dst = span->array->attribs[VARYING_SLOT_COL0]; } _mesa_convert_colors(span->array->ChanType, src, @@ -981,7 +981,7 @@ shade_texture_span(struct gl_context *ctx, SWspan *span) convert_color_type(span, GL_FLOAT, 0); } else { - span->array->rgba = (void *) span->array->attribs[FRAG_ATTRIB_COL0]; + span->array->rgba = (void *) span->array->attribs[VARYING_SLOT_COL0]; } if (span->primitive != GL_POINT || @@ -996,7 +996,7 @@ shade_texture_span(struct gl_context *ctx, SWspan *span) _swrast_span_interpolate_z (ctx, span); #if 0 - if (inputsRead & FRAG_BIT_WPOS) + if (inputsRead & VARYING_BIT_POS) #else /* XXX always interpolate wpos so that DDX/DDY work */ #endif @@ -1015,14 +1015,14 @@ shade_texture_span(struct gl_context *ctx, SWspan *span) /* conventional texturing */ #if CHAN_BITS == 32 - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { interpolate_int_colors(ctx, span); } #else if (!(span->arrayMask & SPAN_RGBA)) interpolate_int_colors(ctx, span); #endif - if ((span->arrayAttribs & FRAG_BITS_TEX_ANY) == 0x0) + if ((span->arrayAttribs & VARYING_BITS_TEX_ANY) == 0x0) interpolate_texcoords(ctx, span); _swrast_texture_span(ctx, span); @@ -1262,8 +1262,8 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span) } #if CHAN_BITS == 32 - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { - interpolate_active_attribs(ctx, span, FRAG_BIT_COL0); + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { + interpolate_active_attribs(ctx, span, VARYING_BIT_COL0); } #else if ((span->arrayMask & SPAN_RGBA) == 0) { @@ -1339,7 +1339,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span) } else { span->array->rgba = (void *) - span->array->attribs[FRAG_ATTRIB_COL0]; + span->array->attribs[VARYING_SLOT_COL0]; } } @@ -1574,7 +1574,7 @@ _swrast_get_dest_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, void *rbPixels; /* Point rbPixels to a temporary space */ - rbPixels = span->array->attribs[FRAG_ATTRIB_MAX - 1]; + rbPixels = span->array->attribs[VARYING_SLOT_MAX - 1]; /* Get destination values from renderbuffer */ if (span->arrayMask & SPAN_XY) { diff --git a/mesalib/src/mesa/swrast/s_span.h b/mesalib/src/mesa/swrast/s_span.h index 0763c7161..6f710c533 100644 --- a/mesalib/src/mesa/swrast/s_span.h +++ b/mesalib/src/mesa/swrast/s_span.h @@ -68,11 +68,11 @@ struct gl_renderbuffer; */ typedef struct sw_span_arrays { - /** Per-fragment attributes (indexed by FRAG_ATTRIB_* tokens) */ + /** Per-fragment attributes (indexed by VARYING_SLOT_* tokens) */ /* XXX someday look at transposing first two indexes for better memory * access pattern. */ - GLfloat attribs[FRAG_ATTRIB_MAX][SWRAST_MAX_WIDTH][4]; + GLfloat attribs[VARYING_SLOT_MAX][SWRAST_MAX_WIDTH][4]; /** This mask indicates which fragments are alive or culled */ GLubyte mask[SWRAST_MAX_WIDTH]; @@ -133,9 +133,9 @@ typedef struct sw_span GLbitfield interpMask; /** Fragment attribute interpolants */ - GLfloat attrStart[FRAG_ATTRIB_MAX][4]; /**< initial value */ - GLfloat attrStepX[FRAG_ATTRIB_MAX][4]; /**< dvalue/dx */ - GLfloat attrStepY[FRAG_ATTRIB_MAX][4]; /**< dvalue/dy */ + GLfloat attrStart[VARYING_SLOT_MAX][4]; /**< initial value */ + GLfloat attrStepX[VARYING_SLOT_MAX][4]; /**< dvalue/dx */ + GLfloat attrStepY[VARYING_SLOT_MAX][4]; /**< dvalue/dy */ /* XXX the rest of these will go away eventually... */ @@ -156,7 +156,7 @@ typedef struct sw_span */ GLbitfield arrayMask; - /** Mask of FRAG_BIT_x bits */ + /** Mask of VARYING_BIT_x bits */ GLbitfield64 arrayAttribs; /** diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c index 1a2db35e2..c24807cb7 100644 --- a/mesalib/src/mesa/swrast/s_texcombine.c +++ b/mesalib/src/mesa/swrast/s_texcombine.c @@ -648,9 +648,9 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) if (texUnit->_ReallyEnabled && texUnit->_CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) { const GLfloat (*texcoords)[4] = (const GLfloat (*)[4]) - span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; + span->array->attribs[VARYING_SLOT_TEX0 + unit]; float4_array targetcoords = - span->array->attribs[FRAG_ATTRIB_TEX0 + + span->array->attribs[VARYING_SLOT_TEX0 + ctx->Texture.Unit[unit].BumpTarget - GL_TEXTURE0]; const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit); @@ -714,7 +714,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) if (texUnit->_ReallyEnabled && texUnit->_CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) { const GLfloat (*texcoords)[4] = (const GLfloat (*)[4]) - span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; + span->array->attribs[VARYING_SLOT_TEX0 + unit]; const struct gl_texture_object *curObj = texUnit->_Current; const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit); GLfloat *lambda = span->array->lambda[unit]; diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c index 953300f65..ae3ffe5f4 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.c +++ b/mesalib/src/mesa/swrast/s_texfilter.c @@ -1880,7 +1880,7 @@ sample_lambda_2d_aniso(struct gl_context *ctx, * from the context list of available texture objects. */ const GLuint u = texture_unit_index(ctx, tObj); - const GLuint attr = FRAG_ATTRIB_TEX0 + u; + const GLuint attr = VARYING_SLOT_TEX0 + u; GLfloat texW, texH; const GLfloat dsdx = span->attrStepX[attr][0]; diff --git a/mesalib/src/mesa/swrast/s_triangle.c b/mesalib/src/mesa/swrast/s_triangle.c index 893859db0..f0b1d383d 100644 --- a/mesalib/src/mesa/swrast/s_triangle.c +++ b/mesalib/src/mesa/swrast/s_triangle.c @@ -57,10 +57,10 @@ _swrast_culltriangle( struct gl_context *ctx, const SWvertex *v2 ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLfloat ex = v1->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat ey = v1->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat fx = v2->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat fy = v2->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat ex = v1->attrib[VARYING_SLOT_POS][0] - v0->attrib[VARYING_SLOT_POS][0]; + GLfloat ey = v1->attrib[VARYING_SLOT_POS][1] - v0->attrib[VARYING_SLOT_POS][1]; + GLfloat fx = v2->attrib[VARYING_SLOT_POS][0] - v0->attrib[VARYING_SLOT_POS][0]; + GLfloat fy = v2->attrib[VARYING_SLOT_POS][1] - v0->attrib[VARYING_SLOT_POS][1]; GLfloat c = ex*fy-ey*fx; if (c * swrast->_BackfaceSign * swrast->_BackfaceCullSign <= 0.0F) @@ -678,13 +678,13 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, const GLuint texEnableSave = ctx->Texture._EnabledCoordUnits; ctx->Texture._EnabledCoordUnits = 0; - tex_coord[0] = span->attrStart[FRAG_ATTRIB_TEX0][0] * (info->smask + 1); - tex_step[0] = span->attrStepX[FRAG_ATTRIB_TEX0][0] * (info->smask + 1); - tex_coord[1] = span->attrStart[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1); - tex_step[1] = span->attrStepX[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1); - /* span->attrStart[FRAG_ATTRIB_TEX0][2] only if 3D-texturing, here only 2D */ - tex_coord[2] = span->attrStart[FRAG_ATTRIB_TEX0][3]; - tex_step[2] = span->attrStepX[FRAG_ATTRIB_TEX0][3]; + tex_coord[0] = span->attrStart[VARYING_SLOT_TEX0][0] * (info->smask + 1); + tex_step[0] = span->attrStepX[VARYING_SLOT_TEX0][0] * (info->smask + 1); + tex_coord[1] = span->attrStart[VARYING_SLOT_TEX0][1] * (info->tmask + 1); + tex_step[1] = span->attrStepX[VARYING_SLOT_TEX0][1] * (info->tmask + 1); + /* span->attrStart[VARYING_SLOT_TEX0][2] only if 3D-texturing, here only 2D */ + tex_coord[2] = span->attrStart[VARYING_SLOT_TEX0][3]; + tex_step[2] = span->attrStepX[VARYING_SLOT_TEX0][3]; switch (info->filter) { case GL_NEAREST: @@ -939,23 +939,23 @@ _swrast_add_spec_terms_triangle(struct gl_context *ctx, const SWvertex *v0, COPY_CHAN4( cSave[1], ncv1->color ); COPY_CHAN4( cSave[2], ncv2->color ); /* sum v0 */ - rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum); /* sum v1 */ - rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[2], bSum); /* sum v2 */ - rSum = CHAN_TO_FLOAT(ncv2->color[0]) + ncv2->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv2->color[1]) + ncv2->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv2->color[2]) + ncv2->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv2->color[0]) + ncv2->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv2->color[1]) + ncv2->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv2->color[2]) + ncv2->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[2], bSum); diff --git a/mesalib/src/mesa/swrast/s_tritemp.h b/mesalib/src/mesa/swrast/s_tritemp.h index 061759d26..797afc41a 100644 --- a/mesalib/src/mesa/swrast/s_tritemp.h +++ b/mesalib/src/mesa/swrast/s_tritemp.h @@ -153,26 +153,26 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, /* printf("%s()\n", __FUNCTION__); printf(" %g, %g, %g\n", - v0->attrib[FRAG_ATTRIB_WPOS][0], - v0->attrib[FRAG_ATTRIB_WPOS][1], - v0->attrib[FRAG_ATTRIB_WPOS][2]); + v0->attrib[VARYING_SLOT_POS][0], + v0->attrib[VARYING_SLOT_POS][1], + v0->attrib[VARYING_SLOT_POS][2]); printf(" %g, %g, %g\n", - v1->attrib[FRAG_ATTRIB_WPOS][0], - v1->attrib[FRAG_ATTRIB_WPOS][1], - v1->attrib[FRAG_ATTRIB_WPOS][2]); + v1->attrib[VARYING_SLOT_POS][0], + v1->attrib[VARYING_SLOT_POS][1], + v1->attrib[VARYING_SLOT_POS][2]); printf(" %g, %g, %g\n", - v2->attrib[FRAG_ATTRIB_WPOS][0], - v2->attrib[FRAG_ATTRIB_WPOS][1], - v2->attrib[FRAG_ATTRIB_WPOS][2]); + v2->attrib[VARYING_SLOT_POS][0], + v2->attrib[VARYING_SLOT_POS][1], + v2->attrib[VARYING_SLOT_POS][2]); */ /* Compute fixed point x,y coords w/ half-pixel offsets and snapping. * And find the order of the 3 vertices along the Y axis. */ { - const GLfixed fy0 = FloatToFixed(v0->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask; - const GLfixed fy1 = FloatToFixed(v1->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask; - const GLfixed fy2 = FloatToFixed(v2->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask; + const GLfixed fy0 = FloatToFixed(v0->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask; + const GLfixed fy1 = FloatToFixed(v1->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask; + const GLfixed fy2 = FloatToFixed(v2->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask; if (fy0 <= fy1) { if (fy1 <= fy2) { /* y0 <= y1 <= y2 */ @@ -212,9 +212,9 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, } /* fixed point X coords */ - vMin_fx = FloatToFixed(vMin->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask; - vMid_fx = FloatToFixed(vMid->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask; - vMax_fx = FloatToFixed(vMax->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask; + vMin_fx = FloatToFixed(vMin->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask; + vMid_fx = FloatToFixed(vMid->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask; + vMax_fx = FloatToFixed(vMax->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask; } /* vertex/edge relationship */ @@ -333,22 +333,22 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_Z span.interpMask |= SPAN_Z; { - GLfloat eMaj_dz = vMax->attrib[FRAG_ATTRIB_WPOS][2] - vMin->attrib[FRAG_ATTRIB_WPOS][2]; - GLfloat eBot_dz = vMid->attrib[FRAG_ATTRIB_WPOS][2] - vMin->attrib[FRAG_ATTRIB_WPOS][2]; - span.attrStepX[FRAG_ATTRIB_WPOS][2] = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz); - if (span.attrStepX[FRAG_ATTRIB_WPOS][2] > maxDepth || - span.attrStepX[FRAG_ATTRIB_WPOS][2] < -maxDepth) { + GLfloat eMaj_dz = vMax->attrib[VARYING_SLOT_POS][2] - vMin->attrib[VARYING_SLOT_POS][2]; + GLfloat eBot_dz = vMid->attrib[VARYING_SLOT_POS][2] - vMin->attrib[VARYING_SLOT_POS][2]; + span.attrStepX[VARYING_SLOT_POS][2] = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz); + if (span.attrStepX[VARYING_SLOT_POS][2] > maxDepth || + span.attrStepX[VARYING_SLOT_POS][2] < -maxDepth) { /* probably a sliver triangle */ - span.attrStepX[FRAG_ATTRIB_WPOS][2] = 0.0; - span.attrStepY[FRAG_ATTRIB_WPOS][2] = 0.0; + span.attrStepX[VARYING_SLOT_POS][2] = 0.0; + span.attrStepY[VARYING_SLOT_POS][2] = 0.0; } else { - span.attrStepY[FRAG_ATTRIB_WPOS][2] = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx); + span.attrStepY[VARYING_SLOT_POS][2] = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx); } if (depthBits <= 16) - span.zStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_WPOS][2]); + span.zStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_POS][2]); else - span.zStep = (GLint) span.attrStepX[FRAG_ATTRIB_WPOS][2]; + span.zStep = (GLint) span.attrStepX[VARYING_SLOT_POS][2]; } #endif #ifdef INTERP_RGB @@ -364,61 +364,61 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, GLfloat eMaj_da = (GLfloat) (vMax->color[ACOMP] - vMin->color[ACOMP]); GLfloat eBot_da = (GLfloat) (vMid->color[ACOMP] - vMin->color[ACOMP]); # endif - span.attrStepX[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); - span.attrStepY[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); - span.attrStepX[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); - span.attrStepY[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); - span.attrStepX[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); - span.attrStepY[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); - span.redStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][0]); - span.greenStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][1]); - span.blueStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][2]); + span.attrStepX[VARYING_SLOT_COL0][0] = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); + span.attrStepY[VARYING_SLOT_COL0][0] = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); + span.attrStepX[VARYING_SLOT_COL0][1] = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); + span.attrStepY[VARYING_SLOT_COL0][1] = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); + span.attrStepX[VARYING_SLOT_COL0][2] = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); + span.attrStepY[VARYING_SLOT_COL0][2] = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); + span.redStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][0]); + span.greenStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][1]); + span.blueStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][2]); # ifdef INTERP_ALPHA - span.attrStepX[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); - span.attrStepY[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); - span.alphaStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][3]); + span.attrStepX[VARYING_SLOT_COL0][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); + span.attrStepY[VARYING_SLOT_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); + span.alphaStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][3]); # endif /* INTERP_ALPHA */ } else { ASSERT(ctx->Light.ShadeModel == GL_FLAT); span.interpMask |= SPAN_FLAT; - span.attrStepX[FRAG_ATTRIB_COL0][0] = span.attrStepY[FRAG_ATTRIB_COL0][0] = 0.0F; - span.attrStepX[FRAG_ATTRIB_COL0][1] = span.attrStepY[FRAG_ATTRIB_COL0][1] = 0.0F; - span.attrStepX[FRAG_ATTRIB_COL0][2] = span.attrStepY[FRAG_ATTRIB_COL0][2] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][0] = span.attrStepY[VARYING_SLOT_COL0][0] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][1] = span.attrStepY[VARYING_SLOT_COL0][1] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][2] = span.attrStepY[VARYING_SLOT_COL0][2] = 0.0F; span.redStep = 0; span.greenStep = 0; span.blueStep = 0; # ifdef INTERP_ALPHA - span.attrStepX[FRAG_ATTRIB_COL0][3] = span.attrStepY[FRAG_ATTRIB_COL0][3] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][3] = span.attrStepY[VARYING_SLOT_COL0][3] = 0.0F; span.alphaStep = 0; # endif } #endif /* INTERP_RGB */ #ifdef INTERP_INT_TEX { - GLfloat eMaj_ds = (vMax->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE; - GLfloat eBot_ds = (vMid->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE; - GLfloat eMaj_dt = (vMax->attrib[FRAG_ATTRIB_TEX0][1] - vMin->attrib[FRAG_ATTRIB_TEX0][1]) * T_SCALE; - GLfloat eBot_dt = (vMid->attrib[FRAG_ATTRIB_TEX0][1] - vMin->attrib[FRAG_ATTRIB_TEX0][1]) * T_SCALE; - span.attrStepX[FRAG_ATTRIB_TEX0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); - span.attrStepY[FRAG_ATTRIB_TEX0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); - span.attrStepX[FRAG_ATTRIB_TEX0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); - span.attrStepY[FRAG_ATTRIB_TEX0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); - span.intTexStep[0] = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_TEX0][0]); - span.intTexStep[1] = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_TEX0][1]); + GLfloat eMaj_ds = (vMax->attrib[VARYING_SLOT_TEX0][0] - vMin->attrib[VARYING_SLOT_TEX0][0]) * S_SCALE; + GLfloat eBot_ds = (vMid->attrib[VARYING_SLOT_TEX0][0] - vMin->attrib[VARYING_SLOT_TEX0][0]) * S_SCALE; + GLfloat eMaj_dt = (vMax->attrib[VARYING_SLOT_TEX0][1] - vMin->attrib[VARYING_SLOT_TEX0][1]) * T_SCALE; + GLfloat eBot_dt = (vMid->attrib[VARYING_SLOT_TEX0][1] - vMin->attrib[VARYING_SLOT_TEX0][1]) * T_SCALE; + span.attrStepX[VARYING_SLOT_TEX0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); + span.attrStepY[VARYING_SLOT_TEX0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); + span.attrStepX[VARYING_SLOT_TEX0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); + span.attrStepY[VARYING_SLOT_TEX0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); + span.intTexStep[0] = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_TEX0][0]); + span.intTexStep[1] = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_TEX0][1]); } #endif #ifdef INTERP_ATTRIBS { - /* attrib[FRAG_ATTRIB_WPOS][3] is 1/W */ - const GLfloat wMax = vMax->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat wMin = vMin->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat wMid = vMid->attrib[FRAG_ATTRIB_WPOS][3]; + /* attrib[VARYING_SLOT_POS][3] is 1/W */ + const GLfloat wMax = vMax->attrib[VARYING_SLOT_POS][3]; + const GLfloat wMin = vMin->attrib[VARYING_SLOT_POS][3]; + const GLfloat wMid = vMid->attrib[VARYING_SLOT_POS][3]; { const GLfloat eMaj_dw = wMax - wMin; const GLfloat eBot_dw = wMid - wMin; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw); - span.attrStepY[FRAG_ATTRIB_WPOS][3] = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx); + span.attrStepX[VARYING_SLOT_POS][3] = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw); + span.attrStepY[VARYING_SLOT_POS][3] = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx); } ATTRIB_LOOP_BEGIN if (swrast->_InterpMode[attr] == GL_FLAT) { @@ -518,8 +518,8 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #endif #ifdef INTERP_ATTRIBS GLfloat wLeft = 0, dwOuter = 0, dwInner; - GLfloat attrLeft[FRAG_ATTRIB_MAX][4]; - GLfloat daOuter[FRAG_ATTRIB_MAX][4], daInner[FRAG_ATTRIB_MAX][4]; + GLfloat attrLeft[VARYING_SLOT_MAX][4]; + GLfloat daOuter[VARYING_SLOT_MAX][4], daInner[VARYING_SLOT_MAX][4]; #endif for (subTriangle=0; subTriangle<=1; subTriangle++) { @@ -609,25 +609,25 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_Z { - GLfloat z0 = vLower->attrib[FRAG_ATTRIB_WPOS][2]; + GLfloat z0 = vLower->attrib[VARYING_SLOT_POS][2]; if (depthBits <= 16) { /* interpolate fixed-pt values */ GLfloat tmp = (z0 * FIXED_SCALE - + span.attrStepX[FRAG_ATTRIB_WPOS][2] * adjx - + span.attrStepY[FRAG_ATTRIB_WPOS][2] * adjy) + FIXED_HALF; + + span.attrStepX[VARYING_SLOT_POS][2] * adjx + + span.attrStepY[VARYING_SLOT_POS][2] * adjy) + FIXED_HALF; if (tmp < MAX_GLUINT / 2) zLeft = (GLfixed) tmp; else zLeft = MAX_GLUINT / 2; - fdzOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_WPOS][2] + - dxOuter * span.attrStepX[FRAG_ATTRIB_WPOS][2]); + fdzOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_POS][2] + + dxOuter * span.attrStepX[VARYING_SLOT_POS][2]); } else { /* interpolate depth values w/out scaling */ - zLeft = (GLuint) (z0 + span.attrStepX[FRAG_ATTRIB_WPOS][2] * FixedToFloat(adjx) - + span.attrStepY[FRAG_ATTRIB_WPOS][2] * FixedToFloat(adjy)); - fdzOuter = (GLint) (span.attrStepY[FRAG_ATTRIB_WPOS][2] + - dxOuter * span.attrStepX[FRAG_ATTRIB_WPOS][2]); + zLeft = (GLuint) (z0 + span.attrStepX[VARYING_SLOT_POS][2] * FixedToFloat(adjx) + + span.attrStepY[VARYING_SLOT_POS][2] * FixedToFloat(adjy)); + fdzOuter = (GLint) (span.attrStepY[VARYING_SLOT_POS][2] + + dxOuter * span.attrStepX[VARYING_SLOT_POS][2]); } # ifdef DEPTH_TYPE zRow = (DEPTH_TYPE *) @@ -639,26 +639,26 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_RGB if (ctx->Light.ShadeModel == GL_SMOOTH) { rLeft = (GLint)(ChanToFixed(vLower->color[RCOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][0] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][0] * adjy) + FIXED_HALF; + + span.attrStepX[VARYING_SLOT_COL0][0] * adjx + + span.attrStepY[VARYING_SLOT_COL0][0] * adjy) + FIXED_HALF; gLeft = (GLint)(ChanToFixed(vLower->color[GCOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][1] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][1] * adjy) + FIXED_HALF; + + span.attrStepX[VARYING_SLOT_COL0][1] * adjx + + span.attrStepY[VARYING_SLOT_COL0][1] * adjy) + FIXED_HALF; bLeft = (GLint)(ChanToFixed(vLower->color[BCOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][2] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][2] * adjy) + FIXED_HALF; - fdrOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][0] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][0]); - fdgOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][1] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][1]); - fdbOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][2] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][2]); + + span.attrStepX[VARYING_SLOT_COL0][2] * adjx + + span.attrStepY[VARYING_SLOT_COL0][2] * adjy) + FIXED_HALF; + fdrOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][0] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][0]); + fdgOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][1] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][1]); + fdbOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][2] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][2]); # ifdef INTERP_ALPHA aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][3] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][3] * adjy) + FIXED_HALF; - fdaOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][3] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3]); + + span.attrStepX[VARYING_SLOT_COL0][3] * adjx + + span.attrStepY[VARYING_SLOT_COL0][3] * adjy) + FIXED_HALF; + fdaOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][3] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][3]); # endif } else { @@ -678,29 +678,29 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_INT_TEX { GLfloat s0, t0; - s0 = vLower->attrib[FRAG_ATTRIB_TEX0][0] * S_SCALE; - sLeft = (GLfixed)(s0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][0] * adjx - + span.attrStepY[FRAG_ATTRIB_TEX0][0] * adjy) + FIXED_HALF; - dsOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][0] - + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][0]); - - t0 = vLower->attrib[FRAG_ATTRIB_TEX0][1] * T_SCALE; - tLeft = (GLfixed)(t0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][1] * adjx - + span.attrStepY[FRAG_ATTRIB_TEX0][1] * adjy) + FIXED_HALF; - dtOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][1] - + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][1]); + s0 = vLower->attrib[VARYING_SLOT_TEX0][0] * S_SCALE; + sLeft = (GLfixed)(s0 * FIXED_SCALE + span.attrStepX[VARYING_SLOT_TEX0][0] * adjx + + span.attrStepY[VARYING_SLOT_TEX0][0] * adjy) + FIXED_HALF; + dsOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_TEX0][0] + + dxOuter * span.attrStepX[VARYING_SLOT_TEX0][0]); + + t0 = vLower->attrib[VARYING_SLOT_TEX0][1] * T_SCALE; + tLeft = (GLfixed)(t0 * FIXED_SCALE + span.attrStepX[VARYING_SLOT_TEX0][1] * adjx + + span.attrStepY[VARYING_SLOT_TEX0][1] * adjy) + FIXED_HALF; + dtOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_TEX0][1] + + dxOuter * span.attrStepX[VARYING_SLOT_TEX0][1]); } #endif #ifdef INTERP_ATTRIBS { - const GLuint attr = FRAG_ATTRIB_WPOS; - wLeft = vLower->attrib[FRAG_ATTRIB_WPOS][3] + const GLuint attr = VARYING_SLOT_POS; + wLeft = vLower->attrib[VARYING_SLOT_POS][3] + (span.attrStepX[attr][3] * adjx + span.attrStepY[attr][3] * adjy) * (1.0F/FIXED_SCALE); dwOuter = span.attrStepY[attr][3] + dxOuter * span.attrStepX[attr][3]; } ATTRIB_LOOP_BEGIN - const GLfloat invW = vLower->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invW = vLower->attrib[VARYING_SLOT_POS][3]; if (swrast->_InterpMode[attr] == GL_FLAT) { GLuint c; for (c = 0; c < 4; c++) { @@ -755,7 +755,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, dtInner = dtOuter + span.intTexStep[1]; #endif #ifdef INTERP_ATTRIBS - dwInner = dwOuter + span.attrStepX[FRAG_ATTRIB_WPOS][3]; + dwInner = dwOuter + span.attrStepX[VARYING_SLOT_POS][3]; ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { @@ -791,7 +791,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #endif #ifdef INTERP_ATTRIBS - span.attrStart[FRAG_ATTRIB_WPOS][3] = wLeft; + span.attrStart[VARYING_SLOT_POS][3] = wLeft; ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { diff --git a/mesalib/src/mesa/swrast/s_zoom.c b/mesalib/src/mesa/swrast/s_zoom.c index 828374f68..3b309a251 100644 --- a/mesalib/src/mesa/swrast/s_zoom.c +++ b/mesalib/src/mesa/swrast/s_zoom.c @@ -166,15 +166,15 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, else if (zoomed.array->ChanType == GL_UNSIGNED_SHORT) zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->rgba16; else - zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->attribs[FRAG_ATTRIB_COL0]; + zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->attribs[VARYING_SLOT_COL0]; - COPY_4V(zoomed.attrStart[FRAG_ATTRIB_WPOS], span->attrStart[FRAG_ATTRIB_WPOS]); - COPY_4V(zoomed.attrStepX[FRAG_ATTRIB_WPOS], span->attrStepX[FRAG_ATTRIB_WPOS]); - COPY_4V(zoomed.attrStepY[FRAG_ATTRIB_WPOS], span->attrStepY[FRAG_ATTRIB_WPOS]); + COPY_4V(zoomed.attrStart[VARYING_SLOT_POS], span->attrStart[VARYING_SLOT_POS]); + COPY_4V(zoomed.attrStepX[VARYING_SLOT_POS], span->attrStepX[VARYING_SLOT_POS]); + COPY_4V(zoomed.attrStepY[VARYING_SLOT_POS], span->attrStepY[VARYING_SLOT_POS]); - zoomed.attrStart[FRAG_ATTRIB_FOGC][0] = span->attrStart[FRAG_ATTRIB_FOGC][0]; - zoomed.attrStepX[FRAG_ATTRIB_FOGC][0] = span->attrStepX[FRAG_ATTRIB_FOGC][0]; - zoomed.attrStepY[FRAG_ATTRIB_FOGC][0] = span->attrStepY[FRAG_ATTRIB_FOGC][0]; + zoomed.attrStart[VARYING_SLOT_FOGC][0] = span->attrStart[VARYING_SLOT_FOGC][0]; + zoomed.attrStepX[VARYING_SLOT_FOGC][0] = span->attrStepX[VARYING_SLOT_FOGC][0]; + zoomed.attrStepY[VARYING_SLOT_FOGC][0] = span->attrStepY[VARYING_SLOT_FOGC][0]; if (format == GL_RGBA || format == GL_RGB) { /* copy Z info */ @@ -183,7 +183,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, /* we'll generate an array of colorss */ zoomed.interpMask = span->interpMask & ~SPAN_RGBA; zoomed.arrayMask |= SPAN_RGBA; - zoomed.arrayAttribs |= FRAG_BIT_COL0; /* we'll produce these values */ + zoomed.arrayAttribs |= VARYING_BIT_COL0; /* we'll produce these values */ ASSERT(span->arrayMask & SPAN_RGBA); } else if (format == GL_DEPTH_COMPONENT) { @@ -235,7 +235,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x; ASSERT(j >= 0); ASSERT(j < (GLint) span->end); - COPY_4V(zoomed.array->attribs[FRAG_ATTRIB_COL0][i], rgba[j]); + COPY_4V(zoomed.array->attribs[VARYING_SLOT_COL0][i], rgba[j]); } } } @@ -273,10 +273,10 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x; ASSERT(j >= 0); ASSERT(j < (GLint) span->end); - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][0] = rgb[j][0]; - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][1] = rgb[j][1]; - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][2] = rgb[j][2]; - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][3] = 1.0F; + zoomed.array->attribs[VARYING_SLOT_COL0][i][0] = rgb[j][0]; + zoomed.array->attribs[VARYING_SLOT_COL0][i][1] = rgb[j][1]; + zoomed.array->attribs[VARYING_SLOT_COL0][i][2] = rgb[j][2]; + zoomed.array->attribs[VARYING_SLOT_COL0][i][3] = 1.0F; } } } diff --git a/mesalib/src/mesa/swrast/swrast.h b/mesalib/src/mesa/swrast/swrast.h index 97cc5ee63..82555ae6a 100644 --- a/mesalib/src/mesa/swrast/swrast.h +++ b/mesalib/src/mesa/swrast/swrast.h @@ -74,7 +74,7 @@ * improve its usefulness as a fallback mechanism for hardware * drivers. * - * wpos = attr[FRAG_ATTRIB_WPOS] and MUST BE THE FIRST values in the + * wpos = attr[VARYING_SLOT_POS] and MUST BE THE FIRST values in the * vertex because of the tnl clipping code. * wpos[0] and [1] are the screen-coords of SWvertex. @@ -98,13 +98,13 @@ * primitives unaccelerated), hook in swrast_setup instead. */ typedef struct { - GLfloat attrib[FRAG_ATTRIB_MAX][4]; + GLfloat attrib[VARYING_SLOT_MAX][4]; GLchan color[4]; /** integer color */ GLfloat pointSize; } SWvertex; -#define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0 +#define VARYING_SLOT_CI VARYING_SLOT_COL0 struct swrast_device_driver; |