r600g: drop compiler stuff and switch over dumb tgsi assembler
[mesa.git] / src / gallium / drivers / r600 / r600_asm.h
1 /*
2 * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
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 R600_ASM_H
24 #define R600_ASM_H
25
26 #include "radeon.h"
27 #include "util/u_double_list.h"
28
29 struct r600_bc_alu_src {
30 unsigned sel;
31 unsigned chan;
32 unsigned neg;
33 unsigned abs;
34 };
35
36 struct r600_bc_alu_dst {
37 unsigned sel;
38 unsigned chan;
39 unsigned clamp;
40 unsigned write;
41 };
42
43 struct r600_bc_alu {
44 struct list_head list;
45 struct r600_bc_alu_src src[3];
46 struct r600_bc_alu_dst dst;
47 unsigned inst;
48 unsigned last;
49 unsigned is_op3;
50 unsigned nliteral;
51 u32 value[4];
52 };
53
54 struct r600_bc_vtx {
55 struct list_head list;
56 unsigned inst;
57 unsigned fetch_type;
58 unsigned buffer_id;
59 unsigned src_gpr;
60 unsigned src_sel_x;
61 unsigned mega_fetch_count;
62 unsigned dst_gpr;
63 unsigned dst_sel_x;
64 unsigned dst_sel_y;
65 unsigned dst_sel_z;
66 unsigned dst_sel_w;
67 };
68
69 struct r600_bc_output {
70 unsigned array_base;
71 unsigned type;
72 unsigned end_of_program;
73 unsigned inst;
74 unsigned elem_size;
75 unsigned gpr;
76 unsigned swizzle_x;
77 unsigned swizzle_y;
78 unsigned swizzle_z;
79 unsigned swizzle_w;
80 unsigned barrier;
81 };
82
83 struct r600_bc_cf {
84 struct list_head list;
85 unsigned inst;
86 unsigned addr;
87 unsigned ndw;
88 unsigned id;
89 struct list_head alu;
90 struct list_head vtx;
91 struct r600_bc_output output;
92 };
93
94 struct r600_bc {
95 enum radeon_family family;
96 struct list_head cf;
97 struct r600_bc_cf *cf_last;
98 unsigned ndw;
99 unsigned ncf;
100 unsigned ngpr;
101 unsigned nresource;
102 u32 *bytecode;
103 };
104
105 int r600_bc_init(struct r600_bc *bc, enum radeon_family family);
106 int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu);
107 int r600_bc_add_literal(struct r600_bc *bc, const u32 *value);
108 int r600_bc_add_vtx(struct r600_bc *bc, const struct r600_bc_vtx *vtx);
109 int r600_bc_add_output(struct r600_bc *bc, const struct r600_bc_output *output);
110 int r600_bc_build(struct r600_bc *bc);
111
112 #endif