summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-08-14 00:05:28 +0800
committerChia-I Wu <olv@lunarg.com>2010-08-16 20:46:29 +0800
commita072f0e186522f9de2848989422ad0244f65c961 (patch)
treed1bafb12f45a1b8c4167ac9c02d4446b7bc9f990 /src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
parent7b3beb22405ee2de0cf02951b6547964a2989ee5 (diff)
drwa: Add PRIMITIVE macro to vsplit.
PRIMITIVE is used by the indexed path to flush the entire primitive with custom vertex count checks. It replaces the existing fast path.
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
index efeaa56711..4bb57b1493 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
@@ -34,9 +34,8 @@
* (rebased) index buffer as the draw elements.
*/
static boolean
-CONCAT(vsplit_segment_fast_, ELT_TYPE)(struct vsplit_frontend *vsplit,
- unsigned flags,
- unsigned istart, unsigned icount)
+CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
+ unsigned istart, unsigned icount)
{
struct draw_context *draw = vsplit->draw;
const ELT_TYPE *ib = (const ELT_TYPE *) draw->pt.user.elts;
@@ -44,10 +43,25 @@ CONCAT(vsplit_segment_fast_, ELT_TYPE)(struct vsplit_frontend *vsplit,
const unsigned max_index = draw->pt.user.max_index;
const int elt_bias = draw->pt.user.eltBias;
unsigned fetch_start, fetch_count;
- const ushort *draw_elts;
+ const ushort *draw_elts = NULL;
unsigned i;
- assert(icount <= vsplit->segment_size);
+ /* use the ib directly */
+ if (min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])) {
+ if (icount > vsplit->max_vertices)
+ return FALSE;
+
+ for (i = 0; i < icount; i++) {
+ ELT_TYPE idx = ib[istart + i];
+ assert(idx >= min_index && idx <= max_index);
+ }
+ draw_elts = (const ushort *) ib;
+ }
+ else {
+ /* have to go through vsplit->draw_elts */
+ if (icount > vsplit->segment_size)
+ return FALSE;
+ }
/* this is faster only when we fetch less elements than the normal path */
if (max_index - min_index > icount - 1)
@@ -65,14 +79,7 @@ CONCAT(vsplit_segment_fast_, ELT_TYPE)(struct vsplit_frontend *vsplit,
fetch_start = min_index + elt_bias;
fetch_count = max_index - min_index + 1;
- if (min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])) {
- for (i = 0; i < icount; i++) {
- ELT_TYPE idx = ib[istart + i];
- assert(idx >= min_index && idx <= max_index);
- }
- draw_elts = (const ushort *) ib;
- }
- else {
+ if (!draw_elts) {
if (min_index == 0) {
for (i = 0; i < icount; i++) {
ELT_TYPE idx = ib[istart + i];
@@ -95,7 +102,7 @@ CONCAT(vsplit_segment_fast_, ELT_TYPE)(struct vsplit_frontend *vsplit,
return vsplit->middle->run_linear_elts(vsplit->middle,
fetch_start, fetch_count,
- draw_elts, icount, flags);
+ draw_elts, icount, 0x0);
}
/**
@@ -170,12 +177,6 @@ CONCAT(vsplit_segment_simple_, ELT_TYPE)(struct vsplit_frontend *vsplit,
unsigned istart,
unsigned icount)
{
- /* the primitive is not splitted */
- if (!(flags)) {
- if (CONCAT(vsplit_segment_fast_, ELT_TYPE)(vsplit,
- flags, istart, icount))
- return;
- }
CONCAT(vsplit_segment_cache_, ELT_TYPE)(vsplit,
flags, istart, icount, FALSE, 0, FALSE, 0);
}
@@ -213,6 +214,9 @@ CONCAT(vsplit_segment_fan_, ELT_TYPE)(struct vsplit_frontend *vsplit,
const unsigned max_count_loop = vsplit->segment_size - 1; \
const unsigned max_count_fan = vsplit->segment_size;
+#define PRIMITIVE(istart, icount) \
+ CONCAT(vsplit_primitive_, ELT_TYPE)(vsplit, istart, icount)
+
#else /* ELT_TYPE */
static void
@@ -274,6 +278,8 @@ vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, unsigned flags,
const unsigned max_count_loop = vsplit->segment_size - 1; \
const unsigned max_count_fan = vsplit->segment_size;
+#define PRIMITIVE(istart, icount) FALSE
+
#define ELT_TYPE linear
#endif /* ELT_TYPE */