/* _NEW_BUFFERS */
gl_format rb_format = _mesa_get_render_format(ctx, intel_rb_format(irb));
- if (irb->tex_image && !brw->has_surface_tile_offset) {
+ if (rb->TexImage && !brw->has_surface_tile_offset) {
intel_renderbuffer_tile_offsets(irb, &tile_x, &tile_y);
if (tile_x != 0 || tile_y != 0) {
struct gl_renderbuffer_attachment *att)
{
struct intel_context *intel = intel_context(ctx);
- struct gl_texture_image *image = _mesa_get_attachment_teximage(att);
- struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer);
+ struct gl_renderbuffer *rb = att->Renderbuffer;
+ struct intel_renderbuffer *irb = intel_renderbuffer(rb);
+ struct gl_texture_image *image = rb->TexImage;
struct intel_texture_image *intel_image = intel_texture_image(image);
struct intel_mipmap_tree *mt = intel_image->mt;
int layer;
return;
}
- irb->tex_image = image;
-
DBG("Begin render %s texture tex=%u w=%d h=%d refcount=%d\n",
_mesa_get_format_name(image->TexFormat),
att->Texture->Name, image->Width, image->Height,
- irb->Base.Base.RefCount);
+ rb->RefCount);
/* update drawing region, etc */
intel_draw_buffer(ctx);
{
struct intel_context *intel = intel_context(ctx);
struct gl_renderbuffer *rb = att->Renderbuffer;
- struct intel_renderbuffer *irb = intel_renderbuffer(rb);
DBG("Finish render %s texture\n", _mesa_get_format_name(rb->Format));
- if (irb)
- irb->tex_image = NULL;
-
/* Since we've (probably) rendered to the texture and will (likely) use
* it in the texture domain later on in this batchbuffer, flush the
* batch. Once again, we wish for a domain tracker in libdrm to cover
}
if (fb->Attachment[i].Type == GL_TEXTURE) {
- const struct gl_texture_image *img =
- _mesa_get_attachment_teximage_const(&fb->Attachment[i]);
-
- if (img->Border) {
+ if (rb->TexImage->Border) {
fbo_incomplete(fb, "FBO incomplete: texture with border\n");
continue;
}
struct intel_renderbuffer *irb,
bool invalidate)
{
- struct intel_texture_image *intel_image =
- intel_texture_image(irb->tex_image);
+ struct gl_renderbuffer *rb =&irb->Base.Base;
+ struct intel_texture_image *intel_image = intel_texture_image(rb->TexImage);
struct intel_mipmap_tree *new_mt;
int width, height, depth;
- intel_miptree_get_dimensions_for_image(irb->tex_image, &width, &height, &depth);
+ intel_miptree_get_dimensions_for_image(rb->TexImage, &width, &height, &depth);
- new_mt = intel_miptree_create(intel, irb->tex_image->TexObject->Target,
+ new_mt = intel_miptree_create(intel, rb->TexImage->TexObject->Target,
intel_image->base.Base.TexFormat,
intel_image->base.Base.Level,
intel_image->base.Base.Level,
struct intel_mipmap_tree *mt; /**< The renderbuffer storage. */
drm_intel_bo *map_bo;
- /* Current texture image this renderbuffer is attached to. */
- struct gl_texture_image *tex_image;
-
/**
* \name Miptree view
* \{
struct gl_renderbuffer_attachment *att)
{
struct gl_renderbuffer *rb = att->Renderbuffer;
- struct gl_texture_image *ti =
- att->Texture->Image[att->CubeMapFace][att->TextureLevel];
+ struct gl_texture_image *ti = rb->TexImage;
/* Update the renderbuffer fields from the texture. */
nouveau_surface_ref(&to_nouveau_teximage(ti)->surface,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att)
{
- struct gl_texture_image *newImage
- = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
- struct radeon_renderbuffer *rrb = radeon_renderbuffer(att->Renderbuffer);
+ struct gl_renderbuffer *rb = att->Renderbuffer;
+ struct gl_texture_image *newImage = rb->TexImage;
+ struct radeon_renderbuffer *rrb = radeon_renderbuffer(rb);
radeon_texture_image *radeon_image;
GLuint imageOffset;
DBG("Begin render texture tid %lx tex=%u w=%d h=%d refcount=%d\n",
_glthread_GetID(),
att->Texture->Name, newImage->Width, newImage->Height,
- rrb->base.Base.RefCount);
+ rb->RefCount);
/* point the renderbufer's region to the texture image region */
if (rrb->bo != radeon_image->mt->bo) {
radeon_finish_render_texture(struct gl_context * ctx,
struct gl_renderbuffer_attachment *att)
{
- struct gl_texture_object *tex_obj = att->Texture;
- radeon_texture_image *radeon_image = NULL;
-
- if (tex_obj)
- radeon_image = (radeon_texture_image *)_mesa_get_attachment_teximage(att);
+ struct gl_texture_image *image = att->Renderbuffer->TexImage;
+ radeon_texture_image *radeon_image = (radeon_texture_image *)image;
if (radeon_image)
radeon_image->used_as_render_target = GL_FALSE;
}
if (att->Type == GL_TEXTURE) {
- mesa_format = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->TexFormat;
+ mesa_format = att->Renderbuffer->TexImage->TexFormat;
} else {
/* All renderbuffer formats are renderable, but not sampable */
continue;
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;
rb->Width = texImage->Width2;
rb->Height = texImage->Height2;
rb->NumSamples = texImage->NumSamples;
+ rb->TexImage = texImage;
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 =
- _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);
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);
}
}
_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);
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,
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);
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;
}
struct st_renderbuffer *strb = st_renderbuffer(rb);
struct pipe_resource *pt;
struct st_texture_object *stObj;
- const struct gl_texture_image *texImage;
struct pipe_surface surf_tmpl;
if (!st_finalize_texture(ctx, pipe, att->Texture))
pt = st_get_texobj_resource(att->Texture);
assert(pt);
- /* get pointer to texture image we're rendeing to */
- texImage = _mesa_get_attachment_teximage(att);
-
/* get the texture for the texture object */
stObj = st_texture_object(att->Texture);
return GL_FALSE;
format = stObj->pt->format;
- texFormat = _mesa_get_attachment_teximage_const(att)->TexFormat;
+ texFormat = att->Renderbuffer->TexImage->TexFormat;
/* If the encoding is sRGB and sRGB rendering cannot be enabled,
* check for linear format support instead.
(void) ctx;
- swImage = swrast_texture_image(_mesa_get_attachment_teximage(att));
+ swImage = swrast_texture_image(rb->TexImage);
assert(swImage);
format = swImage->Base.TexFormat;