diff options
author | Dave Airlie <airlied@redhat.com> | 2009-03-25 17:01:37 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-03-26 13:24:21 +1000 |
commit | 258686a973d7aef4bf956f540e99e65dc5bbee9c (patch) | |
tree | 67150f17c7edbd5b8961dafbcd992a3f6b40a780 /src/mesa/drivers/dri/radeon | |
parent | 4d36a19c90fcc3f6e09dd01072b8b279cc8baef2 (diff) |
radeon: fixup map/unmap texture to work with override BOs
if you hit this you've already failed but we shouldn't crash
Diffstat (limited to 'src/mesa/drivers/dri/radeon')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_texture.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index d212898acd..a38d76ac2c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -131,6 +131,25 @@ void radeon_teximage_unmap(radeon_texture_image *image) } } +static void map_override(GLcontext *ctx, radeonTexObj *t) +{ + radeon_texture_image *img = get_radeon_texture_image(t->base.Image[0][0]); + + radeon_bo_map(t->bo, GL_FALSE); + + img->base.Data = t->bo->ptr; + _mesa_set_fetch_functions(&img->base, 2); +} + +static void unmap_override(GLcontext *ctx, radeonTexObj *t) +{ + radeon_texture_image *img = get_radeon_texture_image(t->base.Image[0][0]); + + radeon_bo_unmap(t->bo); + + img->base.Data = NULL; +} + /** * Map a validated texture for reading during software rendering. */ @@ -143,8 +162,11 @@ void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj) return; /* for r100 3D sw fallbacks don't have mt */ + if (t->image_override && t->bo) + map_override(ctx, t); + if (!t->mt) - return; + return; radeon_bo_map(t->mt->bo, GL_FALSE); for(face = 0; face < t->mt->faces; ++face) { @@ -158,6 +180,8 @@ void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj) radeonTexObj* t = radeon_tex_obj(texObj); int face, level; + if (t->image_override && t->bo) + unmap_override(ctx, t); /* for r100 3D sw fallbacks don't have mt */ if (!t->mt) return; |