[Mesa-dev] [PATCH] gallium: add start_slot parameter to set_vertex_buffers
Brian Paul
brianp at vmware.com
Mon Oct 29 09:28:29 PDT 2012
On 10/26/2012 07:29 PM, Marek Olšák wrote:
> This allows updating only a subrange of buffer bindings.
>
> set_vertex_buffers(pipe, start_slot, count, NULL) unbinds buffers in that
> range. Binding NULL resources unbinds buffers too (both buffer and user_buffer
> must be NULL).
>
> The meta ops are adapted to only save, change, and restore the single slot
> they use. The cso_context can save and restore only one vertex buffer slot.
> The clients can query which one it is using cso_get_aux_vertex_buffer_slot.
> It's currently set to 0. (the Draw module breaks if it's set to non-zero)
>
> It should decrease the CPU overhead when using a lot of meta ops, but
> the drivers must be able to treat each vertex buffer slot as a separate
> state (only r600g does so at the moment).
>
> I can imagine this also being useful for optimizing some OpenGL use cases.
> ---
I did a quick scan and this looks OK to me. Just a few minor nits below.
> diff --git a/src/gallium/auxiliary/util/u_helpers.c b/src/gallium/auxiliary/util/u_helpers.c
> new file mode 100644
> index 0000000..ac1edcd
> --- /dev/null
> +++ b/src/gallium/auxiliary/util/u_helpers.c
u_helpers.[ch] seems a bit generic for this code. The functions seem
to be related to vertex buffers so maybe call it u_vertex_buffers.[ch]
> diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
> index 4047bd9..607fbec 100644
> --- a/src/gallium/auxiliary/util/u_math.h
> +++ b/src/gallium/auxiliary/util/u_math.h
> @@ -482,12 +482,16 @@ unsigned ffs( unsigned u )
> */
> static INLINE unsigned util_last_bit(unsigned u)
> {
> +#if defined(__GNUC__)&& ((__GNUC__ * 100 + __GNUC_MINOR__)>= 304)
> + return u == 0 ? 0 : 32 - __builtin_clz(u);
> +#else
> unsigned r = 0;
> while (u) {
> r++;
> u>>= 1;
> }
> return r;
> +#endif
> }
This could go in it's own patch, but not a huge deal.
Reviewed-by: Brian Paul <brianp at vmware.com>
BTW, I have a branch which consolidates all the
pipe_context::bind_X_sampler_state() functions and pipe_context::
set_X_sampler_view() functions plus adds a start_slot parameter.
It's a bit stale though and needs to be rebased on master.
-Brian
More information about the mesa-dev
mailing list