• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     int num_generic;
47 };
48 
r300_shader_semantics_reset(struct r300_shader_semantics * info)49 static inline void r300_shader_semantics_reset(
50     struct r300_shader_semantics* info)
51 {
52     int i;
53 
54     info->pos = ATTR_UNUSED;
55     info->psize = ATTR_UNUSED;
56     info->face = ATTR_UNUSED;
57     info->fog = ATTR_UNUSED;
58     info->wpos = ATTR_UNUSED;
59 
60     for (i = 0; i < ATTR_COLOR_COUNT; i++) {
61         info->color[i] = ATTR_UNUSED;
62         info->bcolor[i] = ATTR_UNUSED;
63     }
64 
65     for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
66         info->generic[i] = ATTR_UNUSED;
67     }
68 
69     info->num_generic = 0;
70 }
71 
72 #endif
73