diff options
author | Marek Olšák <[email protected]> | 2011-10-20 23:14:36 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-10-20 23:37:22 +0200 |
commit | a04f8c361211dda6a27c5577070492e17a2f4743 (patch) | |
tree | 7564052c0268b05aeef490b418022bf3442cd3f1 /src/gallium/drivers/r300/r300_texture.c | |
parent | c60eb632b7884fb00ba4d3ec460f070e0214d1b8 (diff) |
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.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_texture.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 34860c9d72b..fa09410c6a5 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -812,9 +812,9 @@ static void r300_texture_setup_fb_state(struct r300_surface *surf) } } -boolean r300_resource_set_properties(struct pipe_screen *screen, - struct pipe_resource *tex, - const struct pipe_resource *new_properties) +void r300_resource_set_properties(struct pipe_screen *screen, + struct pipe_resource *tex, + const struct pipe_resource *new_properties) { struct r300_screen *rscreen = r300_screen(screen); struct r300_resource *res = r300_resource(tex); @@ -824,13 +824,8 @@ boolean r300_resource_set_properties(struct pipe_screen *screen, util_format_short_name(tex->format), util_format_short_name(new_properties->format)); - if (!r300_texture_desc_init(rscreen, res, new_properties)) { - fprintf(stderr, "r300: ERROR: Cannot set texture properties.\n"); - return FALSE; - } + r300_texture_desc_init(rscreen, res, new_properties); r300_texture_setup_format_state(rscreen, res, 0, &res->tx_format); - - return TRUE; } static void r300_texture_destroy(struct pipe_screen *screen, @@ -897,12 +892,7 @@ r300_texture_create_object(struct r300_screen *rscreen, tex->tex.stride_in_bytes_override = stride_in_bytes_override; tex->buf = buffer; - if (!r300_resource_set_properties(&rscreen->screen, &tex->b.b.b, base)) { - if (buffer) - pb_reference(&buffer, NULL); - FREE(tex); - return NULL; - } + r300_resource_set_properties(&rscreen->screen, &tex->b.b.b, base); /* Create the backing buffer if needed. */ if (!tex->buf) { |