intel: Fold the one last function intel_tex_format.c into the caller.
authorEric Anholt <eric@anholt.net>
Mon, 22 Apr 2013 23:04:25 +0000 (16:04 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 29 Apr 2013 18:41:34 +0000 (11:41 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i915/Makefile.sources
src/mesa/drivers/dri/i915/intel_tex_format.c [deleted symlink]
src/mesa/drivers/dri/i965/Makefile.sources
src/mesa/drivers/dri/i965/intel_tex_format.c [deleted symlink]
src/mesa/drivers/dri/intel/intel_mipmap_tree.c
src/mesa/drivers/dri/intel/intel_tex.h
src/mesa/drivers/dri/intel/intel_tex_format.c [deleted file]

index 183a1dae1ed0bb566d88a4306b8511d1046d4664..b14e52c5da83b0bc40759e150707303ed9b11a6b 100644 (file)
@@ -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 (symlink)
index 3415f75..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../intel/intel_tex_format.c
\ No newline at end of file
index be8d630e85ef82f556d468eaeba0c0a8f1bd3b70..251762efceba5832e6f815df8fcf559f2e3f2e91 100644 (file)
@@ -24,7 +24,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 (symlink)
index 3415f75..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../intel/intel_tex_format.c
\ No newline at end of file
index 47f81b13a5ebb11e1ef471b19de69b8cdc531a16..f70228cdb048e8c6d75993a02d46673fefe13e2c 100644 (file)
@@ -142,16 +142,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;
@@ -159,9 +155,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; 
 
index 6fa5b40bd6af189d79171a613029df295ab8b792..0a6316301830cc35d6bacb91bf2bfcf752e6e583 100644 (file)
@@ -74,8 +74,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 (file)
index 0902cdd..0000000
+++ /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;
-}