summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-05-03 19:14:31 +0200
committerMarek Olšák <maraeo@gmail.com>2010-05-03 20:39:40 +0200
commit5cdedaaf295acae13ac10feeb3143d83bc53d314 (patch)
tree95de2ea5daaa49be706643533b6fc1afe14d5244 /src/gallium/drivers/r300
parent0bcb4f10016fb611b2946307d880f4dc1dd05eae (diff)
r300g: refuse to create a texture with size 0
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/r300_texture.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 3e3cf33bde..506fb73367 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -924,6 +924,17 @@ struct pipe_resource* r300_texture_create(struct pipe_screen* screen,
return NULL;
}
+ /* Refuse to create a texture with size 0. */
+ if (!base->width0 ||
+ (!base->height0 && (base->target == PIPE_TEXTURE_2D ||
+ base->target == PIPE_TEXTURE_CUBE)) ||
+ (!base->depth0 && base->target == PIPE_TEXTURE_3D)) {
+ fprintf(stderr, "r300: texture_create: "
+ "Got invalid texture dimensions: %ix%ix%i\n",
+ base->width0, base->height0, base->depth0);
+ return NULL;
+ }
+
tex->b.b = *base;
tex->b.vtbl = &r300_texture_vtbl;
pipe_reference_init(&tex->b.b.reference, 1);