Permalink
Browse files

added support for discarding fragments

  • Loading branch information...
1 parent 14b5bab commit 1413072dfd9abd9ce0620ddba9338ea16095a3cf @WolfgangSt WolfgangSt committed Oct 6, 2011
@@ -80,6 +80,7 @@
<Compile Include="Shaders\ShaderDefinition.MatrixFunctions.cs" />
<Compile Include="Shaders\ShaderDefinition.Noise.cs" />
<Compile Include="Shaders\ShaderDefinition.Sampler.cs" />
+ <Compile Include="Shaders\ShaderDefinition.Special.cs" />
<Compile Include="Shaders\ShaderDefinition.Texture.cs" />
<Compile Include="Shaders\ShaderDefinition.Trigonometry.cs" />
<Compile Include="Shaders\ShaderDefinition.UInt32Vector.cs" />
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace IIS.SLSharp.Shaders
+{
+ public abstract partial class ShaderDefinition
+ {
+ /// <summary>
+ /// Discards the current fragment.
+ /// </summary>
+ protected internal static void Discard() { throw _invalidAccess; }
+ }
+}
@@ -14,6 +14,8 @@ public GlslVisitor()
{
Handlers = new Dictionary<Expression<Action>, Func<MethodDefinition, InvocationExpression, StringBuilder>>(new HandlerComparer())
{
+ { () => ShaderDefinition.Discard(), KeywordDiscard },
+
#region Trigonometry
{ () => ShaderDefinition.Radians(_float), ToLower },
@@ -518,5 +520,10 @@ public GlslVisitor()
#endregion
};
}
+
+ private StringBuilder KeywordDiscard(MethodDefinition unused1, InvocationExpression unused2)
+ {
+ return new StringBuilder("discard");
+ }
}
}

0 comments on commit 1413072

Please sign in to comment.