Mesa (gallium-0.2): g3dvl: Some cleanups.

Younes Manton ymanton at kemper.freedesktop.org
Mon Jan 19 02:48:32 UTC 2009


Module: Mesa
Branch: gallium-0.2
Commit: 76753e30781e88912c0465642616ab16bbc1b4f3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=76753e30781e88912c0465642616ab16bbc1b4f3

Author: Younes Manton <younes.m at gmail.com>
Date:   Sun Jan 18 21:38:48 2009 -0500

g3dvl: Some cleanups.

---

 .../state_trackers/g3dvl/vl_r16snorm_mc_buf.c      |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
index 0c1ce3c..f0f8294 100644
--- a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
+++ b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
@@ -297,6 +297,7 @@ static inline int vlGrabMacroBlock
 {
 	assert(mc);
 	assert(macroblock);
+	assert(mc->num_macroblocks < mc->macroblocks_per_picture);
 
 	mc->macroblocks[mc->num_macroblocks].mbx = macroblock->mbx;
 	mc->macroblocks[mc->num_macroblocks].mby = macroblock->mby;
@@ -330,6 +331,7 @@ static inline int vlGrabMacroBlock
 }
 
 #define SET_BLOCK(vb, cbp, mbx, mby, unitx, unity, ofsx, ofsy, hx, hy, lm, cbm, crm, zb)					\
+	do {															\
 	(vb)[0].pos.x = (mbx) * (unitx) + (ofsx);		(vb)[0].pos.y = (mby) * (unity) + (ofsy);			\
 	(vb)[1].pos.x = (mbx) * (unitx) + (ofsx);		(vb)[1].pos.y = (mby) * (unity) + (ofsy) + (hy);		\
 	(vb)[2].pos.x = (mbx) * (unitx) + (ofsx) + (hx);	(vb)[2].pos.y = (mby) * (unity) + (ofsy);			\
@@ -392,7 +394,8 @@ static inline int vlGrabMacroBlock
 		(vb)[3].cr_tc.x = (zb)[2].x + (hx);	(vb)[3].cr_tc.y = (zb)[2].y;						\
 		(vb)[4].cr_tc.x = (zb)[2].x;		(vb)[4].cr_tc.y = (zb)[2].y + (hy);					\
 		(vb)[5].cr_tc.x = (zb)[2].x + (hx);	(vb)[5].cr_tc.y = (zb)[2].y + (hy);					\
-	}
+	}															\
+	} while (0)
 
 static inline int vlGenMacroblockVerts
 (
@@ -409,6 +412,7 @@ static inline int vlGenMacroblockVerts
 	assert(mc);
 	assert(macroblock);
 	assert(ycbcr_vb);
+	assert(pos < mc->macroblocks_per_picture);
 
 	switch (macroblock->mb_type)
 	{
@@ -581,6 +585,8 @@ static int vlFlush
 	if (mc->num_macroblocks < mc->macroblocks_per_picture)
 		return 0;
 
+	assert(mc->num_macroblocks <= mc->macroblocks_per_picture);
+
 	pipe = mc->pipe;
 
 	for (i = 0; i < mc->num_macroblocks; ++i)




More information about the mesa-commit mailing list