1 /*
2 * Copyright 2009 Marek Olšák <maraeo@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 R300_SHADER_SEMANTICS_H
24 #define R300_SHADER_SEMANTICS_H
25
26 #define ATTR_UNUSED (-1)
27 #define ATTR_COLOR_COUNT 2
28 #define ATTR_GENERIC_COUNT 32
29
30 /* This structure contains information about what attributes are written by VS
31 * or read by FS. (but not both) It's much easier to work with than
32 * tgsi_shader_info.
33 *
34 * The variables contain indices to tgsi_shader_info semantics and those
35 * indices are nothing else than input/output register numbers. */
36 struct r300_shader_semantics {
37 int pos;
38 int psize;
39 int color[ATTR_COLOR_COUNT];
40 int bcolor[ATTR_COLOR_COUNT];
41 int face;
42 int generic[ATTR_GENERIC_COUNT];
43 int fog;
44 int wpos;
45 };
46
r300_shader_semantics_reset(struct r300_shader_semantics * info)47 static INLINE void r300_shader_semantics_reset(
48 struct r300_shader_semantics* info)
49 {
50 int i;
51
52 info->pos = ATTR_UNUSED;
53 info->psize = ATTR_UNUSED;
54 info->face = ATTR_UNUSED;
55 info->fog = ATTR_UNUSED;
56 info->wpos = ATTR_UNUSED;
57
58 for (i = 0; i < ATTR_COLOR_COUNT; i++) {
59 info->color[i] = ATTR_UNUSED;
60 info->bcolor[i] = ATTR_UNUSED;
61 }
62
63 for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
64 info->generic[i] = ATTR_UNUSED;
65 }
66 }
67
68 #endif
69