2 * Mesa 3-D graphics library
5 * Copyright (C) 2006 Brian Paul All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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.
26 // From Shader Spec, ver. 1.10, rev. 59
29 __fixed_output vec4 gl_Position;
30 __fixed_output float gl_PointSize;
31 __fixed_output vec4 gl_ClipVertex;
33 attribute vec4 gl_Color;
34 attribute vec4 gl_SecondaryColor;
35 attribute vec3 gl_Normal;
36 attribute vec4 gl_Vertex;
37 attribute vec4 gl_MultiTexCoord0;
38 attribute vec4 gl_MultiTexCoord1;
39 attribute vec4 gl_MultiTexCoord2;
40 attribute vec4 gl_MultiTexCoord3;
41 attribute vec4 gl_MultiTexCoord4;
42 attribute vec4 gl_MultiTexCoord5;
43 attribute vec4 gl_MultiTexCoord6;
44 attribute vec4 gl_MultiTexCoord7;
45 attribute float gl_FogCoord;
47 varying vec4 gl_FrontColor;
48 varying vec4 gl_BackColor;
49 varying vec4 gl_FrontSecondaryColor;
50 varying vec4 gl_BackSecondaryColor;
51 varying vec4 gl_TexCoord[gl_MaxTextureCoords];
52 varying float gl_FogFragCoord;
55 // Geometric Functions
60 __retVal = gl_ModelViewProjectionMatrix[0] * gl_Vertex.xxxx
61 + gl_ModelViewProjectionMatrix[1] * gl_Vertex.yyyy
62 + gl_ModelViewProjectionMatrix[2] * gl_Vertex.zzzz
63 + gl_ModelViewProjectionMatrix[3] * gl_Vertex.wwww;
69 // 8.7 Texture Lookup Functions
70 // These are pretty much identical to the ones in slang_fragment_builtin.gc
71 // When used in a vertex program, the texture sample instructions should not
72 // be using a LOD term so it's effectively zero. Adding 'lod' to that does
76 vec4 texture1DLod(const sampler1D sampler, const float coord, const float lod)
81 __asm vec4_tex_1d_bias __retVal, sampler, coord4;
84 vec4 texture1DProjLod(const sampler1D sampler, const vec2 coord, const float lod)
87 pcoord.x = coord.x / coord.y;
89 __asm vec4_tex_1d_bias __retVal, sampler, pcoord;
92 vec4 texture1DProjLod(const sampler1D sampler, const vec4 coord, const float lod)
95 pcoord.x = coord.x / coord.z;
97 __asm vec4_tex_1d_bias __retVal, sampler, pcoord;
102 vec4 texture2DLod(const sampler2D sampler, const vec2 coord, const float lod)
105 coord4.xy = coord.xy;
107 __asm vec4_tex_2d_bias __retVal, sampler, coord4;
110 vec4 texture2DProjLod(const sampler2D sampler, const vec3 coord, const float lod)
113 pcoord.xy = coord.xy / coord.z;
115 __asm vec4_tex_2d_bias __retVal, sampler, pcoord;
118 vec4 texture2DProjLod(const sampler2D sampler, const vec4 coord, const float lod)
121 pcoord.xy = coord.xy / coord.z;
123 __asm vec4_tex_2d_bias __retVal, sampler, pcoord;
127 vec4 texture3DLod(const sampler3D sampler, const vec3 coord, const float lod)
130 coord4.xyz = coord.xyz;
132 __asm vec4_tex_3d_bias __retVal, sampler, coord4;
135 vec4 texture3DProjLod(const sampler3D sampler, const vec4 coord, const float lod)
137 // do projection here (there's no vec4_tex_3d_bias_proj instruction)
139 pcoord.xyz = coord.xyz / coord.w;
141 __asm vec4_tex_3d_bias __retVal, sampler, pcoord;
145 vec4 textureCubeLod(const samplerCube sampler, const vec3 coord, const float lod)
150 __asm vec4_tex_cube __retVal, sampler, coord4;
154 vec4 shadow1DLod(const sampler1DShadow sampler, const vec3 coord, const float lod)
159 __asm vec4_tex_1d_bias __retVal, sampler, coord4;
162 vec4 shadow1DProjLod(const sampler1DShadow sampler, const vec4 coord,
166 pcoord.x = coord.x / coord.w;
169 __asm vec4_tex_1d_bias __retVal, sampler, pcoord;
173 vec4 shadow2DLod(const sampler2DShadow sampler, const vec3 coord, const float lod)
178 __asm vec4_tex_2d_bias __retVal, sampler, coord4;
181 vec4 shadow2DProjLod(const sampler2DShadow sampler, const vec4 coord,
185 pcoord.xy = coord.xy / coord.w;
188 __asm vec4_tex_2d_bias __retVal, sampler, pcoord;