Keith Whitwell pisze: > On Wed, 2009-07-22 at 01:35 -0700, Michał Król wrote: > >> Keith Whitwell pisze: >> >>> Remove the need to have a pointer in this struct by just including >>> the immediate data inline. Having a pointer in the struct introduces >>> complications like needing to alloc/free the data pointed to, uncertainty >>> about who owns the data, etc. There doesn't seem to be a need for it, >>> and it is unlikely to make much difference plus or minus to performance. >>> >>> >> This patch is OK, though it heavily relies on the fact the immediates >> are always stored as float quadruplets. We either need to add a bunch of >> asserts about that, or specialise the tgsi representation by removing >> NrTokens field and make it explicit we are dealing with exactly four >> values, not (NrTokens-1). >> > > I don't think it relies on this at all. Can you be more specific what > you think has been lost? > > Immediates with less than four values will be handled fine, with some of > the slots in the full_immediate struct remaining unused. This is the > same as all the other tgsi_full_* structs -- they all have slots that > don't always get populated. > > The NrTokens field retains its meaning, and the tokenized representation > of programs isn't changed by this patch. > > Also, if we ever support non-float immediates, that can be handled by > this change just as well as previously -- ie. by adding an Unsigned > value to the union tgsi_immediate_data. > >
Yes, that is all correct. Though, nothing stops us from having more than 4 values in an immediate declartion. You have a valid point that there can be less than 4 values, hence NrTokens must stay, but we still need to assert on (NrTokens <= 4+1). ------------------------------------------------------------------------------ _______________________________________________ Mesa3d-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
