Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 01516d1..f914cf8 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 bpp = _mesa_get_format_bytes(mt->format) * 8;
    unsigned ret_align, divisor, multiplier;
 
    /* Values in below tables specifiy the horizontal alignment requirement
@@ -58,10 +57,10 @@ tr_mode_horizontal_texture_alignment(const struct 
intel_mipmap_tree *mt)
 
    assert(mt->tr_mode != INTEL_MIPTREE_TRMODE_NONE);
 
-   /* Alignment computations below assume bpp >= 8 and a power of 2. */
-   assert (bpp >= 8 && bpp <= 128 && _mesa_is_pow_two(bpp));
+   /* Alignment computations below assume a power of 2 cpp. */
+   assert (mt->cpp >= 1 && mt->cpp <= 16 && _mesa_is_pow_two(mt->cpp));
    /* Compute array index. */
-   i = ffs(bpp/8) - 1;
+   i = ffs(mt->cpp) - 1;
 
    switch(mt->target) {
    case GL_TEXTURE_1D:
@@ -177,7 +176,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 bpp = _mesa_get_format_bytes(mt->format) * 8;
    unsigned ret_align, divisor, multiplier;
 
    /* Vertical alignment tables for TRMODE_YF */
@@ -187,10 +185,10 @@ tr_mode_vertical_texture_alignment(const struct 
intel_mipmap_tree *mt)
 
    assert(mt->tr_mode != INTEL_MIPTREE_TRMODE_NONE);
 
-   /* Alignment computations below assume bpp >= 8 and a power of 2. */
-   assert (bpp >= 8 && bpp <= 128 && _mesa_is_pow_two(bpp)) ;
+   /* Alignment computations below assume a power of 2 cpp. */
+   assert (mt->cpp >= 1 && mt->cpp <= 16 && _mesa_is_pow_two(mt->cpp)) ;
    /* Compute array index. */
-   i = ffs(bpp / 8) - 1;
+   i = ffs(mt->cpp) - 1;
 
    switch(mt->target) {
    case GL_TEXTURE_2D:
-- 
2.4.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to