} while (0)
-/**
- * XXX very similar to same func in draw_vb.c (which will go away)
- */
void
draw_set_vertex_attributes( struct draw_context *draw,
const unsigned *slot_to_vf_attr,
draw->nr_planes = 6;
#ifdef MESA
+#if 0
draw->vf = vf_create( GL_TRUE );
+#endif
#endif
/* Statically allocate maximum sized vertices for the cache - could be cleverer...
void draw_destroy( struct draw_context *draw )
{
-#ifdef MESA
+#if 0/*def MESA*/
if (draw->header.storage) {
ALIGN_FREE( draw->header.storage );
}
draw->viewport = *viewport; /* struct copy */
#ifdef MESA
+#if 0
vf_set_vp_scale_translate( draw->vf, viewport->scale, viewport->translate );
+#endif
#endif
/* Using tnl/ and vf/ modules is temporary while getting started.
} pq;
- /* Misc for draw_vb.c (XXX temporary)
- */
-#ifdef MESA
- GLvector4f header;
-#endif
+#if 0
ubyte *verts;
boolean in_vb;
struct vertex_fetch *vf;
+#endif
};
free( i915 );
}
-static void i915_draw_vb( struct pipe_context *pipe,
- struct vertex_buffer *VB )
-{
- struct i915_context *i915 = i915_context( pipe );
-
- if (i915->dirty)
- i915_update_derived( i915 );
-
-#if 0
- draw_vb( i915->draw, VB );
-#endif
-}
-
-static void
-i915_draw_vertices(struct pipe_context *pipe,
- unsigned mode,
- unsigned numVertex, const float *verts,
- unsigned numAttribs, const unsigned attribs[])
+static void i915_draw_arrays( struct pipe_context *pipe,
+ unsigned mode, unsigned start, unsigned count)
{
struct i915_context *i915 = i915_context( pipe );
if (i915->dirty)
i915_update_derived( i915 );
-#if 0
- draw_vertices(i915->draw, mode, numVertex, verts, numAttribs, attribs);
-#endif
+
+ draw_arrays(i915->draw, mode, start, count);
}
i915->pipe.destroy = i915_destroy;
i915->pipe.supported_formats = i915_supported_formats;
i915->pipe.max_texture_size = i915_max_texture_size;
- i915->pipe.draw_vb = i915_draw_vb;
- i915->pipe.draw_vertices = i915_draw_vertices;
i915->pipe.clear = i915_clear;
i915->pipe.reset_occlusion_counter = NULL; /* no support */
i915->pipe.get_occlusion_counter = NULL;
+ i915->pipe.draw_arrays = i915_draw_arrays;
/*
* Create drawing context and plug our rendering stage into it.
#ifndef PIPE_CONTEXT_H
#define PIPE_CONTEXT_H
-//#include "main/mtypes.h"
#include "p_state.h"
#include "p_compiler.h"
-/* Drawing currently kludged up via the existing tnl/ module.
- */
-struct vertex_buffer;
-
-
/**
* Software pipeline rendering context. Basically a collection of
* state setting functions, plus VBO drawing entrypoint.
/*
* Drawing
*/
- /* XXX this is temporary */
- void (*draw_vb)( struct pipe_context *pipe,
- struct vertex_buffer *VB );
-
- /* XXX this is temporary */
- void (*draw_vertices)( struct pipe_context *pipe,
- unsigned mode,
- unsigned numVertex, const float *verts,
- unsigned numAttribs, const unsigned attribs[]);
-
- /** this is basically what we want */
void (*draw_arrays)( struct pipe_context *pipe,
unsigned mode, unsigned start, unsigned count);
}
-#if 0
-static void softpipe_draw_vb( struct pipe_context *pipe,
- struct vertex_buffer *VB )
-{
- struct softpipe_context *softpipe = softpipe_context( pipe );
-
- if (softpipe->dirty)
- softpipe_update_derived( softpipe );
-
- /* XXX move mapping/unmapping to higher/coarser level? */
- softpipe_map_surfaces(softpipe);
- draw_vb( softpipe->draw, VB );
- softpipe_unmap_surfaces(softpipe);
-}
-#endif
-
-
-static void
-softpipe_draw_vertices(struct pipe_context *pipe,
- unsigned mode,
- unsigned numVertex, const float *verts,
- unsigned numAttribs, const unsigned attribs[])
-{
- struct softpipe_context *softpipe = softpipe_context( pipe );
-
- if (softpipe->dirty)
- softpipe_update_derived( softpipe );
-
- /* XXX move mapping/unmapping to higher/coarser level? */
- softpipe_map_surfaces(softpipe);
-#if 0
- draw_vertices(softpipe->draw, mode, numVertex, verts, numAttribs, attribs);
-#endif
- softpipe_unmap_surfaces(softpipe);
-}
-
-
-
static void softpipe_reset_occlusion_counter(struct pipe_context *pipe)
{
struct softpipe_context *softpipe = softpipe_context( pipe );
softpipe->pipe.set_vertex_buffer = softpipe_set_vertex_buffer;
softpipe->pipe.set_vertex_element = softpipe_set_vertex_element;
-#if 0
- softpipe->pipe.draw_vb = softpipe_draw_vb;
- softpipe->pipe.draw_vertices = softpipe_draw_vertices;
-#endif
softpipe->pipe.draw_arrays = softpipe_draw_arrays;
softpipe->pipe.draw_elements = softpipe_draw_elements;
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
+
+
#include "sp_context.h"
#include "sp_state.h"
#include "sp_surface.h"
+#include "pipe/draw/draw_context.h"
+
void
softpipe_set_vertex_element(struct pipe_context *pipe,
#include "main/imports.h"
#include "vbo/vbo.h"
+#include "vbo/vbo_context.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_vp_build.h" /* USE_NEW_DRAW */
+#include "tnl/t_vp_build.h"
#include "st_context.h"
#include "st_atom.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
-#include "vbo/vbo_context.h"
-
-/*
- * Enabling this causes the VBO module to call draw_vbo() below,
- * bypassing the T&L module. This only works with VBO-based demos,
- * such as progs/test/bufferobj.c
- */
-#define USE_NEW_DRAW 01
-
-
-/*
- * TNL stage which feeds into the above.
- *
- * XXX: this needs to go into each driver using this code, because we
- * cannot make the leap from ctx->draw_context in this file. The
- * driver needs to customize tnl anyway, so this isn't a big deal.
- */
-static GLboolean draw( GLcontext * ctx, struct tnl_pipeline_stage *stage )
-{
- struct st_context *st = st_context(ctx);
-#if 0
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-#endif
-
- /* Validate driver and pipe state:
- */
- st_validate_state( st );
-
- /* Call into the new draw code to handle the VB:
- */
-#if 0
- st->pipe->draw_vb( st->pipe, VB );
-#endif
-
- /* Finished
- */
- return GL_FALSE;
-}
-
-const struct tnl_pipeline_stage st_draw = {
- "check state and draw",
- NULL,
- NULL,
- NULL,
- NULL,
- draw
-};
-
-static const struct tnl_pipeline_stage *st_pipeline[] = {
-#if USE_NEW_DRAW
- &_tnl_vertex_program_stage,
-#else
- &_tnl_vertex_transform_stage,
- &_tnl_vertex_cull_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
- &_tnl_vertex_program_stage,
-#endif
- &st_draw, /* ADD: escape to pipe */
- 0,
-};
-
static GLuint
void st_init_draw( struct st_context *st )
{
GLcontext *ctx = st->ctx;
-
-#if USE_NEW_DRAW
struct vbo_context *vbo = (struct vbo_context *) ctx->swtnl_im;
create_default_attribs_buffer(st);
assert(vbo->draw_prims);
vbo->draw_prims = draw_vbo;
-#endif
-#if 0
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, st_pipeline );
-#endif
-
- /* USE_NEW_DRAW */
_tnl_ProgramCacheInit( ctx );
}