• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Mesa 3-D graphics library
3  * Version:  7.3
4  *
5  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a
8  * copy of this software and associated documentation files (the "Software"),
9  * to deal in the Software without restriction, including without limitation
10  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11  * and/or sell copies of the Software, and to permit persons to whom the
12  * Software is furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 /**
26  * \file prog_parameter.c
27  * Program parameter lists and functions.
28  * \author Brian Paul
29  */
30 
31 #ifndef PROG_PARAMETER_H
32 #define PROG_PARAMETER_H
33 
34 #include "main/mtypes.h"
35 #include "prog_statevars.h"
36 
37 
38 /**
39  * Program parameter flags
40  */
41 /*@{*/
42 #define PROG_PARAM_BIT_CENTROID   0x1  /**< for varying vars (GLSL 1.20) */
43 #define PROG_PARAM_BIT_INVARIANT  0x2  /**< for varying vars (GLSL 1.20) */
44 #define PROG_PARAM_BIT_FLAT       0x4  /**< for varying vars (GLSL 1.30) */
45 #define PROG_PARAM_BIT_LINEAR     0x8  /**< for varying vars (GLSL 1.30) */
46 #define PROG_PARAM_BIT_CYL_WRAP  0x10  /**< XXX gallium debug */
47 /*@}*/
48 
49 
50 
51 /**
52  * Program parameter.
53  * Used by shaders/programs for uniforms, constants, varying vars, etc.
54  */
55 struct gl_program_parameter
56 {
57    const char *Name;        /**< Null-terminated string */
58    //gl_register_file Type;   /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */
59    //GLenum DataType;         /**< GL_FLOAT, GL_FLOAT_VEC2, etc */
60    /**
61     * Number of components (1..4), or more.
62     * If the number of components is greater than 4,
63     * this parameter is part of a larger uniform like a GLSL matrix or array.
64     * The next program parameter's Size will be Size-4 of this parameter.
65     */
66    //GLuint Size;
67    GLuint Slots;            /**< how many float[4] slots occupied */
68    // location starts from 0, such that VERT_ATTRIB_GENERIC0 = 0
69    // since there are no predefined vertex attribs in es20
70    // for varyings BindLocation is vertex output location
71    // and Loctation is fragment input location
72    GLint BindLocation;  /**< requested by BindAttribLocation for attributes */
73    GLint Location;          /**< actual location assigned after linking */
74    //GLboolean Initialized;   /**< debug: Has the ParameterValue[] been set? */
75    //GLbitfield Flags;        /**< Bitmask of PROG_PARAM_*_BIT */
76    /**
77     * A sequence of STATE_* tokens and integers to identify GL state.
78     */
79    //gl_state_index StateIndexes[STATE_LENGTH];
80 };
81 
82 
83 /**
84  * List of gl_program_parameter instances.
85  */
86 struct gl_program_parameter_list
87 {
88    GLuint Size;           /**< allocated size of Parameters, ParameterValues */
89    GLuint NumParameters;  /**< number of parameters in arrays */
90    struct gl_program_parameter *Parameters; /**< Array [Size] */
91    //GLfloat (*ParameterValues)[4];        /**< Array [Size] of GLfloat[4] */
92    //GLbitfield StateFlags; /**< _NEW_* flags indicating which state changes
93    //                            might invalidate ParameterValues[] */
94 };
95 
96 #ifdef __cplusplus
97 extern "C" {
98 class ir_variable;
99 #else
100 typedef struct ir_variable ir_variable;
101 #endif
102 
103 // returns index in paramList or -1
104 GLint _mesa_add_parameter(struct gl_program_parameter_list * paramList,
105                            const char * name);
106 
107 GLint _mesa_get_parameter(const struct gl_program_parameter_list * paramList,
108                            const char * name);
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif /* PROG_PARAMETER_H */
114