Merge branch '7.8'
[mesa.git] / src / gallium / auxiliary / draw / draw_vs_llvm.c
1 /**************************************************************************
2 *
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 /*
29 * Authors:
30 * Zack Rusin
31 * Keith Whitwell <keith@tungstengraphics.com>
32 * Brian Paul
33 */
34
35 #include "util/u_memory.h"
36 #include "pipe/p_shader_tokens.h"
37 #include "draw_private.h"
38 #include "draw_context.h"
39 #include "draw_vs.h"
40
41 #include "tgsi/tgsi_parse.h"
42
43 #ifdef HAVE_LLVM
44
45 struct draw_llvm_vertex_shader {
46 struct draw_vertex_shader base;
47 struct tgsi_exec_machine *machine;
48 };
49
50
51 static void
52 vs_llvm_prepare( struct draw_vertex_shader *base,
53 struct draw_context *draw )
54 {
55 }
56
57
58 static void
59 vs_llvm_run_linear( struct draw_vertex_shader *base,
60 const float (*input)[4],
61 float (*output)[4],
62 const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
63 unsigned count,
64 unsigned input_stride,
65 unsigned output_stride )
66 {
67 }
68
69 static void
70 vs_llvm_delete( struct draw_vertex_shader *base )
71 {
72 struct draw_llvm_vertex_shader *shader =
73 (struct draw_llvm_vertex_shader *)base;
74
75 /* Do something to free compiled shader:
76 */
77
78 FREE( (void*) shader->base.state.tokens );
79 FREE( shader );
80 }
81
82
83
84
85 struct draw_vertex_shader *
86 draw_create_vs_llvm(struct draw_context *draw,
87 const struct pipe_shader_state *templ)
88 {
89 #if 0
90 struct draw_llvm_vertex_shader *vs;
91
92 vs = CALLOC_STRUCT( draw_llvm_vertex_shader );
93 if (vs == NULL)
94 return NULL;
95
96 /* we make a private copy of the tokens */
97 vs->base.state.tokens = tgsi_dup_tokens(templ->tokens);
98 if (!vs->base.state.tokens) {
99 FREE(vs);
100 return NULL;
101 }
102
103 tgsi_scan_shader(vs->base.state.tokens, &vs->base.info);
104
105 vs->base.draw = draw;
106 vs->base.prepare = vs_llvm_prepare;
107 vs->base.create_varient = draw_vs_varient_generic;
108 vs->base.run_linear = vs_llvm_run_linear;
109 vs->base.delete = vs_llvm_delete;
110 vs->machine = draw->vs.machine;
111
112 return &vs->base;
113 #endif
114 return NULL;
115 }
116
117
118
119
120
121 #else
122
123 struct draw_vertex_shader *
124 draw_create_vs_llvm(struct draw_context *draw,
125 const struct pipe_shader_state *shader)
126 {
127 return NULL;
128 }
129
130 #endif