1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 * Keith Whitwell <keith@tungstengraphics.com>
35 #include "tnl/t_context.h"
36 #include "tnl/t_pipeline.h"
38 #include "st_context.h"
41 #include "pipe/p_context.h"
44 * TNL stage which feeds into the above.
46 * XXX: this needs to go into each driver using this code, because we
47 * cannot make the leap from ctx->draw_context in this file. The
48 * driver needs to customize tnl anyway, so this isn't a big deal.
50 static GLboolean
draw( GLcontext
* ctx
, struct tnl_pipeline_stage
*stage
)
52 struct st_context
*st
= st_context(ctx
);
53 struct vertex_buffer
*VB
= &TNL_CONTEXT(ctx
)->vb
;
55 /* Validate driver and pipe state:
57 st_validate_state( st
);
59 /* Call into the new draw code to handle the VB:
61 st
->pipe
->draw_vb( st
->pipe
, VB
);
68 const struct tnl_pipeline_stage st_draw
= {
69 "check state and draw",
77 static const struct tnl_pipeline_stage
*st_pipeline
[] = {
78 &_tnl_vertex_transform_stage
,
79 &_tnl_vertex_cull_stage
,
80 &_tnl_normal_transform_stage
,
82 &_tnl_fog_coordinate_stage
,
84 &_tnl_texture_transform_stage
,
85 &_tnl_point_attenuation_stage
,
86 &_tnl_vertex_program_stage
,
87 &st_draw
, /* ADD: escape to pipe */
91 /* This is all a hack to keep using tnl until we have vertex programs
94 void st_init_draw( struct st_context
*st
)
96 GLcontext
*ctx
= st
->ctx
;
98 _tnl_destroy_pipeline( ctx
);
99 _tnl_install_pipeline( ctx
, st_pipeline
);
103 void st_destroy_draw( struct st_context
*st
)