[Mesa-dev] [PATCH 6/7] i965/gen9: Remove temporary variable 'align_yf' in tr_mode_..._texture_alignment()

Anuj Phogat anuj.phogat at gmail.com
Thu Aug 13 14:52:01 PDT 2015


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 9a3c844..01516d1 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -42,7 +42,6 @@
 static unsigned int
 tr_mode_horizontal_texture_alignment(const struct intel_mipmap_tree *mt)
 {
-   const unsigned *align_yf;
    const unsigned bpp = _mesa_get_format_bytes(mt->format) * 8;
    unsigned ret_align, divisor, multiplier;
 
@@ -61,11 +60,13 @@ tr_mode_horizontal_texture_alignment(const struct intel_mipmap_tree *mt)
 
    /* Alignment computations below assume bpp >= 8 and a power of 2. */
    assert (bpp >= 8 && bpp <= 128 && _mesa_is_pow_two(bpp));
+   /* Compute array index. */
+   i = ffs(bpp/8) - 1;
 
    switch(mt->target) {
    case GL_TEXTURE_1D:
    case GL_TEXTURE_1D_ARRAY:
-      align_yf = align_1d_yf;
+      ret_align = align_1d_yf[i];
       multiplier = 16;
       break;
    case GL_TEXTURE_2D:
@@ -75,22 +76,17 @@ tr_mode_horizontal_texture_alignment(const struct intel_mipmap_tree *mt)
    case GL_TEXTURE_CUBE_MAP_ARRAY:
    case GL_TEXTURE_2D_MULTISAMPLE:
    case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
-      align_yf = align_2d_yf;
+      ret_align = align_2d_yf[i];
       multiplier = 4;
       break;
    case GL_TEXTURE_3D:
-      align_yf = align_3d_yf;
+      ret_align = align_3d_yf[i];
       multiplier = 4;
       break;
    default:
       unreachable("not reached");
    }
 
-   /* Compute array index. */
-   i = ffs(bpp/8) - 1;
-
-   ret_align = align_yf[i];
-
    if (mt->tr_mode == INTEL_MIPTREE_TRMODE_YS)
       ret_align *= multiplier;
 
@@ -181,7 +177,6 @@ intel_horizontal_texture_alignment_unit(struct brw_context *brw,
 static unsigned int
 tr_mode_vertical_texture_alignment(const struct intel_mipmap_tree *mt)
 {
-   const unsigned *align_yf;
    const unsigned bpp = _mesa_get_format_bytes(mt->format) * 8;
    unsigned ret_align, divisor, multiplier;
 
@@ -194,6 +189,8 @@ tr_mode_vertical_texture_alignment(const struct intel_mipmap_tree *mt)
 
    /* Alignment computations below assume bpp >= 8 and a power of 2. */
    assert (bpp >= 8 && bpp <= 128 && _mesa_is_pow_two(bpp)) ;
+   /* Compute array index. */
+   i = ffs(bpp / 8) - 1;
 
    switch(mt->target) {
    case GL_TEXTURE_2D:
@@ -203,11 +200,11 @@ tr_mode_vertical_texture_alignment(const struct intel_mipmap_tree *mt)
    case GL_TEXTURE_CUBE_MAP_ARRAY:
    case GL_TEXTURE_2D_MULTISAMPLE:
    case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
-      align_yf = align_2d_yf;
+      ret_align = align_2d_yf[i];
       multiplier = 4;
       break;
    case GL_TEXTURE_3D:
-      align_yf = align_3d_yf;
+      ret_align = align_3d_yf[i];
       multiplier = 2;
       break;
    case GL_TEXTURE_1D:
@@ -216,11 +213,6 @@ tr_mode_vertical_texture_alignment(const struct intel_mipmap_tree *mt)
       unreachable("Unexpected miptree target");
    }
 
-   /* Compute array index. */
-   i = ffs(bpp / 8) - 1;
-
-   ret_align = align_yf[i];
-
    if (mt->tr_mode == INTEL_MIPTREE_TRMODE_YS)
       ret_align *= multiplier;
 
-- 
2.4.3



More information about the mesa-dev mailing list