From 199512968be28aa5a4f41c4f30e0e311e31b252a Mon Sep 17 00:00:00 2001 From: Stephane Marchesin Date: Fri, 14 Apr 2006 22:41:16 +0000 Subject: [PATCH] Cleaned stuff in the tcl code --- .../drivers/dri/nouveau/nouveau_context.c | 1 + .../drivers/dri/nouveau/nouveau_context.h | 13 ++++++++ src/mesa/drivers/dri/nouveau/nouveau_tris.c | 30 +++++++------------ src/mesa/drivers/dri/nouveau/nouveau_tris.h | 3 ++ src/mesa/drivers/dri/nouveau/nv10_swtcl.c | 7 ++--- src/mesa/drivers/dri/nouveau/nv10_swtcl.h | 3 +- 6 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 9e025a52318..683e6d6ea63 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -134,6 +134,7 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual, case NV_04: case NV_05: default: + //nv03TriInitFunctions( ctx ); break; case NV_10: case NV_20: diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index c2929a16a8e..93c6f1dfffd 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -88,6 +88,7 @@ typedef struct nouveau_context { GLuint specular_offset; /* The drawing fallbacks */ + GLuint Fallback; nouveau_tri_func* draw_tri; nouveau_line_func* draw_line; nouveau_point_func* draw_point; @@ -122,6 +123,18 @@ typedef struct nouveau_context { #define NOUVEAU_CONTEXT(ctx) ((nouveauContextPtr)(ctx->DriverCtx)) +#define NOUVEAU_FALLBACK_TEXTURE 0x0001 +#define NOUVEAU_FALLBACK_DRAW_BUFFER 0x0002 +#define NOUVEAU_FALLBACK_READ_BUFFER 0x0004 +#define NOUVEAU_FALLBACK_STENCIL 0x0008 +#define NOUVEAU_FALLBACK_RENDER_MODE 0x0010 +#define NOUVEAU_FALLBACK_LOGICOP 0x0020 +#define NOUVEAU_FALLBACK_SEP_SPECULAR 0x0040 +#define NOUVEAU_FALLBACK_BLEND_EQ 0x0080 +#define NOUVEAU_FALLBACK_BLEND_FUNC 0x0100 +#define NOUVEAU_FALLBACK_PROJTEX 0x0200 +#define NOUVEAU_FALLBACK_DISABLE 0x0400 + extern GLboolean nouveauCreateContext( const __GLcontextModes *glVisual, __DRIcontextPrivate *driContextPriv, diff --git a/src/mesa/drivers/dri/nouveau/nouveau_tris.c b/src/mesa/drivers/dri/nouveau/nouveau_tris.c index 9749915b41d..53a18d2f738 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_tris.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_tris.c @@ -26,6 +26,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "nouveau_context.h" #include "nouveau_tris.h" +#include "nv10_swtcl.h" +#include "nouveau_span.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" @@ -44,9 +46,7 @@ void nouveau_fallback_tri(struct nouveau_context *nmesa, _swsetup_Translate(ctx, v0, &v[0]); _swsetup_Translate(ctx, v1, &v[1]); _swsetup_Translate(ctx, v2, &v[2]); - nouveauSpanRenderStart( ctx ); _swrast_Triangle(ctx, &v[0], &v[1], &v[2]); - nouveauSpanRenderFinish( ctx ); } @@ -58,9 +58,7 @@ void nouveau_fallback_line(struct nouveau_context *nmesa, SWvertex v[2]; _swsetup_Translate(ctx, v0, &v[0]); _swsetup_Translate(ctx, v1, &v[1]); - nouveauSpanRenderStart( ctx ); _swrast_Line(ctx, &v[0], &v[1]); - nouveauSpanRenderFinish( ctx ); } @@ -70,12 +68,9 @@ void nouveau_fallback_point(struct nouveau_context *nmesa, GLcontext *ctx = nmesa->glCtx; SWvertex v[1]; _swsetup_Translate(ctx, v0, &v[0]); - nouveauSpanRenderStart( ctx ); _swrast_Point(ctx, &v[0]); - nouveauSpanRenderFinish( ctx ); } - void nouveauFallback(struct nouveau_context *nmesa, GLuint bit, GLboolean mode) { GLcontext *ctx = nmesa->glCtx; @@ -85,7 +80,11 @@ void nouveauFallback(struct nouveau_context *nmesa, GLuint bit, GLboolean mode) if (mode) { nmesa->Fallback |= bit; if (oldfallback == 0) { - nv40FinishPrimitive(nmesa); + if (nmesa->screen->card_typerenderIndex = ~0; @@ -96,14 +95,7 @@ void nouveauFallback(struct nouveau_context *nmesa, GLuint bit, GLboolean mode) if (oldfallback == bit) { _swrast_flush( ctx ); - tnl->Driver.Render.Start = nouveauRenderStart; - tnl->Driver.Render.PrimitiveNotify = nouveauRenderPrimitive; - tnl->Driver.Render.Finish = nouveauRenderFinish; - - tnl->Driver.Render.BuildVertices = _tnl_build_vertices; - tnl->Driver.Render.CopyPV = _tnl_copy_pv; - tnl->Driver.Render.Interp = _tnl_interp; - tnl->Driver.Render.ResetLineStipple = nouveauResetLineStipple; + nouveauInitTriFunctions(ctx); _tnl_invalidate_vertex_state( ctx, ~0 ); _tnl_invalidate_vertices( ctx, ~0 ); @@ -118,10 +110,10 @@ void nouveauFallback(struct nouveau_context *nmesa, GLuint bit, GLboolean mode) void nouveauRunPipeline( GLcontext *ctx ) { - struct nouveau_context *vmesa = NOUVEAU_CONTEXT(ctx); + struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); - if (vmesa->newState) { - vmesa->newRenderState |= vmesa->newState; + if (nmesa->newState) { + nmesa->newRenderState |= nmesa->newState; } _tnl_run_pipeline( ctx ); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_tris.h b/src/mesa/drivers/dri/nouveau/nouveau_tris.h index 4d9de538d71..950f6625702 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_tris.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_tris.h @@ -47,6 +47,9 @@ extern void nouveauFallback(struct nouveau_context *nmesa, GLuint bit, GLboolean extern void nouveauRunPipeline( GLcontext *ctx ); +extern void nouveauTriInitFunctions( GLcontext *ctx ); + + #endif /* __NOUVEAU_TRIS_H__ */ diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c index 3eafde39a7f..e04a4ece5e8 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c @@ -88,7 +88,7 @@ static inline void nv10StartPrimitive(struct nouveau_context* nmesa) BEGIN_RING_PRIM(channel,NV20_BEGIN_VERTICES,NOUVEAU_MIN_PRIM_SIZE); } -static inline void nv10FinishPrimitive(struct nouveau_context *nmesa) +inline void nv10FinishPrimitive(struct nouveau_context *nmesa) { FINISH_RING_PRIM(); if (nmesa->screen->card_type==NV_10) @@ -788,13 +788,11 @@ static void nv10RenderPrimitive( GLcontext *ctx, GLuint prim ) } - /**********************************************************************/ /* Initialization. */ /**********************************************************************/ - -void nouveauInitTriFuncs(GLcontext *ctx) +void nouveauTriInitFunctions(GLcontext *ctx) { struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -821,3 +819,4 @@ void nouveauInitTriFuncs(GLcontext *ctx) } + diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.h b/src/mesa/drivers/dri/nouveau/nv10_swtcl.h index 7b42967dd8e..fd57eeaa958 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.h +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.h @@ -31,8 +31,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "mtypes.h" -extern void nv10TriInitFunctions( GLcontext *ctx ); extern void nv10Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void nv10FinishPrimitive(struct nouveau_context *nmesa); +extern void nv10RenderStart(GLcontext *ctx); #define FALLBACK( nmesa, bit, mode ) nouveauFallback( nmesa->glCtx, bit, mode ) #endif /* __NV10_SWTCL_H__ */ -- 2.30.2