瀏覽代碼

st/mesa: return success/fail from guess_and_alloc_texture()

Before we looked at stObj->pt to see if we may have run out of memory,
but that's not a good indicator.  This fixes the spurious GL_OUT_OF_MEMORY
errors that could arise before.
undefined
Brian Paul 15 年之前
父節點
當前提交
2b53f4a9c6
共有 1 個檔案被更改,包括 10 行新增7 行删除
  1. 10
    7
      src/mesa/state_tracker/st_cb_texture.c

+ 10
- 7
src/mesa/state_tracker/st_cb_texture.c 查看文件

* *
* We use the given st_texture_image as a clue to determine the size of the * We use the given st_texture_image as a clue to determine the size of the
* mipmap image at level=0. * mipmap image at level=0.
*
* \return GL_TRUE for success, GL_FALSE if out of memory.
*/ */
static void
static GLboolean
guess_and_alloc_texture(struct st_context *st, guess_and_alloc_texture(struct st_context *st,
struct st_texture_object *stObj, struct st_texture_object *stObj,
const struct st_texture_image *stImage) const struct st_texture_image *stImage)
(dims >= 3 && depth == 1) ) { (dims >= 3 && depth == 1) ) {
/* we can't determine the image size at level=0 */ /* we can't determine the image size at level=0 */
stObj->width0 = stObj->height0 = stObj->depth0 = 0; stObj->width0 = stObj->height0 = stObj->depth0 = 0;
return;
/* this is not an out of memory error */
return GL_TRUE;
} }
} }


depth, depth,
bindings); bindings);


DBG("%s - success\n", __FUNCTION__);
DBG("%s returning %d\n", __FUNCTION__, (stObj->pt != NULL));

return stObj->pt != NULL;
} }




} }


if (!stObj->pt) { if (!stObj->pt) {
guess_and_alloc_texture(st, stObj, stImage);
if (!stObj->pt) {
if (!guess_and_alloc_texture(st, stObj, stImage)) {
/* Probably out of memory. /* Probably out of memory.
* Try flushing any pending rendering, then retry. * Try flushing any pending rendering, then retry.
*/ */
st_finish(st); st_finish(st);
guess_and_alloc_texture(st, stObj, stImage);
if (!stObj->pt) {
if (!guess_and_alloc_texture(st, stObj, stImage)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
return; return;
} }

Loading…
取消
儲存