00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00039 #ifndef _TRANSLATE_H
00040 #define _TRANSLATE_H
00041
00042
00043 #include "pipe/p_compiler.h"
00044 #include "pipe/p_format.h"
00045 #include "pipe/p_state.h"
00046
00047 struct translate_element
00048 {
00049 enum pipe_format input_format;
00050 enum pipe_format output_format;
00051 unsigned input_buffer:8;
00052 unsigned input_offset:24;
00053 unsigned output_offset;
00054 };
00055
00056
00057 struct translate_key {
00058 unsigned output_stride;
00059 unsigned nr_elements;
00060 struct translate_element element[PIPE_MAX_ATTRIBS + 1];
00061 };
00062
00063
00064 struct translate {
00065 struct translate_key key;
00066
00067 void (*release)( struct translate * );
00068
00069 void (*set_buffer)( struct translate *,
00070 unsigned i,
00071 const void *ptr,
00072 unsigned stride );
00073
00074 void (PIPE_CDECL *run_elts)( struct translate *,
00075 const unsigned *elts,
00076 unsigned count,
00077 void *output_buffer);
00078
00079 void (PIPE_CDECL *run)( struct translate *,
00080 unsigned start,
00081 unsigned count,
00082 void *output_buffer);
00083 };
00084
00085
00086
00087 #if 0
00088 struct translate_context *translate_context_create( void );
00089 void translate_context_destroy( struct translate_context * );
00090
00091 struct translate *translate_lookup_or_create( struct translate_context *tctx,
00092 const struct translate_key *key );
00093 #endif
00094
00095
00096 struct translate *translate_create( const struct translate_key *key );
00097
00098 static INLINE int translate_keysize( const struct translate_key *key )
00099 {
00100 return 2 * sizeof(int) + key->nr_elements * sizeof(struct translate_element);
00101 }
00102
00103 static INLINE int translate_key_compare( const struct translate_key *a,
00104 const struct translate_key *b )
00105 {
00106 int keysize = translate_keysize(a);
00107 return memcmp(a, b, keysize);
00108 }
00109
00110
00111 static INLINE void translate_key_sanitize( struct translate_key *a )
00112 {
00113 int keysize = translate_keysize(a);
00114 char *ptr = (char *)a;
00115 memset(ptr + keysize, 0, sizeof(*a) - keysize);
00116 }
00117
00118
00119
00120
00121
00122 struct translate *translate_sse2_create( const struct translate_key *key );
00123
00124 struct translate *translate_generic_create( const struct translate_key *key );
00125
00126
00127 #endif