summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_context.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-01-16 10:54:53 -0700
committerBrian Paul <[email protected]>2012-01-24 14:12:11 -0700
commit33257803d9083643ea9709c127933d5a2c4f1960 (patch)
treec7a4a568eab26e3304264a561368a8311c9e7aeb /src/mesa/swrast/s_context.h
parente34a54ff451a37a6e6eab529c44330dd6a8b218b (diff)
swrast: new assertions in _swrast_pixel_address()
Diffstat (limited to 'src/mesa/swrast/s_context.h')
-rw-r--r--src/mesa/swrast/s_context.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index 3391600e120..36ab86a5e84 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -430,6 +430,14 @@ _swrast_pixel_address(struct gl_renderbuffer *rb, GLint x, GLint y)
{
const GLint bpp = _mesa_get_format_bytes(rb->Format);
const GLint rowStride = rb->RowStride * bpp;
+ assert(x >= 0);
+ assert(y >= 0);
+ /* NOTE: using <= only because of s_tritemp.h which gets a pixel
+ * address but doesn't necessarily access it.
+ */
+ assert(x <= (GLint) rb->Width);
+ assert(y <= (GLint) rb->Height);
+ assert(rb->Data);
return (GLubyte *) rb->Data + y * rowStride + x * bpp;
}