summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_texture_desc.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2011-10-20 23:14:36 +0200
committerMarek Olšák <maraeo@gmail.com>2011-10-20 23:37:22 +0200
commita04f8c361211dda6a27c5577070492e17a2f4743 (patch)
tree7564052c0268b05aeef490b418022bf3442cd3f1 /src/gallium/drivers/r300/r300_texture_desc.c
parentc60eb632b7884fb00ba4d3ec460f070e0214d1b8 (diff)
downloadexternal_mesa3d-a04f8c361211dda6a27c5577070492e17a2f4743.zip
external_mesa3d-a04f8c361211dda6a27c5577070492e17a2f4743.tar.gz
external_mesa3d-a04f8c361211dda6a27c5577070492e17a2f4743.tar.bz2
r300g: don't return NULL in resource_from_handle if the resource is too small
The DDX may allocate a buffer with a too small size. Instead of failing, let's pretend everything's alright. Such bugs should be fixed in the DDX, of course. NOTE: This is a candidate for the stable branches.
Diffstat (limited to 'src/gallium/drivers/r300/r300_texture_desc.c')
-rw-r--r--src/gallium/drivers/r300/r300_texture_desc.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c
index 55e363b..926bb0b 100644
--- a/src/gallium/drivers/r300/r300_texture_desc.c
+++ b/src/gallium/drivers/r300/r300_texture_desc.c
@@ -473,9 +473,9 @@ static void r300_tex_print_info(struct r300_resource *tex,
util_format_short_name(tex->b.b.b.format));
}
-boolean r300_texture_desc_init(struct r300_screen *rscreen,
- struct r300_resource *tex,
- const struct pipe_resource *base)
+void r300_texture_desc_init(struct r300_screen *rscreen,
+ struct r300_resource *tex,
+ const struct pipe_resource *base)
{
tex->b.b.b.target = base->target;
tex->b.b.b.format = base->format;
@@ -514,11 +514,15 @@ boolean r300_texture_desc_init(struct r300_screen *rscreen,
/* Make sure the buffer we got is large enough. */
if (tex->tex.size_in_bytes > tex->buf->size) {
- fprintf(stderr, "r300: texture_desc_init: The buffer is not "
- "large enough. Got: %i, Need: %i, Info:\n",
- tex->buf->size, tex->tex.size_in_bytes);
+ fprintf(stderr,
+ "r300: I got a pre-allocated buffer to use it as a texture "
+ "storage, but the buffer is too small. I'll use the buffer "
+ "anyway, because I can't crash here, but it's dangerous. "
+ "This can be a DDX bug. Got: %iB, Need: %iB, Info:\n",
+ tex->buf->size, tex->tex.size_in_bytes);
r300_tex_print_info(tex, "texture_desc_init");
- return FALSE;
+ /* Ooops, what now. Apps will break if we fail this,
+ * so just pretend everything's okay. */
}
}
@@ -526,8 +530,6 @@ boolean r300_texture_desc_init(struct r300_screen *rscreen,
if (SCREEN_DBG_ON(rscreen, DBG_TEX))
r300_tex_print_info(tex, "texture_desc_init");
-
- return TRUE;
}
unsigned r300_texture_get_offset(struct r300_resource *tex,