Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Renamed all texture* builtins to Texture*

Changed ToLower xtrans utility function to only lowercase the first char.
Updated all samples
  • Loading branch information...
commit e9fcb89722c4212ee24bd990e8a708df5b4d137f 1 parent 0fcbade
Wolfgang Steffens WolfgangSt authored
6 IIS.SLSharp.Examples.Axiom.GeoClipmap/Shaders/ClipmapShader.cs
View
@@ -69,7 +69,7 @@ public void ClipmapVertexMain()
_uv = (Vertex.xy + FineBlockOrigin.xy) * FineBlockOrigin.zw;
- var texel = new vec3(textureLod(Heightmap, _uv, 1.0f).r);
+ var texel = new vec3(TextureLod(Heightmap, _uv, 1.0f).r);
var zfZd = texel.x * 512.0f;
var zf = Floor(zfZd) * 0.001953125f;
@@ -91,8 +91,8 @@ public void ClipmapVertexMain()
// just for testing, derive normal using interpolation over heights
- var dfdx = (textureLod(Heightmap, _uv + new vec2(FineBlockOrigin.z, 0.0f), 1.0f).r - texel.r);
- var dfdy = (textureLod(Heightmap, _uv + new vec2(0.0f, FineBlockOrigin.w), 1.0f).r - texel.r);
+ var dfdx = (TextureLod(Heightmap, _uv + new vec2(FineBlockOrigin.z, 0.0f), 1.0f).r - texel.r);
+ var dfdy = (TextureLod(Heightmap, _uv + new vec2(0.0f, FineBlockOrigin.w), 1.0f).r - texel.r);
var dz = 2.0f * ScaleFactor.z - dfdx * dfdx - dfdy * dfdy;
Normal = new vec3(dfdx, dfdy, dz);
4 IIS.SLSharp.Examples.Axiom/Shaders/WangShader.cs
View
@@ -24,11 +24,11 @@ public vec4 WangAt(vec2 tex)
var address = tex - tex % (1.0f / 256.0f);
var subPos = Fraction(tex * 256.0f) / 4.0f;
- var offset = texture(WangMap, Fraction(address)).xw;
+ var offset = Texture(WangMap, Fraction(address)).xw;
var tc = offset + subPos;
var tileScaledTex = tex * new vec2(32.0f / 1.0f);
- return textureGrad(WangTiles, tc, DeriveTowardsX(tileScaledTex), DeriveTowardsY(tileScaledTex));
+ return TextureGrad(WangTiles, tc, DeriveTowardsX(tileScaledTex), DeriveTowardsY(tileScaledTex));
}
public override void Begin()
4 IIS.SLSharp.Examples.Complex/Shaders/SimplexNoiseShader.cs
View
@@ -117,13 +117,13 @@ protected vec3 Fade(vec3 t)
[FragmentShader]
protected vec4 Perm2D(vec2 p)
{
- return texture(PermSampler2D, p);
+ return Texture(PermSampler2D, p);
}
[FragmentShader]
protected float GradPerm(float x, vec3 p)
{
- return Dot(texture(PermGradSampler, x).xyz, p);
+ return Dot(Texture(PermGradSampler, x).xyz, p);
}
[FragmentShader]
4 IIS.SLSharp.Examples.Complex/Shaders/WangShader.cs
View
@@ -22,11 +22,11 @@ public vec4 WangAt(vec2 tex)
{
var address = tex - tex % (1.0f / 256.0f);
var subPos = Fraction(tex * 256.0f) / 4.0f;
- var offset = texture(WangMap, Fraction(address)).xw;
+ var offset = Texture(WangMap, Fraction(address)).xw;
var tc = offset + subPos;
var tileScaledTex = tex * new vec2(32.0f / 1.0f);
- return textureGrad(WangTiles, tc, DeriveTowardsX(tileScaledTex), DeriveTowardsY(tileScaledTex));
+ return TextureGrad(WangTiles, tc, DeriveTowardsX(tileScaledTex), DeriveTowardsY(tileScaledTex));
}
public override void Begin()
6 IIS.SLSharp.Examples.GeoClipmap/Shaders/ClipmapShader.cs
View
@@ -55,7 +55,7 @@ public void ClipmapVertexMain()
var worldPos = (Vertex.xy + ScaleFactor.xy) * ScaleFactor.zz;
_uv = (Vertex.xy + FineBlockOrigin.xy) * ScaleFactor.ww;
- var texel = new vec3(texture(Heightmap, _uv, 1.0f).r);
+ var texel = new vec3(Texture(Heightmap, _uv, 1.0f).r);
var zfZd = texel.x * 512.0f;
var zd = (Floor(zfZd) + 1.0f) * 0.001953125f;
@@ -81,8 +81,8 @@ public void ClipmapVertexMain()
// just for testing, derive normal using interpolation over heights
- var dfdx = (textureLod(Heightmap, _uv + new vec2(ScaleFactor.w, 0.0f), 1.0f).r - texel.r);
- var dfdy = (textureLod(Heightmap, _uv + new vec2(0.0f, ScaleFactor.w), 1.0f).r - texel.r);
+ var dfdx = (TextureLod(Heightmap, _uv + new vec2(ScaleFactor.w, 0.0f), 1.0f).r - texel.r);
+ var dfdy = (TextureLod(Heightmap, _uv + new vec2(0.0f, ScaleFactor.w), 1.0f).r - texel.r);
var dz = 2.0f*ScaleFactor.z - dfdx * dfdx - dfdy * dfdy;
Normal = new vec3(dfdx, dfdy, dz);
4 IIS.SLSharp.Examples.GeoClipmap/Shaders/DebugShader.cs
View
@@ -47,7 +47,7 @@ public void DebugFragmentMain()
var uvs = _uv * HeightSize.xy;
var subUv = Fraction(uvs);
var val = (uvs - subUv + new vec2(0.5f)) / HeightSize.xy;
- var height = texture(Heightmap, val);
+ var height = Texture(Heightmap, val);
//var height = new vec4(1.0f);
var idx = height.r * 255.0f;
@@ -59,7 +59,7 @@ public void DebugFragmentMain()
var tileUv = new vec2(subUv.x/16.0f + xidx, (1.0f-subUv.y)/16.0f + yidx);
- FragColor = texture(DebugTex, tileUv);
+ FragColor = Texture(DebugTex, tileUv);
//FragColor = height;
6 IIS.SLSharp.Examples.Mogre.GeoClipmap/Shaders/ClipmapShader.cs
View
@@ -70,7 +70,7 @@ public void ClipmapVertexMain()
_uv = (Vertex.xy + FineBlockOrigin.xy) * FineBlockOrigin.zw;
- var texel = new vec3(textureLod(Heightmap, _uv, 1.0f).r);
+ var texel = new vec3(TextureLod(Heightmap, _uv, 1.0f).r);
var zfZd = texel.x * 512.0f;
var zf = Floor(zfZd) * 0.001953125f;
@@ -92,8 +92,8 @@ public void ClipmapVertexMain()
// just for testing, derive normal using interpolation over heights
- var dfdx = (textureLod(Heightmap, _uv + new vec2(FineBlockOrigin.z, 0.0f), 1.0f).r - texel.r);
- var dfdy = (textureLod(Heightmap, _uv + new vec2(0.0f, FineBlockOrigin.w), 1.0f).r - texel.r);
+ var dfdx = (TextureLod(Heightmap, _uv + new vec2(FineBlockOrigin.z, 0.0f), 1.0f).r - texel.r);
+ var dfdy = (TextureLod(Heightmap, _uv + new vec2(0.0f, FineBlockOrigin.w), 1.0f).r - texel.r);
var dz = 2.0f * ScaleFactor.z - dfdx * dfdx - dfdy * dfdy;
Normal = new vec3(dfdx, dfdy, dz);
4 IIS.SLSharp.Examples.Mogre/Shaders/WangShader.cs
View
@@ -22,11 +22,11 @@ public vec4 WangAt(vec2 tex)
{
var address = tex - tex % (1.0f / 256.0f);
var subPos = Fraction(tex * 256.0f) / 4.0f;
- var offset = texture(WangMap, Fraction(address)).xw;
+ var offset = Texture(WangMap, Fraction(address)).xw;
var tc = offset + subPos;
var tileScaledTex = tex * new vec2(32.0f / 1.0f);
- return textureGrad(WangTiles, tc, DeriveTowardsX(tileScaledTex), DeriveTowardsY(tileScaledTex));
+ return TextureGrad(WangTiles, tc, DeriveTowardsX(tileScaledTex), DeriveTowardsY(tileScaledTex));
}
public override void Begin()
6 IIS.SLSharp/Shaders/ShaderDefinition.MatrixFunctions.cs
View
@@ -476,13 +476,13 @@ public abstract partial class ShaderDefinition
#region determinant (double)
/// <summary>Returns the determinant of m. </summary>
- protected float determinant(dmat2 m) { throw _invalidAccess; }
+ protected double determinant(dmat2 m) { throw _invalidAccess; }
/// <summary>Returns the determinant of m. </summary>
- protected float determinant(dmat3 m) { throw _invalidAccess; }
+ protected double determinant(dmat3 m) { throw _invalidAccess; }
/// <summary>Returns the determinant of m. </summary>
- protected float determinant(dmat4 m) { throw _invalidAccess; }
+ protected double determinant(dmat4 m) { throw _invalidAccess; }
#endregion
}
1,366 IIS.SLSharp/Shaders/ShaderDefinition.Texture.cs
View
683 additions, 683 deletions not shown
438 IIS.SLSharp/Translation/GLSL/GlslVisitor.ShaderDef.cs
View
@@ -556,6 +556,444 @@ public GlslVisitor()
{ () => ShaderDefinition.Noise4(vec4), ToLower },
#endregion
+
+ #region Texture
+
+ { () => ShaderDefinition.TextureSize(sampler1D, _int), ToLower },
+ { () => ShaderDefinition.TextureSize(isampler1D, _int), ToLower },
+ { () => ShaderDefinition.TextureSize(usampler1D, _int), ToLower },
+
+ { () => ShaderDefinition.TextureSize(sampler2D, _int), ToLower },
+ { () => ShaderDefinition.TextureSize(isampler2D, _int), ToLower },
+ { () => ShaderDefinition.TextureSize(usampler2D, _int), ToLower },
+
+ { () => ShaderDefinition.TextureSize(sampler3D, _int), ToLower },
+ { () => ShaderDefinition.TextureSize(isampler3D, _int), ToLower },
+ { () => ShaderDefinition.TextureSize(usampler3D, _int), ToLower },
+
+ { () => ShaderDefinition.TextureSize(samplerCube, _int), ToLower },
+ { () => ShaderDefinition.TextureSize(isamplerCube, _int), ToLower },
+ { () => ShaderDefinition.TextureSize(usamplerCube, _int), ToLower },
+
+ { () => ShaderDefinition.TextureSize(sampler1DShadow, _int), ToLower },
+ { () => ShaderDefinition.TextureSize(sampler2DShadow, _int), ToLower },
+ { () => ShaderDefinition.TextureSize(samplerCubeShadow, _int), ToLower },
+
+ { () => ShaderDefinition.TextureSize(sampler2DRect), ToLower },
+ { () => ShaderDefinition.TextureSize(isampler2DRect), ToLower },
+ { () => ShaderDefinition.TextureSize(usampler2DRect), ToLower },
+
+ { () => ShaderDefinition.TextureQueryLod(sampler1D, _float), ToLower },
+ { () => ShaderDefinition.TextureQueryLod(isampler1D, _float), ToLower },
+ { () => ShaderDefinition.TextureQueryLod(usampler1D, _float), ToLower },
+
+ { () => ShaderDefinition.TextureQueryLod(sampler2D, vec2), ToLower },
+ { () => ShaderDefinition.TextureQueryLod(isampler2D, vec2), ToLower },
+ { () => ShaderDefinition.TextureQueryLod(usampler2D, vec2), ToLower },
+
+ { () => ShaderDefinition.TextureQueryLod(sampler3D, vec3), ToLower },
+ { () => ShaderDefinition.TextureQueryLod(isampler3D, vec3), ToLower },
+ { () => ShaderDefinition.TextureQueryLod(usampler3D, vec3), ToLower },
+
+ { () => ShaderDefinition.TextureQueryLod(samplerCube, vec3), ToLower },
+ { () => ShaderDefinition.TextureQueryLod(isamplerCube, vec3), ToLower },
+ { () => ShaderDefinition.TextureQueryLod(usamplerCube, vec3), ToLower },
+
+ { () => ShaderDefinition.TextureQueryLod(sampler1DShadow, _float), ToLower },
+ { () => ShaderDefinition.TextureQueryLod(sampler2DShadow, vec2), ToLower },
+ { () => ShaderDefinition.TextureQueryLod(samplerCubeShadow, vec3), ToLower },
+
+ { () => ShaderDefinition.Texture(sampler1D, _float), ToLower },
+ { () => ShaderDefinition.Texture(sampler1D, _float, _float), ToLower },
+ { () => ShaderDefinition.Texture(isampler1D, _float), ToLower },
+ { () => ShaderDefinition.Texture(isampler1D, _float, _float), ToLower },
+ { () => ShaderDefinition.Texture(usampler1D, _float), ToLower },
+ { () => ShaderDefinition.Texture(usampler1D, _float, _float), ToLower },
+
+ { () => ShaderDefinition.Texture(sampler2D, vec2), ToLower },
+ { () => ShaderDefinition.Texture(sampler2D, vec2, _float), ToLower },
+ { () => ShaderDefinition.Texture(isampler2D, vec2), ToLower },
+ { () => ShaderDefinition.Texture(isampler2D, vec2, _float), ToLower },
+ { () => ShaderDefinition.Texture(usampler2D, vec2), ToLower },
+ { () => ShaderDefinition.Texture(usampler2D, vec2, _float), ToLower },
+
+ { () => ShaderDefinition.Texture(sampler3D, vec3), ToLower },
+ { () => ShaderDefinition.Texture(sampler3D, vec3, _float), ToLower },
+ { () => ShaderDefinition.Texture(isampler3D, vec3), ToLower },
+ { () => ShaderDefinition.Texture(isampler3D, vec3, _float), ToLower },
+ { () => ShaderDefinition.Texture(usampler3D, vec3), ToLower },
+ { () => ShaderDefinition.Texture(usampler3D, vec3, _float), ToLower },
+
+ { () => ShaderDefinition.Texture(samplerCube, vec3), ToLower },
+ { () => ShaderDefinition.Texture(samplerCube, vec3, _float), ToLower },
+ { () => ShaderDefinition.Texture(isamplerCube, vec3), ToLower },
+ { () => ShaderDefinition.Texture(isamplerCube, vec3, _float), ToLower },
+ { () => ShaderDefinition.Texture(usamplerCube, vec3), ToLower },
+ { () => ShaderDefinition.Texture(usamplerCube, vec3, _float), ToLower },
+
+ { () => ShaderDefinition.Texture(sampler1DShadow, vec3), ToLower },
+ { () => ShaderDefinition.Texture(sampler1DShadow, vec3, _float), ToLower },
+ { () => ShaderDefinition.Texture(sampler2DShadow, vec3), ToLower },
+ { () => ShaderDefinition.Texture(sampler2DShadow, vec3, _float), ToLower },
+ { () => ShaderDefinition.Texture(samplerCubeShadow, vec4), ToLower },
+ { () => ShaderDefinition.Texture(samplerCubeShadow, vec4, _float), ToLower },
+
+ { () => ShaderDefinition.Texture(sampler2DRect, vec2), ToLower },
+ { () => ShaderDefinition.Texture(isampler2DRect, vec2), ToLower },
+ { () => ShaderDefinition.Texture(usampler2DRect, vec2), ToLower },
+
+ { () => ShaderDefinition.TextureProj(sampler1D, vec2), ToLower },
+ { () => ShaderDefinition.TextureProj(sampler1D, vec2, _float), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler1D, vec2), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler1D, vec2, _float), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler1D, vec2), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler1D, vec2, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProj(sampler1D, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(sampler1D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler1D, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler1D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler1D, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler1D, vec4, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProj(sampler2D, vec3), ToLower },
+ { () => ShaderDefinition.TextureProj(sampler2D, vec3, _float), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler2D, vec3), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler2D, vec3, _float), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler2D, vec3), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler2D, vec3, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProj(sampler2D, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(sampler2D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler2D, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler2D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler2D, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler2D, vec4, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProj(sampler3D, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(sampler3D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler3D, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler3D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler3D, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler3D, vec4, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProj(sampler1DShadow, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(sampler1DShadow, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProj(sampler2DShadow, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(sampler2DShadow, vec4, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProj(sampler2DRect, vec3), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler2DRect, vec3), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler2DRect, vec3), ToLower },
+
+ { () => ShaderDefinition.TextureProj(sampler2DRect, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(isampler2DRect, vec4), ToLower },
+ { () => ShaderDefinition.TextureProj(usampler2DRect, vec4), ToLower },
+
+ { () => ShaderDefinition.TextureProj(sampler2DRectShadow, vec4), ToLower },
+
+ { () => ShaderDefinition.TextureLod(sampler1D, _float, _float), ToLower },
+ { () => ShaderDefinition.TextureLod(isampler1D, _float, _float), ToLower },
+ { () => ShaderDefinition.TextureLod(usampler1D, _float, _float), ToLower },
+
+ { () => ShaderDefinition.TextureLod(sampler2D, vec2, _float), ToLower },
+ { () => ShaderDefinition.TextureLod(isampler2D, vec2, _float), ToLower },
+ { () => ShaderDefinition.TextureLod(usampler2D, vec2, _float), ToLower },
+
+ { () => ShaderDefinition.TextureLod(sampler3D, vec3, _float), ToLower },
+ { () => ShaderDefinition.TextureLod(isampler3D, vec3, _float), ToLower },
+ { () => ShaderDefinition.TextureLod(usampler3D, vec3, _float), ToLower },
+
+ { () => ShaderDefinition.TextureLod(samplerCube, vec3, _float), ToLower },
+ { () => ShaderDefinition.TextureLod(isamplerCube, vec3, _float), ToLower },
+ { () => ShaderDefinition.TextureLod(usamplerCube, vec3, _float), ToLower },
+
+ { () => ShaderDefinition.TextureLod(sampler1DShadow, vec3, _float), ToLower },
+ { () => ShaderDefinition.TextureLod(sampler2DShadow, vec3, _float), ToLower },
+
+ { () => ShaderDefinition.TextureOffset(sampler1D, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureOffset(sampler1D, _float, _int, _float), ToLower },
+ { () => ShaderDefinition.TextureOffset(isampler1D, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureOffset(isampler1D, _float, _int, _float), ToLower },
+ { () => ShaderDefinition.TextureOffset(usampler1D, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureOffset(usampler1D, _float, _int, _float), ToLower },
+
+ { () => ShaderDefinition.TextureOffset(sampler2D, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureOffset(sampler2D, vec2, ivec2, _float), ToLower },
+ { () => ShaderDefinition.TextureOffset(isampler2D, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureOffset(isampler2D, vec2, ivec2, _float), ToLower },
+ { () => ShaderDefinition.TextureOffset(usampler2D, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureOffset(usampler2D, vec2, ivec2, _float), ToLower },
+
+ { () => ShaderDefinition.TextureOffset(sampler3D, vec3, ivec3), ToLower },
+ { () => ShaderDefinition.TextureOffset(sampler3D, vec3, ivec3, _float), ToLower },
+ { () => ShaderDefinition.TextureOffset(isampler3D, vec3, ivec3), ToLower },
+ { () => ShaderDefinition.TextureOffset(isampler3D, vec3, ivec3, _float), ToLower },
+ { () => ShaderDefinition.TextureOffset(usampler3D, vec3, ivec3), ToLower },
+ { () => ShaderDefinition.TextureOffset(usampler3D, vec3, ivec3, _float), ToLower },
+
+ { () => ShaderDefinition.TextureOffset(sampler2DRect, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureOffset(isampler2DRect, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureOffset(usampler2DRect, vec2, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureOffset(sampler2DRectShadow, vec3, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureOffset(sampler1DShadow, vec3, _int, _float), ToLower },
+ { () => ShaderDefinition.TextureOffset(sampler2DShadow, vec3, ivec2, _float), ToLower },
+
+ { () => ShaderDefinition.TexelFetch(sampler1D, _int, _int), ToLower },
+ { () => ShaderDefinition.TexelFetch(isampler1D, _int, _int), ToLower },
+ { () => ShaderDefinition.TexelFetch(usampler1D, _int, _int), ToLower },
+
+ { () => ShaderDefinition.TexelFetch(sampler2D, ivec2, _int), ToLower },
+ { () => ShaderDefinition.TexelFetch(isampler2D, ivec2, _int), ToLower },
+ { () => ShaderDefinition.TexelFetch(usampler2D, ivec2, _int), ToLower },
+
+ { () => ShaderDefinition.TexelFetch(sampler3D, ivec3, _int), ToLower },
+ { () => ShaderDefinition.TexelFetch(isampler3D, ivec3, _int), ToLower },
+ { () => ShaderDefinition.TexelFetch(usampler3D, ivec3, _int), ToLower },
+
+ { () => ShaderDefinition.TexelFetch(sampler2DRect, ivec2), ToLower },
+ { () => ShaderDefinition.TexelFetch(isampler2DRect, ivec2), ToLower },
+ { () => ShaderDefinition.TexelFetch(usampler2DRect, ivec2), ToLower },
+
+ { () => ShaderDefinition.TexelFetchOffset(sampler1D, _int, _int, _int), ToLower },
+ { () => ShaderDefinition.TexelFetchOffset(isampler1D, _int, _int, _int), ToLower },
+ { () => ShaderDefinition.TexelFetchOffset(usampler1D, _int, _int, _int), ToLower },
+
+ { () => ShaderDefinition.TexelFetchOffset(sampler2D, ivec2, _int, ivec2), ToLower },
+ { () => ShaderDefinition.TexelFetchOffset(isampler2D, ivec2, _int, ivec2), ToLower },
+ { () => ShaderDefinition.TexelFetchOffset(usampler2D, ivec2, _int, ivec2), ToLower },
+
+ { () => ShaderDefinition.TexelFetchOffset(sampler3D, ivec3, _int, ivec3), ToLower },
+ { () => ShaderDefinition.TexelFetchOffset(isampler3D, ivec3, _int, ivec3), ToLower },
+ { () => ShaderDefinition.TexelFetchOffset(usampler3D, ivec3, _int, ivec3), ToLower },
+
+ { () => ShaderDefinition.TexelFetchOffset(sampler2DRect, ivec2, ivec2), ToLower },
+ { () => ShaderDefinition.TexelFetchOffset(isampler2DRect, ivec2, ivec2), ToLower },
+ { () => ShaderDefinition.TexelFetchOffset(usampler2DRect, ivec2, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjOffset(sampler1D, vec2, _int), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(sampler1D, vec2, _int, _float), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler1D, vec2, _int), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler1D, vec2, _int, _float), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler1D, vec2, _int), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler1D, vec2, _int, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjOffset(sampler1D, vec4, _int), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(sampler1D, vec4, _int, _float), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler1D, vec4, _int), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler1D, vec4, _int, _float), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler1D, vec4, _int), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler1D, vec4, _int, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjOffset(sampler2D, vec3, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(sampler2D, vec3, ivec2, _float), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler2D, vec3, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler2D, vec3, ivec2, _float), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler2D, vec3, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler2D, vec3, ivec2, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjOffset(sampler2D, vec4, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(sampler2D, vec4, ivec2, _float), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler2D, vec4, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler2D, vec4, ivec2, _float), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler2D, vec4, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler2D, vec4, ivec2, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjOffset(sampler3D, vec4, ivec3), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(sampler3D, vec4, ivec3, _float), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler3D, vec4, ivec3), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler3D, vec4, ivec3, _float), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler3D, vec4, ivec3), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler3D, vec4, ivec3, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjOffset(sampler1DShadow, vec4, _int), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(sampler1DShadow, vec4, _int, _float), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(sampler2DShadow, vec4, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(sampler2DShadow, vec4, ivec2, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjOffset(sampler2DRect, vec3, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler2DRect, vec3, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler2DRect, vec3, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjOffset(sampler2DRect, vec4, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(isampler2DRect, vec4, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjOffset(usampler2DRect, vec4, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjOffset(sampler2DRectShadow, vec4, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureLodOffset(sampler1D, _float, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureLodOffset(isampler1D, _float, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureLodOffset(usampler1D, _float, _float, _int), ToLower },
+
+ { () => ShaderDefinition.TextureLodOffset(sampler2D, vec2, _float, ivec2), ToLower },
+ { () => ShaderDefinition.TextureLodOffset(isampler2D, vec2, _float, ivec2), ToLower },
+ { () => ShaderDefinition.TextureLodOffset(usampler2D, vec2, _float, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureLodOffset(sampler3D, vec3, _float, ivec3), ToLower },
+ { () => ShaderDefinition.TextureLodOffset(isampler3D, vec3, _float, ivec3), ToLower },
+ { () => ShaderDefinition.TextureLodOffset(usampler3D, vec3, _float, ivec3), ToLower },
+
+ { () => ShaderDefinition.TextureLodOffset(sampler1DShadow, vec3, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureLodOffset(sampler2DShadow, vec3, _float, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjLod(sampler1D, vec2, _float), ToLower },
+ { () => ShaderDefinition.TextureProjLod(isampler1D, vec2, _float), ToLower },
+ { () => ShaderDefinition.TextureProjLod(usampler1D, vec2, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjLod(sampler1D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProjLod(isampler1D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProjLod(usampler1D, vec4, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjLod(sampler2D, vec3, _float), ToLower },
+ { () => ShaderDefinition.TextureProjLod(isampler2D, vec3, _float), ToLower },
+ { () => ShaderDefinition.TextureProjLod(usampler2D, vec3, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjLod(sampler2D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProjLod(isampler2D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProjLod(usampler2D, vec4, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjLod(sampler3D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProjLod(isampler3D, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProjLod(usampler3D, vec4, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjLod(sampler1DShadow, vec4, _float), ToLower },
+ { () => ShaderDefinition.TextureProjLod(sampler2DShadow, vec4, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjLodOffset(sampler1D, vec2, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureProjLodOffset(isampler1D, vec2, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureProjLodOffset(usampler1D, vec2, _float, _int), ToLower },
+
+ { () => ShaderDefinition.TextureProjLodOffset(sampler1D, vec4, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureProjLodOffset(isampler1D, vec4, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureProjLodOffset(usampler1D, vec4, _float, _int), ToLower },
+
+ { () => ShaderDefinition.TextureProjLodOffset(sampler2D, vec3, _float, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjLodOffset(isampler2D, vec3, _float, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjLodOffset(usampler2D, vec3, _float, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjLodOffset(sampler2D, vec4, _float, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjLodOffset(isampler2D, vec4, _float, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjLodOffset(usampler2D, vec4, _float, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjLodOffset(sampler3D, vec4, _float, ivec3), ToLower },
+ { () => ShaderDefinition.TextureProjLodOffset(isampler3D, vec4, _float, ivec3), ToLower },
+ { () => ShaderDefinition.TextureProjLodOffset(usampler3D, vec4, _float, ivec3), ToLower },
+
+ { () => ShaderDefinition.TextureProjLodOffset(sampler1DShadow, vec4, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureProjLodOffset(sampler2DShadow, vec4, _float, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureGrad(sampler1D, _float, _float, _float), ToLower },
+ { () => ShaderDefinition.TextureGrad(isampler1D, _float, _float, _float), ToLower },
+ { () => ShaderDefinition.TextureGrad(usampler1D, _float, _float, _float), ToLower },
+
+ { () => ShaderDefinition.TextureGrad(sampler2D, vec2, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureGrad(isampler2D, vec2, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureGrad(usampler2D, vec2, vec2, vec2), ToLower },
+
+ { () => ShaderDefinition.TextureGrad(sampler3D, vec3, vec3, vec3), ToLower },
+ { () => ShaderDefinition.TextureGrad(isampler3D, vec3, vec3, vec3), ToLower },
+ { () => ShaderDefinition.TextureGrad(usampler3D, vec3, vec3, vec3), ToLower },
+
+ { () => ShaderDefinition.TextureGrad(samplerCube, vec3, vec3, vec3), ToLower },
+ { () => ShaderDefinition.TextureGrad(isamplerCube, vec3, vec3, vec3), ToLower },
+ { () => ShaderDefinition.TextureGrad(usamplerCube, vec3, vec3, vec3), ToLower },
+
+ { () => ShaderDefinition.TextureGrad(sampler2DRect, vec2, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureGrad(isampler2DRect, vec2, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureGrad(usampler2DRect, vec2, vec2, vec2), ToLower },
+
+ { () => ShaderDefinition.TextureGrad(sampler2DRectShadow, vec3, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureGrad(sampler1DShadow, vec3, _float, _float), ToLower },
+ { () => ShaderDefinition.TextureGrad(sampler2DShadow, vec3, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureGrad(samplerCubeShadow, vec4, vec3, vec3), ToLower },
+
+ { () => ShaderDefinition.TextureGradOffset(sampler1D, _float, _float, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureGradOffset(isampler1D, _float, _float, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureGradOffset(usampler1D, _float, _float, _float, _int), ToLower },
+
+ { () => ShaderDefinition.TextureGradOffset(sampler2D, vec2, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureGradOffset(isampler2D, vec2, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureGradOffset(usampler2D, vec2, vec2, vec2, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureGradOffset(sampler3D, vec3, vec3, vec3, ivec3), ToLower },
+ { () => ShaderDefinition.TextureGradOffset(isampler3D, vec3, vec3, vec3, ivec3), ToLower },
+ { () => ShaderDefinition.TextureGradOffset(usampler3D, vec3, vec3, vec3, ivec3), ToLower },
+
+ { () => ShaderDefinition.TextureGradOffset(sampler2DRect, vec2, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureGradOffset(isampler2DRect, vec2, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureGradOffset(usampler2DRect, vec2, vec2, vec2, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureGradOffset(sampler2DRectShadow, vec3, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureGradOffset(sampler1DShadow, vec3, _float, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureGradOffset(sampler2DShadow, vec3, vec2, vec2, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjGrad(sampler1D, vec2, _float, _float), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(isampler1D, vec2, _float, _float), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(usampler1D, vec2, _float, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjGrad(sampler1D, vec4, _float, _float), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(isampler1D, vec4, _float, _float), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(usampler1D, vec4, _float, _float), ToLower },
+
+ { () => ShaderDefinition.TextureProjGrad(sampler2D, vec3, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(isampler2D, vec3, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(usampler2D, vec3, vec2, vec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjGrad(sampler2D, vec4, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(isampler2D, vec4, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(usampler2D, vec4, vec2, vec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjGrad(sampler3D, vec4, vec3, vec3), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(isampler3D, vec4, vec3, vec3), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(usampler3D, vec4, vec3, vec3), ToLower },
+
+ { () => ShaderDefinition.TextureProjGrad(sampler2DRect, vec3, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(isampler2DRect, vec3, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(usampler2DRect, vec3, vec2, vec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjGrad(sampler2DRect, vec4, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(isampler2DRect, vec4, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(usampler2DRect, vec4, vec2, vec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjGrad(sampler2DRectShadow, vec4, vec2, vec2), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(sampler1DShadow, vec4, _float, _float), ToLower },
+ { () => ShaderDefinition.TextureProjGrad(sampler2DShadow, vec4, vec2, vec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjGradOffset(sampler1D, vec2, _float, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(isampler1D, vec2, _float, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(usampler1D, vec2, _float, _float, _int), ToLower },
+
+ { () => ShaderDefinition.TextureProjGradOffset(sampler1D, vec4, _float, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(isampler1D, vec4, _float, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(usampler1D, vec4, _float, _float, _int), ToLower },
+
+ { () => ShaderDefinition.TextureProjGradOffset(sampler2D, vec3, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(isampler2D, vec3, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(usampler2D, vec3, vec2, vec2, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjGradOffset(sampler2D, vec4, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(isampler2D, vec4, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(usampler2D, vec4, vec2, vec2, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjGradOffset(sampler3D, vec4, vec3, vec3, ivec3), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(isampler3D, vec4, vec3, vec3, ivec3), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(usampler3D, vec4, vec3, vec3, ivec3), ToLower },
+
+ { () => ShaderDefinition.TextureProjGradOffset(sampler2DRect, vec3, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(isampler2DRect, vec3, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(usampler2DRect, vec3, vec2, vec2, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjGradOffset(sampler2DRect, vec4, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(isampler2DRect, vec4, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(usampler2DRect, vec4, vec2, vec2, ivec2), ToLower },
+
+ { () => ShaderDefinition.TextureProjGradOffset(sampler2DRectShadow, vec4, vec2, vec2, ivec2), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(sampler1DShadow, vec4, _float, _float, _int), ToLower },
+ { () => ShaderDefinition.TextureProjGradOffset(sampler2DShadow, vec4, vec2, vec2, ivec2), ToLower },
+
+ #endregion
};
}
6 IIS.SLSharp/Translation/HLSL/HlslVisitor.ShaderDef.cs
View
@@ -432,14 +432,14 @@ public HlslVisitor()
#endregion
- { () => ShaderDefinition.texture(sampler2D, vec2), Rename("tex2D") },
+ { () => ShaderDefinition.Texture(sampler2D, vec2), Rename("tex2D") },
// we need to wrap this into tex2DBias(sampler, new vec4(vec2, 0.0, float)
//{ () => ShaderDefinition.texture(sampler2D, vec2, _float), Redirect<Workarounds.Texture>("tex2Dbias") },
- { () => ShaderDefinition.textureGrad(sampler2D, vec2, vec2, vec2), Rename("tex2Dgrad") },
+ { () => ShaderDefinition.TextureGrad(sampler2D, vec2, vec2, vec2), Rename("tex2Dgrad") },
- { () => ShaderDefinition.textureLod(sampler2D, vec2, _float), TextureLod }
+ { () => ShaderDefinition.TextureLod(sampler2D, vec2, _float), TextureLod }
};
}
21 IIS.SLSharp/Translation/VisitorBase.ShaderDef.cs
View
@@ -15,7 +15,25 @@ internal abstract partial class VisitorBase
// ReSharper disable InconsistentNaming
// ReSharper disable UnusedMember.Local
#pragma warning disable 649
+ protected static readonly ShaderDefinition.sampler1D sampler1D;
+ protected static readonly ShaderDefinition.isampler1D isampler1D;
+ protected static readonly ShaderDefinition.usampler1D usampler1D;
protected static readonly ShaderDefinition.sampler2D sampler2D;
+ protected static readonly ShaderDefinition.isampler2D isampler2D;
+ protected static readonly ShaderDefinition.usampler2D usampler2D;
+ protected static readonly ShaderDefinition.sampler3D sampler3D;
+ protected static readonly ShaderDefinition.isampler3D isampler3D;
+ protected static readonly ShaderDefinition.usampler3D usampler3D;
+ protected static readonly ShaderDefinition.samplerCube samplerCube;
+ protected static readonly ShaderDefinition.isamplerCube isamplerCube;
+ protected static readonly ShaderDefinition.usamplerCube usamplerCube;
+ protected static readonly ShaderDefinition.sampler1DShadow sampler1DShadow;
+ protected static readonly ShaderDefinition.sampler2DShadow sampler2DShadow;
+ protected static readonly ShaderDefinition.samplerCubeShadow samplerCubeShadow;
+ protected static readonly ShaderDefinition.sampler2DRect sampler2DRect;
+ protected static readonly ShaderDefinition.isampler2DRect isampler2DRect;
+ protected static readonly ShaderDefinition.usampler2DRect usampler2DRect;
+ protected static readonly ShaderDefinition.sampler2DRectShadow sampler2DRectShadow;
protected static ShaderDefinition.vec2 vec2;
protected static ShaderDefinition.vec3 vec3;
protected static ShaderDefinition.vec4 vec4;
@@ -94,7 +112,8 @@ protected StringBuilder PassThrough(MethodDefinition m, InvocationExpression i)
protected StringBuilder ToLower(MethodDefinition m, InvocationExpression i)
{
var result = new StringBuilder();
- return result.Append(m.Name.ToLowerInvariant()).Append("(").Append(ArgsToString(i.Arguments)).Append(")");
+ var lowerName = Char.ToLowerInvariant(m.Name[0]) + m.Name.Substring(1);
+ return result.Append(lowerName).Append("(").Append(ArgsToString(i.Arguments)).Append(")");
}
private void CheckWarnings(MethodDefinition def)
Please sign in to comment.
Something went wrong with that request. Please try again.