From: Alan Hourihane Date: Wed, 14 Jan 2009 16:53:22 +0000 (+0000) Subject: mesa: handle some cases of 0x0 render targets X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=85dfed93fe2a6aace7dd2e08f97760e7062e6eb3;p=mesa.git mesa: handle some cases of 0x0 render targets --- diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index ca1a719a9ac..e14f55681cd 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -55,10 +55,11 @@ update_renderbuffer_surface(struct st_context *st, int rtt_width = strb->Base.Width; int rtt_height = strb->Base.Height; - if (!strb->surface || - strb->surface->texture != texture || - strb->surface->width != rtt_width || - strb->surface->height != rtt_height) { + if (texture && + (!strb->surface || + strb->surface->texture != texture || + strb->surface->width != rtt_width || + strb->surface->height != rtt_height)) { GLuint level; /* find matching mipmap level size */ for (level = 0; level <= texture->last_level; level++) { diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index eece7dee112..45a05421f8e 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -388,8 +388,6 @@ st_render_texture(GLcontext *ctx, /*printf("***** render to texture level %d: %d x %d\n", att->TextureLevel, rb->Width, rb->Height);*/ pt = st_get_texobj_texture(att->Texture); - assert(pt); - /*printf("***** pipe texture %d x %d\n", pt->width[0], pt->height[0]);*/ pipe_texture_reference( &strb->texture, pt ); @@ -397,7 +395,10 @@ st_render_texture(GLcontext *ctx, /* the new surface will be created during framebuffer validation */ - init_renderbuffer_bits(strb, pt->format); + if (pt) { + /*printf("***** pipe texture %d x %d\n", pt->width[0], pt->height[0]);*/ + init_renderbuffer_bits(strb, pt->format); + } /* printf("RENDER TO TEXTURE obj=%p pt=%p surf=%p %d x %d\n", diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index a15faf732ca..9e5c35072a1 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -160,9 +160,14 @@ st_generate_mipmap(GLcontext *ctx, GLenum target, struct st_context *st = ctx->st; struct pipe_texture *pt = st_get_texobj_texture(texObj); const uint baseLevel = texObj->BaseLevel; - const uint lastLevel = pt->last_level; + uint lastLevel; uint dstLevel; + if (!pt) + return; + + lastLevel = pt->last_level; + if (!st_render_mipmap(st, target, pt, baseLevel, lastLevel)) { fallback_generate_mipmap(ctx, target, texObj); }