summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe/sp_region.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-08-17 10:27:53 +0100
committerBrian <brian.paul@tungstengraphics.com>2007-08-17 10:27:53 +0100
commit93efcf50fae7bdd9ee9468f4f4049ecb4c06e2df (patch)
treead265c6428e8c86f4973c33aacc873f650451161 /src/mesa/pipe/softpipe/sp_region.c
parent04f2078860d0649b016e9281f86725cb42e15b42 (diff)
assertions
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_region.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_region.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/pipe/softpipe/sp_region.c b/src/mesa/pipe/softpipe/sp_region.c
index 231ea1ea22..25d0a419aa 100644
--- a/src/mesa/pipe/softpipe/sp_region.c
+++ b/src/mesa/pipe/softpipe/sp_region.c
@@ -33,6 +33,7 @@
#include "sp_context.h"
#include "sp_region.h"
+#include "pipe/p_util.h"
#include "pipe/p_winsys.h"
#include "pipe/p_defines.h"
@@ -86,7 +87,7 @@ sp_region_alloc(struct pipe_context *pipe,
unsigned cpp, unsigned width, unsigned height, unsigned flags)
{
struct softpipe_context *sp = softpipe_context( pipe );
- struct pipe_region *region = calloc(sizeof(*region), 1);
+ struct pipe_region *region = CALLOC_STRUCT(pipe_region);
const unsigned alignment = 64;
region->cpp = cpp;
@@ -94,6 +95,8 @@ sp_region_alloc(struct pipe_context *pipe,
region->height = height;
region->refcount = 1;
+ assert(region->pitch > 0);
+
region->buffer = sp->pipe.winsys->buffer_create( sp->pipe.winsys, alignment );
/* NULL data --> just allocate the space */
@@ -233,6 +236,9 @@ sp_region_fill(struct pipe_context *pipe,
{
unsigned i, j;
+ assert(dst->pitch > 0);
+ assert(width <= dst->pitch);
+
(void)pipe->region_map(pipe, dst);
switch (dst->cpp) {