diff options
Diffstat (limited to 'src/gallium/include')
-rw-r--r-- | src/gallium/include/pipe/p_context.h | 38 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_defines.h | 10 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_state.h | 85 |
3 files changed, 95 insertions, 38 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); /*@}*/ diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 30f1d7fb964..800a04cd8f0 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -438,7 +438,7 @@ enum pipe_cap { PIPE_CAP_TEXTURE_MIRROR_CLAMP = 25, PIPE_CAP_BLEND_EQUATION_SEPARATE = 28, PIPE_CAP_SM3 = 29, /*< Shader Model, supported */ - PIPE_CAP_STREAM_OUTPUT = 30, + PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS = 30, PIPE_CAP_PRIMITIVE_RESTART = 31, /** Maximum texture image units accessible from vertex and fragment shaders * combined */ @@ -466,8 +466,12 @@ enum pipe_cap { PIPE_CAP_MAX_TEXEL_OFFSET = 51, PIPE_CAP_CONDITIONAL_RENDER = 52, PIPE_CAP_TEXTURE_BARRIER = 53, - PIPE_CAP_TGSI_CAN_COMPACT_VARYINGS = 54, /* temporary */ - PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS = 55 /* temporary */ + PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_ATTRIBS = 54, + PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS = 55, + PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS = 56, + PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME = 57, + PIPE_CAP_TGSI_CAN_COMPACT_VARYINGS = 58, /* temporary */ + PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS = 59 /* temporary */ }; /** diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 37e0679e15f..f943ca58b88 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -121,6 +121,12 @@ struct pipe_rasterizer_state */ unsigned gl_rasterization_rules:1; + /** + * When true, rasterization is disabled and no pixels are written. + * This only makes sense with the Stream Out functionality. + */ + unsigned rasterizer_discard:1; + unsigned line_stipple_factor:8; /**< [1..256] actually */ unsigned line_stipple_pattern:16; @@ -164,9 +170,30 @@ struct pipe_clip_state }; +/** + * Stream output for vertex transform feedback. + */ +struct pipe_stream_output_info +{ + unsigned num_outputs; + /** stride for an entire vertex, only used if all output_buffers are 0 */ + unsigned stride; + /** + * Array of stream outputs, in the order they are to be written in. + * Selected components are tightly packed into the output buffer. + */ + struct { + unsigned register_index:8; /**< 0 to PIPE_MAX_SHADER_OUTPUTS */ + unsigned register_mask:4; /**< TGSI_WRITEMASK_x */ + unsigned output_buffer:4; /**< 0 to PIPE_MAX_SO_BUFFERS */ + } output[PIPE_MAX_SHADER_OUTPUTS]; +}; + + struct pipe_shader_state { const struct tgsi_token *tokens; + struct pipe_stream_output_info stream_output; }; @@ -375,24 +402,6 @@ struct pipe_resource /** - * Stream output for vertex transform feedback. - */ -struct pipe_stream_output_state -{ - /** number of the output buffer to insert each element into */ - int output_buffer[PIPE_MAX_SHADER_OUTPUTS]; - /** which register to grab each output from */ - int register_index[PIPE_MAX_SHADER_OUTPUTS]; - /** TGSI_WRITEMASK signifying which components to output */ - ubyte register_mask[PIPE_MAX_SHADER_OUTPUTS]; - /** number of outputs */ - int num_outputs; - /** stride for an entire vertex, only used if all output_buffers are 0 */ - unsigned stride; -}; - - -/** * Transfer object. For data transfer to/from a resource. */ struct pipe_transfer @@ -422,6 +431,30 @@ struct pipe_vertex_buffer /** + * A stream output target. The structure specifies the range vertices can + * be written to. + * + * In addition to that, the structure should internally maintain the offset + * into the buffer, which should be incremented everytime something is written + * (appended) to it. The internal offset is buffer_offset + how many bytes + * have been written. The internal offset can be stored on the device + * and the CPU actually doesn't have to query it. + * + * Use PIPE_QUERY_SO_STATISTICS to know how many primitives have + * actually been written. + */ +struct pipe_stream_output_target +{ + struct pipe_reference reference; + struct pipe_resource *buffer; /**< buffer into which this is a target view */ + struct pipe_context *context; /**< context this view belongs to */ + + unsigned buffer_offset; /**< offset where data should be written, in bytes */ + unsigned buffer_size; /**< how much data is allowed to be written */ +}; + + +/** * Information to describe a vertex attribute (position, color, etc) */ struct pipe_vertex_element @@ -481,6 +514,22 @@ struct pipe_draw_info */ boolean primitive_restart; unsigned restart_index; + + /** + * Stream output target. If not NULL, it's used to provide the 'count' + * parameter based on the number vertices captured by the stream output + * stage. (or generally, based on the number of bytes captured) + * + * Only 'mode', 'start_instance', and 'instance_count' are taken into + * account, all the other variables from pipe_draw_info are ignored. + * + * 'start' is implicitly 0 and 'count' is set as discussed above. + * The draw command is non-indexed. + * + * Note that this only provides the count. The vertex buffers must + * be set via set_vertex_buffers manually. + */ + struct pipe_stream_output_target *count_from_stream_output; }; |