[Mesa-dev] [PATCH] util: add u_lowering
Rob Clark
robdclark at gmail.com
Tue Sep 30 16:45:30 PDT 2014
On Tue, Sep 30, 2014 at 6:31 PM, Eric Anholt <eric at anholt.net> wrote:
> Brian Paul <brianp at vmware.com> writes:
>
>> On 09/30/2014 03:38 PM, Rob Clark wrote:
>>> From: Rob Clark <robclark at freedesktop.org>
>>>
>>> TGSI->TGSI pass, extracted from freedreno. Currently provides the
>>> following lower support, to help drivers emulate unsupported opcodes
>>> or features:
>>>
>>> Individual opcodes:
>>> DST, XPD, SCS, LRP, FRC, POW, LIT, EXP, LOG, DP4, DP3, DPH,
>>> DP2, DP2A
>>>
>>> Also supported, although it is up to the driver to manage it's own
>>> shader variants:
>>> + two-sided-color
>>> + texture coord saturate (ie. to emulate GL_CLAMP)
>>>
>>> All of the lowering operations are opt-in so a driver can pick and
>>> choose what it wants.
>>>
>>> Signed-off-by: Rob Clark <robclark at freedesktop.org>
>>
>> Hi Rob, a few thoughts:
>>
>> How about moving this into the src/gallium/auxiliary/tgsi/ directory
>> since this is a very TGSI-specific thing?
>
> I happened to be writing a series in parallel with Rob to do the same
> thing, and I chose tgsi/. I've rebased my changes on his freedreno fix,
> and I'm going to send them out in this thread now. I don't really care
> which location wins, having good history is all I care about (Also,
> reviewing his changes, I found style improvements that I propagated to
> mine. So duplicated work ended up having some value).
I'm fine w/ .../tgsi as well. And your split into copy+reformat looks
fine, so a-b
>
>> I think some of my recent changes to the tgsi_transform code would be
>> helpful, like emit_epilog/prolog() and the various
>> tgsi_transform_opX_inst() helpers.
>>
>> There's a lot of tricky code trying to determine the exact size of the
>> new shader token buffer. Why not just use a 2x buffer and then realloc
>> to the exact size at the end?
>
> 2x isn't nearly the lowest growth factor, right? How massively
> overallocated do you go?
It could be worse than 2x.. it would be a pretty funny shader, but
flat 2x won't be enough in some edge cases
> All this calculation of array sizes up front is pretty awful, though --
> it seems like token buffers ought to be just growing as you append
> tokens. But I guess that would be a change to do to tgsi_transform in
> general.
+1
>> I think the big if/switch statements could be replaced by some kind of
>> table-driven system.
the switch statement did start out a more reasonable size :-P
certainly some room to refactor.. I just wanted to move it out of
.../drivers/freedreno so that Eric could use it
BR,
-R
More information about the mesa-dev
mailing list