diff options
author | Eric Anholt <[email protected]> | 2011-10-17 14:53:13 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-10-26 12:42:28 -0700 |
commit | 4ad8a0adec588b4c2c5a8f93265ed46cee5d3ff6 (patch) | |
tree | 4587fb6582dcccd27b6d7908d4233971b9a9f344 | |
parent | 96db07e28c165610b809a9fd88410a82a24a893e (diff) |
intel: Drop texture border support code.
Now that texture borders are gone, we never need to allocate our
textures through non-miptrees, which simplifies some irritating paths.
v2: Remove the !mt support case from intel_map_texture_image()
Reviewed-by: Kenneth Graunke <[email protected]> (v1)
Reviewed-by: Brian Paul <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fallback.c | 17 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex.c | 58 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_image.c | 36 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_validate.c | 7 |
5 files changed, 29 insertions, 93 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index ae08cf56f50..708bd0e9a54 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -42,7 +42,6 @@ static bool do_check_fallback(struct brw_context *brw) { struct gl_context *ctx = &brw->intel.ctx; - GLuint i; if (brw->intel.no_rast) { DBG("FALLBACK: rasterization disabled\n"); @@ -56,20 +55,6 @@ static bool do_check_fallback(struct brw_context *brw) return true; } - /* _NEW_TEXTURE: - */ - for (i = 0; i < BRW_MAX_TEX_UNIT; i++) { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; - if (texUnit->_ReallyEnabled) { - struct gl_texture_object *tex_obj = texUnit->_Current; - struct gl_texture_image *texImage = tex_obj->Image[0][tex_obj->BaseLevel]; - if (texImage->Border) { - DBG("FALLBACK: texture border\n"); - return true; - } - } - } - return false; } @@ -80,7 +65,7 @@ static void check_fallback(struct brw_context *brw) const struct brw_tracked_state brw_check_fallback = { .dirty = { - .mesa = _NEW_RENDERMODE | _NEW_TEXTURE | _NEW_STENCIL, + .mesa = _NEW_RENDERMODE | _NEW_STENCIL, .brw = 0, .cache = 0 }, diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 54f73e8b47b..19f151f4fa3 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -246,10 +246,6 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt, GLuint level = intelImage->base.Base.Level; int width, height, depth; - /* Images with borders are never pulled into mipmap trees. */ - if (image->Border) - return false; - if (image->TexFormat != mt->format) return false; diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 58066598beb..7af51388091 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -61,6 +61,8 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, struct intel_texture_object *intel_texobj = intel_texture_object(texobj); GLuint slices; + assert(image->Border == 0); + /* Because the driver uses AllocTextureImageBuffer() internally, it may end * up mismatched with FreeTextureImageBuffer(), but that is safe to call * multiple times. @@ -93,8 +95,7 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, DBG("%s: alloc obj %p level %d %dx%dx%d using object's miptree %p\n", __FUNCTION__, texobj, image->Level, width, height, depth, intel_texobj->mt); - return true; - } else if (image->Border == 0) { + } else { intel_image->mt = intel_miptree_create_for_teximage(intel, intel_texobj, intel_image, false); @@ -114,14 +115,9 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, DBG("%s: alloc obj %p level %d %dx%dx%d using new miptree %p\n", __FUNCTION__, texobj, image->Level, width, height, depth, intel_image->mt); - return true; } - DBG("%s: alloc obj %p level %d %dx%dx%d using swrast\n", - __FUNCTION__, texobj, image->Level, width, height, depth); - - return _swrast_alloc_texture_image_buffer(ctx, image, format, - width, height, depth); + return true; } static void @@ -168,6 +164,11 @@ intel_map_texture_image(struct gl_context *ctx, struct intel_texture_image *intel_image = intel_texture_image(tex_image); struct intel_mipmap_tree *mt = intel_image->mt; unsigned int bw, bh; + void *base; + unsigned int image_x, image_y; + + /* Our texture data is always stored in a miptree. */ + assert(mt); /* Check that our caller wasn't confused about how to map a 1D texture. */ assert(tex_image->TexObject->Target != GL_TEXTURE_1D_ARRAY || @@ -190,36 +191,18 @@ intel_map_texture_image(struct gl_context *ctx, assert(y % bh == 0); y /= bh; - if (likely(mt)) { - void *base = intel_region_map(intel, mt->region, mode); - unsigned int image_x, image_y; - - intel_miptree_get_image_offset(mt, tex_image->Level, tex_image->Face, - slice, &image_x, &image_y); - x += image_x; - y += image_y; + base = intel_region_map(intel, mt->region, mode); + intel_miptree_get_image_offset(mt, tex_image->Level, tex_image->Face, + slice, &image_x, &image_y); + x += image_x; + y += image_y; - *stride = mt->region->pitch * mt->cpp; - *map = base + y * *stride + x * mt->cpp; + *stride = mt->region->pitch * mt->cpp; + *map = base + y * *stride + x * mt->cpp; - DBG("%s: %d,%d %dx%d from mt %p %d,%d = %p/%d\n", __FUNCTION__, - x - image_x, y - image_y, w, h, - mt, x, y, *map, *stride); - } else { - /* texture data is in malloc'd memory */ - GLuint width = tex_image->Width; - GLuint height = ALIGN(tex_image->Height, bh) / bh; - GLuint texelSize = _mesa_get_format_bytes(tex_image->TexFormat); - - assert(map); - - *stride = _mesa_format_row_stride(tex_image->TexFormat, width); - *map = intel_image->base.Buffer + (slice * height + y) * *stride + x * texelSize; - - DBG("%s: %d,%d %dx%d from data %p = %p/%d\n", __FUNCTION__, - x, y, w, h, - intel_image->base.Buffer, *map, *stride); - } + DBG("%s: %d,%d %dx%d from mt %p %d,%d = %p/%d\n", __FUNCTION__, + x - image_x, y - image_y, w, h, + mt, x, y, *map, *stride); } static void @@ -229,8 +212,7 @@ intel_unmap_texture_image(struct gl_context *ctx, struct intel_context *intel = intel_context(ctx); struct intel_texture_image *intel_image = intel_texture_image(tex_image); - if (intel_image->mt) - intel_region_unmap(intel, intel_image->mt->region); + intel_region_unmap(intel, intel_image->mt->region); if (intel_image->stencil_rb) { /* diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index d0526843c5e..eaf034abe56 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -26,24 +26,8 @@ #define FILE_DEBUG_FLAG DEBUG_TEXTURE -/* Functions to store texture images. Where possible, mipmap_tree's - * will be created or further instantiated with image data, otherwise - * images will be stored in malloc'd memory. A validation step is - * required to pull those images into a mipmap tree, or otherwise - * decide a fallback is required. - */ - - - -/* Otherwise, store it in memory if (Border != 0) or (any dimension == - * 1). - * - * Otherwise, if max_level >= level >= min_level, create tree with - * space for textures from min_level down to max_level. - * - * Otherwise, create tree with space for textures from (level - * 0)..(1x1). Consider pruning this tree at a validation if the - * saving is worth it. +/* Work back from the specified level of the image to the baselevel and create a + * miptree of that size. */ struct intel_mipmap_tree * intel_miptree_create_for_teximage(struct intel_context *intel, @@ -61,9 +45,6 @@ intel_miptree_create_for_teximage(struct intel_context *intel, DBG("%s\n", __FUNCTION__); - if (intelImage->base.Base.Border) - return NULL; - if (intelImage->base.Base.Level > intelObj->base.BaseLevel && (width == 1 || (intelObj->base.Target != GL_TEXTURE_1D && height == 1) || @@ -350,14 +331,13 @@ intelTexImage(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, - GLint border, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *unpack, struct gl_texture_object *texObj, struct gl_texture_image *texImage, GLsizei imageSize) { - DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__, - _mesa_lookup_enum_by_nr(target), level, width, height, depth, border); + DBG("%s target %s level %d %dx%dx%d\n", __FUNCTION__, + _mesa_lookup_enum_by_nr(target), level, width, height, depth); /* Attempt to use the blitter for PBO image uploads. */ @@ -371,7 +351,7 @@ intelTexImage(struct gl_context * ctx, __FUNCTION__, width, height, depth, pixels); _mesa_store_teximage3d(ctx, target, level, internalFormat, - width, height, depth, border, + width, height, depth, 0, format, type, pixels, unpack, texObj, texImage); } @@ -389,7 +369,7 @@ intelTexImage3D(struct gl_context * ctx, struct gl_texture_image *texImage) { intelTexImage(ctx, 3, target, level, - internalFormat, width, height, depth, border, + internalFormat, width, height, depth, format, type, pixels, unpack, texObj, texImage, 0); } @@ -405,7 +385,7 @@ intelTexImage2D(struct gl_context * ctx, struct gl_texture_image *texImage) { intelTexImage(ctx, 2, target, level, - internalFormat, width, height, 1, border, + internalFormat, width, height, 1, format, type, pixels, unpack, texObj, texImage, 0); } @@ -421,7 +401,7 @@ intelTexImage1D(struct gl_context * ctx, struct gl_texture_image *texImage) { intelTexImage(ctx, 1, target, level, - internalFormat, width, 1, 1, border, + internalFormat, width, 1, 1, format, type, pixels, unpack, texObj, texImage, 0); } diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index 6639de9c2af..a657732027a 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -52,13 +52,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) intel_update_max_level(intelObj, sampler); firstImage = intel_texture_image(tObj->Image[0][tObj->BaseLevel]); - /* Fallback case: - */ - if (firstImage->base.Base.Border) { - intel_miptree_release(&intelObj->mt); - return false; - } - intel_miptree_get_dimensions_for_image(&firstImage->base.Base, &width, &height, &depth); |