r300: Remove all Mesa dependencies from the shader compiler
[mesa.git] / src / mesa / drivers / dri / r300 / compiler / radeon_compiler.h
1 /*
2 * Copyright 2009 Nicolai Hähnle <nhaehnle@gmail.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
22
23 #ifndef RADEON_COMPILER_H
24 #define RADEON_COMPILER_H
25
26 #include "memory_pool.h"
27 #include "radeon_code.h"
28 #include "radeon_program.h"
29
30
31 struct radeon_compiler {
32 struct memory_pool Pool;
33 struct rc_program Program;
34 unsigned Debug:1;
35 unsigned Error:1;
36 char * ErrorMsg;
37 };
38
39 void rc_init(struct radeon_compiler * c);
40 void rc_destroy(struct radeon_compiler * c);
41
42 void rc_debug(struct radeon_compiler * c, const char * fmt, ...);
43 void rc_error(struct radeon_compiler * c, const char * fmt, ...);
44
45 void rc_calculate_inputs_outputs(struct radeon_compiler * c);
46
47 void rc_move_input(struct radeon_compiler * c, unsigned input, struct rc_src_register new_input);
48 void rc_move_output(struct radeon_compiler * c, unsigned output, unsigned new_output, unsigned writemask);
49 void rc_copy_output(struct radeon_compiler * c, unsigned output, unsigned dup_output);
50 void rc_transform_fragment_wpos(struct radeon_compiler * c, unsigned wpos, unsigned new_input);
51
52 struct r300_fragment_program_compiler {
53 struct radeon_compiler Base;
54 struct rX00_fragment_program_code *code;
55 struct r300_fragment_program_external_state state;
56 unsigned is_r500;
57 unsigned OutputDepth;
58 unsigned OutputColor;
59
60 void * UserData;
61 void (*AllocateHwInputs)(
62 struct r300_fragment_program_compiler * c,
63 void (*allocate)(void * data, unsigned input, unsigned hwreg),
64 void * mydata);
65 };
66
67 void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c);
68
69
70 struct r300_vertex_program_compiler {
71 struct radeon_compiler Base;
72 struct r300_vertex_program_code *code;
73 uint32_t RequiredOutputs;
74
75 void * UserData;
76 void (*SetHwInputOutput)(struct r300_vertex_program_compiler * c);
77 };
78
79 void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* c);
80
81 #endif /* RADEON_COMPILER_H */