[Mesa-dev] RFC uniform packing for gallium V2

Timothy Arceri tarceri at itsqueeze.com
Sun Jun 25 08:12:18 UTC 2017


On Sun, Jun 25, 2017, at 12:30 AM, Nicolai Hähnle wrote:
> On 25.06.2017 09:18, Nicolai Hähnle wrote:
> > On 25.06.2017 03:31, Timothy Arceri wrote:
> >> There are still a handful of piglit tests failing and I'm yet to test
> >> that there are no regressions in the non-packed path, but I'd really
> >> like some feedback on the approach as Dave has flagged it as a possible
> >> controversial tgsi change.
> >>
> >> In order to avoid complicated swizzling and array element adjustments
> >> when dealing with arrays, this series simply adjusts the constant buffer
> >> index to point to the right location. There are some small changes to
> >> deal with indirect indexing but these also remain very simple and easy
> >> to follow.
> >>
> >> Dave has raised concerns that others might not like this as it doesn't
> >> strictly follow the tgsi approach that everything is a vec4. I would
> >> argue however that this is by far the simplest approch.
> >> Doing this with swizzles and array adjustments is going to require
> >> something like lower_packed_varyings.cpp which would be unnecessarily
> >> complicated IMO, I started off down that track and soon changed
> >> direction.
> > 
> > Yeah, I don't like the approach either. All register files are by vec4 
> > in TGSI, and changing that feels pretty wrong.
> 
> Actually, just thinking about the fact that there are more sources of 
> TGSI than just GLSL means that this is a definite no-go. Think of nine 
> and some of the blitter shaders, for example. Just use LOAD, please.

That could be easily worked around with a CAP. 

Anyway if we really don't want to do it this way, I'll leave this for
now. It's really not as simple as it seems to just use LOAD. Working
with the param list is awkward, and we are adding things to it all over
the place, tracking offsets is going to get overly complicated. I'm not
interested in going down that road right now.

> 
> Cheers,
> Nicolai
> 
> > 
> > I would suggest lowering loads from CONST[0] to LOAD instructions, in 
> > the same way that is used for SSBOs. This has the additional advantage 
> > that we could then use the same code paths to support std430 packing for 
> > UBOs (via a GL extension, I suppose).
> > 
> > 
> >> The main goal of this series is to reduce the cpu overhead cause by
> >> _mesa_propagate_uniforms_to_driver_storage(). The function is slow 
> >> since we
> >> need to deal with strides etc because we are copying packed data to an
> >> unpacked destination. It's also copying data that we have only just 
> >> copied
> >> to anouther duplicate uniform storage that gets created by the linker.
> > 
> > The duplicate copy is necessary unless we start using the same constant 
> > buffer for all shaders in a program, which actually might not be such a 
> > bad idea.
> > 
> > Cheers,
> > Nicolai
> > 
> > 
> >> This series fixes both of these issues and also reduces the size of the
> >> drivers const buffer as a side effect.
> >>
> >> Patches 2-3 just rework the way we use the param list.
> >>
> >> The remaining add the packing support enabled by the
> >> PackedDriverUniformStorage const.
> >>
> >> You can get the series in my test4 branch [1].
> >>
> >> [1] https://github.com/tarceri/Mesa.git
> >>
> >> _______________________________________________
> >> mesa-dev mailing list
> >> mesa-dev at lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >>
> > 
> > 
> 
> 
> -- 
> Lerne, wie die Welt wirklich ist,
> Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list