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 <chad@chad-versace.us>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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 &&
|
||||
|
@@ -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 *
|
||||
|
Reference in New Issue
Block a user