projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ARB prog lexer: Fix lexer to eat both DOS and Unix line endings
[mesa.git]
/
src
/
mesa
/
tnl
/
t_context.c
diff --git
a/src/mesa/tnl/t_context.c
b/src/mesa/tnl/t_context.c
index 3b8dd18bbb2bb53a9e6cbb7d039fd510a1cacb71..f2771cde09566bec0288669246d98f520661a9a0 100644
(file)
--- a/
src/mesa/tnl/t_context.c
+++ b/
src/mesa/tnl/t_context.c
@@
-1,8
+1,8
@@
/*
* Mesa 3-D graphics library
/*
* Mesa 3-D graphics library
- * Version:
6.5
.2
+ * Version:
7
.2
*
*
- * Copyright (C) 1999-200
6
Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-200
8
Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@
-32,6
+32,8
@@
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/light.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/light.h"
+#include "math/m_translate.h"
+#include "math/m_xform.h"
#include "tnl.h"
#include "t_context.h"
#include "tnl.h"
#include "t_context.h"
@@
-61,7
+63,6
@@
_tnl_CreateContext( GLcontext *ctx )
/* Initialize tnl state.
*/
if (ctx->VertexProgram._MaintainTnlProgram) {
/* Initialize tnl state.
*/
if (ctx->VertexProgram._MaintainTnlProgram) {
- _tnl_ProgramCacheInit( ctx );
_tnl_install_pipeline( ctx, _tnl_vp_pipeline );
} else {
_tnl_install_pipeline( ctx, _tnl_default_pipeline );
_tnl_install_pipeline( ctx, _tnl_vp_pipeline );
} else {
_tnl_install_pipeline( ctx, _tnl_default_pipeline );
@@
-79,6
+80,12
@@
_tnl_CreateContext( GLcontext *ctx )
tnl->nr_blocks = 0;
tnl->nr_blocks = 0;
+ /* plug in the VBO drawing function */
+ vbo_set_draw_func(ctx, _tnl_vbo_draw_prims);
+
+ _math_init_transformation();
+ _math_init_translate();
+
return GL_TRUE;
}
return GL_TRUE;
}
@@
-90,9
+97,6
@@
_tnl_DestroyContext( GLcontext *ctx )
_tnl_destroy_pipeline( ctx );
_tnl_destroy_pipeline( ctx );
- if (ctx->VertexProgram._MaintainTnlProgram)
- _tnl_ProgramCacheDestroy( ctx );
-
FREE(tnl);
ctx->swtnl_context = NULL;
}
FREE(tnl);
ctx->swtnl_context = NULL;
}
@@
-105,43
+109,52
@@
_tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
const struct gl_vertex_program *vp = ctx->VertexProgram._Current;
const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
const struct gl_vertex_program *vp = ctx->VertexProgram._Current;
const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
- if (new_state & (_NEW_HINT)) {
+ if (new_state & (_NEW_HINT
| _NEW_PROGRAM
)) {
ASSERT(tnl->AllowVertexFog || tnl->AllowPixelFog);
ASSERT(tnl->AllowVertexFog || tnl->AllowPixelFog);
- tnl->_DoVertexFog = (tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
- || !tnl->AllowPixelFog;
+ tnl->_DoVertexFog = (
(
tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
+ || !tnl->AllowPixelFog
) && !fp
;
}
tnl->pipeline.new_state |= new_state;
}
tnl->pipeline.new_state |= new_state;
- /* Calculate tnl->render_inputs:
+ /* Calculate tnl->render_inputs. This bitmask indicates which vertex
+ * attributes need to be emitted to the rasterizer.
*/
if (ctx->Visual.rgbMode) {
GLuint i;
RENDERINPUTS_ZERO( tnl->render_inputs_bitset );
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
*/
if (ctx->Visual.rgbMode) {
GLuint i;
RENDERINPUTS_ZERO( tnl->render_inputs_bitset );
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
+
if (!fp || (fp->Base.InputsRead & FRAG_BIT_COL0)) {
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR0 );
}
if (!fp || (fp->Base.InputsRead & FRAG_BIT_COL0)) {
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR0 );
}
+
+ if (NEED_SECONDARY_COLOR(ctx))
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 );
+
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- if (ctx->Texture._EnabledCoordUnits & (1 << i)) {
+ if (ctx->Texture._EnabledCoordUnits & (1 << i) ||
+ (fp && fp->Base.InputsRead & FRAG_BIT_TEX(i))) {
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) );
}
}
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) );
}
}
-
- if (NEED_SECONDARY_COLOR(ctx))
- RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 );
}
else {
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR_INDEX );
}
}
else {
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR_INDEX );
}
- if (ctx->Fog.Enabled ||
- ((ctx->FragmentProgram._Active || ctx->FragmentProgram._Current) &&
- (ctx->FragmentProgram._Current->FogOption != GL_NONE ||
- (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_FOGC))))
+ if (ctx->Fog.Enabled) {
+ /* fixed-function fog */
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
+ }
+ else if (fp) {
+ if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) {
+ /* fragment program needs fog coord */
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
+ }
+ }
if (ctx->Polygon.FrontMode != GL_FILL ||
ctx->Polygon.BackMode != GL_FILL)
if (ctx->Polygon.FrontMode != GL_FILL ||
ctx->Polygon.BackMode != GL_FILL)
@@
-202,8
+215,8
@@
_tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->AllowVertexFog = value;
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->AllowVertexFog = value;
- tnl->_DoVertexFog = (tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
- || !tnl->AllowPixelFog;
+ tnl->_DoVertexFog = (
(
tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
+ || !tnl->AllowPixelFog
) && !ctx->FragmentProgram._Current
;
}
}
@@
-212,7
+225,7
@@
_tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->AllowPixelFog = value;
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->AllowPixelFog = value;
- tnl->_DoVertexFog = (tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
- || !tnl->AllowPixelFog;
+ tnl->_DoVertexFog = (
(
tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
+ || !tnl->AllowPixelFog
) && !ctx->FragmentProgram._Current
;
}
}