diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2007-08-24 13:04:48 +0200 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-12-17 14:35:10 -0800 |
commit | 8ffed8b913340904dfb8fe183607d97a27887180 (patch) | |
tree | 88f1d79db1182be7441f263a5f98e104a262815a | |
parent | f84613d6fcbbb5f769ee34cff0900353a13693cf (diff) |
__glXDRIbindTexImage: Fail if no texture bound to pixmap's texture target.
We would most likely crash somewhere in Mesa if we tried to continue in this
case.
(cherry picked from commit 095850596114178119a8cc854716ce0cc6e05121)
-rw-r--r-- | GL/glx/glxdri.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c index 09abca3f9..4f8015578 100644 --- a/GL/glx/glxdri.c +++ b/GL/glx/glxdri.c @@ -374,17 +374,25 @@ __glXDRIbindTexImage(__GLXcontext *baseContext, { RegionPtr pRegion = NULL; PixmapPtr pixmap; - int bpp, override = 0; + int bpp, override = 0, texname; GLenum format, type; ScreenPtr pScreen = glxPixmap->pScreen; __GLXDRIscreen * const screen = (__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum); + CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ? + GL_TEXTURE_BINDING_2D : + GL_TEXTURE_BINDING_RECTANGLE_NV, + &texname)); + + if (!texname) + return __glXError(GLXBadContextState); + pixmap = (PixmapPtr) glxPixmap->pDraw; if (screen->texOffsetStart && screen->driScreen.setTexOffset) { __GLXpixmap **texOffsetOverride = screen->texOffsetOverride; - int i, firstEmpty = 16, texname; + int i, firstEmpty = 16; for (i = 0; i < 16; i++) { if (texOffsetOverride[i] == glxPixmap) @@ -409,11 +417,6 @@ alreadyin: glxPixmap->pDRICtx = &((__GLXDRIcontext*)baseContext)->driContext; - CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ? - GL_TEXTURE_BINDING_2D : - GL_TEXTURE_BINDING_RECTANGLE_NV, - &texname)); - if (texname == glxPixmap->texname) return Success; |