1188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle/*
2188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * Copyright 2009 Nicolai Hähnle <nhaehnle@gmail.com>
3188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle *
4188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * Permission is hereby granted, free of charge, to any person obtaining a
5188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * copy of this software and associated documentation files (the "Software"),
6188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * to deal in the Software without restriction, including without limitation
7188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * on the rights to use, copy, modify, merge, publish, distribute, sub
8188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * license, and/or sell copies of the Software, and to permit persons to whom
9188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * the Software is furnished to do so, subject to the following conditions:
10188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle *
11188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * The above copyright notice and this permission notice (including the next
12188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * paragraph) shall be included in all copies or substantial portions of the
13188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * Software.
14188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle *
15188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * THE COPYRIGHT HOLDER(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle * USE OR OTHER DEALINGS IN THE SOFTWARE. */
22188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle
23188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle#ifndef R300_TGSI_TO_RC_H
24188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle#define R300_TGSI_TO_RC_H
25188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle
26229db2b8ade33571e4cece1d838234895db220c2Corbin Simpson#include "pipe/p_compiler.h"
27229db2b8ade33571e4cece1d838234895db220c2Corbin Simpson
28188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnlestruct radeon_compiler;
29188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle
30188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnlestruct tgsi_full_declaration;
31188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnlestruct tgsi_shader_info;
32188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnlestruct tgsi_token;
33188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle
349a1bf52c184b6c0393543fe4bb03c790630b9e21Corbin Simpsonstruct swizzled_imms {
359a1bf52c184b6c0393543fe4bb03c790630b9e21Corbin Simpson    unsigned index;
369a1bf52c184b6c0393543fe4bb03c790630b9e21Corbin Simpson    unsigned swizzle;
379a1bf52c184b6c0393543fe4bb03c790630b9e21Corbin Simpson};
389a1bf52c184b6c0393543fe4bb03c790630b9e21Corbin Simpson
39188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnlestruct tgsi_to_rc {
40188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle    struct radeon_compiler * compiler;
41188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle    const struct tgsi_shader_info * info;
42188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle
43188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle    int immediate_offset;
44565f0cef26d6da49ae58462d0c1f9b832ee71174Corbin Simpson    struct swizzled_imms * imms_to_swizzle;
459a1bf52c184b6c0393543fe4bb03c790630b9e21Corbin Simpson    unsigned imms_to_swizzle_count;
46229db2b8ade33571e4cece1d838234895db220c2Corbin Simpson
47229db2b8ade33571e4cece1d838234895db220c2Corbin Simpson    /* Vertex shaders have no half swizzles, and no way to handle them, so
48229db2b8ade33571e4cece1d838234895db220c2Corbin Simpson     * until rc grows proper support, indicate if they're safe to use. */
49229db2b8ade33571e4cece1d838234895db220c2Corbin Simpson    boolean use_half_swizzles;
50ffcdd49c69811b9f768c0b32acef6527d5626a6eMarek Olšák
51ffcdd49c69811b9f768c0b32acef6527d5626a6eMarek Olšák    /* If an error occured. */
52ffcdd49c69811b9f768c0b32acef6527d5626a6eMarek Olšák    boolean error;
53188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle};
54188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle
55188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnlevoid r300_tgsi_to_rc(struct tgsi_to_rc * ttr, const struct tgsi_token * tokens);
56188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle
57188f8c679254f193cdcfcd4ef338f3c8c5e1146dNicolai Hähnle#endif /* R300_TGSI_TO_RC_H */
58