• 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 #define ATTR_TEXCOORD_COUNT     8
30 
31 /* This structure contains information about what attributes are written by VS
32  * or read by FS. (but not both) It's much easier to work with than
33  * tgsi_shader_info.
34  *
35  * The variables contain indices to tgsi_shader_info semantics and those
36  * indices are nothing else than input/output register numbers. */
37 struct r300_shader_semantics {
38     int pos;
39     int psize;
40     int color[ATTR_COLOR_COUNT];
41     int bcolor[ATTR_COLOR_COUNT];
42     int face;
43     int texcoord[ATTR_TEXCOORD_COUNT];
44     int generic[ATTR_GENERIC_COUNT];
45     int fog;
46     int wpos;
47     int pcoord;
48 
49     int num_texcoord;
50     int num_generic;
51 };
52 
r300_shader_semantics_reset(struct r300_shader_semantics * info)53 static inline void r300_shader_semantics_reset(
54     struct r300_shader_semantics* info)
55 {
56     int i;
57 
58     info->pos = ATTR_UNUSED;
59     info->psize = ATTR_UNUSED;
60     info->face = ATTR_UNUSED;
61     info->fog = ATTR_UNUSED;
62     info->wpos = ATTR_UNUSED;
63     info->pcoord = ATTR_UNUSED;
64 
65     for (i = 0; i < ATTR_COLOR_COUNT; i++) {
66         info->color[i] = ATTR_UNUSED;
67         info->bcolor[i] = ATTR_UNUSED;
68     }
69 
70     for (i = 0; i < ATTR_TEXCOORD_COUNT; i++) {
71         info->texcoord[i] = ATTR_UNUSED;
72     }
73 
74     for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
75         info->generic[i] = ATTR_UNUSED;
76     }
77 
78     info->num_texcoord = 0;
79     info->num_generic = 0;
80 }
81 
82 #endif
83