diff options
author | Marek Olšák <[email protected]> | 2011-12-15 18:42:21 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2011-12-15 18:51:48 +0100 |
commit | 861a029ddb31e91bb4d8e18ab708d0d172f63aad (patch) | |
tree | a938450d80ee5dbda670f7fe37bb51b10c1982c4 /src/gallium/include/pipe/p_context.h | |
parent | 4f4a1be2009863ea34a69b22f58aa1ca08cd710f (diff) |
gallium: interface changes necessary to implement transform feedback (v5)
Namely:
- EXT_transform_feedback
- ARB_transform_feedback2
- ARB_transform_feedback_instanced
The old interface was not useful for OpenGL and had to be reworked.
This interface was originally designed for OpenGL, but additional
changes have been made in order to make st/d3d1x support easier.
The most notable change is the stream-out info must be linked
with a vertex or geometry shader and cannot be set independently.
This is due to limitations of existing hardware (special shader
instructions must be used to write into stream-out buffers),
and it's also how OpenGL works (stream outputs must be specified
prior to linking shaders).
Other than that, each stream output buffer has a "view" into it that
internally maintains the number of bytes which have been written
into it. (one buffer can be bound in several different transform
feedback objects in OpenGL, so we must be able to have several views
around) The set_stream_output_targets function contains a parameter
saying whether new data should be appended or not.
Also, the view can optionally be used to provide the vertex
count for draw_vbo. Note that the count is supposed to be stored
in device memory and the CPU never gets to know its value.
OpenGL way | Gallium way
------------------------------------
BeginTF = set_so_targets(append_bitmask = 0)
PauseTF = set_so_targets(num_targets = 0)
ResumeTF = set_so_targets(append_bitmask = ~0)
EndTF = set_so_targets(num_targets = 0)
DrawTF = use pipe_draw_info::count_from_stream_output
v2: * removed the reset_stream_output_targets function
* added a parameter append_bitmask to set_stream_output_targets,
each bit specifies whether new data should be appended to each
buffer or not.
v3: * added PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME for ARB_tfb2,
note that the draw-auto subset is always required (for d3d10),
only the pause/resume functionality is limited if the CAP is not
advertised
v4: * update gallium/docs
v5: * compactified struct pipe_stream_output_info, updated dump/trace
Diffstat (limited to 'src/gallium/include/pipe/p_context.h')
-rw-r--r-- | src/gallium/include/pipe/p_context.h | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index b2d5f9543e6..de79a9bfff1 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -56,7 +56,7 @@ struct pipe_sampler_view; struct pipe_scissor_state; struct pipe_shader_state; struct pipe_stencil_ref; -struct pipe_stream_output_state; +struct pipe_stream_output_target; struct pipe_surface; struct pipe_vertex_buffer; struct pipe_vertex_element; @@ -86,11 +86,6 @@ struct pipe_context { /*@{*/ void (*draw_vbo)( struct pipe_context *pipe, const struct pipe_draw_info *info ); - - /** - * Draw the stream output buffer at index 0 - */ - void (*draw_stream_output)( struct pipe_context *pipe, unsigned mode ); /*@}*/ /** @@ -179,11 +174,6 @@ struct pipe_context { void (*bind_vertex_elements_state)(struct pipe_context *, void *); void (*delete_vertex_elements_state)(struct pipe_context *, void *); - void * (*create_stream_output_state)(struct pipe_context *, - const struct pipe_stream_output_state *); - void (*bind_stream_output_state)(struct pipe_context *, void *); - void (*delete_stream_output_state)(struct pipe_context*, void*); - /*@}*/ /** @@ -237,12 +227,26 @@ struct pipe_context { void (*set_index_buffer)( struct pipe_context *pipe, const struct pipe_index_buffer * ); - void (*set_stream_output_buffers)(struct pipe_context *, - struct pipe_resource **buffers, - int *offsets, /*array of offsets - from the start of each - of the buffers */ - int num_buffers); + /*@}*/ + + /** + * Stream output functions. + */ + /*@{*/ + + struct pipe_stream_output_target *(*create_stream_output_target)( + struct pipe_context *, + struct pipe_resource *, + unsigned buffer_offset, + unsigned buffer_size); + + void (*stream_output_target_destroy)(struct pipe_context *, + struct pipe_stream_output_target *); + + void (*set_stream_output_targets)(struct pipe_context *, + unsigned num_targets, + struct pipe_stream_output_target **targets, + unsigned append_bitmask); /*@}*/ |