diff options
author | Chris Wilson <[email protected]> | 2009-09-02 05:11:25 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-09-02 08:47:47 -0600 |
commit | a46e32787d98192d35bf2834011cfa5537e0e703 (patch) | |
tree | b9c5d28478613723a54590fedf788d8ca95e1eb2 /src/mesa/main/texenvprogram.c | |
parent | c0cf0fd163397d68acfb2e226a6b9a569ded54cd (diff) |
mesa: Compact state key for TexEnv program cache
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.
Diffstat (limited to 'src/mesa/main/texenvprogram.c')
-rw-r--r-- | src/mesa/main/texenvprogram.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 59139579696..b16b8dd36b8 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -82,8 +82,8 @@ texenv_doing_secondary_color(GLcontext *ctx) #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) struct mode_opt { - GLuint Source:4; /**< SRC_x */ - GLuint Operand:3; /**< OPR_x */ + GLubyte Source:4; /**< SRC_x */ + GLubyte Operand:3; /**< OPR_x */ }; struct state_key { @@ -103,10 +103,11 @@ struct state_key { GLuint NumArgsRGB:3; /**< up to MAX_COMBINER_TERMS */ GLuint ModeRGB:5; /**< MODE_x */ - struct mode_opt OptRGB[MAX_COMBINER_TERMS]; GLuint NumArgsA:3; /**< up to MAX_COMBINER_TERMS */ GLuint ModeA:5; /**< MODE_x */ + + struct mode_opt OptRGB[MAX_COMBINER_TERMS]; struct mode_opt OptA[MAX_COMBINER_TERMS]; } unit[MAX_TEXTURE_UNITS]; }; @@ -1497,6 +1498,7 @@ _mesa_get_fixed_func_fragment_program(GLcontext *ctx) struct gl_fragment_program *prog; struct state_key key; + printf("SIZE OF KEY %d\n", sizeof(key)); make_state_key(ctx, &key); prog = (struct gl_fragment_program *) |