From 808da7d8ca26f71832dc94bb50180b60a5ee3af2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 24 Jun 2013 14:59:53 -0600 Subject: [PATCH] svga: use new svga_define_texture_level() helper To get array bounds checking. Reviewed-by: Jose Fonseca --- src/gallium/drivers/svga/svga_resource_texture.c | 4 ++-- src/gallium/drivers/svga/svga_resource_texture.h | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index fd07ea1e3bc..49509303553 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -364,9 +364,9 @@ svga_texture_transfer_unmap(struct pipe_context *pipe, ss->texture_timestamp++; svga_age_texture_view(tex, transfer->level); if (transfer->resource->target == PIPE_TEXTURE_CUBE) - tex->defined[transfer->box.z][transfer->level] = TRUE; + svga_define_texture_level(tex, transfer->box.z, transfer->level); else - tex->defined[0][transfer->level] = TRUE; + svga_define_texture_level(tex, 0, transfer->level); } FREE(st->swbuf); diff --git a/src/gallium/drivers/svga/svga_resource_texture.h b/src/gallium/drivers/svga/svga_resource_texture.h index 58646f70de5..7e2e61339e0 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.h +++ b/src/gallium/drivers/svga/svga_resource_texture.h @@ -130,6 +130,19 @@ svga_age_texture_view(struct svga_texture *tex, unsigned level) } +/** + * Mark the given texture face/level as being defined. + */ +static INLINE void +svga_define_texture_level(struct svga_texture *tex, + unsigned face,unsigned level) +{ + assert(face < Elements(tex->defined)); + assert(level < Elements(tex->defined[0])); + tex->defined[face][level] = TRUE; +} + + struct pipe_resource * svga_texture_create(struct pipe_screen *screen, const struct pipe_resource *template); -- 2.30.2