Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added support for discarding fragments

  • Loading branch information...
commit 1413072dfd9abd9ce0620ddba9338ea16095a3cf 1 parent 14b5bab
@WolfgangSt WolfgangSt authored
View
1  IIS.SLSharp/IIS.SLSharp.csproj
@@ -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" />
View
15 IIS.SLSharp/Shaders/ShaderDefinition.Special.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; }
+ }
+}
View
7 IIS.SLSharp/Translation/GLSL/GlslVisitor.ShaderDef.cs
@@ -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");
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.