diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/fbobject.c | 8 | ||||
-rw-r--r-- | src/mesa/main/fbobject.h | 19 | ||||
-rw-r--r-- | src/mesa/main/framebuffer.c | 3 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 8 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 2 |
5 files changed, 14 insertions, 26 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index f00d11ab9f1..070fb8c5356 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -363,7 +363,7 @@ _mesa_update_texture_renderbuffer(struct gl_context *ctx, struct gl_texture_image *texImage; struct gl_renderbuffer *rb; - texImage = _mesa_get_attachment_teximage(att); + texImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; if (!texImage) return; @@ -390,6 +390,7 @@ _mesa_update_texture_renderbuffer(struct gl_context *ctx, rb->Width = texImage->Width2; rb->Height = texImage->Height2; rb->NumSamples = texImage->NumSamples; + rb->TexImage = texImage; ctx->Driver.RenderTexture(ctx, fb, att); } @@ -889,8 +890,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, /* get width, height, format of the renderbuffer/texture */ if (att->Type == GL_TEXTURE) { - const struct gl_texture_image *texImg = - _mesa_get_attachment_teximage(att); + const struct gl_texture_image *texImg = att->Renderbuffer->TexImage; minWidth = MIN2(minWidth, texImg->Width); maxWidth = MAX2(maxWidth, texImg->Width); minHeight = MIN2(minHeight, texImg->Height); @@ -1862,7 +1862,7 @@ check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb) for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = fb->Attachment + i; - if (att->Texture && _mesa_get_attachment_teximage(att)) { + if (att->Texture && att->Renderbuffer->TexImage) { ctx->Driver.RenderTexture(ctx, fb, att); } } diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h index bfab6e17da7..dfd795a3a52 100644 --- a/src/mesa/main/fbobject.h +++ b/src/mesa/main/fbobject.h @@ -71,25 +71,6 @@ extern struct gl_renderbuffer_attachment * _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment); - -/** Return the texture image for a renderbuffer attachment */ -static inline struct gl_texture_image * -_mesa_get_attachment_teximage(struct gl_renderbuffer_attachment *att) -{ - assert(att->Type == GL_TEXTURE); - return att->Texture->Image[att->CubeMapFace][att->TextureLevel]; -} - - -/** Return the (const) texture image for a renderbuffer attachment */ -static inline const struct gl_texture_image * -_mesa_get_attachment_teximage_const(const struct gl_renderbuffer_attachment *att) -{ - assert(att->Type == GL_TEXTURE); - return att->Texture->Image[att->CubeMapFace][att->TextureLevel]; -} - - extern void _mesa_remove_attachment(struct gl_context *ctx, struct gl_renderbuffer_attachment *att); diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 911bb927a60..af3c5952583 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -962,8 +962,7 @@ _mesa_print_framebuffer(const struct gl_framebuffer *fb) for (i = 0; i < BUFFER_COUNT; i++) { const struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; if (att->Type == GL_TEXTURE) { - const struct gl_texture_image *texImage = - _mesa_get_attachment_teximage_const(att); + const struct gl_texture_image *texImage = att->Renderbuffer->TexImage; fprintf(stderr, " %2d: Texture %u, level %u, face %u, slice %u, complete %d\n", i, att->Texture->Name, att->TextureLevel, att->CubeMapFace, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 5dfe911d060..244bee2e670 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2586,6 +2586,14 @@ struct gl_renderbuffer GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or GL_STENCIL_INDEX. */ gl_format Format; /**< The actual renderbuffer memory format */ + /** + * Pointer to the texture image if this renderbuffer wraps a texture, + * otherwise NULL. + * + * Note that the reference on the gl_texture_object containing this + * TexImage is held by the gl_renderbuffer_attachment. + */ + struct gl_texture_image *TexImage; /** Delete this renderbuffer */ void (*Delete)(struct gl_context *ctx, struct gl_renderbuffer *rb); diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 26fa4c38190..d07f6e9dc9e 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2759,8 +2759,8 @@ check_rtt_cb(GLuint key, void *data, void *userData) att->Texture == texObj && att->TextureLevel == level && att->CubeMapFace == face) { - ASSERT(_mesa_get_attachment_teximage(att)); _mesa_update_texture_renderbuffer(ctx, ctx->DrawBuffer, att); + ASSERT(att->Renderbuffer->TexImage); /* Mark fb status as indeterminate to force re-validation */ fb->_Status = 0; } |