summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2008-07-25 12:17:58 -0700
committerEric Anholt <[email protected]>2008-07-25 12:19:50 -0700
commitff60e3fa031504b403766324b1fae3ccacec6650 (patch)
tree277c6cf680446639efb0e9d9bd4ff617c3768448
parent2e3714380027252ba17a11f23eae851d3f77ab02 (diff)
intel: If a tex image doesn't fit in the object's tree, make a temporary tree.
Previously, we would just store the data as malloced memory hanging off the object, which would get memcpyed in at validate time. This broke an oglconform render-to-texture test, since validate wasn't called but a miptree was expected.
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 6d57b2b7dd1..b8dcd1e0610 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -395,10 +395,25 @@ intelTexImage(GLcontext * ctx,
intel_miptree_reference(&intelImage->mt, intelObj->mt);
assert(intelImage->mt);
- }
+ } else if (intelImage->base.Border == 0) {
+ int comp_byte = 0;
+
+ if (intelImage->base.IsCompressed) {
+ comp_byte =
+ intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat);
+ }
- if (!intelImage->mt)
- DBG("XXX: Image did not fit into tree - storing in local memory!\n");
+ /* Didn't fit in the object miptree, but it's suitable for inclusion in
+ * a miptree, so create one just for our level and store it in the image.
+ * It'll get moved into the object miptree at validate time.
+ */
+ intelImage->mt = intel_miptree_create(intel, target, internalFormat,
+ level, level,
+ width, height, depth,
+ intelImage->base.TexFormat->TexelBytes,
+ comp_byte);
+
+ }
/* PBO fastpaths:
*/