[Mesa-dev] [PATCH 1/5] mesa: change ctx->Color.ColorMask into a 32-bit bitmask
Marek Olšák
maraeo at gmail.com
Wed Jan 31 20:53:46 UTC 2018
On Wed, Jan 31, 2018 at 9:31 PM, Roland Scheidegger <sroland at vmware.com> wrote:
> Am 31.01.2018 um 20:55 schrieb Marek Olšák:
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> 4 bits per draw buffer, 8 draw buffers in total --> 32 bits.
>>
>> This is easier to work with.
>> ---
>> src/mesa/drivers/common/driverfuncs.c | 8 ++--
>> src/mesa/drivers/common/meta.c | 41 +++++++-----------
>> src/mesa/drivers/common/meta.h | 2 +-
>> src/mesa/drivers/dri/i915/intel_clear.c | 5 +--
>> src/mesa/drivers/dri/i915/intel_pixel.c | 5 +--
>> src/mesa/drivers/dri/i915/intel_pixel_copy.c | 5 +--
>> src/mesa/drivers/dri/i965/brw_blorp.c | 9 ++--
>> src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 8 ++--
>> src/mesa/drivers/dri/i965/genX_state_upload.c | 13 +++---
>> src/mesa/drivers/dri/i965/intel_pixel.c | 5 +--
>> src/mesa/drivers/dri/i965/intel_pixel_copy.c | 5 +--
>> src/mesa/drivers/dri/nouveau/nouveau_driver.c | 8 +++-
>> src/mesa/drivers/dri/nouveau/nv04_context.c | 5 +--
>> src/mesa/drivers/dri/nouveau/nv04_state_raster.c | 8 ++--
>> src/mesa/drivers/dri/nouveau/nv10_state_raster.c | 8 ++--
>> src/mesa/drivers/dri/nouveau/nv20_context.c | 8 ++--
>> src/mesa/drivers/dri/r200/r200_state.c | 8 ++--
>> src/mesa/drivers/dri/radeon/radeon_state.c | 8 ++--
>> src/mesa/drivers/x11/xm_dd.c | 4 +-
>> src/mesa/main/accum.c | 16 +++----
>> src/mesa/main/attrib.c | 16 +++----
>> src/mesa/main/blend.c | 53 +++++++++---------------
>> src/mesa/main/blend.h | 10 +++++
>> src/mesa/main/clear.c | 2 +-
>> src/mesa/main/get.c | 16 +++----
>> src/mesa/main/mtypes.h | 8 +++-
>> src/mesa/state_tracker/st_atom_blend.c | 27 ++++--------
>> src/mesa/state_tracker/st_cb_clear.c | 39 ++---------------
>> src/mesa/swrast/s_clear.c | 8 +++-
>> src/mesa/swrast/s_context.c | 10 +----
>> src/mesa/swrast/s_masking.c | 24 +++++++----
>> src/mesa/swrast/s_span.c | 6 +--
>> src/mesa/swrast/s_triangle.c | 8 ++--
>> 33 files changed, 174 insertions(+), 232 deletions(-)
>>
>
> ...
>
>
>>
>> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
>> index cf9a2f6..16ad8f6 100644
>> --- a/src/mesa/main/get.c
>> +++ b/src/mesa/main/get.c
>> @@ -670,24 +670,24 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
>>
>> case GL_CURRENT_TEXTURE_COORDS:
>> unit = ctx->Texture.CurrentUnit;
>> v->value_float_4[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0];
>> v->value_float_4[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1];
>> v->value_float_4[2] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2];
>> v->value_float_4[3] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3];
>> break;
>>
>> case GL_COLOR_WRITEMASK:
>> - v->value_int_4[0] = ctx->Color.ColorMask[0][RCOMP] ? 1 : 0;
>> - v->value_int_4[1] = ctx->Color.ColorMask[0][GCOMP] ? 1 : 0;
>> - v->value_int_4[2] = ctx->Color.ColorMask[0][BCOMP] ? 1 : 0;
>> - v->value_int_4[3] = ctx->Color.ColorMask[0][ACOMP] ? 1 : 0;
>> + v->value_int_4[0] = GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 0) ? 1 : 0;
>> + v->value_int_4[1] = GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 1) ? 1 : 0;
>> + v->value_int_4[2] = GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 2) ? 1 : 0;
>> + v->value_int_4[3] = GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 3) ? 1 : 0;
>
> Here and below, GET_COLORMASK_BIT is already defined to return 1 or 0,
> so the conditional seems a bit overkill (albeit I guess the compiler is
> clever enough to get rid of it?)
Yes (and yes). I'll just adjust it without re-sending.
Marek
More information about the mesa-dev
mailing list