[gtksourceview] Added OpenGL Shading Language by Simon Wenner and Chong Kai Xiong.



commit c8fbafbca49f7236185fd2275ee8a825c72f819b
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu Sep 10 10:37:47 2009 +0200

    Added OpenGL Shading Language by Simon Wenner and Chong Kai Xiong.

 gtksourceview/language-specs/Makefile.am  |    1 +
 gtksourceview/language-specs/glsl.lang    |  407 +++++++++++++++++++++++++++++
 gtksourceview/language-specs/testfiles.sh |   14 +
 3 files changed, 422 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/language-specs/Makefile.am b/gtksourceview/language-specs/Makefile.am
index f43da49..be28f3e 100644
--- a/gtksourceview/language-specs/Makefile.am
+++ b/gtksourceview/language-specs/Makefile.am
@@ -27,6 +27,7 @@ LANGUAGES =			\
 	forth.lang		\
 	fortran.lang		\
 	gap.lang		\
+	glsl.lang		\
 	gtk-doc.lang		\
 	gtkrc.lang		\
 	haddock.lang		\
diff --git a/gtksourceview/language-specs/glsl.lang b/gtksourceview/language-specs/glsl.lang
new file mode 100644
index 0000000..a4c59ba
--- /dev/null
+++ b/gtksourceview/language-specs/glsl.lang
@@ -0,0 +1,407 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Authors:  Chong Kai Xiong, Simon Wenner
+ Copyright (C) 2005-2006  Chong Kai Xiong  <descender phreaker net>
+ Copyright (C) 2009  Simon Wenner  <simon wenner ch>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+-->
+
+<!--
+ Defines all symbols of the OpenGL Shading Language (GLSL) version 1.40.
+ Specification (16-Feb-2009):
+ http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.40.05.pdf
+-->
+<language id="glsl" _name="OpenGL Shading Language" version="2.0" _section="Sources">
+
+  <metadata>
+    <property name="globs">*.glslv;*.glslf</property>
+    <property name="line-comment-start">//</property>
+    <property name="block-comment-start">/*</property>
+    <property name="block-comment-end">*/</property>
+  </metadata>
+
+  <styles>
+    <style id="preprocessor"      _name="Preprocessor"          map-to="def:preprocessor"/>
+    <style id="type"              _name="Data Type"             map-to="def:type"/>
+    <style id="keyword"           _name="Keyword"               map-to="def:keyword"/>
+    <style id="builtin-function"  _name="Builtin Function"      map-to="def:builtin"/>
+    <style id="builtin-constant"  _name="Builtin Constant"      map-to="def:constant"/>
+    <style id="special-variable"  _name="Special Variable"      map-to="def:identifier"/>
+    <style id="future-use"        _name="Reserved Keywords"/>
+  </styles>
+
+  <definitions>
+    <context id="preprocessor" style-ref="preprocessor">
+      <prefix>^[ \t]*#[ \t]*</prefix>
+      <keyword>define</keyword>
+      <keyword>undef</keyword>
+      <keyword>(if|elif)([ \t]+defined)?</keyword>
+      <keyword>ifdef</keyword>
+      <keyword>ifndef</keyword>
+      <keyword>else</keyword>
+      <keyword>endif</keyword>
+      <keyword>error</keyword>
+      <keyword>pragma</keyword>
+      <keyword>extension</keyword>
+      <keyword>version</keyword>
+      <keyword>line</keyword>
+    </context>
+
+    <context id="common-macros" style-ref="preprocessor">
+      <keyword>__VERSION__</keyword>
+      <keyword>__LINE__</keyword>
+      <keyword>__FILE__</keyword>
+    </context>
+
+    <context id="keywords" style-ref="keyword">
+      <keyword>break</keyword>
+      <keyword>continue</keyword>
+      <keyword>discard</keyword>
+      <keyword>do</keyword>
+      <keyword>for</keyword>
+      <keyword>if</keyword>
+      <keyword>else</keyword>
+      <keyword>return</keyword>
+      <keyword>while</keyword>
+      <keyword>switch</keyword>
+      <keyword>case</keyword>
+      <keyword>default</keyword>
+      <!-- qualifiers -->
+      <keyword>attribute</keyword>
+      <keyword>const</keyword>
+      <keyword>in</keyword>
+      <keyword>inout</keyword>
+      <keyword>out</keyword>
+      <keyword>uniform</keyword>
+      <keyword>varying</keyword>
+      <keyword>invariant</keyword>
+      <keyword>centroid</keyword>
+      <keyword>flat</keyword>
+      <keyword>smooth</keyword>
+      <keyword>noperspective</keyword>
+      <keyword>layout</keyword>
+      <!-- precision -->
+      <keyword>lowp</keyword>
+      <keyword>mediump</keyword>
+      <keyword>highp</keyword>
+      <keyword>precision</keyword>
+    </context>
+
+    <context id="primitives" style-ref="type">
+      <keyword>bool</keyword>
+      <keyword>float</keyword>
+      <keyword>int</keyword>
+      <keyword>uint</keyword>
+      <keyword>struct</keyword>
+      <keyword>void</keyword>
+      <keyword>[biu]?vec[2-4]</keyword>
+      <keyword>mat[2-4]</keyword>
+      <keyword>mat[2-4]x[2-4]</keyword>
+      <keyword>[iu]?sampler[1-3]D</keyword>
+      <keyword>sampler[1-2]DShadow</keyword>
+      <keyword>[iu]?sampler[1-2]DArray</keyword>
+      <keyword>sampler[1-2]DArrayShadow</keyword>
+      <keyword>[iu]?samplerCube</keyword>
+      <keyword>samplerCubeShadow</keyword>
+      <keyword>[iu]?sampler2DRect</keyword>
+      <keyword>sampler2DRectShadow</keyword>
+      <keyword>[iu]?samplerBuffer</keyword>
+    </context>
+
+    <context id="reserved-keywords-for-future-use" style-ref="future-use">
+      <keyword>common</keyword>
+      <keyword>partition</keyword>
+      <keyword>active</keyword>
+      <keyword>asm</keyword>
+      <keyword>class</keyword>
+      <keyword>union</keyword>
+      <keyword>enum</keyword>
+      <keyword>typedef</keyword>
+      <keyword>template</keyword>
+      <keyword>this</keyword>
+      <keyword>packed</keyword>
+      <keyword>goto</keyword>
+      <keyword>inline</keyword>
+      <keyword>noinline</keyword>
+      <keyword>volatile</keyword>
+      <keyword>public</keyword>
+      <keyword>static</keyword>
+      <keyword>extern</keyword>
+      <keyword>external</keyword>
+      <keyword>interface</keyword>
+      <keyword>long</keyword>
+      <keyword>short</keyword>
+      <keyword>double</keyword>
+      <keyword>half</keyword>
+      <keyword>fixed</keyword>
+      <keyword>unsigned</keyword>
+      <keyword>input</keyword>
+      <keyword>output</keyword>
+      <keyword>[hdf]vec[2-4]</keyword>
+      <keyword>sampler3DRect</keyword>
+      <keyword>filter</keyword>
+      <keyword>sizeof</keyword>
+      <keyword>cast</keyword>
+      <keyword>namespace</keyword>
+      <keyword>using</keyword>
+      <keyword>row_major</keyword>
+    </context>
+
+    <context id="builtin-functions" style-ref="builtin-function">
+      <keyword>radians</keyword>
+      <keyword>degrees</keyword>
+      <keyword>sin</keyword>
+      <keyword>cos</keyword>
+      <keyword>tan</keyword>
+      <keyword>asin</keyword>
+      <keyword>acos</keyword>
+      <keyword>atan</keyword>
+      <keyword>sinh</keyword>
+      <keyword>cosh</keyword>
+      <keyword>tanh</keyword>
+      <keyword>asinh</keyword>
+      <keyword>acosh</keyword>
+      <keyword>atanh</keyword>
+      <keyword>pow</keyword>
+      <keyword>exp</keyword>
+      <keyword>log</keyword>
+      <keyword>exp2</keyword>
+      <keyword>log2</keyword>
+      <keyword>sqrt</keyword>
+      <keyword>inversesqrt</keyword>
+
+      <keyword>abs</keyword>
+      <keyword>sign</keyword>
+      <keyword>floor</keyword>
+      <keyword>trunc</keyword>
+      <keyword>round</keyword>
+      <keyword>roundEven</keyword>
+      <keyword>ceil</keyword>
+      <keyword>fract</keyword>
+      <keyword>mod</keyword>
+      <keyword>modf</keyword>
+      <keyword>min</keyword>
+      <keyword>max</keyword>
+      <keyword>clamp</keyword>
+      <keyword>mix</keyword>
+      <keyword>step</keyword>
+      <keyword>smoothstep</keyword>
+      <keyword>isnan</keyword>
+      <keyword>isinf</keyword>
+
+      <keyword>length</keyword>
+      <keyword>distance</keyword>
+      <keyword>dot</keyword>
+      <keyword>cross</keyword>
+      <keyword>normalize</keyword>
+      <keyword>ftransform</keyword>
+      <keyword>faceforward</keyword>
+      <keyword>reflect</keyword>
+      <keyword>refract</keyword>
+      <keyword>matrixCompMult</keyword>
+      <keyword>outerProduct</keyword>
+      <keyword>transpose</keyword>
+
+      <keyword>lessThan</keyword>
+      <keyword>lessThanEqual</keyword>
+      <keyword>greaterThan</keyword>
+      <keyword>greaterThanEqual</keyword>
+      <keyword>equal</keyword>
+      <keyword>notEqual</keyword>
+      <keyword>any</keyword>
+      <keyword>all</keyword>
+      <keyword>not</keyword>
+
+      <keyword>textureSize</keyword>
+      <keyword>texture</keyword>
+      <keyword>textureProj</keyword>
+      <keyword>textureLod</keyword>
+      <keyword>textureOffset</keyword>
+
+      <keyword>texelFetch</keyword>
+      <keyword>texelFetchOffset</keyword>
+      <keyword>textureProjOffset</keyword>
+      <keyword>textureLodOffset</keyword>
+      <keyword>textureProjLod</keyword>
+      <keyword>textureProjLodOffset</keyword>
+      <keyword>textureGrad</keyword>
+      <keyword>textureGradOffset</keyword>
+      <keyword>textureProjGrad</keyword>
+      <keyword>textureProjGradOffset</keyword>
+
+      <keyword>texture[1-3]D</keyword>
+      <keyword>texture[1-3]DProj</keyword>
+      <keyword>texture[1-3]DLod</keyword>
+      <keyword>texture[1-3]DProjLod</keyword>
+
+      <keyword>textureCube</keyword>
+      <keyword>textureCubeLod</keyword>
+
+      <keyword>shadow[1-2]D</keyword>
+      <keyword>shadow[1-2]DProj</keyword>
+      <keyword>shadow[1-2]DLod</keyword>
+      <keyword>shadow[1-2]DProjLod</keyword>
+
+      <keyword>dFdx</keyword>
+      <keyword>dFdy</keyword>
+      <keyword>fwidth</keyword>
+
+      <keyword>noise[1-4]</keyword>
+    </context>
+
+    <context id="vertex-shader-special-variables" style-ref="special-variable">
+      <!-- Section 7.1 -->
+      <keyword>gl_Position</keyword>
+      <keyword>gl_PointSize</keyword>
+      <keyword>gl_VertexID</keyword>
+      <keyword>gl_InstanceID</keyword>
+      <keyword>gl_ClipDistance</keyword>
+      <keyword>gl_ClipVertex</keyword>
+    </context>
+
+    <context id="fragment-shader-special-variables" style-ref="special-variable">
+      <!-- Section 7.2 -->
+      <keyword>gl_FragCoord</keyword>
+      <keyword>gl_FrontFacing</keyword>
+      <keyword>gl_ClipDistance</keyword>
+      <keyword>gl_FragColor</keyword>
+      <keyword>gl_FragData</keyword>
+      <keyword>gl_FragDepth</keyword>
+    </context>
+
+    <context id="builtin-vertex-attributes" style-ref="special-variable">
+      <!-- Section 7.3 -->
+      <keyword>gl_Color</keyword>
+      <keyword>gl_SecondaryColor</keyword>
+      <keyword>gl_Normal</keyword>
+      <keyword>gl_Vertex</keyword>
+      <keyword>gl_MultiTexCoord[0-7]</keyword>
+      <keyword>gl_FogCoord</keyword>
+    </context>
+
+    <context id="builtin-constants" style-ref="builtin-constant">
+      <!-- Section 7.4 -->
+      <keyword>gl_MaxTextureUnits</keyword>
+      <keyword>gl_MaxVertexAttribs</keyword>
+      <keyword>gl_MaxVertexUniformComponents</keyword>
+      <keyword>gl_MaxVaryingFloats</keyword>
+      <keyword>gl_MaxVaryingComponents</keyword>
+      <keyword>gl_MaxVertexTextureImageUnits</keyword>
+      <keyword>gl_MaxCombinedTextureImageUnits</keyword>
+      <keyword>gl_MaxTextureImageUnits</keyword>
+      <keyword>gl_MaxFragmentUniformComponents</keyword>
+      <keyword>gl_MaxDrawBuffers</keyword>
+      <keyword>gl_MaxClipDistances</keyword>
+    </context>
+
+    <context id="builtin-uniform-states" style-ref="builtin-constant">
+      <!-- Section 7.5 -->
+      <keyword>gl_DepthRange</keyword>
+
+      <keyword>gl_ModelViewMatrix</keyword>
+      <keyword>gl_ProjectionMatrix</keyword>
+      <keyword>gl_ModelViewProjectionMatrix</keyword>
+      <keyword>gl_TextureMatrix</keyword>
+
+      <keyword>gl_NormalMatrix</keyword>
+
+      <keyword>gl_ModelViewMatrixInverse</keyword>
+      <keyword>gl_ProjectionMatrixInverse</keyword>
+      <keyword>gl_ModelViewProjectionMatrixInverse</keyword>
+      <keyword>gl_TextureMatrixInverse</keyword>
+
+      <keyword>gl_ModelViewMatrixTranspose</keyword>
+      <keyword>gl_ProjectionMatrixTranspose</keyword>
+      <keyword>gl_ModelViewProjectionMatrixTranspose</keyword>
+      <keyword>gl_TextureMatrixTranspose</keyword>
+
+      <keyword>gl_ModelViewMatrixInverseTranspose</keyword>
+      <keyword>gl_ProjectionMatrixInverseTranspose</keyword>
+      <keyword>gl_ModelViewProjectionMatrixInverseTranspose</keyword>
+      <keyword>gl_TextureMatrixInverseTranspose</keyword>
+
+      <keyword>gl_NormalScale</keyword>
+      <keyword>gl_ClipPlane</keyword>
+      <keyword>gl_Point</keyword>
+
+      <keyword>gl_FrontMaterial</keyword>
+      <keyword>gl_BackMaterial</keyword>
+
+      <keyword>gl_LightSource</keyword>
+      <keyword>gl_LightModel</keyword>
+
+      <keyword>gl_FrontLightModelProduct</keyword>
+      <keyword>gl_BackLightModelProduct</keyword>
+
+      <keyword>gl_FrontLightProduct</keyword>
+      <keyword>gl_BackLightProduct</keyword>
+
+      <keyword>gl_TextureEnvColor</keyword>
+      <keyword>gl_EyePlaneS</keyword>
+      <keyword>gl_EyePlaneT</keyword>
+      <keyword>gl_EyePlaneR</keyword>
+      <keyword>gl_EyePlaneQ</keyword>
+      <keyword>gl_ObjectPlaneS</keyword>
+      <keyword>gl_ObjectPlaneT</keyword>
+      <keyword>gl_ObjectPlaneR</keyword>
+      <keyword>gl_ObjectPlaneQ</keyword>
+
+      <keyword>gl_Fog</keyword>
+    </context>
+
+    <context id="builtin-varyings" style-ref="special-variable">
+      <!-- Section 7.6 -->
+      <keyword>gl_PointCoord</keyword>
+
+      <keyword>gl_FrontColor</keyword>
+      <keyword>gl_BackColor</keyword>
+      <keyword>gl_FrontSecondaryColor</keyword>
+      <keyword>gl_BackSecondaryColor</keyword>
+      <keyword>gl_TexCoord</keyword>
+      <keyword>gl_FogFragCoord</keyword>
+    </context>
+
+    <context id="glsl">
+      <include>
+        <context ref="c:comment"/>
+        <context ref="c:comment-multiline"/>
+        <context ref="c:close-comment-outside-comment"/>
+        <context ref="c:if0-comment"/>
+        <context ref="preprocessor"/>
+        <context ref="common-macros"/>
+        <context ref="keywords"/>
+        <context ref="primitives"/>
+        <context ref="c:boolean"/>
+        <context ref="c:decimal"/>
+        <context ref="c:octal"/>
+        <context ref="c:hexadecimal"/>
+        <context ref="c:float"/>
+        <context ref="builtin-functions"/>
+        <context ref="vertex-shader-special-variables"/>
+        <context ref="fragment-shader-special-variables"/>
+        <context ref="builtin-vertex-attributes"/>
+        <context ref="builtin-constants"/>
+        <context ref="builtin-uniform-states"/>
+        <context ref="builtin-varyings"/>
+        <context ref="reserved-keywords-for-future-use"/>
+      </include>
+    </context>
+
+  </definitions>
+</language>
diff --git a/gtksourceview/language-specs/testfiles.sh b/gtksourceview/language-specs/testfiles.sh
index 365aba2..df7b7b7 100755
--- a/gtksourceview/language-specs/testfiles.sh
+++ b/gtksourceview/language-specs/testfiles.sh
@@ -15,6 +15,20 @@
 dir="testdir"
 mkdir -p $dir/
 
+cat > $dir/file.glslf << EOFEOF
+#version 140
+varying vec4 color_out;
+/*
+  A color shader
+*/
+void main(void)
+{
+  // edit the color of the fragment
+  vec4 new_color = color_out + vec4(0.4, 0.4, 0.1, 1.0);
+  gl_FragColor = clamp(new_color, 0.0, 1.0);
+}
+EOFEOF
+
 cat > $dir/file.cu << EOFEOF
 #include "cuMatrix.h"
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]