This patch unindents some code by converting: if (condition) { ...lots of code... }
to the quick-exit style: if (!condition) continue; ...lots of code... Except that it leaves the swizzling code indented under an if (true) block because the next patch needs to make it conditional (and there's no point in unindenting just to reindent). Signed-off-by: Kenneth Graunke <kenn...@whitecape.org> --- src/mesa/drivers/dri/i965/brw_wm.c | 45 ++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 995e8f3..d991300 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -499,11 +499,17 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx, int unit_id = prog->SamplerUnits[s]; const struct gl_texture_unit *unit = &ctx->Texture.Unit[unit_id]; + const struct gl_texture_object *t = unit->_Current; - if (unit->_ReallyEnabled && unit->_Current->Target != GL_TEXTURE_BUFFER) { - const struct gl_texture_object *t = unit->_Current; - const struct gl_texture_image *img = t->Image[0][t->BaseLevel]; - struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit_id); + if (!unit->_ReallyEnabled || t->Target == GL_TEXTURE_BUFFER) + continue; + + const struct gl_texture_image *img = t->Image[0][t->BaseLevel]; + + /* Handle EXT_texture_swizzle and DEPTH_TEXTURE_MODE swizzling for + * hardware that doesn't natively support it. + */ + if (true) { int swizzles[SWIZZLE_NIL + 1] = { SWIZZLE_X, SWIZZLE_Y, @@ -548,27 +554,28 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx, } } - if (img->InternalFormat == GL_YCBCR_MESA) { - key->yuvtex_mask |= 1 << s; - if (img->TexFormat == MESA_FORMAT_YCBCR) - key->yuvtex_swap_mask |= 1 << s; - } - key->swizzles[s] = MAKE_SWIZZLE4(swizzles[GET_SWZ(t->_Swizzle, 0)], swizzles[GET_SWZ(t->_Swizzle, 1)], swizzles[GET_SWZ(t->_Swizzle, 2)], swizzles[GET_SWZ(t->_Swizzle, 3)]); + } - if (sampler->MinFilter != GL_NEAREST && - sampler->MagFilter != GL_NEAREST) { - if (sampler->WrapS == GL_CLAMP) - key->gl_clamp_mask[0] |= 1 << s; - if (sampler->WrapT == GL_CLAMP) - key->gl_clamp_mask[1] |= 1 << s; - if (sampler->WrapR == GL_CLAMP) - key->gl_clamp_mask[2] |= 1 << s; - } + if (img->InternalFormat == GL_YCBCR_MESA) { + key->yuvtex_mask |= 1 << s; + if (img->TexFormat == MESA_FORMAT_YCBCR) + key->yuvtex_swap_mask |= 1 << s; + } + + struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit_id); + if (sampler->MinFilter != GL_NEAREST && + sampler->MagFilter != GL_NEAREST) { + if (sampler->WrapS == GL_CLAMP) + key->gl_clamp_mask[0] |= 1 << s; + if (sampler->WrapT == GL_CLAMP) + key->gl_clamp_mask[1] |= 1 << s; + if (sampler->WrapR == GL_CLAMP) + key->gl_clamp_mask[2] |= 1 << s; } } } -- 1.7.11.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev