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++) {
/*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 );
/* 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",
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);
}