color masking correctly implemented for 15bpp.
small fixes for textures and tri engine.
*/
static void fxDisableColor (fxMesaContext fxMesa)
{
- if (fxMesa->colDepth != 16) {
- /* 32bpp mode or 15bpp mode */
+ if (fxMesa->colDepth == 32) {
+ /* 32bpp mode */
fxMesa->Glide.grColorMaskExt(FXFALSE, FXFALSE, FXFALSE, FXFALSE);
} else {
- /* 16 bpp mode */
+ /* 15/16 bpp mode */
grColorMask(FXFALSE, FXFALSE);
}
}
/*
* As per GL spec, color masking should be obeyed when clearing
*/
- if (ctx->Visual.greenBits != 8 && ctx->Visual.greenBits != 5) {
+ if (ctx->Visual.greenBits != 8) {
/* can only do color masking if running in 24/32bpp on Napalm */
if (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] ||
ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]) {
ctx->Pixel.ZoomY != 1.0F ||
(ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT|
IMAGE_MAP_COLOR_BIT)) ||
- ctx->Color.AlphaEnabled ||
+ /*ctx->Color.AlphaEnabled ||*/
ctx->Depth.Test ||
ctx->Fog.Enabled ||
ctx->Scissor.Enabled ||
ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
+ /*!ctx->Color.ColorMask[0] ||
!ctx->Color.ColorMask[1] ||
!ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
+ !ctx->Color.ColorMask[3] ||*/
ctx->Color.ColorLogicOpEnabled ||
ctx->Texture._EnabledUnits ||
ctx->Depth.OcclusionTest ||
fxMesa->unitsState.stencilWriteMask = 0xff;
- if (fxMesa->colDepth != 16) {
- /* 32bpp mode or 15bpp mode */
+ if (fxMesa->colDepth == 32) {
+ /* 32bpp */
fxMesa->Glide.grColorMaskExt(FXTRUE, FXTRUE, FXTRUE, fxMesa->haveHwAlpha);
} else {
- /* 16 bpp mode */
+ /* 15/16 bpp mode */
grColorMask(FXTRUE, fxMesa->haveHwAlpha);
}
textureLevels++;
} while ((textureSize >>= 0x1) & 0x7ff);
ctx->Const.MaxTextureLevels = textureLevels;
+ ctx->Const.MaxTextureLodBias = /*textureLevels - 1*/8; /* Glide bug */
#if FX_RESCALE_BIG_TEXURES_HACK
fxMesa->textureMaxLod = textureLevels - 1;
if ((env = getenv("MESA_FX_MAXLOD")) != NULL) {
_mesa_enable_extension(ctx, "GL_EXT_secondary_color");
#endif
+ _mesa_enable_extension(ctx, "GL_ARB_point_sprite");
_mesa_enable_extension(ctx, "GL_EXT_point_parameters");
_mesa_enable_extension(ctx, "GL_EXT_paletted_texture");
_mesa_enable_extension(ctx, "GL_EXT_texture_lod_bias");
}
#endif
- if ((fxMesa->colDepth == 16) &&
+ if ((fxMesa->colDepth != 32) &&
((ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP]) ||
(ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]))) {
return FX_FALLBACK_COLORMASK;
/* apply any lod biasing right now */
if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
GLfloat bias = *param;
- CLAMP_SELF(bias, -8.0, 7.75);
-
+ CLAMP_SELF(bias, -ctx->Const.MaxTextureLodBias,
+ ctx->Const.MaxTextureLodBias - 0.25);
+
grTexLodBiasValue(GR_TMU0, bias);
if (fxMesa->haveTwoTMUs) {
case GL_MIRRORED_REPEAT:
ti->sClamp = GR_TEXTURECLAMP_MIRROR_EXT;
break;
+ case GL_CLAMP_TO_BORDER: /* no-no, but don't REPEAT, either */
case GL_CLAMP_TO_EDGE: /* CLAMP discarding border */
case GL_CLAMP:
ti->sClamp = GR_TEXTURECLAMP_CLAMP;
case GL_MIRRORED_REPEAT:
ti->tClamp = GR_TEXTURECLAMP_MIRROR_EXT;
break;
+ case GL_CLAMP_TO_BORDER: /* no-no, but don't REPEAT, either */
case GL_CLAMP_TO_EDGE: /* CLAMP discarding border */
case GL_CLAMP:
ti->tClamp = GR_TEXTURECLAMP_CLAMP;
* our data aligned inside a 8:1 rectangle.
* 3) just in case if MIN("s", "t") gets overflowed with GL_REPEAT,
* we replicate the data over the padded area.
+ * For now, we take 2) + 3) but texelfetchers will be wrong!
*/
GLuint srcRowStride = _mesa_compressed_row_stride(internalFormat, width);
destRowStride, (mml->height+3) / 4,
1, data, srcRowStride,
texImage->Data);
-
+ ti->padded = GL_TRUE;
} else {
MEMCPY(texImage->Data, data, texImage->CompressedSize);
}
GLboolean fixedPalette;
GLboolean validated;
+
+ GLboolean padded;
}
tfxTexInfo;
FX_smallLodLog2(ti->info) = FX_largeLodLog2(ti->info);
/* this is necessary because of fxDDCompressedTexImage2D */
- if ((ti->info.format == GR_TEXFMT_ARGB_CMP_FXT1) ||
- (ti->info.format == GR_TEXFMT_ARGB_CMP_DXT1) ||
- (ti->info.format == GR_TEXFMT_ARGB_CMP_DXT3) ||
- (ti->info.format == GR_TEXFMT_ARGB_CMP_DXT5)) {
+ if (ti->padded) {
struct gl_texture_image *texImage = tObj->Image[0][minl];
tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
if (mml->wScale != 1 || mml->hScale != 1) {
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
- if (fxMesa->colDepth != 16) {
- /* 32bpp mode or 15bpp mode */
+ if (fxMesa->colDepth == 32) {
+ /* 32bpp mode */
fxMesa->Glide.grColorMaskExt(ctx->Color.ColorMask[RCOMP],
ctx->Color.ColorMask[GCOMP],
ctx->Color.ColorMask[BCOMP],
ctx->Color.ColorMask[ACOMP] && fxMesa->haveHwAlpha);
}
else {
- /* 16 bpp mode */
+ /* 15/16 bpp mode */
grColorMask(ctx->Color.ColorMask[RCOMP] |
ctx->Color.ColorMask[GCOMP] |
ctx->Color.ColorMask[BCOMP],
#endif
#define __GL_COSF cos
#define __GL_SINF sin
+static void fx_draw_point_sprite ( fxMesaContext fxMesa,
+ GrVertex *v0, GLfloat psize )
+{
+ const GLcontext *ctx = fxMesa->glCtx;
+
+ GLfloat radius;
+ GrVertex _v_[4];
+ GLuint ts0 = fxMesa->tmu_source[0];
+ GLuint ts1 = fxMesa->tmu_source[1];
+ GLfloat w = v0->oow;
+ GLfloat u0scale = fxMesa->s0scale * w;
+ GLfloat v0scale = fxMesa->t0scale * w;
+ GLfloat u1scale = fxMesa->s1scale * w;
+ GLfloat v1scale = fxMesa->t1scale * w;
+
+ radius = psize / 2.;
+ _v_[0] = *v0;
+ _v_[1] = *v0;
+ _v_[2] = *v0;
+ _v_[3] = *v0;
+ /* CLIP_LOOP ?!? */
+ /* point coverage? */
+ /* we don't care about culling here (see fxSetupCull) */
+
+ _v_[0].x -= radius;
+ _v_[0].y += radius;
+ _v_[1].x += radius;
+ _v_[1].y += radius;
+ _v_[2].x += radius;
+ _v_[2].y -= radius;
+ _v_[3].x -= radius;
+ _v_[3].y -= radius;
+
+ if (ctx->Point.CoordReplace[ts0]) {
+ _v_[0].tmuvtx[0].sow = 0;
+ _v_[0].tmuvtx[0].tow = 0;
+ _v_[1].tmuvtx[0].sow = u0scale;
+ _v_[1].tmuvtx[0].tow = 0;
+ _v_[2].tmuvtx[0].sow = u0scale;
+ _v_[2].tmuvtx[0].tow = v0scale;
+ _v_[3].tmuvtx[0].sow = 0;
+ _v_[3].tmuvtx[0].tow = v0scale;
+ }
+ if (ctx->Point.CoordReplace[ts1]) {
+ _v_[0].tmuvtx[1].sow = 0;
+ _v_[0].tmuvtx[1].tow = 0;
+ _v_[1].tmuvtx[1].sow = u1scale;
+ _v_[1].tmuvtx[1].tow = 0;
+ _v_[2].tmuvtx[1].sow = u1scale;
+ _v_[2].tmuvtx[1].tow = v1scale;
+ _v_[3].tmuvtx[1].sow = 0;
+ _v_[3].tmuvtx[1].tow = v1scale;
+ }
+
+ grDrawVertexArrayContiguous(GR_TRIANGLE_FAN, 4, _v_, sizeof(GrVertex));
+}
+
static void fx_draw_point_wide ( fxMesaContext fxMesa,
GrVertex *v0 )
{
const GLcontext *ctx = fxMesa->glCtx;
const GLfloat psize = (ctx->_TriangleCaps & DD_POINT_ATTEN) ? v0->psize : ctx->Point.Size;
+ if (ctx->Point.PointSprite) {
+ fx_draw_point_sprite(fxMesa, v0, psize);
+ return;
+ }
+
_v_[0] = v0;
_v_[1] = &vtxB;
_v_[2] = &vtxC;
const GLcontext *ctx = fxMesa->glCtx;
const GLfloat psize = (ctx->_TriangleCaps & DD_POINT_ATTEN) ? v0->psize : ctx->Point.Size;
+ if (ctx->Point.PointSprite) {
+ fx_draw_point_sprite(fxMesa, v0, psize);
+ return;
+ }
+
radius = psize / 2.;
n = IROUND(psize * 2); /* radius x 4 */
if (n < 4) n = 4;
INIT(GL_QUADS);
-#if 1
- /* [dBorca] Hack alert:
- * since VTX-0-2 we get here with start = 0, count = 2,
- * causing around 4 billion triangles. Revise this after
- * a while
- */
- if (count < 3) {
- return;
- }
-#endif
-
- for (i = start ; i < count-3 ; i += 4 ) {
+ for (i = start + 3 ; i < count ; i += 4 ) {
#define VERT(x) (fxVB + (x))
GrVertex *_v_[4];
- _v_[0] = VERT(i+3);
- _v_[1] = VERT(i+0);
- _v_[2] = VERT(i+1);
- _v_[3] = VERT(i+2);
+ _v_[0] = VERT(i);
+ _v_[1] = VERT(i-3);
+ _v_[2] = VERT(i-2);
+ _v_[3] = VERT(i-1);
grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);
- /*grDrawTriangle( VERT(i), VERT(i+1), VERT(i+3) );*/
- /*grDrawTriangle( VERT(i+1), VERT(i+2), VERT(i+3) );*/
+ /*grDrawTriangle( VERT(i-3), VERT(i-2), VERT(i) );*/
+ /*grDrawTriangle( VERT(i-2), VERT(i-1), VERT(i) );*/
#undef VERT
}
}
static void fxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
GLuint n )
{
+ int i;
fxMesaContext fxMesa = FX_CONTEXT( ctx );
GrVertex *vertptr = fxMesa->verts;
- const GrVertex *start = VERT(elts[0]);
- int i;
- for (i = 2 ; i < n ; i++) {
- grDrawTriangle( start, VERT(elts[i-1]), VERT(elts[i]) );
+ if (n == 3) {
+ grDrawTriangle( VERT(elts[0]), VERT(elts[1]), VERT(elts[2]) );
+ } else if (n <= 32) {
+ GrVertex *newvptr[32];
+ for (i = 0 ; i < n ; i++) {
+ newvptr[i] = VERT(elts[i]);
+ }
+ grDrawVertexArray(GR_TRIANGLE_FAN, n, newvptr);
+ } else {
+ const GrVertex *start = VERT(elts[0]);
+ for (i = 2 ; i < n ; i++) {
+ grDrawTriangle( start, VERT(elts[i-1]), VERT(elts[i]) );
+ }
}
}
fx_render_tab_verts[0] = fx_render_pw_verts;
fx_render_tab_elts[0] = fx_render_pw_elts;
}
- tnl->Driver.Render.Points = rast_tab[FX_FALLBACK_BIT].points;
+ tnl->Driver.Render.Points = rast_tab[index|FX_FALLBACK_BIT].points;
} else {
fx_render_tab_verts[0] = fx_render_vb_points;
fx_render_tab_elts[0] = fx_render_points_elts;
}
+/* [dBorca] Hack alert:
+ * doesn't work with blending.
+ * need to take care of stencil.
+ */
GLboolean fxMultipass_ColorSum (GLcontext *ctx, GLuint pass)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);