diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-08-15 11:45:54 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-08-15 11:45:54 -0600 |
commit | bff0411c5a1a9fdfff7f8a5128af4d496b89fa0d (patch) | |
tree | df9eff2972f8e732dcd789bef59b60eaddfac26d /src/mesa/state_tracker | |
parent | f30093418928dce5872ea179ed5d21d3b24b7c82 (diff) |
sketch out vbo drawing function
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_draw.c | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 95fa43df4d..002565a658 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -30,7 +30,9 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "imports.h" +#include "main/imports.h" + +#include "vbo/vbo.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" @@ -38,7 +40,10 @@ #include "st_context.h" #include "st_atom.h" #include "st_draw.h" +#include "st_cb_bufferobjects.h" #include "pipe/p_context.h" +#include "pipe/p_defines.h" + /* * TNL stage which feeds into the above. @@ -88,6 +93,57 @@ static const struct tnl_pipeline_stage *st_pipeline[] = { 0, }; + + +/** + * This function gets plugged into the VBO module and is called when + * we have something to render. + * Basically, translate the information into the format expected by pipe. + */ +static void +draw_vbo(GLcontext *ctx, + const struct gl_client_array **arrays, + const struct _mesa_prim *prims, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLuint min_index, + GLuint max_index) +{ + struct pipe_context *pipe = ctx->st->pipe; + GLuint attr; + + /* tell pipe about the vertex array element/attributes */ + for (attr = 0; attr < 16; attr++) { + struct gl_buffer_object *bufobj = arrays[attr]->BufferObj; + if (bufobj && bufobj->Name) { + struct st_buffer_object *stobj = st_buffer_object(bufobj); + struct pipe_buffer_handle *buffer = stobj->buffer; + GLenum type = arrays[attr]->Type; + GLint size = arrays[attr]->Size; + struct pipe_vertex_buffer vbuffer; + struct pipe_vertex_element velement; + + vbuffer.pitch = 0; + vbuffer.max_index = 0; + vbuffer.buffer = NULL; + vbuffer.buffer_offset = 0; + + velement.src_offset = 0; + velement.vertex_buffer_index = attr; + velement.dst_offset = 0; + velement.src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + + pipe->set_vertex_buffer(pipe, attr, &vbuffer); + pipe->set_vertex_element(pipe, attr, &velement); + } + } + + /* do actual drawing */ +} + + + + /* This is all a hack to keep using tnl until we have vertex programs * up and running. */ |