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
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef GALLIVM_H
00034 #define GALLIVM_H
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #if defined __cplusplus
00047 extern "C" {
00048 #endif
00049
00050 #include "pipe/p_state.h"
00051
00052 #ifdef MESA_LLVM
00053
00054 struct tgsi_token;
00055
00056 struct gallivm_ir;
00057 struct gallivm_prog;
00058 struct gallivm_cpu_engine;
00059 struct tgsi_interp_coef;
00060 struct tgsi_sampler;
00061 struct tgsi_exec_vector;
00062
00063 enum gallivm_shader_type {
00064 GALLIVM_VS,
00065 GALLIVM_FS
00066 };
00067
00068 enum gallivm_vector_layout {
00069 GALLIVM_AOS,
00070 GALLIVM_SOA
00071 };
00072
00073 struct gallivm_ir *gallivm_ir_new(enum gallivm_shader_type type);
00074 void gallivm_ir_set_layout(struct gallivm_ir *ir,
00075 enum gallivm_vector_layout layout);
00076 void gallivm_ir_set_components(struct gallivm_ir *ir, int num);
00077 void gallivm_ir_fill_from_tgsi(struct gallivm_ir *ir,
00078 const struct tgsi_token *tokens);
00079 void gallivm_ir_delete(struct gallivm_ir *ir);
00080
00081
00082 struct gallivm_prog *gallivm_ir_compile(struct gallivm_ir *ir);
00083
00084 void gallivm_prog_inputs_interpolate(struct gallivm_prog *prog,
00085 float (*inputs)[PIPE_MAX_SHADER_INPUTS][4],
00086 const struct tgsi_interp_coef *coefs);
00087 void gallivm_prog_dump(struct gallivm_prog *prog, const char *file_prefix);
00088
00089
00090 struct gallivm_cpu_engine *gallivm_cpu_engine_create(struct gallivm_prog *prog);
00091 struct gallivm_cpu_engine *gallivm_global_cpu_engine();
00092 int gallivm_cpu_vs_exec(struct gallivm_prog *prog,
00093 struct tgsi_exec_machine *machine,
00094 const float (*input)[4],
00095 unsigned num_inputs,
00096 float (*output)[4],
00097 unsigned num_outputs,
00098 const float (*constants)[4],
00099 unsigned count,
00100 unsigned input_stride,
00101 unsigned output_stride);
00102 int gallivm_cpu_fs_exec(struct gallivm_prog *prog,
00103 float x, float y,
00104 float (*dests)[PIPE_MAX_SHADER_INPUTS][4],
00105 float (*inputs)[PIPE_MAX_SHADER_INPUTS][4],
00106 float (*consts)[4],
00107 struct tgsi_sampler *samplers);
00108 void gallivm_cpu_jit_compile(struct gallivm_cpu_engine *ee, struct gallivm_prog *prog);
00109 void gallivm_cpu_engine_delete(struct gallivm_cpu_engine *ee);
00110
00111
00112 #endif
00113
00114 #if defined __cplusplus
00115 }
00116 #endif
00117
00118 #endif