1 /* 2 * Copyright 2009 Marek Olšák <[email protected]> 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #ifndef R300_SHADER_SEMANTICS_H 7 #define R300_SHADER_SEMANTICS_H 8 9 #define ATTR_UNUSED (-1) 10 #define ATTR_COLOR_COUNT 2 11 #define ATTR_GENERIC_COUNT 32 12 #define ATTR_TEXCOORD_COUNT 8 13 14 /* This structure contains information about what attributes are written by VS 15 * or read by FS. (but not both) It's much easier to work with than 16 * tgsi_shader_info. 17 * 18 * The variables contain indices to tgsi_shader_info semantics and those 19 * indices are nothing else than input/output register numbers. */ 20 struct r300_shader_semantics { 21 int pos; 22 int psize; 23 int color[ATTR_COLOR_COUNT]; 24 int bcolor[ATTR_COLOR_COUNT]; 25 int face; 26 int texcoord[ATTR_TEXCOORD_COUNT]; 27 int generic[ATTR_GENERIC_COUNT]; 28 int fog; 29 int wpos; 30 int pcoord; 31 32 int num_texcoord; 33 int num_generic; 34 }; 35 r300_shader_semantics_reset(struct r300_shader_semantics * info)36static inline void r300_shader_semantics_reset( 37 struct r300_shader_semantics* info) 38 { 39 int i; 40 41 info->pos = ATTR_UNUSED; 42 info->psize = ATTR_UNUSED; 43 info->face = ATTR_UNUSED; 44 info->fog = ATTR_UNUSED; 45 info->wpos = ATTR_UNUSED; 46 info->pcoord = ATTR_UNUSED; 47 48 for (i = 0; i < ATTR_COLOR_COUNT; i++) { 49 info->color[i] = ATTR_UNUSED; 50 info->bcolor[i] = ATTR_UNUSED; 51 } 52 53 for (i = 0; i < ATTR_TEXCOORD_COUNT; i++) { 54 info->texcoord[i] = ATTR_UNUSED; 55 } 56 57 for (i = 0; i < ATTR_GENERIC_COUNT; i++) { 58 info->generic[i] = ATTR_UNUSED; 59 } 60 61 info->num_texcoord = 0; 62 info->num_generic = 0; 63 } 64 65 #endif 66