1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
30 * Zack Rusin zack@tungstengraphics.com
36 #if defined __cplusplus
40 #include "pipe/p_state.h"
48 struct gallivm_cpu_engine
;
49 struct tgsi_interp_coef
;
51 struct tgsi_exec_vector
;
53 enum gallivm_shader_type
{
58 enum gallivm_vector_layout
{
63 struct gallivm_ir
*gallivm_ir_new(enum gallivm_shader_type type
);
64 void gallivm_ir_set_layout(struct gallivm_ir
*ir
,
65 enum gallivm_vector_layout layout
);
66 void gallivm_ir_set_components(struct gallivm_ir
*ir
, int num
);
67 void gallivm_ir_fill_from_tgsi(struct gallivm_ir
*ir
,
68 const struct tgsi_token
*tokens
);
69 void gallivm_ir_delete(struct gallivm_ir
*ir
);
72 struct gallivm_prog
*gallivm_ir_compile(struct gallivm_ir
*ir
);
74 void gallivm_prog_inputs_interpolate(struct gallivm_prog
*prog
,
75 float (*inputs
)[PIPE_MAX_SHADER_INPUTS
][4],
76 const struct tgsi_interp_coef
*coefs
);
77 void gallivm_prog_dump(struct gallivm_prog
*prog
, const char *file_prefix
);
80 struct gallivm_cpu_engine
*gallivm_cpu_engine_create(struct gallivm_prog
*prog
);
81 struct gallivm_cpu_engine
*gallivm_global_cpu_engine();
82 int gallivm_cpu_vs_exec(struct gallivm_prog
*prog
,
83 struct tgsi_exec_vector
*inputs
,
84 struct tgsi_exec_vector
*dests
,
86 int gallivm_cpu_fs_exec(struct gallivm_prog
*prog
,
88 float (*dests
)[PIPE_MAX_SHADER_INPUTS
][4],
89 float (*inputs
)[PIPE_MAX_SHADER_INPUTS
][4],
91 struct tgsi_sampler
*samplers
);
92 void gallivm_cpu_jit_compile(struct gallivm_cpu_engine
*ee
, struct gallivm_prog
*prog
);
93 void gallivm_cpu_engine_delete(struct gallivm_cpu_engine
*ee
);
96 #endif /* MESA_LLVM */
98 #if defined __cplusplus