[Mesa-dev] [PATCH 1/3] intel: Fold the one last function intel_tex_format.c into the caller.

Eric Anholt eric at anholt.net
Thu Apr 25 13:20:23 PDT 2013


---
 src/mesa/drivers/dri/i915/Makefile.sources     |    1 -
 src/mesa/drivers/dri/i915/intel_tex_format.c   |    1 -
 src/mesa/drivers/dri/i965/Makefile.sources     |    1 -
 src/mesa/drivers/dri/i965/intel_tex_format.c   |    1 -
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c |   16 ++++++++++------
 src/mesa/drivers/dri/intel/intel_tex.h         |    2 --
 src/mesa/drivers/dri/intel/intel_tex_format.c  |   15 ---------------
 7 files changed, 10 insertions(+), 27 deletions(-)
 delete mode 120000 src/mesa/drivers/dri/i915/intel_tex_format.c
 delete mode 120000 src/mesa/drivers/dri/i965/intel_tex_format.c
 delete mode 100644 src/mesa/drivers/dri/intel/intel_tex_format.c

diff --git a/src/mesa/drivers/dri/i915/Makefile.sources b/src/mesa/drivers/dri/i915/Makefile.sources
index fc5a941..fff27b7 100644
--- a/src/mesa/drivers/dri/i915/Makefile.sources
+++ b/src/mesa/drivers/dri/i915/Makefile.sources
@@ -21,7 +21,6 @@ i915_FILES = \
 	intel_tex_subimage.c \
 	intel_tex_copy.c \
 	intel_tex_validate.c \
-	intel_tex_format.c \
 	intel_tex.c \
 	intel_pixel.c \
 	intel_pixel_bitmap.c \
diff --git a/src/mesa/drivers/dri/i915/intel_tex_format.c b/src/mesa/drivers/dri/i915/intel_tex_format.c
deleted file mode 120000
index 3415f75..0000000
--- a/src/mesa/drivers/dri/i915/intel_tex_format.c
+++ /dev/null
@@ -1 +0,0 @@
-../intel/intel_tex_format.c
\ No newline at end of file
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources
index 4e21824..0c7ffe2 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -23,7 +23,6 @@ i965_FILES = \
 	intel_syncobj.c \
 	intel_tex.c \
 	intel_tex_copy.c \
-	intel_tex_format.c \
 	intel_tex_image.c \
 	intel_tex_layout.c \
 	intel_tex_subimage.c \
diff --git a/src/mesa/drivers/dri/i965/intel_tex_format.c b/src/mesa/drivers/dri/i965/intel_tex_format.c
deleted file mode 120000
index 3415f75..0000000
--- a/src/mesa/drivers/dri/i965/intel_tex_format.c
+++ /dev/null
@@ -1 +0,0 @@
-../intel/intel_tex_format.c
\ No newline at end of file
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 326731c..98f1e98 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -141,16 +141,12 @@ intel_miptree_create_layout(struct intel_context *intel,
                             GLuint num_samples)
 {
    struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1);
-   int compress_byte = 0;
 
    DBG("%s target %s format %s level %d..%d <-- %p\n", __FUNCTION__,
        _mesa_lookup_enum_by_nr(target),
        _mesa_get_format_name(format),
        first_level, last_level, mt);
 
-   if (_mesa_is_format_compressed(format))
-      compress_byte = intel_compressed_num_bytes(format);
-
    mt->target = target_to_target(target);
    mt->format = format;
    mt->first_level = first_level;
@@ -158,9 +154,17 @@ intel_miptree_create_layout(struct intel_context *intel,
    mt->logical_width0 = width0;
    mt->logical_height0 = height0;
    mt->logical_depth0 = depth0;
-   mt->cpp = compress_byte ? compress_byte : _mesa_get_format_bytes(mt->format);
+
+   /* The cpp is bytes per (1, blockheight)-sized block for compressed
+    * textures.  This is why you'll see divides by blockheight all over
+    */
+   unsigned bw, bh;
+   _mesa_get_format_block_size(format, &bw, &bh);
+   assert(_mesa_get_format_bytes(mt->format) % bw == 0);
+   mt->cpp = _mesa_get_format_bytes(mt->format) / bw;
+
    mt->num_samples = num_samples;
-   mt->compressed = compress_byte ? 1 : 0;
+   mt->compressed = _mesa_is_format_compressed(format);
    mt->msaa_layout = INTEL_MSAA_LAYOUT_NONE;
    mt->refcount = 1; 
 
diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h
index 4785507..e038115 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.h
+++ b/src/mesa/drivers/dri/intel/intel_tex.h
@@ -68,8 +68,6 @@ bool
 intel_tex_image_s8z24_create_renderbuffers(struct intel_context *intel,
 					   struct intel_texture_image *image);
 
-int intel_compressed_num_bytes(GLuint mesaFormat);
-
 bool intel_copy_texsubimage(struct intel_context *intel,
                             struct intel_texture_image *intelImage,
                             GLint dstx, GLint dsty,
diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c
deleted file mode 100644
index 0902cdd..0000000
--- a/src/mesa/drivers/dri/intel/intel_tex_format.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "intel_context.h"
-#include "intel_tex.h"
-#include "main/enums.h"
-#include "main/formats.h"
-
-int intel_compressed_num_bytes(GLuint mesaFormat)
-{
-   GLuint bw, bh;
-   GLuint block_size;
-
-   block_size = _mesa_get_format_bytes(mesaFormat);
-   _mesa_get_format_block_size(mesaFormat, &bw, &bh);
-
-   return block_size / bw;
-}
-- 
1.7.10.4



More information about the mesa-dev mailing list