diff options
author | Michal Krol <[email protected]> | 2009-12-30 18:26:40 +0100 |
---|---|---|
committer | Michal Krol <[email protected]> | 2009-12-30 18:26:40 +0100 |
commit | 5007e39f76c897b8f3aa4acf6086c8b7ac30bdef (patch) | |
tree | d971e3535c0162a9d0c2fa5ecc066e446d7fc068 /src/gallium/auxiliary/translate/translate_generic.c | |
parent | 76e53923ba79124c6df55bddd7e9a11a7e9104d4 (diff) |
Implement instanced indexed draw.
Diffstat (limited to 'src/gallium/auxiliary/translate/translate_generic.c')
-rw-r--r-- | src/gallium/auxiliary/translate/translate_generic.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c index 0fa99274099..742f03b5031 100644 --- a/src/gallium/auxiliary/translate/translate_generic.c +++ b/src/gallium/auxiliary/translate/translate_generic.c @@ -569,6 +569,7 @@ static emit_func get_emit_func( enum pipe_format format ) static void PIPE_CDECL generic_run_elts( struct translate *translate, const unsigned *elts, unsigned count, + unsigned instance_id, void *output_buffer ) { struct translate_generic *tg = translate_generic(translate); @@ -584,13 +585,20 @@ static void PIPE_CDECL generic_run_elts( struct translate *translate, for (attr = 0; attr < nr_attrs; attr++) { float data[4]; - - const char *src = (tg->attrib[attr].input_ptr + - tg->attrib[attr].input_stride * elt); + const char *src; char *dst = (vert + tg->attrib[attr].output_offset); + if (tg->attrib[attr].instance_divisor) { + src = tg->attrib[attr].input_ptr + + tg->attrib[attr].input_stride * + (instance_id / tg->attrib[attr].instance_divisor); + } else { + src = tg->attrib[attr].input_ptr + + tg->attrib[attr].input_stride * elt; + } + tg->attrib[attr].fetch( src, data ); if (0) debug_printf("vert %d/%d attr %d: %f %f %f %f\n", |