X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Ftnl%2Ft_context.c;h=1b787180e3684c648ab1b4211ff9d7d4217daf44;hb=30f4ccff5bd7304a623d2909aaf8de35727ce03d;hp=77f1c1bce423c381fc387e293583dbc40dc5b121;hpb=3d8d5b298a268b119d840bc9bae0ee9e0c9244a9;p=mesa.git diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index 77f1c1bce42..1b787180e36 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -1,6 +1,5 @@ /* * Mesa 3-D graphics library - * Version: 7.2 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * @@ -23,12 +22,12 @@ * OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell + * Keith Whitwell */ #include "main/glheader.h" -#include "main/imports.h" + #include "main/context.h" #include "main/macros.h" #include "main/mtypes.h" @@ -36,6 +35,9 @@ #include "math/m_translate.h" #include "math/m_xform.h" #include "main/state.h" +#include "main/viewport.h" +#include "util/simple_list.h" +#include "util/u_memory.h" #include "tnl.h" #include "t_context.h" @@ -70,6 +72,8 @@ _tnl_CreateContext( struct gl_context *ctx ) _tnl_install_pipeline( ctx, _tnl_default_pipeline ); } + _math_matrix_ctr(&tnl->_WindowMap); + tnl->NeedNdcCoords = GL_TRUE; tnl->AllowVertexFog = GL_TRUE; tnl->AllowPixelFog = GL_TRUE; @@ -93,12 +97,12 @@ _tnl_CreateContext( struct gl_context *ctx ) insert_at_tail( tnl->_ShineTabList, s ); } - /* plug in the VBO drawing function */ - vbo_set_draw_func(ctx, _tnl_vbo_draw_prims); - _math_init_transformation(); _math_init_translate(); + /* Keep our list of tnl_vertex_array inputs */ + _tnl_init_inputs(&tnl->draw_arrays); + return GL_TRUE; } @@ -109,6 +113,8 @@ _tnl_DestroyContext( struct gl_context *ctx ) struct tnl_shine_tab *s, *tmps; TNLcontext *tnl = TNL_CONTEXT(ctx); + _math_matrix_dtr(&tnl->_WindowMap); + /* Free lighting shininess exponentiation table */ foreach_s( s, tmps, tnl->_ShineTabList ) { free( s ); @@ -126,12 +132,12 @@ void _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) { TNLcontext *tnl = TNL_CONTEXT(ctx); - const struct gl_vertex_program *vp = ctx->VertexProgram._Current; - const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; + const struct gl_program *vp = ctx->VertexProgram._Current; + const struct gl_program *fp = ctx->FragmentProgram._Current; GLuint i; 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) && !fp; } @@ -143,7 +149,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) */ tnl->render_inputs_bitset = BITFIELD64_BIT(_TNL_ATTRIB_POS); - if (!fp || (fp->Base.InputsRead & VARYING_BIT_COL0)) { + if (!fp || (fp->info.inputs_read & VARYING_BIT_COL0)) { tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR0); } @@ -152,19 +158,20 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { if (ctx->Texture._EnabledCoordUnits & (1 << i) || - (fp && fp->Base.InputsRead & VARYING_BIT_TEX(i))) { + (fp && fp->info.inputs_read & VARYING_BIT_TEX(i)) || + _mesa_ati_fragment_shader_enabled(ctx)) { tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_TEX(i)); } } if (ctx->Fog.Enabled - || (fp != NULL && (fp->Base.InputsRead & VARYING_BIT_FOGC) != 0)) { + || (fp != NULL && (fp->info.inputs_read & VARYING_BIT_FOGC) != 0)) { /* Either fixed-function fog or a fragment program needs fog coord. */ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_FOG); } - if (ctx->Polygon.FrontMode != GL_FILL || + if (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_EDGEFLAG); @@ -178,11 +185,19 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) if (vp) { GLuint i; for (i = 0; i < MAX_VARYING; i++) { - if (vp->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) { + if (vp->info.outputs_written & + BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) { tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i)); } } } + + if (new_state & (_NEW_VIEWPORT | _NEW_BUFFERS)) { + float scale[3], translate[3]; + _mesa_get_viewport_xform(ctx, 0, scale, translate); + _math_matrix_viewport(&tnl->_WindowMap, scale, translate, + ctx->DrawBuffer->_DepthMaxF); + } } @@ -195,7 +210,7 @@ _tnl_wakeup( struct gl_context *ctx ) #if 0 if (ctx->Light.ColorMaterialEnabled) { - _mesa_update_color_material( ctx, + _mesa_update_color_material( ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); } #endif