summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-09-18 15:35:56 -0600
committerBrian Paul <[email protected]>2008-09-18 15:37:13 -0600
commit8d249ca620f6995cc5824d95c29bda7043bbdf8c (patch)
tree9dd3ec865bfdb3c8b29448b295199529835b9679 /src/mesa
parent0b8e19ffc51c29543796d4f1e3243e97d8c32671 (diff)
gallium: if we run out of memory in st_TexImage, flush and try again.
If the driver buffers a scene flushing should release old textures and make space for new ones. Fixes problem with texdown.c test.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 2e1ad93942b..958f88bf2c4 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -481,8 +481,15 @@ st_TexImage(GLcontext * ctx,
if (!stObj->pt) {
guess_and_alloc_texture(ctx->st, stObj, stImage);
if (!stObj->pt) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
- return;
+ /* Probably out of memory.
+ * Try flushing any pending rendering, then retry.
+ */
+ st_finish(ctx->st);
+ guess_and_alloc_texture(ctx->st, stObj, stImage);
+ if (!stObj->pt) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
+ return;
+ }
}
}