summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/r300_draw.c
diff options
context:
space:
mode:
authorPauli Nieminen <suokkos@gmail.com>2009-08-25 02:23:52 +0300
committerPauli Nieminen <suokkos@gmail.com>2009-08-25 02:23:52 +0300
commit4297f32c246cc5b726d02745456c06952322958d (patch)
tree5a665c0a013dbf2921158c501d9420ef60811431 /src/mesa/drivers/dri/r300/r300_draw.c
parent55c0457fe9574452b3c2558ada160c42a3e1fbdc (diff)
radeon/r200/r300/r600: Warn if we emit more than prediction was.
Prediction code making too small prediction may cause space check aserttion failure later in rendering. So warning about any failure to predict correctly should be fixed.
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_draw.c')
-rw-r--r--src/mesa/drivers/dri/r300/r300_draw.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c
index 2ac898bd59..56680516c8 100644
--- a/src/mesa/drivers/dri/r300/r300_draw.c
+++ b/src/mesa/drivers/dri/r300/r300_draw.c
@@ -42,6 +42,7 @@
#include "r300_cmdbuf.h"
#include "radeon_buffer_objects.h"
+#include "radeon_common_context.h"
#include "tnl/tnl.h"
#include "tnl/t_vp_build.h"
@@ -632,7 +633,8 @@ static GLboolean r300TryDrawPrims(GLcontext *ctx,
/* ensure we have the cmd buf space in advance to cover
* the state + DMA AOS pointers */
- r300PredictTryDrawPrimsSize(ctx, nr_prims);
+ GLuint emit_end = r300PredictTryDrawPrimsSize(ctx, nr_prims)
+ + r300->radeon.cmdbuf.cs->cdw;
r300SetupIndexBuffer(ctx, ib);
@@ -656,6 +658,10 @@ static GLboolean r300TryDrawPrims(GLcontext *ctx,
fprintf(stderr, "%s: %u (%d-%d) cs ending at %d\n",
__FUNCTION__, nr_prims, min_index, max_index, r300->radeon.cmdbuf.cs->cdw );
+ if (emit_end < r300->radeon.cmdbuf.cs->cdw)
+ WARN_ONCE("Rendering was %d commands larger than predicted size."
+ " We might overflow command buffer.\n", r300->radeon.cmdbuf.cs->cdw - emit_end);
+
return GL_TRUE;
}