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_Vertex * gl_ModelViewProjectionMatrixTranspose;
66 // 8.7 Texture Lookup Functions
67 // These are pretty much identical to the ones in slang_fragment_builtin.gc
68 // When used in a vertex program, the texture sample instructions should not
69 // be using a LOD term so it's effectively zero. Adding 'lod' to that does
73 vec4 texture1DLod(const sampler1D sampler, const float coord, const float lod)
78 __asm vec4_texb1d __retVal, sampler, coord4;
81 vec4 texture1DProjLod(const sampler1D sampler, const vec2 coord, const float lod)
84 pcoord.x = coord.x / coord.y;
86 __asm vec4_texb1d __retVal, sampler, pcoord;
89 vec4 texture1DProjLod(const sampler1D sampler, const vec4 coord, const float lod)
92 pcoord.x = coord.x / coord.z;
94 __asm vec4_texb1d __retVal, sampler, pcoord;
99 vec4 texture2DLod(const sampler2D sampler, const vec2 coord, const float lod)
102 coord4.xy = coord.xy;
104 __asm vec4_texb2d __retVal, sampler, coord4;
107 vec4 texture2DProjLod(const sampler2D sampler, const vec3 coord, const float lod)
110 pcoord.xy = coord.xy / coord.z;
112 __asm vec4_texb2d __retVal, sampler, pcoord;
115 vec4 texture2DProjLod(const sampler2D sampler, const vec4 coord, const float lod)
118 pcoord.xy = coord.xy / coord.z;
120 __asm vec4_texb2d __retVal, sampler, pcoord;
124 vec4 texture3DLod(const sampler3D sampler, const vec3 coord, const float lod)
127 coord4.xyz = coord.xyz;
129 __asm vec4_texb3d __retVal, sampler, coord4;
132 vec4 texture3DProjLod(const sampler3D sampler, const vec4 coord, const float lod)
134 // do projection here (there's no vec4_texbp3d instruction)
136 pcoord.xyz = coord.xyz / coord.w;
138 __asm vec4_texb3d __retVal, sampler, pcoord;
142 vec4 textureCubeLod(const samplerCube sampler, const vec3 coord, const float lod)
147 __asm vec4_texcube __retVal, sampler, coord4;
151 vec4 shadow1DLod(const sampler1DShadow sampler, const vec3 coord, const float lod)
156 __asm vec4_texb1d __retVal, sampler, coord4;
159 vec4 shadow1DProjLod(const sampler1DShadow sampler, const vec4 coord,
163 pcoord.x = coord.x / coord.w;
166 __asm vec4_texb1d __retVal, sampler, pcoord;
170 vec4 shadow2DLod(const sampler2DShadow sampler, const vec3 coord, const float lod)
175 __asm vec4_texb2d __retVal, sampler, coord4;
178 vec4 shadow2DProjLod(const sampler2DShadow sampler, const vec4 coord,
182 pcoord.xy = coord.xy / coord.w;
185 __asm vec4_texb2d __retVal, sampler, pcoord;