[Mesa-dev] [PATCH 4/5] draw/so: account for holes in the stream output

Marek Olšák maraeo at gmail.com
Thu Apr 25 10:45:57 PDT 2013


You can already express holes with the current interface by setting
dst_offset of two outputs such that there is a hole between them (e.g.
dst_offset0 = 0, dst_offset1 = 8). I don't think inserting a dummy
output for the hole is needed.

Also, the commit summary doesn't say that the gallium interface (which
has nothing to do with Draw) is being changed.

Marek

On Wed, Apr 24, 2013 at 12:58 AM, Zack Rusin <zackr at vmware.com> wrote:
> The spec says that the stream output can have holes if the register
> index is the maximum possible value, in which case writes to the
> buffer should be skipped but everything else should be processed
> as usual.
>
> Signed-off-by: Zack Rusin <zackr at vmware.com>
> ---
>  src/gallium/auxiliary/draw/draw_pt_so_emit.c |   15 ++++++++++-----
>  src/gallium/include/pipe/p_state.h           |    2 ++
>  2 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
> index fc69017..563bf65 100644
> --- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c
> +++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
> @@ -168,11 +168,16 @@ static void so_emit_prim(struct pt_so_emit *so,
>           buffer = (float *)((char *)draw->so.targets[ob]->mapping +
>                              draw->so.targets[ob]->target.buffer_offset +
>                              draw->so.targets[ob]->internal_offset) + state->output[slot].dst_offset;
> -
> -         if (idx == so->pos_idx && pcp_ptr)
> -            memcpy(buffer, &pre_clip_pos[start_comp], num_comps * sizeof(float));
> -         else
> -            memcpy(buffer, &input[idx][start_comp], num_comps * sizeof(float));
> +
> +         /* the maximum register index simply means that this is
> +          * a hole that should be skipped */
> +         if (idx != PIPE_MAX_SO_REGISTER_INDEX) {
> +            if (idx == so->pos_idx && pcp_ptr) {
> +               memcpy(buffer, &pre_clip_pos[start_comp], num_comps * sizeof(float));
> +            } else {
> +               memcpy(buffer, &input[idx][start_comp], num_comps * sizeof(float));
> +            }
> +         }
>        }
>        for (ob = 0; ob < draw->so.num_targets; ++ob) {
>           draw->so.targets[ob]->internal_offset += state->stride[ob] * sizeof(float);
> diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
> index 5830dff..155bfad 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -65,6 +65,7 @@ extern "C" {
>  #define PIPE_MAX_TEXTURE_LEVELS   16
>  #define PIPE_MAX_SO_BUFFERS        4
>  #define PIPE_MAX_SO_OUTPUT_COMPONENT_COUNT 128
> +#define PIPE_MAX_SO_REGISTER_INDEX    0xff
>
>
>  struct pipe_reference
> @@ -194,6 +195,7 @@ struct pipe_stream_output_info
>      * Selected components are tightly packed into the output buffer.
>      */
>     struct {
> +      /* Update PIPE_MAX_SO_REGISTER_INDEX when changing the size */
>        unsigned register_index:8;  /**< 0 to PIPE_MAX_SHADER_OUTPUTS */
>        unsigned start_component:2; /** 0 to 3 */
>        unsigned num_components:3;  /** 1 to 4 */
> --
> 1.7.10.4
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list