[Mesa-dev] Coding or Table based approach for r600g? (was RFC: 0001-r600g-R700-can-do-more-than-8-tex-and-vtx-clauses.patch)

Christian König deathsimple at vodafone.de
Wed Mar 9 11:02:15 PST 2011


Am Mittwoch, den 09.03.2011, 13:06 +0100 schrieb Ferry Huberts:
> On 03/09/2011 12:23 PM, Henri Verbeet wrote:
> > 2011/3/9 Christian König <deathsimple at vodafone.de>:
> >> So hey guys what do you think about it?
> >>
> >> And to make my own opinion clear:
> >> I also really prefer tables, but didn't used them in the past because I
> >> wasn't 100% sure which feature depends on what and which approach we
> >> really want.
> >>
> > I don't think the issue is so much about using a table vs. a function
> > to retrieve something, that's likely something that depends on the
> > specific cases. The issue here is more about recalculating things that
> > are never going to change after initialization.
> 
> yeah, that was my point.
> 
> the table is only _a_ solution.
> 
> a different solution I sometimes employ is to lazily determine the value
> on first use and then keep it cached. that requires an extra state
> variable however to determine whether the value was already determined.
This approach only makes sense to me for expensive calculations, but
this doesn't seems to be the major problem here.

The point is that this code isn't time critical, but makes most of the
abstractions of the differences between R600, R700 and Evergreen, so the
main design criteria should be readability and (most of all)
extensibility, not speed (I think we all want to support Cayman at some
point in the future).

So please take a look at the attached patch, it shouldn't change the
generated bytecode a bit, but just makes the code more readable (at
least I think so) and easier to extend.

Regards,
Christian.


More information about the mesa-dev mailing list