Demos (master): stex3d: added out-of-memory error checks

Brian Paul brianp at kemper.freedesktop.org
Thu Nov 18 15:26:19 UTC 2010


Module: Demos
Branch: master
Commit: e8c7c4e7ef630d4b52d8cd94dfaa43ab80ba5e83
URL:    http://cgit.freedesktop.org/mesa/demos/commit/?id=e8c7c4e7ef630d4b52d8cd94dfaa43ab80ba5e83

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Nov 18 08:25:41 2010 -0700

stex3d: added out-of-memory error checks

---

 src/demos/stex3d.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/demos/stex3d.c b/src/demos/stex3d.c
index b1f3504..0c138b2 100644
--- a/src/demos/stex3d.c
+++ b/src/demos/stex3d.c
@@ -308,6 +308,9 @@ create3Dtexture(void)
    glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA,
 		tex_width, tex_height, tex_depth,
 		0, GL_RGBA, GL_UNSIGNED_BYTE, voxels);
+   if (glGetError() == GL_OUT_OF_MEMORY)
+      printf("stex3d: Out of memory allocating %d x %d x %d RGBA texture",
+             tex_width, tex_height, tex_depth);
 
    free(voxels);
 
@@ -578,6 +581,9 @@ create3Dgradient(void)
    glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA,
 		tex_width, tex_height, tex_depth,
 		0, GL_RGBA, GL_UNSIGNED_BYTE, voxels);
+   if (glGetError() == GL_OUT_OF_MEMORY)
+      printf("stex3d: Out of memory allocating %d x %d x %d RGBA texture",
+             tex_width, tex_height, tex_depth);
 
    free(voxels);
 }




More information about the mesa-commit mailing list