Re: [Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread Brian Paul
Ian Romanick wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Chris Wilson wrote: >> By rearranging the bitfields within the key we can reduce the size >> of the key from 644 to 196 bytes, reducing the cost of both the >> hashing and equality tests. > > How did you arrive at these num

Re: [Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread Ian Romanick
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chris Wilson wrote: > By rearranging the bitfields within the key we can reduce the size > of the key from 644 to 196 bytes, reducing the cost of both the > hashing and equality tests. How did you arrive at these numbers? Is that what sizeof says, or

Re: [Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread Joakim Sindholt
On Wed, 2009-09-02 at 10:58 -0600, tom fogal wrote: > writes: > > On Wed, 2009-09-02 at 09:05 -0700, Keith Whitwell wrote: > > > On Wed, 2009-09-02 at 08:48 -0700, Jos Fonseca wrote: > > > > On Wed, 2009-09-02 at 05:11 -0700, Chris Wilson wrote: > > > > > By rearranging the bitfields within the key

Re: [Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread tom fogal
writes: > On Wed, 2009-09-02 at 09:05 -0700, Keith Whitwell wrote: > > On Wed, 2009-09-02 at 08:48 -0700, José Fonseca wrote: > > > On Wed, 2009-09-02 at 05:11 -0700, Chris Wilson wrote: > > > > By rearranging the bitfields within the key we can reduce the size > > > > of the key from 644 to 196 b

Re: [Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread José Fonseca
On Wed, 2009-09-02 at 09:05 -0700, Keith Whitwell wrote: > On Wed, 2009-09-02 at 08:48 -0700, José Fonseca wrote: > > On Wed, 2009-09-02 at 05:11 -0700, Chris Wilson wrote: > > > By rearranging the bitfields within the key we can reduce the size > > > of the key from 644 to 196 bytes, reducing the

Re: [Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread Keith Whitwell
On Wed, 2009-09-02 at 08:48 -0700, José Fonseca wrote: > On Wed, 2009-09-02 at 05:11 -0700, Chris Wilson wrote: > > By rearranging the bitfields within the key we can reduce the size > > of the key from 644 to 196 bytes, reducing the cost of both the > > hashing and equality tests. > > --- > > src

Re: [Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread José Fonseca
On Wed, 2009-09-02 at 05:11 -0700, Chris Wilson wrote: > By rearranging the bitfields within the key we can reduce the size > of the key from 644 to 196 bytes, reducing the cost of both the > hashing and equality tests. > --- > src/mesa/main/texenvprogram.c |7 --- > 1 files changed, 4 ins

Re: [Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread Patrick Baggett
Well...you need 7 bits/struct, so you can just use a byte array rather than a struct array, and then manipulate each member using macros to hide the ugly AND/OR/shifting. Would work for C89, for that matter. On Wed, Sep 2, 2009 at 9:48 AM, Roland Scheidegger wrote: > Hmm, I'm not actually sure th

Re: [Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread Roland Scheidegger
Hmm, I'm not actually sure this will always reduce the state key size. I think the compiler is still allowed to pad the mode_opt struct out to whatever it likes (maybe #pragma pack(1) can prevent this), even though maybe gcc does not. I don't like pragmas too much, but it looks the only way to do t

Re: [Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread Brian Paul
Unfortunately gcc (version 4.3.2 anyway) warns on this: main/texenvprogram.c:87: warning: type of bit-field ‘Source’ is a GCC extension main/texenvprogram.c:88: warning: type of bit-field ‘Operand’ is a GCC extension I'm trying to find a #pragma or something to silence the warning... -Brian Ke

Re: [Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread Keith Whitwell
Looks great Chris. Keith On Wed, 2009-09-02 at 05:11 -0700, Chris Wilson wrote: > By rearranging the bitfields within the key we can reduce the size > of the key from 644 to 196 bytes, reducing the cost of both the > hashing and equality tests. > --- > src/mesa/main/texenvprogram.c |7 --

[Mesa3d-dev] [PATCH 1/2] mesa: Compact state key for TexEnv program cache

2009-09-02 Thread Chris Wilson
By rearranging the bitfields within the key we can reduce the size of the key from 644 to 196 bytes, reducing the cost of both the hashing and equality tests. --- src/mesa/main/texenvprogram.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/texenvprogra