summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>1999-08-26 14:50:49 +0000
committerKeith Whitwell <keith@tungstengraphics.com>1999-08-26 14:50:49 +0000
commit2be79c1aa2c168b7ecfb8289ce462ffb1de935eb (patch)
treeade794e15539608ae1e89d264cdeb459c50783ae /src
parent0552b3063349d167b128714e49c704e8f9006071 (diff)
various pipeline bugs
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/glide/fxapi.c1
-rw-r--r--src/mesa/drivers/glide/fxdd.c8
-rw-r--r--src/mesa/drivers/glide/fxdrv.h8
-rw-r--r--src/mesa/main/context.c50
-rw-r--r--src/mesa/main/dlist.c6
-rw-r--r--src/mesa/main/enable.c6
-rw-r--r--src/mesa/main/polygon.c5
-rw-r--r--src/mesa/main/varray.c9
-rw-r--r--src/mesa/x86/common_x86.c7
9 files changed, 69 insertions, 31 deletions
diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c
index fbc586e757..82084e7479 100644
--- a/src/mesa/drivers/glide/fxapi.c
+++ b/src/mesa/drivers/glide/fxapi.c
@@ -948,6 +948,7 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win,GrScreenResolution_t res
fxMesa->haveTwoTMUs=GL_FALSE;
if (getenv("FX_EMULATE_SINGLE_TMU")) {
+ fprint(stderr, "stadnnadna;lskdjf");
if (MESA_VERBOSE&VERBOSE_DRIVER)
fprintf(stderr, "\n\nEmulating single tmu\n\n");
fxMesa->haveTwoTMUs = GL_FALSE;
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index b2f3a7a43c..8fe8d809c0 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -513,6 +513,10 @@ static void fxDDUpdateDDPointers(GLcontext *ctx)
if(new_state & INTERESTED) {
fxDDChooseRenderState( ctx );
fxMesa->RenderVBTables=fxDDChooseRenderVBTables(ctx);
+ fxMesa->RenderVBClippedTab=fxMesa->RenderVBTables[0];
+ fxMesa->RenderVBCulledTab=fxMesa->RenderVBTables[1];
+ fxMesa->RenderVBRawTab=fxMesa->RenderVBTables[2];
+
ctx->Driver.RasterSetup=fxDDChooseSetupFunction(ctx);
}
@@ -520,10 +524,6 @@ static void fxDDUpdateDDPointers(GLcontext *ctx)
ctx->Driver.LineFunc=fxMesa->LineFunc;
ctx->Driver.TriangleFunc=fxMesa->TriangleFunc;
ctx->Driver.QuadFunc=fxMesa->QuadFunc;
- ctx->Driver.RenderVBClippedTab=fxMesa->RenderVBTables[0];
- ctx->Driver.RenderVBCulledTab=fxMesa->RenderVBTables[1];
- ctx->Driver.RenderVBRawTab=fxMesa->RenderVBTables[2];
-
}
ctx->Driver.AllocDepthBuffer=fxAllocDepthBuffer;
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index bb8f5b8761..435d4ce741 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -420,6 +420,11 @@ struct tfxMesaContext {
render_func **RenderVBTables;
+ render_func *RenderVBClippedTab;
+ render_func *RenderVBCulledTab;
+ render_func *RenderVBRawTab;
+
+
tfxStats stats;
void *state;
@@ -570,7 +575,10 @@ extern void fxDDShadeModel(GLcontext *ctx, GLenum mode);
extern void fxDDCullFace(GLcontext *ctx, GLenum mode);
extern void fxDDFrontFace(GLcontext *ctx, GLenum mode);
+extern void fxPrintRenderState( const char *msg, GLuint state );
+extern void fxPrintHintState( const char *msg, GLuint state );
+extern void fxDDDoRenderVB( struct vertex_buffer *VB );
#endif
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 55c7467821..61c1641c46 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: context.c,v 1.2 1999/08/26 14:50:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -764,7 +764,7 @@ static void initialize_context( GLcontext *ctx )
/* Extensions */
gl_extensions_ctr( ctx );
- ctx->AllowVertexCull = 0;
+ ctx->AllowVertexCull = CLIP_CULLED_BIT;
/* Lighting group */
for (i=0;i<MAX_LIGHTS;i++) {
@@ -1919,6 +1919,8 @@ static void update_pixel_masking( GLcontext *ctx )
static void update_fog_mode( GLcontext *ctx )
{
+ int old_mode = ctx->FogMode;
+
if (ctx->Fog.Enabled) {
if (ctx->Texture.Enabled)
ctx->FogMode = FOG_FRAGMENT;
@@ -1934,6 +1936,9 @@ static void update_fog_mode( GLcontext *ctx )
else {
ctx->FogMode = FOG_NONE;
}
+
+ if (old_mode != ctx->FogMode)
+ ctx->NewState |= NEW_FOG;
}
@@ -2121,7 +2126,9 @@ void gl_update_state( GLcontext *ctx )
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
}
- if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING)) {
+ if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING | NEW_FOG)) {
+
+
if (ctx->NewState & NEW_RASTER_OPS) {
update_pixel_logic(ctx);
update_pixel_masking(ctx);
@@ -2192,10 +2199,10 @@ void gl_update_state( GLcontext *ctx )
}
if (ctx->NewState & NEW_LIGHTING) {
- ctx->TriangleCaps &= ~(DD_TRI_LIGHT_TWOSIDE|DD_EARLY_CULL);
+ ctx->TriangleCaps &= ~(DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL);
if (ctx->Light.Enabled) {
if (ctx->Light.Model.TwoSide)
- ctx->TriangleCaps |= (DD_TRI_LIGHT_TWOSIDE|DD_EARLY_CULL);
+ ctx->TriangleCaps |= (DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL);
gl_update_lighting(ctx);
}
}
@@ -2207,21 +2214,29 @@ void gl_update_state( GLcontext *ctx )
if (ctx->NewState & NEW_POLYGON) {
/* Setup CullBits bitmask */
if (ctx->Polygon.CullFlag) {
+ ctx->backface_sign = 1;
switch(ctx->Polygon.CullFaceMode) {
- case GL_FRONT:
- ctx->Polygon.CullBits = 2;
- break;
case GL_BACK:
+ if(ctx->Polygon.FrontFace==GL_CCW)
+ ctx->backface_sign = -1;
ctx->Polygon.CullBits = 1;
break;
+ case GL_FRONT:
+ if(ctx->Polygon.FrontFace!=GL_CCW)
+ ctx->backface_sign = -1;
+ ctx->Polygon.CullBits = 2;
+ break;
default:
case GL_FRONT_AND_BACK:
+ ctx->backface_sign = 0;
ctx->Polygon.CullBits = 3;
break;
}
}
- else
+ else {
ctx->Polygon.CullBits = 3;
+ ctx->backface_sign = 0;
+ }
/* Any Polygon offsets enabled? */
ctx->TriangleCaps &= ~DD_TRI_OFFSET;
@@ -2257,6 +2272,9 @@ void gl_update_state( GLcontext *ctx )
ctx->IndirectTriangles = ctx->TriangleCaps & ~ctx->Driver.TriangleCaps;
ctx->IndirectTriangles |= DD_SW_RASTERIZE;
+ if (MESA_VERBOSE&VERBOSE_CULL)
+ gl_print_tri_caps("initial indirect tris", ctx->IndirectTriangles);
+
ctx->Driver.PointsFunc = NULL;
ctx->Driver.LineFunc = NULL;
ctx->Driver.TriangleFunc = NULL;
@@ -2272,6 +2290,9 @@ void gl_update_state( GLcontext *ctx )
*/
ctx->Driver.UpdateState(ctx);
+ if (MESA_VERBOSE&VERBOSE_CULL)
+ gl_print_tri_caps("indirect tris", ctx->IndirectTriangles);
+
/*
* In case the driver didn't hook in an optimized point, line or
* triangle function we'll now select "core/fallback" point, line
@@ -2282,8 +2303,16 @@ void gl_update_state( GLcontext *ctx )
gl_set_line_function(ctx);
gl_set_triangle_function(ctx);
gl_set_quad_function(ctx);
+
+ if ((ctx->IndirectTriangles &
+ (DD_TRI_SW_RASTERIZE|DD_QUAD_SW_RASTERIZE|DD_TRI_CULL)) ==
+ (DD_TRI_SW_RASTERIZE|DD_QUAD_SW_RASTERIZE|DD_TRI_CULL))
+ ctx->IndirectTriangles &= ~DD_TRI_CULL;
}
+ if (MESA_VERBOSE&VERBOSE_CULL)
+ gl_print_tri_caps("indirect tris 2", ctx->IndirectTriangles);
+
gl_set_render_vb_function(ctx);
}
@@ -2311,9 +2340,10 @@ void gl_update_state( GLcontext *ctx )
/* Figure out whether we can light in object space or not. If we
* can, find the current positions of the lights in object space
*/
- if ((ctx->Enabled & (ENABLE_POINT_ATTEN | ENABLE_LIGHT |
+ if ((ctx->Enabled & (ENABLE_POINT_ATTEN | ENABLE_LIGHT | ENABLE_FOG |
ENABLE_TEXGEN0 | ENABLE_TEXGEN1)) &&
(ctx->NewState & (NEW_LIGHTING |
+ NEW_FOG |
NEW_MODELVIEW |
NEW_PROJECTION |
NEW_TEXTURING |
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 001de0367b..24266e3e42 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -1,4 +1,4 @@
-/* $Id: dlist.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: dlist.c,v 1.2 1999/08/26 14:50:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -2454,6 +2454,10 @@ static void execute_list( GLcontext *ctx, GLuint list )
case OPCODE_VERTEX_CASSETTE:
if (ctx->NewState)
gl_update_state(ctx);
+ if (ctx->CompileCVAFlag) {
+ ctx->CompileCVAFlag = 0;
+ ctx->CVA.elt.pipeline_valid = 0;
+ }
if (!ctx->CVA.elt.pipeline_valid)
gl_build_immediate_pipeline( ctx );
gl_fixup_cassette( ctx, (struct immediate *) n[1].data );
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index b79a907f4c..429a7b1141 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.2 1999/08/19 13:24:27 brianp Exp $ */
+/* $Id: enable.c,v 1.3 1999/08/26 14:50:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -56,7 +56,7 @@ void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" );
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "%s %s (%x)\n",
+ fprintf(stderr, "%s %s (newstate is %x)\n",
state ? "glEnable" : "glDisable",
gl_lookup_enum_by_nr(cap),
ctx->NewState);
@@ -153,7 +153,7 @@ void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
if (ctx->Fog.Enabled!=state) {
ctx->Fog.Enabled = state;
ctx->Enabled ^= ENABLE_FOG;
- ctx->NewState |= NEW_FOG;
+ ctx->NewState |= NEW_FOG|NEW_RASTER_OPS;
}
break;
case GL_LIGHT0:
diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
index 83690035ff..09399da8ea 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -1,4 +1,4 @@
-/* $Id: polygon.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: polygon.c,v 1.2 1999/08/26 14:50:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -119,9 +119,6 @@ void gl_PolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
ctx->Polygon.Unfilled = GL_TRUE;
ctx->TriangleCaps |= DD_TRI_UNFILLED;
}
- else {
- ctx->Polygon.Unfilled = GL_FALSE;
- }
ctx->NewState |= (NEW_POLYGON | NEW_RASTER_OPS);
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index b63d6a7cce..aab630ca23 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1,4 +1,4 @@
-/* $Id: varray.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: varray.c,v 1.2 1999/08/26 14:50:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -407,7 +407,7 @@ void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM )
if (translate & VERT_OBJ_ANY)
(ctx->Array.VertexEltFunc)( IM->Obj,
&ctx->Array.Vertex,
- flags, elts, VERT_ELT,
+ flags, elts, (VERT_ELT|VERT_OBJ_ANY),
start, count);
if (translate & VERT_NORM)
@@ -830,11 +830,10 @@ static void FUNC( GLcontext *ctx, GLenum mode, \
GLuint nr = MIN2( VB_MAX, count - j + VB_START ); \
struct immediate *IM = ctx->input; \
GLuint sf = IM->Flag[VB_START]; \
- GLuint flags = IM->ArrayOrFlags; \
\
for (i = VB_START ; i < nr ; i++) { \
IM->Elt[i] = (GLuint) *indices++; \
- IM->Flag[i] = flags; \
+ IM->Flag[i] = VERT_ELT; \
} \
\
if (j == 0) IM->Flag[VB_START] |= sf; \
@@ -1251,8 +1250,6 @@ void gl_update_client_state( GLcontext *ctx )
/* Not really important any more:
*/
ctx->Array.Summary = ctx->Array.Flags & VERT_DATA;
-
- ctx->input->ArrayOrFlags = (ctx->Array.Flags & VERT_OBJ_234) | VERT_ELT;
ctx->input->ArrayAndFlags = ~ctx->Array.Flags;
ctx->input->ArrayEltFlush = !(ctx->CompileCVAFlag);
}
diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c
index 7d30be94cf..b5dc202c3e 100644
--- a/src/mesa/x86/common_x86.c
+++ b/src/mesa/x86/common_x86.c
@@ -32,6 +32,7 @@
*/
#include <stdlib.h>
+#include <stdio.h>
#include "common_x86asm.h"
int gl_x86_cpu_features = 0;
@@ -43,7 +44,7 @@ void gl_init_all_x86_asm (void)
gl_x86_cpu_features = gl_identify_x86_cpu_features ();
if (gl_x86_cpu_features & GL_CPU_GenuineIntel) {
- printf ("GenuineIntel cpu detected.\n");
+ fprintf (stderr, "GenuineIntel cpu detected.\n");
}
gl_init_x86_asm_transforms ();
@@ -52,7 +53,7 @@ void gl_init_all_x86_asm (void)
if (gl_x86_cpu_features & GL_CPU_MMX) {
char *s = getenv( "MESA_NO_MMX" );
if (s == NULL) {
- printf ("MMX cpu detected.\n");
+ fprintf (stderr, "MMX cpu detected.\n");
} else {
gl_x86_cpu_features &= (!GL_CPU_MMX);
}
@@ -64,7 +65,7 @@ void gl_init_all_x86_asm (void)
if (gl_x86_cpu_features & GL_CPU_3Dnow) {
char *s = getenv( "MESA_NO_3DNOW" );
if (s == NULL) {
- printf ("3Dnow cpu detected.\n");
+ fprintf (stderr, "3Dnow cpu detected.\n");
gl_init_3dnow_asm_transforms ();
} else {
gl_x86_cpu_features &= (!GL_CPU_3Dnow);