att->Zoffset = zoffset;
att->Complete = GL_FALSE;
- if (att->Texture->Image[att->CubeMapFace][att->TextureLevel]) {
+ if (_mesa_get_attachment_teximage(att)) {
ctx->Driver.RenderTexture(ctx, fb, att);
}
/* get width, height, format of the renderbuffer/texture
*/
if (att->Type == GL_TEXTURE) {
- const struct gl_texture_image *texImg
- = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
+ const struct gl_texture_image *texImg =
+ _mesa_get_attachment_teximage(att);
minWidth = MIN2(minWidth, texImg->Width);
maxWidth = MAX2(maxWidth, texImg->Width);
minHeight = MIN2(minHeight, texImg->Height);
for (i = 0; i < BUFFER_COUNT; i++) {
struct gl_renderbuffer_attachment *att = fb->Attachment + i;
- struct gl_texture_object *texObj = att->Texture;
- if (texObj
- && texObj->Image[att->CubeMapFace][att->TextureLevel]) {
+ if (att->Texture && _mesa_get_attachment_teximage(att)) {
ctx->Driver.RenderTexture(ctx, fb, att);
}
}
#ifndef FBOBJECT_H
#define FBOBJECT_H
+#include "compiler.h"
#include "glheader.h"
struct gl_context;
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);
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;
+ const struct gl_texture_image *texImage =
+ _mesa_get_attachment_teximage_const(att);
fprintf(stderr,
" %2d: Texture %u, level %u, face %u, slice %u, complete %d\n",
i, att->Texture->Name, att->TextureLevel, att->CubeMapFace,
att->Zoffset, att->Complete);
- texImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
fprintf(stderr, " Size: %u x %u x %u Format %s\n",
texImage->Width, texImage->Height, texImage->Depth,
_mesa_get_format_name(texImage->TexFormat));
att->Texture == texObj &&
att->TextureLevel == level &&
att->CubeMapFace == face) {
- ASSERT(att->Texture->Image[att->CubeMapFace][att->TextureLevel]);
+ ASSERT(_mesa_get_attachment_teximage(att));
/* Tell driver about the new renderbuffer texture */
ctx->Driver.RenderTexture(ctx, ctx->DrawBuffer, att);
/* Mark fb status as indeterminate to force re-validation */
#include "context.h"
#include "colormac.h"
+#include "fbobject.h"
#include "macros.h"
#include "texfetch.h"
#include "teximage.h"
* update the internal format info, etc.
*/
static void
-update_wrapper(struct gl_context *ctx, const struct gl_renderbuffer_attachment *att)
+update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
{
struct texture_renderbuffer *trb
= (struct texture_renderbuffer *) att->Renderbuffer;
(void) ctx;
ASSERT(trb);
- trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
+ trb->TexImage = _mesa_get_attachment_teximage(att);
ASSERT(trb->TexImage);
trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat);
return;
/* get pointer to texture image we're rendeing to */
- texImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
+ texImage = _mesa_get_attachment_teximage(att);
/* create new renderbuffer which wraps the texture image */
rb = st_new_renderbuffer(ctx, 0);
return GL_FALSE;
format = stObj->pt->format;
- texFormat =
- stObj->base.Image[att->CubeMapFace][att->TextureLevel]->TexFormat;
+ texFormat = _mesa_get_attachment_teximage_const(att)->TexFormat;
/* If the encoding is sRGB and sRGB rendering cannot be enabled,
* check for linear format support instead.