From 6ae473221a53d8bcb584021483c5328797c6b67c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 22 Apr 2013 16:04:25 -0700 Subject: [PATCH] intel: Fold the one last function intel_tex_format.c into the caller. Reviewed-by: Kenneth Graunke --- 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 183a1dae1ed..b14e52c5da8 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 3415f754705..00000000000 --- 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 be8d630e85e..251762efceb 100644 --- a/src/mesa/drivers/dri/i965/Makefile.sources +++ b/src/mesa/drivers/dri/i965/Makefile.sources @@ -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 index 3415f754705..00000000000 --- 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 47f81b13a5e..f70228cdb04 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -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; diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index 6fa5b40bd6a..0a631630183 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -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 index 0902cdd5884..00000000000 --- 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; -} -- 2.30.2