]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
R_UpdateTexture no longer calls R_RealGetTexture, and now causes a
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 7 Dec 2009 20:21:30 +0000 (20:21 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 7 Dec 2009 20:21:30 +0000 (20:21 +0000)
Host_Error if the texture has not been precached already, this should
fix a crash with dpv video playback

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9556 d7cf8633-e32d-0410-b094-e92efae38249

gl_textures.c

index 4b4f6cc3f449f50c8e3f11464d5f58572201c124..4e86d252b71a46653e7769ee0b2ba216836a5bd1 100644 (file)
@@ -1154,17 +1154,14 @@ int R_TextureHeight(rtexture_t *rt)
 
 void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, int width, int height)
 {
-       gltexture_t *glt;
-       if (rt == NULL)
-               Host_Error("R_UpdateTexture: no texture supplied");
+       gltexture_t *glt = (gltexture_t *)rt;
        if (data == NULL)
                Host_Error("R_UpdateTexture: no data supplied");
-
-       // we need it to be uploaded before we can update a part of it
-       R_RealGetTexture(rt);
-
+       if (glt == NULL)
+               Host_Error("R_UpdateTexture: no texture supplied");
+       if (!glt->texnum)
+               Host_Error("R_UpdateTexture: texture has not been uploaded yet");
        // update part of the texture
-       glt = (gltexture_t *)rt;
        R_Upload(glt, data, x, y, 0, width, height, 1);
 }