[Mesa-dev] [PATCH 11/14] mesa/main: Maintain compressed TexEnv Combine state.

Marek Olšák maraeo at gmail.com
Fri Apr 7 14:40:35 UTC 2017


On Fri, Apr 7, 2017 at 4:35 PM, Marek Olšák <maraeo at gmail.com> wrote:
> On Thu, Mar 30, 2017 at 8:09 PM, Gustaw Smolarczyk <wielkiegie at gmail.com> wrote:
>> Signed-off-by: Gustaw Smolarczyk <wielkiegie at gmail.com>
>> ---
>>  src/mesa/main/mtypes.h   |  83 ++++++++++++++++++++++++++++++++++++++
>>  src/mesa/main/texstate.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 186 insertions(+)
>>
>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>> index 186d79928c..369d2327f2 100644
>> --- a/src/mesa/main/mtypes.h
>> +++ b/src/mesa/main/mtypes.h
>> @@ -1078,6 +1078,87 @@ struct gl_tex_env_combine_state
>>  };
>>
>>
>> +/** Compressed TexEnv effective Combine mode */
>> +enum gl_tex_env_mode
>> +{
>> +   TEXENV_MODE_REPLACE,                 /* r = a0 */
>> +   TEXENV_MODE_MODULATE,                /* r = a0 * a1 */
>> +   TEXENV_MODE_ADD,                     /* r = a0 + a1 */
>> +   TEXENV_MODE_ADD_SIGNED,              /* r = a0 + a1 - 0.5 */
>> +   TEXENV_MODE_INTERPOLATE,             /* r = a0 * a2 + a1 * (1 - a2) */
>> +   TEXENV_MODE_SUBTRACT,                /* r = a0 - a1 */
>> +   TEXENV_MODE_DOT3_RGB,                /* r = a0 . a1 */
>> +   TEXENV_MODE_DOT3_RGB_EXT,            /* r = a0 . a1 */
>> +   TEXENV_MODE_DOT3_RGBA,               /* r = a0 . a1 */
>> +   TEXENV_MODE_DOT3_RGBA_EXT,           /* r = a0 . a1 */
>> +   TEXENV_MODE_MODULATE_ADD_ATI,        /* r = a0 * a2 + a1 */
>> +   TEXENV_MODE_MODULATE_SIGNED_ADD_ATI, /* r = a0 * a2 + a1 - 0.5 */
>> +   TEXENV_MODE_MODULATE_SUBTRACT_ATI,   /* r = a0 * a2 - a1 */
>> +   TEXENV_MODE_ADD_PRODUCTS_NV,         /* r = a0 * a1 + a2 * a3 */
>> +   TEXENV_MODE_ADD_PRODUCTS_SIGNED_NV,  /* r = a0 * a1 + a2 * a3 - 0.5 */
>> +};
>> +
>> +
>> +/** Compressed TexEnv Combine source */
>> +enum gl_tex_env_source
>> +{
>> +   TEXENV_SRC_TEXTURE0,
>> +   TEXENV_SRC_TEXTURE1,
>> +   TEXENV_SRC_TEXTURE2,
>> +   TEXENV_SRC_TEXTURE3,
>> +   TEXENV_SRC_TEXTURE4,
>> +   TEXENV_SRC_TEXTURE5,
>> +   TEXENV_SRC_TEXTURE6,
>> +   TEXENV_SRC_TEXTURE7,
>> +   TEXENV_SRC_TEXTURE,
>> +   TEXENV_SRC_PREVIOUS,
>> +   TEXENV_SRC_PRIMARY_COLOR,
>> +   TEXENV_SRC_CONSTANT,
>> +   TEXENV_SRC_ZERO,
>> +   TEXENV_SRC_ONE,
>> +};
>> +
>> +
>> +/** Compressed TexEnv Combine operand */
>> +enum gl_tex_env_operand
>> +{
>> +   TEXENV_OPR_COLOR,
>> +   TEXENV_OPR_ONE_MINUS_COLOR,
>> +   TEXENV_OPR_ALPHA,
>> +   TEXENV_OPR_ONE_MINUS_ALPHA,
>> +};
>> +
>> +
>> +/** Compressed TexEnv Combine argument */
>> +struct gl_tex_env_argument
>> +{
>> +#ifdef __GNUC__
>> +   __extension__ uint8_t Source:4;  /**< TEXENV_SRC_x */
>> +   __extension__ uint8_t Operand:2; /**< TEXENV_OPR_x */
>> +#else
>> +   uint8_t Source;  /**< SRC_x */
>> +   uint8_t Operand; /**< OPR_x */
>> +#endif
>
> Why is this #ifdef here?

You can just use "unsigned Source:4;" There is no reason to do it any other way.

Marek


More information about the mesa-dev mailing list