X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fswrast%2Fs_aaline.c;h=03f8fd93b9c5c29383254647dee9bcaafb7e4dac;hb=b85775900d084e3d27f269c3bd336b9aa356b98d;hp=65b9af06affd9c3d3081a0ac27fb6bff18ee2224;hpb=dbf3a15313eed930a3d8fdde12e457259c43651b;p=mesa.git diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c index 65b9af06aff..03f8fd93b9c 100644 --- a/src/mesa/swrast/s_aaline.c +++ b/src/mesa/swrast/s_aaline.c @@ -1,6 +1,5 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -17,16 +16,18 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ +#include "c99_math.h" #include "main/glheader.h" -#include "main/imports.h" #include "main/macros.h" #include "main/mtypes.h" +#include "main/teximage.h" #include "swrast/s_aaline.h" #include "swrast/s_context.h" #include "swrast/s_span.h" @@ -63,10 +64,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; }; @@ -114,11 +115,11 @@ compute_plane(GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, const GLfloat b = pz * py; const GLfloat c = px * px + py * py; const GLfloat d = -(a * x0 + b * y0 + c * z0); - if (a == 0.0 && b == 0.0 && c == 0.0 && d == 0.0) { - plane[0] = 0.0; - plane[1] = 0.0; - plane[2] = 1.0; - plane[3] = 0.0; + if (a == 0.0F && b == 0.0F && c == 0.0F && d == 0.0F) { + plane[0] = 0.0F; + plane[1] = 0.0F; + plane[2] = 1.0F; + plane[3] = 0.0F; } else { plane[0] = a; @@ -130,17 +131,17 @@ compute_plane(GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, } -static INLINE void +static inline void constant_plane(GLfloat value, GLfloat plane[4]) { - plane[0] = 0.0; - plane[1] = 0.0; - plane[2] = -1.0; + plane[0] = 0.0F; + plane[1] = 0.0F; + plane[2] = -1.0F; plane[3] = value; } -static INLINE GLfloat +static inline GLfloat solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4]) { const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; @@ -154,12 +155,12 @@ solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4]) /* * Return 1 / solve_plane(). */ -static INLINE GLfloat +static inline GLfloat solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) { const GLfloat denom = plane[3] + plane[0] * x + plane[1] * y; - if (denom == 0.0) - return 0.0; + if (denom == 0.0F) + return 0.0F; else return -plane[2] / denom; } @@ -168,7 +169,7 @@ solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) /* * Solve plane and return clamped GLchan value. */ -static INLINE GLchan +static inline GLchan solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4]) { const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; @@ -179,7 +180,7 @@ solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4]) return 0; else if (z > CHAN_MAX) return CHAN_MAX; - return (GLchan) IROUND_POS(z); + return (GLchan) lroundf(z); #endif } @@ -187,7 +188,7 @@ solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4]) /* * Compute mipmap level of detail. */ -static INLINE GLfloat +static inline GLfloat compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], GLfloat invQ, GLfloat width, GLfloat height) { @@ -202,7 +203,7 @@ compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], if (rho2 == 0.0F) return 0.0; else - return (GLfloat) (LOGF(rho2) * 1.442695 * 0.5);/* 1.442695 = 1/log(2) */ + return logf(rho2) * 1.442695f * 0.5f;/* 1.442695 = 1/log(2) */ } @@ -325,7 +326,7 @@ compute_coveragef(const struct LineInfo *info, typedef void (*plot_func)(struct gl_context *ctx, struct LineInfo *line, int ix, int iy); - + /* @@ -372,7 +373,7 @@ segment(struct gl_context *ctx, if (x0 < x1) { xLeft = x0 - line->halfWidth; xRight = x1 + line->halfWidth; - if (line->dy >= 0.0) { + if (line->dy >= 0.0F) { yBot = y0 - 3.0F * line->halfWidth; yTop = y0 + line->halfWidth; } @@ -384,7 +385,7 @@ segment(struct gl_context *ctx, else { xLeft = x1 - line->halfWidth; xRight = x0 + line->halfWidth; - if (line->dy <= 0.0) { + if (line->dy <= 0.0F) { yBot = y1 - 3.0F * line->halfWidth; yTop = y1 + line->halfWidth; } @@ -404,7 +405,7 @@ segment(struct gl_context *ctx, GLint iy; /* scan across the line, bottom-to-top */ for (iy = iyBot; iy < iyTop; iy++) { - (*plot)(ctx, line, ix, iy); + plot(ctx, line, ix, iy); } yBot += dydx; yTop += dydx; @@ -418,7 +419,7 @@ segment(struct gl_context *ctx, if (y0 < y1) { yBot = y0 - line->halfWidth; yTop = y1 + line->halfWidth; - if (line->dx >= 0.0) { + if (line->dx >= 0.0F) { xLeft = x0 - 3.0F * line->halfWidth; xRight = x0 + line->halfWidth; } @@ -430,7 +431,7 @@ segment(struct gl_context *ctx, else { yBot = y1 - line->halfWidth; yTop = y0 + line->halfWidth; - if (line->dx <= 0.0) { + if (line->dx <= 0.0F) { xLeft = x1 - 3.0F * line->halfWidth; xRight = x1 + line->halfWidth; } @@ -450,7 +451,7 @@ segment(struct gl_context *ctx, GLint ix; /* scan across the line, left-to-right */ for (ix = ixLeft; ix < ixRight; ix++) { - (*plot)(ctx, line, ix, iy); + plot(ctx, line, ix, iy); } xLeft += dxdy; xRight += dxdy; @@ -476,10 +477,10 @@ _swrast_choose_aa_line_function(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - ASSERT(ctx->Line.SmoothFlag); + assert(ctx->Line.SmoothFlag); if (ctx->Texture._EnabledCoordUnits != 0 - || ctx->FragmentProgram._Current + || _swrast_use_fragment_program(ctx) || (ctx->Light.Enabled && ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) || ctx->Fog.ColorSumEnabled