summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-05-10 11:51:01 -0700
committerEric Anholt <[email protected]>2013-05-17 13:04:05 -0700
commite98c39c109f9b38d6bb97e3890382fdf66c25176 (patch)
tree3f51aa191af6052243787b0b10e1a4d581a64583 /src/mesa/drivers
parent7b085d1bfa7630571e04a7d630765d3e5ed63e25 (diff)
mesa: Track the TexImage being rendered to in the gl_renderbuffer.
We keep having to pass the attachments around with our gl_renderbuffers because that's the only way to find what the gl_renderbuffer actually refers to. This is a step toward removing that (though drivers still need the Zoffset as well). Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c26
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.h3
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_fbo.c3
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_fbo.c17
5 files changed, 18 insertions, 33 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 784e90718b4..bbe8579c553 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1328,7 +1328,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
/* _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) {
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 6b30262892a..bf8e48d779b 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -572,8 +572,9 @@ intel_render_texture(struct gl_context * ctx,
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;
@@ -602,12 +603,10 @@ intel_render_texture(struct gl_context * ctx,
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);
@@ -623,13 +622,9 @@ intel_finish_render_texture(struct gl_context * 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
@@ -734,10 +729,7 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
}
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;
}
@@ -945,14 +937,14 @@ intel_renderbuffer_move_to_temp(struct intel_context *intel,
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,
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h
index 0e0806b63bb..aa52b979f88 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.h
+++ b/src/mesa/drivers/dri/intel/intel_fbo.h
@@ -52,9 +52,6 @@ struct intel_renderbuffer
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
* \{
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index a692051c082..f997ac888f9 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -252,8 +252,7 @@ nouveau_render_texture(struct gl_context *ctx, struct gl_framebuffer *fb,
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,
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index c43f527d222..1fdcf056562 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -787,9 +787,9 @@ radeon_render_texture(struct gl_context * ctx,
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;
@@ -818,7 +818,7 @@ radeon_render_texture(struct gl_context * ctx,
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) {
@@ -853,11 +853,8 @@ static void
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;
@@ -883,7 +880,7 @@ radeon_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
}
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;