Mesa (master): st/mesa: Fix glEGLImageTargetTexture2DOES.
Chia-I Wu
olv at kemper.freedesktop.org
Thu Aug 26 08:40:15 UTC 2010
Module: Mesa
Branch: master
Commit: 0f74efdef05c5c27b3137163d795dc91f34cc114
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f74efdef05c5c27b3137163d795dc91f34cc114
Author: Chia-I Wu <olv at lunarg.com>
Date: Thu Aug 26 02:15:22 2010 +0800
st/mesa: Fix glEGLImageTargetTexture2DOES.
stObj->pt should be set in st_bind_surface, just as in st_TexImage. On
the other hand, st_TexImage should unreference stObj->pt. It also needs
to initialize the texture image again as _mesa_clear_texture_object
clears the image.
---
src/mesa/state_tracker/st_cb_eglimage.c | 3 ++-
src/mesa/state_tracker/st_cb_texture.c | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
index 037e576..3145416 100644
--- a/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/src/mesa/state_tracker/st_cb_eglimage.c
@@ -128,7 +128,8 @@ st_bind_surface(GLcontext *ctx, GLenum target,
_mesa_set_fetch_functions(texImage, 2);
/* FIXME create a non-default sampler view from the pipe_surface? */
- pipe_resource_reference(&stImage->pt, ps->texture);
+ pipe_resource_reference(&stObj->pt, ps->texture);
+ pipe_resource_reference(&stImage->pt, stObj->pt);
stObj->width0 = ps->width;
stObj->height0 = ps->height;
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index a41c780..9eb1403 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -548,6 +548,14 @@ st_TexImage(GLcontext * ctx,
/* switch to "normal" */
if (stObj->surface_based) {
_mesa_clear_texture_object(ctx, texObj);
+ pipe_resource_reference(&stObj->pt, NULL);
+
+ /* oops, need to init this image again */
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ width, height, depth, border, internalFormat);
+ _mesa_choose_texture_format(ctx, texObj, texImage, target, level,
+ internalFormat, format, type);
+
stObj->surface_based = GL_FALSE;
}
More information about the mesa-commit
mailing list