From 7124fa16efe0f8ffb402bcd182f276032bed378d Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 29 Dec 2009 22:49:31 +0100 Subject: translate: Fix translate_key_compare(). Sizes of translate keys must also match. --- src/gallium/auxiliary/translate/translate.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/gallium/auxiliary/translate/translate.h') diff --git a/src/gallium/auxiliary/translate/translate.h b/src/gallium/auxiliary/translate/translate.h index 34526eb061..1afdf194b3 100644 --- a/src/gallium/auxiliary/translate/translate.h +++ b/src/gallium/auxiliary/translate/translate.h @@ -103,8 +103,13 @@ static INLINE int translate_keysize( const struct translate_key *key ) static INLINE int translate_key_compare( const struct translate_key *a, const struct translate_key *b ) { - int keysize = translate_keysize(a); - return memcmp(a, b, keysize); + int keysize_a = translate_keysize(a); + int keysize_b = translate_keysize(b); + + if (keysize_a != keysize_b) { + return keysize_a - keysize_b; + } + return memcmp(a, b, keysize_a); } -- cgit v1.2.3 From 7ca0ce38340144794267609646048b3820d594ab Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 29 Dec 2009 23:21:01 +0100 Subject: Implement draw_arrays_instanced() in softpipe. Modify the translate module to respect instance divisors and accept instance id as a parameter to calculate input vertex offset. --- src/gallium/auxiliary/translate/translate.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gallium/auxiliary/translate/translate.h') diff --git a/src/gallium/auxiliary/translate/translate.h b/src/gallium/auxiliary/translate/translate.h index 1afdf194b3..fb298471b8 100644 --- a/src/gallium/auxiliary/translate/translate.h +++ b/src/gallium/auxiliary/translate/translate.h @@ -50,6 +50,7 @@ struct translate_element enum pipe_format output_format; unsigned input_buffer:8; unsigned input_offset:24; + unsigned instance_divisor; unsigned output_offset; }; @@ -79,6 +80,7 @@ struct translate { void (PIPE_CDECL *run)( struct translate *, unsigned start, unsigned count, + unsigned instance_id, void *output_buffer); }; -- cgit v1.2.3 From 5007e39f76c897b8f3aa4acf6086c8b7ac30bdef Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 30 Dec 2009 18:26:40 +0100 Subject: Implement instanced indexed draw. --- src/gallium/auxiliary/translate/translate.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium/auxiliary/translate/translate.h') diff --git a/src/gallium/auxiliary/translate/translate.h b/src/gallium/auxiliary/translate/translate.h index fb298471b8..9ae7a482a0 100644 --- a/src/gallium/auxiliary/translate/translate.h +++ b/src/gallium/auxiliary/translate/translate.h @@ -75,6 +75,7 @@ struct translate { void (PIPE_CDECL *run_elts)( struct translate *, const unsigned *elts, unsigned count, + unsigned instance_id, void *output_buffer); void (PIPE_CDECL *run)( struct translate *, -- cgit v1.2.3 From 543b9566bdaa48fea2df1866fa1310c1cdbcde27 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 30 Dec 2009 22:18:53 +0100 Subject: Add lame support for instanceID to draw module. It's all screaming for integer support -- fake it with float for now. --- src/gallium/auxiliary/translate/translate.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gallium/auxiliary/translate/translate.h') diff --git a/src/gallium/auxiliary/translate/translate.h b/src/gallium/auxiliary/translate/translate.h index 9ae7a482a0..54ed2c1a4b 100644 --- a/src/gallium/auxiliary/translate/translate.h +++ b/src/gallium/auxiliary/translate/translate.h @@ -44,8 +44,14 @@ #include "pipe/p_format.h" #include "pipe/p_state.h" +enum translate_element_type { + TRANSLATE_ELEMENT_NORMAL, + TRANSLATE_ELEMENT_INSTANCE_ID +}; + struct translate_element { + enum translate_element_type type; enum pipe_format input_format; enum pipe_format output_format; unsigned input_buffer:8; -- cgit v1.2.3