translate: add sse version based on old draw_vf_sse.c
[mesa.git] / src / gallium / auxiliary / translate / translate.h
1 /*
2 * Copyright 2008 Tungsten Graphics, inc.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22 * USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 /**
27 * Vertex fetch/store/convert code. This functionality is used in two places:
28 * 1. Vertex fetch/convert - to grab vertex data from incoming vertex
29 * arrays and convert to format needed by vertex shaders.
30 * 2. Vertex store/emit - to convert simple float[][4] vertex attributes
31 * (which is the organization used throughout the draw/prim pipeline) to
32 * hardware-specific formats and emit into hardware vertex buffers.
33 *
34 *
35 * Authors:
36 * Keith Whitwell <keithw@tungstengraphics.com>
37 */
38
39 #ifndef _TRANSLATE_H
40 #define _TRANSLATE_H
41
42
43 #include "pipe/p_compiler.h"
44 #include "pipe/p_format.h"
45 #include "pipe/p_state.h"
46
47 struct translate_element
48 {
49 enum pipe_format input_format;
50 unsigned input_buffer;
51 unsigned input_offset;
52
53 enum pipe_format output_format;
54 unsigned output_offset;
55 };
56
57
58 struct translate_key {
59 unsigned output_stride;
60 unsigned nr_elements;
61 struct translate_element element[PIPE_MAX_ATTRIBS];
62 };
63
64
65 struct translate {
66 struct translate_key key;
67
68 void (*release)( struct translate * );
69
70 void (*set_buffer)( struct translate *,
71 unsigned i,
72 const void *ptr,
73 unsigned stride );
74
75 void (*run_elts)( struct translate *,
76 const unsigned *elts,
77 unsigned count,
78 void *output_buffer);
79
80 void (*run)( struct translate *,
81 unsigned start,
82 unsigned count,
83 void *output_buffer);
84 };
85
86
87
88 #if 0
89 struct translate_context *translate_context_create( void );
90 void translate_context_destroy( struct translate_context * );
91
92 struct translate *translate_lookup_or_create( struct translate_context *tctx,
93 const struct translate_key *key );
94 #endif
95
96
97 struct translate *translate_create( const struct translate_key *key );
98
99
100 /*******************************************************************************
101 * Private:
102 */
103 struct translate *translate_sse2_create( const struct translate_key *key );
104
105 struct translate *translate_generic_create( const struct translate_key *key );
106
107
108 #endif