summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/glide/fxdd.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2000-11-16 21:05:34 +0000
committerKeith Whitwell <[email protected]>2000-11-16 21:05:34 +0000
commit23caf20169ac38436ee9c13914f1d6aa7cf6bb5e (patch)
tree21307f7bbcaf9ee1e841d7e7bee130570a7b5b95 /src/mesa/drivers/glide/fxdd.c
parent179516673211a2350e479d5321840291f339f5dd (diff)
Move the transform and lighting code to two new directories
math: Provides basic matrix and vector functionality that might be useful to multiple software t&l implementations, and is used by core mesa to manage the Model, Project, etc matrices. tnl: The real transform & lighting code from core mesa, including everything from glVertex3f through vertex buffer handling, transformation, clipping, lighting and handoff to a driver for rasterization. The interfaces of these can be further tightened up, but the basic splitting up of state and code move is done.
Diffstat (limited to 'src/mesa/drivers/glide/fxdd.c')
-rw-r--r--src/mesa/drivers/glide/fxdd.c41
1 files changed, 16 insertions, 25 deletions
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index e70be6cd6b0..178fa192ac0 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -58,6 +58,7 @@
#include "extensions.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
+#include "tnl/tnl.h"
/* These lookup table are used to extract RGB values in [0,255] from
* 16-bit pixel values.
@@ -611,11 +612,6 @@ static void fxDDFinish(GLcontext *ctx)
-void fxDDSetNearFar(GLcontext *ctx, GLfloat n, GLfloat f)
-{
- FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG;
- ctx->Driver.RenderStart = fxSetupFXUnits;
-}
/* KW: Put the word Mesa in the render string because quakeworld
* checks for this rather than doing a glGet(GL_MAX_TEXTURE_SIZE).
@@ -763,35 +759,28 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
/* Initialize the software rasterizer and helper modules.
*/
+ fxMesa->glCtx->Driver.RegisterVB = fxDDRegisterVB;
+
_swrast_CreateContext( fxMesa->glCtx );
_swsetup_CreateContext( fxMesa->glCtx );
+ _tnl_CreateContext( fxMesa->glCtx );
+
+ fxSetupDDPointers(fxMesa->glCtx);
/* Tell the software rasterizer to use pixel fog always.
*/
_swrast_allow_vertex_fog( fxMesa->glCtx, GL_FALSE );
_swrast_allow_pixel_fog( fxMesa->glCtx, GL_TRUE );
- fxSetupDDPointers(fxMesa->glCtx);
fxDDInitExtensions(fxMesa->glCtx);
- fxDDSetNearFar(fxMesa->glCtx,1.0,100.0);
-
FX_grGlideGetState((GrState*)fxMesa->state);
- /* XXX Fix me: callback not registered when main VB is created.
- */
- if (fxMesa->glCtx->VB)
- fxDDRegisterVB( fxMesa->glCtx->VB );
-
/* XXX Fix me too: need to have the 'struct dd' prepared prior to
* creating the context... The below is broken if you try to insert
* new stages.
*/
- if (fxMesa->glCtx->NrPipelineStages)
- fxMesa->glCtx->NrPipelineStages = fxDDRegisterPipelineStages(
- fxMesa->glCtx->PipelineStage,
- fxMesa->glCtx->PipelineStage,
- fxMesa->glCtx->NrPipelineStages);
+ fxDDRegisterPipelineStages( fxMesa->glCtx );
/* Run the config file */
_mesa_context_initialize( fxMesa->glCtx );
@@ -936,6 +925,15 @@ static void fxDDUpdateDDPointers(GLcontext *ctx)
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
+ _tnl_InvalidateState( ctx, new_state );
+
+ /* Recalculate fog table on projection matrix changes. This used to
+ * be triggered by the NearFar callback.
+ */
+ if (new_state & _NEW_PROJECTION) {
+ FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG;
+ ctx->Driver.RenderStart = fxSetupFXUnits;
+ }
if (new_state & (_FX_NEW_IS_IN_HARDWARE |
_FX_NEW_RENDERSTATE |
@@ -965,7 +963,6 @@ void fxSetupDDPointers(GLcontext *ctx)
fprintf(stderr,"fxmesa: fxSetupDDPointers()\n");
}
- ctx->Driver.UpdateStateNotify = ~0;
ctx->Driver.UpdateState=fxDDUpdateDDPointers;
ctx->Driver.WriteDepthSpan=fxDDWriteDepthSpan;
@@ -975,8 +972,6 @@ void fxSetupDDPointers(GLcontext *ctx)
ctx->Driver.GetString=fxDDGetString;
- ctx->Driver.NearFar=fxDDSetNearFar;
-
ctx->Driver.ClearIndex=NULL;
ctx->Driver.ClearColor=fxDDClearColor;
ctx->Driver.Clear=fxDDClear;
@@ -1009,8 +1004,6 @@ void fxSetupDDPointers(GLcontext *ctx)
ctx->Driver.DeleteTexture=fxDDTexDel;
ctx->Driver.UpdateTexturePalette=fxDDTexPalette;
- ctx->Driver.RectFunc=NULL;
-
ctx->Driver.AlphaFunc=fxDDAlphaFunc;
ctx->Driver.BlendFunc=fxDDBlendFunc;
ctx->Driver.DepthFunc=fxDDDepthFunc;
@@ -1026,8 +1019,6 @@ void fxSetupDDPointers(GLcontext *ctx)
ctx->Driver.RegisterVB=fxDDRegisterVB;
ctx->Driver.UnregisterVB=fxDDUnregisterVB;
- ctx->Driver.RegisterPipelineStages = fxDDRegisterPipelineStages;
-
if (!getenv("FX_NO_FAST"))
ctx->Driver.BuildPrecalcPipeline = fxDDBuildPrecalcPipeline;