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 | |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame] | 24 | #include "main/mtypes.h" |
| 25 | |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 26 | struct builtin_variable { |
| 27 | enum ir_variable_mode mode; |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame] | 28 | int slot; |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 29 | const char *type; |
| 30 | const char *name; |
| 31 | }; |
| 32 | |
| 33 | static const builtin_variable builtin_core_vs_variables[] = { |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame] | 34 | { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_Position" }, |
| 35 | { ir_var_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" }, |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 36 | }; |
| 37 | |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 38 | static const builtin_variable builtin_core_fs_variables[] = { |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame] | 39 | { ir_var_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, |
| 40 | { ir_var_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, |
| 41 | { ir_var_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" }, |
| 42 | { ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, |
Eric Anholt | b3f743a | 2010-03-25 14:48:25 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
Eric Anholt | 0f09aea | 2010-03-27 12:48:57 -0700 | [diff] [blame] | 45 | static const builtin_variable builtin_110_deprecated_fs_variables[] = { |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame] | 46 | { ir_var_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" }, |
| 47 | { ir_var_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" }, |
| 48 | { ir_var_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" }, |
Eric Anholt | 0f09aea | 2010-03-27 12:48:57 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 51 | static const builtin_variable builtin_110_deprecated_vs_variables[] = { |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame] | 52 | { ir_var_in, VERT_ATTRIB_POS, "vec4", "gl_Vertex" }, |
| 53 | { ir_var_in, VERT_ATTRIB_NORMAL, "vec3", "gl_Normal" }, |
| 54 | { ir_var_in, VERT_ATTRIB_COLOR0, "vec4", "gl_Color" }, |
| 55 | { ir_var_in, VERT_ATTRIB_COLOR1, "vec4", "gl_SecondaryColor" }, |
| 56 | { ir_var_in, VERT_ATTRIB_TEX0, "vec4", "gl_MultiTexCoord0" }, |
| 57 | { ir_var_in, VERT_ATTRIB_TEX1, "vec4", "gl_MultiTexCoord1" }, |
| 58 | { ir_var_in, VERT_ATTRIB_TEX2, "vec4", "gl_MultiTexCoord2" }, |
| 59 | { ir_var_in, VERT_ATTRIB_TEX3, "vec4", "gl_MultiTexCoord3" }, |
| 60 | { ir_var_in, VERT_ATTRIB_TEX4, "vec4", "gl_MultiTexCoord4" }, |
| 61 | { ir_var_in, VERT_ATTRIB_TEX5, "vec4", "gl_MultiTexCoord5" }, |
| 62 | { ir_var_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" }, |
| 63 | { ir_var_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" }, |
| 64 | { ir_var_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" }, |
| 65 | { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_ClipVertex" }, |
| 66 | { ir_var_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" }, |
| 67 | { ir_var_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" }, |
| 68 | { ir_var_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" }, |
| 69 | { ir_var_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" }, |
| 70 | { ir_var_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" }, |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 71 | }; |
| 72 | |
Eric Anholt | 152b55e | 2010-07-07 19:45:22 -0700 | [diff] [blame] | 73 | static const builtin_variable builtin_120_fs_variables[] = { |
| 74 | { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, |
| 75 | }; |
| 76 | |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 77 | static const builtin_variable builtin_130_vs_variables[] = { |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame] | 78 | { ir_var_in, -1, "int", "gl_VertexID" }, |
Ian Romanick | adfb0cd | 2010-03-10 10:43:16 -0800 | [diff] [blame] | 79 | }; |
Eric Anholt | 78fe3c9 | 2010-03-28 01:46:48 -0700 | [diff] [blame] | 80 | |
| 81 | static const builtin_variable builtin_110_deprecated_uniforms[] = { |
Ian Romanick | ed0626e | 2010-06-21 11:42:57 -0700 | [diff] [blame] | 82 | { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrix" }, |
| 83 | { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrix" }, |
| 84 | { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrix" }, |
| 85 | { ir_var_uniform, -1, "mat3", "gl_NormalMatrix" }, |
| 86 | { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverse" }, |
| 87 | { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverse" }, |
| 88 | { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverse" }, |
| 89 | { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixTranspose" }, |
| 90 | { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixTranspose" }, |
| 91 | { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixTranspose" }, |
| 92 | { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverseTranspose" }, |
| 93 | { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverseTranspose" }, |
| 94 | { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverseTranspose" }, |
| 95 | { ir_var_uniform, -1, "float", "gl_NormalScale" }, |
Aras Pranckevicius | ea3a9eb | 2010-08-04 17:11:32 +0200 | [diff] [blame] | 96 | { ir_var_uniform, -1, "gl_LightModelParameters", "gl_LightModel"}, |
Eric Anholt | 78fe3c9 | 2010-03-28 01:46:48 -0700 | [diff] [blame] | 97 | }; |
| 98 | |