i915_context.c File Reference

Include dependency graph for i915_context.c:

Go to the source code of this file.

Functions

static void i915_destroy (struct pipe_context *pipe)
static boolean i915_draw_range_elements (struct pipe_context *pipe, struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned min_index, unsigned max_index, unsigned prim, unsigned start, unsigned count)
static boolean i915_draw_elements (struct pipe_context *pipe, struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned prim, unsigned start, unsigned count)
static boolean i915_draw_arrays (struct pipe_context *pipe, unsigned prim, unsigned start, unsigned count)
struct pipe_contexti915_create_context (struct pipe_screen *screen, struct pipe_winsys *pipe_winsys, struct i915_winsys *i915_winsys)


Function Documentation

struct pipe_context* i915_create_context ( struct pipe_screen screen,
struct pipe_winsys pipe_winsys,
struct i915_winsys i915_winsys 
) [read]

Definition at line 140 of file i915_context.c.

References assert, i915_context::batch, i915_winsys::batch_get, CALLOC_STRUCT, pipe_context::clear, debug_get_bool_option(), pipe_context::destroy, i915_context::dirty, i915_context::draw, pipe_context::draw_arrays, draw_create(), pipe_context::draw_elements, draw_install_aaline_stage(), draw_install_aapoint_stage(), pipe_context::draw_range_elements, draw_set_rasterize_stage(), FALSE, i915_context::hardware_dirty, i915_clear(), i915_destroy(), i915_draw_arrays(), i915_draw_elements(), i915_draw_range_elements(), i915_draw_render_stage(), i915_draw_vbuf_stage(), i915_init_flush_functions(), i915_init_state_functions(), i915_init_surface_functions(), i915_init_texture_functions(), i915_context::pipe, pipe_context::screen, i915_batchbuffer::winsys, pipe_context::winsys, and i915_context::winsys.

00143 {
00144    struct i915_context *i915;
00145 
00146    i915 = CALLOC_STRUCT(i915_context);
00147    if (i915 == NULL)
00148       return NULL;
00149 
00150    i915->winsys = i915_winsys;
00151    i915->pipe.winsys = pipe_winsys;
00152    i915->pipe.screen = screen;
00153 
00154    i915->pipe.destroy = i915_destroy;
00155 
00156    i915->pipe.clear = i915_clear;
00157 
00158 
00159    i915->pipe.draw_arrays = i915_draw_arrays;
00160    i915->pipe.draw_elements = i915_draw_elements;
00161    i915->pipe.draw_range_elements = i915_draw_range_elements;
00162 
00163    /*
00164     * Create drawing context and plug our rendering stage into it.
00165     */
00166    i915->draw = draw_create();
00167    assert(i915->draw);
00168    if (!debug_get_bool_option("I915_NO_VBUF", FALSE)) {
00169       draw_set_rasterize_stage(i915->draw, i915_draw_vbuf_stage(i915));
00170    }
00171    else {
00172       draw_set_rasterize_stage(i915->draw, i915_draw_render_stage(i915));
00173    }
00174 
00175    i915_init_surface_functions(i915);
00176    i915_init_state_functions(i915);
00177    i915_init_flush_functions(i915);
00178    i915_init_texture_functions(i915);
00179 
00180    draw_install_aaline_stage(i915->draw, &i915->pipe);
00181    draw_install_aapoint_stage(i915->draw, &i915->pipe);
00182 
00183    i915->dirty = ~0;
00184    i915->hardware_dirty = ~0;
00185 
00186    /* Batch stream debugging is a bit hacked up at the moment:
00187     */
00188    i915->batch = i915_winsys->batch_get(i915_winsys);
00189    i915->batch->winsys = i915_winsys;
00190 
00191    return &i915->pipe;
00192 }

static void i915_destroy ( struct pipe_context pipe  )  [static]

Definition at line 43 of file i915_context.c.

References i915_winsys::destroy, i915_context::draw, draw_destroy(), FREE, i915_context(), and i915_context::winsys.

00044 {
00045    struct i915_context *i915 = i915_context( pipe );
00046 
00047    draw_destroy( i915->draw );
00048    
00049    if(i915->winsys->destroy)
00050       i915->winsys->destroy(i915->winsys);
00051 
00052    FREE( i915 );
00053 }

static boolean i915_draw_arrays ( struct pipe_context pipe,
unsigned  prim,
unsigned  start,
unsigned  count 
) [static]

Definition at line 132 of file i915_context.c.

References i915_draw_elements().

00134 {
00135    return i915_draw_elements(pipe, NULL, 0, prim, start, count);
00136 }

static boolean i915_draw_elements ( struct pipe_context pipe,
struct pipe_buffer indexBuffer,
unsigned  indexSize,
unsigned  prim,
unsigned  start,
unsigned  count 
) [static]

Definition at line 121 of file i915_context.c.

References i915_draw_range_elements().

00125 {
00126    return i915_draw_range_elements( pipe, indexBuffer,
00127                                         indexSize,
00128                                         0, 0xffffffff,
00129                                         prim, start, count );
00130 }

static boolean i915_draw_range_elements ( struct pipe_context pipe,
struct pipe_buffer indexBuffer,
unsigned  indexSize,
unsigned  min_index,
unsigned  max_index,
unsigned  prim,
unsigned  start,
unsigned  count 
) [static]

Definition at line 57 of file i915_context.c.

References pipe_vertex_buffer::buffer, i915_state::constants, i915_context::current, i915_context::dirty, i915_context::draw, draw, draw_arrays(), draw_set_mapped_constant_buffer(), draw_set_mapped_element_buffer(), draw_set_mapped_element_buffer_range(), draw_set_mapped_vertex_buffer(), i915_context(), i915_update_derived(), i915_state::num_user_constants, i915_context::num_vertex_buffers, pipe_buffer_map(), pipe_buffer_unmap(), PIPE_BUFFER_USAGE_CPU_READ, PIPE_SHADER_VERTEX, pipe_context::screen, TRUE, and i915_context::vertex_buffer.

00063 {
00064    struct i915_context *i915 = i915_context( pipe );
00065    struct draw_context *draw = i915->draw;
00066    unsigned i;
00067 
00068    if (i915->dirty)
00069       i915_update_derived( i915 );
00070 
00071    /*
00072     * Map vertex buffers
00073     */
00074    for (i = 0; i < i915->num_vertex_buffers; i++) {
00075       void *buf
00076          = pipe_buffer_map(pipe->screen,
00077                                     i915->vertex_buffer[i].buffer,
00078                                     PIPE_BUFFER_USAGE_CPU_READ);
00079       draw_set_mapped_vertex_buffer(draw, i, buf);
00080    }
00081    /* Map index buffer, if present */
00082    if (indexBuffer) {
00083       void *mapped_indexes
00084          = pipe_buffer_map(pipe->screen, indexBuffer,
00085                                     PIPE_BUFFER_USAGE_CPU_READ);
00086       draw_set_mapped_element_buffer_range(draw, indexSize,
00087                                            min_index,
00088                                            max_index,
00089                                            mapped_indexes);
00090    }
00091    else {
00092       /* no index/element buffer */
00093       draw_set_mapped_element_buffer(draw, 0, NULL);
00094    }
00095 
00096 
00097    draw_set_mapped_constant_buffer(draw,
00098                                    i915->current.constants[PIPE_SHADER_VERTEX],
00099                                    ( i915->current.num_user_constants[PIPE_SHADER_VERTEX] * 
00100                                      4 * sizeof(float) ));
00101 
00102    /* draw! */
00103    draw_arrays(i915->draw, prim, start, count);
00104 
00105    /*
00106     * unmap vertex/index buffers
00107     */
00108    for (i = 0; i < i915->num_vertex_buffers; i++) {
00109       pipe_buffer_unmap(pipe->screen, i915->vertex_buffer[i].buffer);
00110       draw_set_mapped_vertex_buffer(draw, i, NULL);
00111    }
00112    if (indexBuffer) {
00113       pipe_buffer_unmap(pipe->screen, indexBuffer);
00114       draw_set_mapped_element_buffer_range(draw, 0, start, start + count - 1, NULL);
00115    }
00116 
00117    return TRUE;
00118 }


Generated on Tue Sep 29 06:25:34 2009 for Gallium3D by  doxygen 1.5.4