summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2007-08-24 13:04:48 +0200
committerMichel Dänzer <michel@tungstengraphics.com>2007-08-24 13:04:48 +0200
commit095850596114178119a8cc854716ce0cc6e05121 (patch)
treece06e1d94775f8925057bbe626278b847b506064
parent3305d17195e3a0a5555300555bd7703312fa489f (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.
-rw-r--r--GL/glx/glxdri.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index 685683dcc..c1f3eb76b 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;