summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2011-06-21 13:44:57 -0700
committerChad Versace <[email protected]>2011-06-24 14:47:19 -0700
commit1a062dfc6f6e872e18f048bb5a61709c36f22870 (patch)
tree73c4a818511227e9bf75101453b0565c1df25e68 /src/mesa
parent407832b0d251515307dc0712863e243435baa4c2 (diff)
intel: Add fields to intel_texture for faking s8z24 with separate stencil
Add the fields depth_rb and stencil_rb, and put hooks in place to release the renderbuffers in intelFreeTextureImageData and intelTexImage. Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.c9
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c13
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_obj.h30
3 files changed, 40 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 32e1fb7397a..21c4a1dddba 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -1,4 +1,5 @@
#include "swrast/swrast.h"
+#include "main/renderbuffer.h"
#include "main/texobj.h"
#include "main/teximage.h"
#include "main/mipmap.h"
@@ -59,6 +60,14 @@ intelFreeTextureImageData(struct gl_context * ctx, struct gl_texture_image *texI
_mesa_free_texmemory(texImage->Data);
texImage->Data = NULL;
}
+
+ if (intelImage->depth_rb) {
+ _mesa_reference_renderbuffer(&intelImage->depth_rb, NULL);
+ }
+
+ if (intelImage->stencil_rb) {
+ _mesa_reference_renderbuffer(&intelImage->stencil_rb, NULL);
+ }
}
/**
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 90d4117ec8f..472a8e1f598 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -314,18 +314,7 @@ intelTexImage(struct gl_context * ctx,
}
}
- /* Release the reference to a potentially orphaned buffer.
- * Release any old malloced memory.
- */
- if (intelImage->mt) {
- intel_miptree_release(intel, &intelImage->mt);
- assert(!texImage->Data);
- }
- else if (texImage->Data) {
- _mesa_free_texmemory(texImage->Data);
- texImage->Data = NULL;
- }
-
+ ctx->Driver.FreeTexImageData(ctx, texImage);
assert(!intelImage->mt);
if (intelObj->mt &&
diff --git a/src/mesa/drivers/dri/intel/intel_tex_obj.h b/src/mesa/drivers/dri/intel/intel_tex_obj.h
index e93ef4a4727..a9ae2ec5429 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_obj.h
+++ b/src/mesa/drivers/dri/intel/intel_tex_obj.h
@@ -63,6 +63,36 @@ struct intel_texture_image
*/
struct intel_mipmap_tree *mt;
GLboolean used_as_render_target;
+
+ /**
+ * \name Renderbuffers for faking packed depth/stencil
+ *
+ * These renderbuffers are non-null only if the intel_context is using
+ * separate stencil and this texture has a packed depth/stencil format. When
+ * glFramebufferTexture is called on this image, the resultant renderbuffer
+ * wrapper reuses these renderbuffers as its own.
+ *
+ * \see intel_wrap_texture
+ * \see intel_tex_image_s8z24_create_renderbuffers
+ * \see intel_tex_image_s8z24_scatter
+ * \see intel_tex_image_s8z24_gather
+ *
+ * \{
+ */
+
+ /**
+ * The depth buffer has format X8_Z24. The x8 bits are undefined unless
+ * intel_tex_image_s8z24_gather has been immediately called. The depth buffer
+ * resuses the image miptree's region and hiz_region as its own.
+ */
+ struct gl_renderbuffer *depth_rb;
+
+ /**
+ * The stencil buffer has format S8 and keeps its data in its own region.
+ */
+ struct gl_renderbuffer *stencil_rb;
+
+ /** \} */
};
static INLINE struct intel_texture_object *