Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2010 Intel Corporation |
| 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 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * 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 NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 | * DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | |
Eric Anholt | ac95f2f | 2010-06-22 10:38:52 -0700 | [diff] [blame] | 24 | #include "ir.h" |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 25 | #include "glsl_parser_extras.h" |
Ian Romanick | 8bde4ce | 2010-03-19 11:57:24 -0700 | [diff] [blame] | 26 | #include "glsl_symbol_table.h" |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 27 | #include "builtin_variables.h" |
| 28 | |
| 29 | #ifndef Elements |
| 30 | #define Elements(x) (sizeof(x)/sizeof(*(x))) |
| 31 | #endif |
| 32 | |
Ian Romanick | c77b257 | 2010-04-07 16:59:46 -0700 | [diff] [blame] | 33 | static ir_variable * |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame^] | 34 | add_variable(const char *name, enum ir_variable_mode mode, int slot, |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 35 | const glsl_type *type, exec_list *instructions, |
Ian Romanick | 8bde4ce | 2010-03-19 11:57:24 -0700 | [diff] [blame] | 36 | glsl_symbol_table *symtab) |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 37 | { |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 38 | ir_variable *var = new ir_variable(type, name); |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 39 | |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 40 | var->mode = mode; |
Eric Anholt | 71df19f | 2010-04-19 11:10:37 -0700 | [diff] [blame] | 41 | switch (var->mode) { |
| 42 | case ir_var_in: |
| 43 | var->shader_in = true; |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 44 | var->read_only = true; |
Eric Anholt | 71df19f | 2010-04-19 11:10:37 -0700 | [diff] [blame] | 45 | break; |
| 46 | case ir_var_inout: |
| 47 | var->shader_in = true; |
| 48 | var->shader_out = true; |
Ian Romanick | ff236fa | 2010-04-21 15:08:08 -0700 | [diff] [blame] | 49 | break; |
Eric Anholt | 71df19f | 2010-04-19 11:10:37 -0700 | [diff] [blame] | 50 | case ir_var_out: |
| 51 | var->shader_out = true; |
| 52 | break; |
| 53 | case ir_var_uniform: |
| 54 | var->shader_in = true; |
| 55 | var->read_only = true; |
| 56 | break; |
| 57 | default: |
| 58 | assert(0); |
| 59 | break; |
| 60 | } |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 61 | |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame^] | 62 | var->location = slot; |
| 63 | |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 64 | /* Once the variable is created an initialized, add it to the symbol table |
| 65 | * and add the declaration to the IR stream. |
| 66 | */ |
| 67 | instructions->push_tail(var); |
| 68 | |
Ian Romanick | 8bde4ce | 2010-03-19 11:57:24 -0700 | [diff] [blame] | 69 | symtab->add_variable(var->name, var); |
Ian Romanick | c77b257 | 2010-04-07 16:59:46 -0700 | [diff] [blame] | 70 | return var; |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 71 | } |
| 72 | |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 73 | |
| 74 | static void |
| 75 | add_builtin_variable(const builtin_variable *proto, exec_list *instructions, |
| 76 | glsl_symbol_table *symtab) |
| 77 | { |
| 78 | /* Create a new variable declaration from the description supplied by |
| 79 | * the caller. |
| 80 | */ |
| 81 | const glsl_type *const type = symtab->get_type(proto->type); |
| 82 | |
| 83 | assert(type != NULL); |
| 84 | |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame^] | 85 | add_variable(proto->name, proto->mode, proto->slot, type, instructions, |
| 86 | symtab); |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | |
Eric Anholt | 78fe3c9 | 2010-03-28 01:46:48 -0700 | [diff] [blame] | 90 | static void |
| 91 | generate_110_uniforms(exec_list *instructions, |
| 92 | glsl_symbol_table *symtab) |
| 93 | { |
| 94 | for (unsigned i = 0 |
| 95 | ; i < Elements(builtin_110_deprecated_uniforms) |
| 96 | ; i++) { |
| 97 | add_builtin_variable(& builtin_110_deprecated_uniforms[i], |
| 98 | instructions, symtab); |
| 99 | } |
| 100 | |
Ian Romanick | 3eba593 | 2010-04-26 14:59:32 -0700 | [diff] [blame] | 101 | /* FINISHME: The size of this array is implementation dependent based on the |
Ian Romanick | cfb3536 | 2010-06-07 19:10:33 -0700 | [diff] [blame] | 102 | * FINISHME: value of GL_MAX_TEXTURE_COORDS. Every platform that supports |
| 103 | * FINISHME: GLSL sets GL_MAX_TEXTURE_COORDS to at least 4, so hard-code 4 |
| 104 | * FINISHME: for now. |
Eric Anholt | 78fe3c9 | 2010-03-28 01:46:48 -0700 | [diff] [blame] | 105 | */ |
Ian Romanick | 3eba593 | 2010-04-26 14:59:32 -0700 | [diff] [blame] | 106 | const glsl_type *const mat4_array_type = |
Ian Romanick | cfb3536 | 2010-06-07 19:10:33 -0700 | [diff] [blame] | 107 | glsl_type::get_array_instance(glsl_type::mat4_type, 4); |
Ian Romanick | 3eba593 | 2010-04-26 14:59:32 -0700 | [diff] [blame] | 108 | |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame^] | 109 | add_variable("gl_TextureMatrix", ir_var_uniform, -1, mat4_array_type, |
Ian Romanick | 3eba593 | 2010-04-26 14:59:32 -0700 | [diff] [blame] | 110 | instructions, symtab); |
Eric Anholt | 78fe3c9 | 2010-03-28 01:46:48 -0700 | [diff] [blame] | 111 | |
| 112 | /* FINISHME: Add support for gl_DepthRangeParameters */ |
| 113 | /* FINISHME: Add support for gl_ClipPlane[] */ |
| 114 | /* FINISHME: Add support for gl_PointParameters */ |
| 115 | |
| 116 | /* FINISHME: Add support for gl_MaterialParameters |
| 117 | * FINISHME: (glFrontMaterial, glBackMaterial) |
| 118 | */ |
| 119 | |
Eric Anholt | aa57943 | 2010-05-19 14:09:04 -0700 | [diff] [blame] | 120 | /* FINISHME: The size of this array is implementation dependent based on the |
| 121 | * FINISHME: value of GL_MAX_TEXTURE_LIGHTS. GL_MAX_TEXTURE_LIGHTS must be |
| 122 | * FINISHME: at least 8, so hard-code 8 for now. |
| 123 | */ |
| 124 | const glsl_type *const light_source_array_type = |
| 125 | glsl_type::get_array_instance(symtab->get_type("gl_LightSourceParameters"), 8); |
| 126 | |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame^] | 127 | add_variable("gl_LightSource", ir_var_uniform, -1, light_source_array_type, |
Eric Anholt | aa57943 | 2010-05-19 14:09:04 -0700 | [diff] [blame] | 128 | instructions, symtab); |
| 129 | |
Eric Anholt | 78fe3c9 | 2010-03-28 01:46:48 -0700 | [diff] [blame] | 130 | /* FINISHME: Add support for gl_LightModel */ |
| 131 | /* FINISHME: Add support for gl_FrontLightProduct[], gl_BackLightProduct[] */ |
| 132 | /* FINISHME: Add support for gl_TextureEnvColor[] */ |
| 133 | /* FINISHME: Add support for gl_ObjectPlane*[], gl_EyePlane*[] */ |
| 134 | /* FINISHME: Add support for gl_Fog */ |
| 135 | } |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 136 | |
| 137 | static void |
| 138 | generate_110_vs_variables(exec_list *instructions, |
Ian Romanick | 8bde4ce | 2010-03-19 11:57:24 -0700 | [diff] [blame] | 139 | glsl_symbol_table *symtab) |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 140 | { |
| 141 | for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) { |
| 142 | add_builtin_variable(& builtin_core_vs_variables[i], |
| 143 | instructions, symtab); |
| 144 | } |
| 145 | |
| 146 | for (unsigned i = 0 |
| 147 | ; i < Elements(builtin_110_deprecated_vs_variables) |
| 148 | ; i++) { |
| 149 | add_builtin_variable(& builtin_110_deprecated_vs_variables[i], |
| 150 | instructions, symtab); |
| 151 | } |
Eric Anholt | 78fe3c9 | 2010-03-28 01:46:48 -0700 | [diff] [blame] | 152 | generate_110_uniforms(instructions, symtab); |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 153 | |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 154 | /* FINISHME: The size of this array is implementation dependent based on the |
Ian Romanick | cfb3536 | 2010-06-07 19:10:33 -0700 | [diff] [blame] | 155 | * FINISHME: value of GL_MAX_TEXTURE_COORDS. Every platform that supports |
| 156 | * FINISHME: GLSL sets GL_MAX_TEXTURE_COORDS to at least 4, so hard-code 4 |
| 157 | * FINISHME: for now. |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 158 | */ |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 159 | const glsl_type *const vec4_array_type = |
Ian Romanick | cfb3536 | 2010-06-07 19:10:33 -0700 | [diff] [blame] | 160 | glsl_type::get_array_instance(glsl_type::vec4_type, 4); |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 161 | |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame^] | 162 | add_variable("gl_TexCoord", ir_var_out, VERT_RESULT_TEX0, vec4_array_type, |
| 163 | instructions, symtab); |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | |
| 167 | static void |
| 168 | generate_120_vs_variables(exec_list *instructions, |
Ian Romanick | 8bde4ce | 2010-03-19 11:57:24 -0700 | [diff] [blame] | 169 | glsl_symbol_table *symtab) |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 170 | { |
| 171 | /* GLSL version 1.20 did not add any built-in variables in the vertex |
| 172 | * shader. |
| 173 | */ |
| 174 | generate_110_vs_variables(instructions, symtab); |
| 175 | } |
| 176 | |
| 177 | |
| 178 | static void |
| 179 | generate_130_vs_variables(exec_list *instructions, |
Ian Romanick | 8bde4ce | 2010-03-19 11:57:24 -0700 | [diff] [blame] | 180 | glsl_symbol_table *symtab) |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 181 | { |
| 182 | generate_120_vs_variables(instructions, symtab); |
| 183 | |
| 184 | for (unsigned i = 0; i < Elements(builtin_130_vs_variables); i++) { |
| 185 | add_builtin_variable(& builtin_130_vs_variables[i], |
| 186 | instructions, symtab); |
| 187 | } |
| 188 | |
Eric Anholt | 271e199 | 2010-04-02 23:47:06 -0700 | [diff] [blame] | 189 | /* FINISHME: The size of this array is implementation dependent based on |
| 190 | * FINISHME: the value of GL_MAX_CLIP_DISTANCES. |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 191 | */ |
Eric Anholt | 271e199 | 2010-04-02 23:47:06 -0700 | [diff] [blame] | 192 | const glsl_type *const clip_distance_array_type = |
| 193 | glsl_type::get_array_instance(glsl_type::float_type, 8); |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame^] | 194 | |
| 195 | /* FINISHME: gl_ClipDistance needs a real location assigned. */ |
| 196 | add_variable("gl_ClipDistance", ir_var_out, -1, clip_distance_array_type, |
Eric Anholt | 271e199 | 2010-04-02 23:47:06 -0700 | [diff] [blame] | 197 | instructions, symtab); |
| 198 | |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | |
| 202 | static void |
| 203 | initialize_vs_variables(exec_list *instructions, |
| 204 | struct _mesa_glsl_parse_state *state) |
| 205 | { |
| 206 | |
| 207 | switch (state->language_version) { |
| 208 | case 110: |
| 209 | generate_110_vs_variables(instructions, state->symbols); |
| 210 | break; |
| 211 | case 120: |
| 212 | generate_120_vs_variables(instructions, state->symbols); |
| 213 | break; |
| 214 | case 130: |
| 215 | generate_130_vs_variables(instructions, state->symbols); |
| 216 | break; |
| 217 | } |
| 218 | } |
| 219 | |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 220 | static void |
| 221 | generate_110_fs_variables(exec_list *instructions, |
| 222 | glsl_symbol_table *symtab) |
| 223 | { |
| 224 | for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) { |
| 225 | add_builtin_variable(& builtin_core_fs_variables[i], |
| 226 | instructions, symtab); |
| 227 | } |
| 228 | |
Eric Anholt | 0f09aea | 2010-03-27 12:48:57 -0700 | [diff] [blame] | 229 | for (unsigned i = 0 |
| 230 | ; i < Elements(builtin_110_deprecated_fs_variables) |
| 231 | ; i++) { |
| 232 | add_builtin_variable(& builtin_110_deprecated_fs_variables[i], |
| 233 | instructions, symtab); |
| 234 | } |
Eric Anholt | 78fe3c9 | 2010-03-28 01:46:48 -0700 | [diff] [blame] | 235 | generate_110_uniforms(instructions, symtab); |
Eric Anholt | 0f09aea | 2010-03-27 12:48:57 -0700 | [diff] [blame] | 236 | |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 237 | /* FINISHME: The size of this array is implementation dependent based on the |
Ian Romanick | cfb3536 | 2010-06-07 19:10:33 -0700 | [diff] [blame] | 238 | * FINISHME: value of GL_MAX_TEXTURE_COORDS. Every platform that supports |
| 239 | * FINISHME: GLSL sets GL_MAX_TEXTURE_COORDS to at least 4, so hard-code 4 |
| 240 | * FINISHME: for now. |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 241 | */ |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 242 | const glsl_type *const vec4_array_type = |
Ian Romanick | cfb3536 | 2010-06-07 19:10:33 -0700 | [diff] [blame] | 243 | glsl_type::get_array_instance(glsl_type::vec4_type, 4); |
Ian Romanick | 3f9a73d | 2010-04-02 11:59:57 -0700 | [diff] [blame] | 244 | |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame^] | 245 | add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type, |
| 246 | instructions, symtab); |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 247 | } |
| 248 | |
Ian Romanick | c77b257 | 2010-04-07 16:59:46 -0700 | [diff] [blame] | 249 | |
| 250 | static void |
| 251 | generate_ARB_draw_buffers_fs_variables(exec_list *instructions, |
| 252 | glsl_symbol_table *symtab, bool warn) |
| 253 | { |
| 254 | /* FINISHME: The size of this array is implementation dependent based on the |
| 255 | * FINISHME: value of GL_MAX_DRAW_BUFFERS. GL_MAX_DRAW_BUFFERS must be |
| 256 | * FINISHME: at least 1, so hard-code 1 for now. |
| 257 | */ |
Ian Romanick | c77b257 | 2010-04-07 16:59:46 -0700 | [diff] [blame] | 258 | const glsl_type *const vec4_array_type = |
Eric Anholt | ec9e738 | 2010-04-22 09:47:27 -0700 | [diff] [blame] | 259 | glsl_type::get_array_instance(glsl_type::vec4_type, 1); |
Ian Romanick | c77b257 | 2010-04-07 16:59:46 -0700 | [diff] [blame] | 260 | |
| 261 | ir_variable *const fd = |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame^] | 262 | add_variable("gl_FragData", ir_var_out, FRAG_RESULT_DATA0, |
| 263 | vec4_array_type, instructions, symtab); |
Ian Romanick | c77b257 | 2010-04-07 16:59:46 -0700 | [diff] [blame] | 264 | |
| 265 | if (warn) |
| 266 | fd->warn_extension = "GL_ARB_draw_buffers"; |
| 267 | } |
| 268 | |
| 269 | |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 270 | static void |
| 271 | generate_120_fs_variables(exec_list *instructions, |
| 272 | glsl_symbol_table *symtab) |
| 273 | { |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 274 | generate_110_fs_variables(instructions, symtab); |
Ian Romanick | c77b257 | 2010-04-07 16:59:46 -0700 | [diff] [blame] | 275 | generate_ARB_draw_buffers_fs_variables(instructions, symtab, false); |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 276 | } |
| 277 | |
| 278 | static void |
| 279 | generate_130_fs_variables(exec_list *instructions, |
| 280 | glsl_symbol_table *symtab) |
| 281 | { |
| 282 | generate_120_fs_variables(instructions, symtab); |
| 283 | |
Ian Romanick | 8645a95 | 2010-04-07 16:47:44 -0700 | [diff] [blame] | 284 | /* FINISHME: The size of this array is implementation dependent based on |
| 285 | * FINISHME: the value of GL_MAX_CLIP_DISTANCES. |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 286 | */ |
Ian Romanick | 8645a95 | 2010-04-07 16:47:44 -0700 | [diff] [blame] | 287 | const glsl_type *const clip_distance_array_type = |
| 288 | glsl_type::get_array_instance(glsl_type::float_type, 8); |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame^] | 289 | |
| 290 | /* FINISHME: gl_ClipDistance needs a real location assigned. */ |
| 291 | add_variable("gl_ClipDistance", ir_var_in, -1, clip_distance_array_type, |
Ian Romanick | 8645a95 | 2010-04-07 16:47:44 -0700 | [diff] [blame] | 292 | instructions, symtab); |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | static void |
| 296 | initialize_fs_variables(exec_list *instructions, |
| 297 | struct _mesa_glsl_parse_state *state) |
| 298 | { |
| 299 | |
| 300 | switch (state->language_version) { |
| 301 | case 110: |
| 302 | generate_110_fs_variables(instructions, state->symbols); |
| 303 | break; |
| 304 | case 120: |
| 305 | generate_120_fs_variables(instructions, state->symbols); |
| 306 | break; |
| 307 | case 130: |
| 308 | generate_130_fs_variables(instructions, state->symbols); |
| 309 | break; |
| 310 | } |
Ian Romanick | c77b257 | 2010-04-07 16:59:46 -0700 | [diff] [blame] | 311 | |
| 312 | |
| 313 | /* Since GL_ARB_draw_buffers is included in GLSL 1.20 and later, we |
| 314 | * can basically ignore any extension settings for it. |
| 315 | */ |
| 316 | if (state->language_version < 120) { |
| 317 | if (state->ARB_draw_buffers_enable) { |
| 318 | generate_ARB_draw_buffers_fs_variables(instructions, state->symbols, |
| 319 | state->ARB_draw_buffers_warn); |
| 320 | } |
| 321 | } |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 322 | } |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 323 | |
| 324 | void |
| 325 | _mesa_glsl_initialize_variables(exec_list *instructions, |
| 326 | struct _mesa_glsl_parse_state *state) |
| 327 | { |
| 328 | switch (state->target) { |
| 329 | case vertex_shader: |
| 330 | initialize_vs_variables(instructions, state); |
| 331 | break; |
| 332 | case geometry_shader: |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 333 | break; |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 334 | case fragment_shader: |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 335 | initialize_fs_variables(instructions, state); |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 336 | break; |
Eric Anholt | 81f49a7 | 2010-04-29 17:57:28 -0700 | [diff] [blame] | 337 | case ir_shader: |
| 338 | fprintf(stderr, "ir reader has no builtin variables"); |
| 339 | exit(1); |
| 340 | break; |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 341 | } |
| 342 | } |