summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorAapo Tahkola <aet@rasterburn.org>2005-02-14 13:14:16 +0000
committerAapo Tahkola <aet@rasterburn.org>2005-02-14 13:14:16 +0000
commit0340663eb732d39a64b8e047cab3b2bfa19ce912 (patch)
tree585d2440c7d49aa678ec280865be327959f20209 /src/mesa/drivers
parent8352666a9db11cfc5f41b9ca0b135750b606d2f2 (diff)
Support for blend color(not tested), "proper line width/point size" clamps and fix for glxinfo problem.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h7
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c76
4 files changed, 69 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index dda8a33934..9466504cfc 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -219,7 +219,6 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
ctx = r300->radeon.glCtx;
if(ctx->Visual.doubleBufferMode == 0){
fprintf(stderr, "Help me! Single buffer mode doesnt work yet.\n");
- exit(-1);
}
ctx->Const.MaxTextureImageUnits = driQueryOptioni(&r300->radeon.optionCache,
"texture_image_units");
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
index 1d4cd1fcbc..883d9b944c 100644
--- a/src/mesa/drivers/dri/r300/r300_reg.h
+++ b/src/mesa/drivers/dri/r300/r300_reg.h
@@ -1005,6 +1005,13 @@ I am fairly certain that they are correct unless stated otherwise in comments.
# define R300_ALPHA_TEST_GREATER (5 << 8)
# define R300_ALPHA_TEST_NEQUAL (6 << 8)
# define R300_ALPHA_TEST_PASS (7 << 8)
+/* // Possibly more correct values:
+# define R300_ALPHA_TEST_LEQUAL (3 << 8)
+# define R300_ALPHA_TEST_EQUAL (2 << 8)
+# define R300_ALPHA_TEST_GEQUAL (6 << 8)
+# define R300_ALPHA_TEST_GREATER (4 << 8)
+# define R300_ALPHA_TEST_NEQUAL (5 << 8)
+*/
# define R300_ALPHA_TEST_OP_MASK (7 << 8)
# define R300_ALPHA_TEST_ENABLE (1 << 11)
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 8b78569e60..8f9d892982 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -485,7 +485,7 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx,
efloat(1.0);
#endif
-/* Why do we need this for immediate mode?? */
+/* Why do we need this for immediate mode?? Vertex processor needs it to know proper regs */
// r300EmitLOAD_VBPNTR(rmesa, 0);
for(i=0; i < VB->PrimitiveCount; i++){
@@ -543,7 +543,7 @@ static GLboolean r300_run_vb_render(GLcontext *ctx,
r300ReleaseArrays(ctx);
r300EmitArrays(ctx, rmesa->state.render_inputs);
-
+
// LOCK_HARDWARE(&(rmesa->radeon));
reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index bbbf674ee1..d0f49b75f0 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -98,6 +98,7 @@ static void r300AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
break;
case GL_ALWAYS:
pp_misc |= R300_ALPHA_TEST_PASS;
+ //pp_misc &= ~R300_ALPHA_TEST_ENABLE;
break;
}
@@ -108,7 +109,17 @@ static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4])
{
GLubyte color[4];
r300ContextPtr rmesa = R300_CONTEXT(ctx);
- fprintf(stderr, "%s:%s is not implemented yet. Fixme !\n", __FILE__, __FUNCTION__);
+
+ R300_STATECHANGE(rmesa, unk4E10);
+
+ /* Ordering might be wrong */
+ CLAMPED_FLOAT_TO_UBYTE(color[0], cf[0]);
+ CLAMPED_FLOAT_TO_UBYTE(color[1], cf[1]);
+ CLAMPED_FLOAT_TO_UBYTE(color[2], cf[2]);
+ CLAMPED_FLOAT_TO_UBYTE(color[3], cf[3]);
+
+ rmesa->hw.unk4E10.cmd[1]=radeonPackColor(4, color[0], color[1], color[2], color[3]);
+ //fprintf(stderr, "%s:%s is not implemented yet. Fixme !\n", __FILE__, __FUNCTION__);
#if 0
R200_STATECHANGE(rmesa, ctx);
CLAMPED_FLOAT_TO_UBYTE(color[0], cf[0]);
@@ -641,7 +652,8 @@ static void r300PointSize(GLcontext * ctx, GLfloat size)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
- /* TODO: Validate point size */
+ size = ctx->Point._Size;
+
R300_STATECHANGE(r300, ps);
r300->hw.ps.cmd[R300_PS_POINTSIZE] =
((int)(size * 6) << R300_POINTSIZE_X_SHIFT) |
@@ -660,10 +672,8 @@ static void r300PointSize(GLcontext * ctx, GLfloat size)
static void r300LineWidth(GLcontext *ctx, GLfloat widthf)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
- /* IMHO mesa isnt clamping line widths according to ctx->Const.*LineWidth
- before calling this from the dd function table.
- Since r300ResetHwState calls these with clamped values,
- they must be set properly. */
+
+ widthf = ctx->Line._Width;
R300_STATECHANGE(r300, lcntl);
r300->hw.lcntl.cmd[1] = (int)(widthf * 6.0);
@@ -696,9 +706,40 @@ static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode)
r300ContextPtr r300 = R300_CONTEXT(ctx);
unsigned long hw_mode=0;
- hw_mode=r300->hw.unk4288.cmd[1];
+ //hw_mode=r300->hw.unk4288.cmd[1];
hw_mode |= 1; /* enables point mode by default */
-
+
+ switch (ctx->Polygon.FrontMode) {
+ case GL_LINE:
+ hw_mode &= ~PM_NOT_FRONT;
+ hw_mode |= PM_FRONT_LINE;
+ break;
+ case GL_POINT:
+ hw_mode &= ~PM_NOT_FRONT;
+ hw_mode &= ~PM_FRONT_LINE;
+ break;
+ /* I dont think fgl properly handles these... In any case, test program is needed */
+ case GL_FILL:
+ break;
+ }
+
+ switch (ctx->Polygon.BackMode) {
+ case GL_LINE:
+ hw_mode &= ~PM_NOT_BACK;
+ hw_mode |= PM_BACK_LINE;
+ break;
+ case GL_POINT:
+ hw_mode &= ~PM_NOT_BACK;
+ hw_mode &= ~PM_BACK_LINE;
+ break;
+ case GL_FILL:
+ break;
+ }
+
+ if(hw_mode == 1)
+ hw_mode = 0;
+
+#if 0
switch (face) {
case GL_FRONT:
//fprintf(stderr, "front\n");
@@ -710,8 +751,7 @@ static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode)
case GL_POINT:
hw_mode &= ~PM_FRONT_LINE;
break;
- case GL_FILL: /* No idea */
- hw_mode = 0;
+ case GL_FILL:
break;
}
break;
@@ -726,8 +766,7 @@ static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode)
case GL_POINT:
hw_mode &= ~PM_BACK_LINE;
break;
- case GL_FILL: /* No idea */
- hw_mode = 0;
+ case GL_FILL:
break;
}
break;
@@ -751,6 +790,7 @@ static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode)
}
break;
}
+#endif
//if( front and back fill) hw_mode=0;
@@ -1887,7 +1927,7 @@ void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk4214.cmd[1] = 0x00050005;
- r300PointSize(ctx, ctx->Point._Size);
+ r300PointSize(ctx, 0.0);
#if 0
r300->hw.ps.cmd[R300_PS_POINTSIZE] = (6 << R300_POINTSIZE_X_SHIFT) |
(6 << R300_POINTSIZE_Y_SHIFT);
@@ -1897,7 +1937,7 @@ void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk4230.cmd[2] = 0x00020006;
r300->hw.unk4230.cmd[3] = r300PackFloat32(1.0 / 192.0);
- r300LineWidth(ctx, ctx->Line._Width);
+ r300LineWidth(ctx, 0.0);
#ifdef EXP_C
static int foobar=0;
@@ -1968,7 +2008,8 @@ void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk4BC8.cmd[1] = 0;
r300->hw.unk4BC8.cmd[2] = 0;
r300->hw.unk4BC8.cmd[3] = 0;
-
+
+ //r300AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef);
#if 0
r300->hw.at.cmd[R300_AT_ALPHA_TEST] = 0;
#endif
@@ -1982,8 +2023,11 @@ void r300ResetHwState(r300ContextPtr r300)
r300->hw.bld.cmd[R300_BLD_CBLEND] = 0;
r300->hw.bld.cmd[R300_BLD_ABLEND] = 0;
#endif
-
+
+ r300BlendColor(ctx, ctx->Color.BlendColor);
+#if 0
r300->hw.unk4E10.cmd[1] = 0;
+#endif
r300->hw.unk4E10.cmd[2] = 0;
r300->hw.unk4E10.cmd[3] = 0;