[Mesa-dev] Path to optimize (moving from create/bind/delete paradgim to set only ?)

Christoph Bumiller e0425955 at student.tuwien.ac.at
Wed Nov 17 15:09:29 PST 2010

On 11/17/2010 10:45 AM, Keith Whitwell wrote:
> This is surprising, as Roland says we're following the DX10 partitioning
> of state, and hardware vendors are effectively coerced to do likewise,
> so things should more or less match up.
For nv50, nvc0 I find the partitioning quite OK, maybe it should be more
fine grained in some places (especially the rasterizer state, why is
line stipple in there and polygon stipple isn't - it's obvious but
inconsistent), in order to avoid too many cso instances with 1 bit
differences, and to save some command buffer volume, but the latter is
probably negligible.

Sampler and sampler view states can be switched with a single bind
command (assuming sane use of the GPU's virtual memory) since they're
stored in dedicated blocks in VRAM, and for the other state objects
(except shaders) we can just memcpy the pregenerated commands into the
push buffer.

There are a few areas where changing a cso requires state changes
elsewhere too, e.g. changing light_twoside requires rebuilding shader
routing tables, but that's no reason to dissolve the cso.

> One thing I noticed about your early posts is that you're not just
> talking about state, but also constant buffer contents.
> This is an area where we could improve things with coding changes to the
> mesa state tracker -- currently we're destroying and recreating constant
> buffers constantly.
> It wouldn't surprise me if this was causing problems due to the
> interleaving of buffer create/destroy with normal rendering, making it
> hard to build up decent length command buffers.
> That *should* change, to a situation where constants are updated in a
> pipelined fashion with transfer_inline_write().  That would really just
> be a state-tracker change.

As for shader constants, knowing that my pipe driver will be used with
OpenGL, we just keep a persistent uniform buffer which is also filled by
special constant buffer upload commands.
Yet it's a bit wasteful to upload everything even if the user may have
just changed 1 float value of 100, and the buffers provided by the state
tracker also include the values of immediates iirc.

> Keith
> _______________________________________________
> 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