Просмотр исходного кода

Removing GLSL code from many shaders, in preparation for unified shading language support

BearishSun 8 лет назад
Родитель
Сommit
73ef6ed764

+ 2 - 36
Data/Examples/Example.bsl

@@ -1,4 +1,5 @@
 #include "$ENGINE$\BasePass.bslinc"
+#include "$ENGINE$\Surface.bslinc"
 
 Parameters = 
 {
@@ -8,8 +9,6 @@ Parameters =
 
 Technique : base("Surface") =
 {
-	Language = "HLSL11";
-	
 	Pass = 
 	{
 		Fragment =
@@ -33,37 +32,4 @@ Technique : base("Surface") =
 			}	
 		};
 	};
-};
-
-Technique : base("Surface") =
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Fragment =
-		{
-			layout(location = 0) in vec2 uv0;
-			layout(location = 1) in vec3 worldPosition;
-			layout(location = 2) in vec3 tangentToWorldZ;
-			layout(location = 3) in vec4 tangentToWorldX;			
-		
-			layout(binding = 4) uniform sampler2D tex;
-
-			layout(location = 0) out vec4 fragColor[3];
-			
-			void main()
-			{
-				SurfaceData surfaceData;
-				surfaceData.albedo = texture(tex, uv0);
-				surfaceData.worldNormal.xyz = tangentToWorldZ;
-				surfaceData.roughness = 1.0f;
-				surfaceData.metalness = 0.0f;
-				
-				encodeGBuffer(surfaceData, fragColor[0], fragColor[1], fragColor[2]);
-			}	
-		};
-	};
-};
-
-#include "$ENGINE$\Surface.bslinc"
+};

+ 4 - 97
Data/Raw/Engine/Includes/BasePass.bslinc

@@ -11,8 +11,6 @@
 
 Technique : base("BasePassCommon") =
 {
-	Language = "HLSL11";
-	
 	Pass =
 	{
 		Vertex =
@@ -56,92 +54,7 @@ Technique
  : inherits("PerObjectData")
  : inherits("NormalVertexInput")
  : inherits("BasePassCommon") =
-{ 
-	Language = "HLSL11";
-};
-
-Technique
- : base("BasePassSkinned")
- : inherits("GBufferOutput")
- : inherits("PerCameraData")
- : inherits("PerObjectData")
- : inherits("SkinnedVertexInput")
- : inherits("BasePassCommon") =
-{
-	Language = "HLSL11";
-};
-
-Technique
- : base("BasePassMorph")
- : inherits("GBufferOutput")
- : inherits("PerCameraData")
- : inherits("PerObjectData")
- : inherits("MorphVertexInput")
- : inherits("BasePassCommon") =
-{
-	Language = "HLSL11";
-};
-
-Technique
- : base("BasePassSkinnedMorph")
- : inherits("GBufferOutput")
- : inherits("PerCameraData")
- : inherits("PerObjectData")
- : inherits("SkinnedMorphVertexInput")
- : inherits("BasePassCommon") =
-{
-	Language = "HLSL11";
-};
-
-Technique 
-	: base("BasePassCommon") =
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Vertex =
-		{			
-			void main()
-			{
-				VertexIntermediate intermediate;
-				getVertexIntermediate(intermediate);
-			
-				vec4 worldPos;
-				getVertexWorldPosition(intermediate, worldPos);
-				
-				outWorldPosition = worldPos.xyz;
-				gl_Position = gMatViewProj * worldPos;
-				
-				populateVertexOutput(intermediate);
-			}
-		};
-		
-		Fragment =
-		{
-			vec3 calcWorldNormal(vec3 normal, vec4 tangent, vec3 surfaceNormal)
-			{
-				vec3 tangentToWorldX = tangent.xyz;
-				vec3 tangentToWorldZ = normal;
-				vec3 tangentToWorldY = cross(tangentToWorldZ, tangentToWorldX) * tangent.w;
-				
-				mat3 tangentToWorld = mat3(tangentToWorldX, tangentToWorldY, tangentToWorldZ);
-				return normalize(tangentToWorld * surfaceNormal);
-			}
-		};
-	};
-};
-
-Technique
- : base("BasePass")
- : inherits("GBufferOutput")
- : inherits("PerCameraData")
- : inherits("PerObjectData")
- : inherits("NormalVertexInput")
- : inherits("BasePassCommon") =
-{ 
-	Language = "GLSL";
-};
+{ };
 
 Technique
  : base("BasePassSkinned")
@@ -150,9 +63,7 @@ Technique
  : inherits("PerObjectData")
  : inherits("SkinnedVertexInput")
  : inherits("BasePassCommon") =
-{
-	Language = "GLSL";
-};
+{ };
 
 Technique
  : base("BasePassMorph")
@@ -161,9 +72,7 @@ Technique
  : inherits("PerObjectData")
  : inherits("MorphVertexInput")
  : inherits("BasePassCommon") =
-{
-	Language = "GLSL";
-};
+{ };
 
 Technique
  : base("BasePassSkinnedMorph")
@@ -172,6 +81,4 @@ Technique
  : inherits("PerObjectData")
  : inherits("SkinnedMorphVertexInput")
  : inherits("BasePassCommon") =
-{
-	Language = "GLSL";
-};
+{ };

+ 0 - 2
Data/Raw/Engine/Includes/GBufferInput.bslinc

@@ -18,8 +18,6 @@ Technique
  : inherits("PerCameraData")
  : base("GBufferInput") =
 {
-	Language = "HLSL11";
-
 	Pass =
 	{
 		Common = 

+ 0 - 24
Data/Raw/Engine/Includes/GBufferOutput.bslinc

@@ -4,8 +4,6 @@ Technique
  : inherits("SurfaceData")
  : base("GBufferOutput") =
 {
-	Language = "HLSL11";
-
 	Pass =
 	{
 		Common = 
@@ -20,26 +18,4 @@ Technique
 			}
 		};
 	};
-};
-
-Technique 
- : inherits("SurfaceData")
- : base("GBufferOutput") =
-{
-	Language = "GLSL";
-
-	Pass =
-	{
-		Common = 
-		{
-			void encodeGBuffer(SurfaceData data, out vec4 GBufferAData, out vec4 GBufferBData, out vec4 GBufferCData)
-			{
-				GBufferAData = data.albedo;
-				GBufferBData.xyz = vec3(data.worldNormal.xyz * 0.5f + 0.5f);
-				GBufferBData.w = 1.0f; // Marks that some deferred data was written
-				GBufferCData.x = data.roughness;
-				GBufferCData.y = data.metalness;
-			}
-		};
-	};
 };

+ 0 - 15
Data/Raw/Engine/Includes/ImageBasedLighting.bslinc

@@ -4,8 +4,6 @@ Technique
  : base("ImageBasedLighting")
  : inherits("ReflectionCubemapCommon") =
 {
-	Language = "HLSL11";
-
 	Pass =
 	{
 		Common = 
@@ -213,17 +211,4 @@ Technique
 			}		
 		};
 	};
-};
-
-Technique : base("ImageBasedLighting") =
-{
-	Language = "GLSL";
-
-	Pass =
-	{
-		Common = 
-		{
-		
-		};
-	};
 };

+ 0 - 62
Data/Raw/Engine/Includes/LightGridCommon.bslinc

@@ -1,7 +1,5 @@
 Technique : base("LightGridCommon") =
 {
-	Language = "HLSL11";
-	
 	Pass =
 	{
 		Common = 
@@ -58,64 +56,4 @@ Technique : base("LightGridCommon") =
 			}
 		};
 	};
-};
-
-Technique : base("LightGridCommon") = 
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Common = 
-		{
-			layout(binding = 4, std140) uniform GridParams
-			{
-				// Offsets at which specific light types begin in gLights buffer
-				// Assumed directional lights start at 0
-				// x - offset to point lights, y - offset to spot lights, z - total number of lights
-				uvec3 gLightOffsets;			
-				uint gNumCells;
-				uvec3 gGridSize;
-				uint gMaxNumLightsPerCell;
-				uvec2 gGridPixelSize;
-			};
-			
-			float convertToNDCZ(float viewZ)
-			{
-				return -gNDCZToWorldZ.y + (gNDCZToWorldZ.x / viewZ);
-			}
-			
-			float calcViewZFromCellZ(uint cellZ)
-			{
-				// See HLSL version for reasons behind this formulation
-			
-				// Note: Some of these calculations could be moved to CPU
-				float viewZ = (pow(cellZ, 2) / pow(gGridSize.z, 2)) * (gNearFar.y - gNearFar.x) + gNearFar.x; 
-				return -viewZ;
-			}
-			
-			uint calcCellZFromViewZ(float viewZ)
-			{
-				// Inverse of calculation in calcViewZFromCellZ
-				uint cellZ = min(uint(floor(sqrt(((-viewZ - gNearFar.x)*pow(gGridSize.z, 2))/(gNearFar.y - gNearFar.x)))), gGridSize.z);
-				
-				return cellZ;
-			}
-			
-			int calcCellIdx(uvec2 pixelPos, float deviceZ)
-			{
-				// OpenGL uses lower left for window space origin, we use upper-left
-				#ifdef OPENGL
-					pixelPos.y = gViewportRectangle.w - pixelPos.y;
-				#endif
-			
-				// Note: Use bitshift to divide since gGridPixelSize will be a power of 2
-				uvec2 cellXY = pixelPos / gGridPixelSize;
-				uint cellZ = calcCellZFromViewZ(convertFromDeviceZ(deviceZ));
-								
-				int cellIdx = int((cellZ * gGridSize.y + cellXY.y) * gGridSize.x + cellXY.x);
-				return cellIdx;
-			}
-		};
-	};
 };

+ 0 - 114
Data/Raw/Engine/Includes/LightingCommon.bslinc

@@ -4,8 +4,6 @@ Technique
  : base("LightingCommon")
  : inherits("SurfaceData") =
 {
-	Language = "HLSL11";
-	
 	Pass =
 	{
 		Common = 
@@ -376,116 +374,4 @@ Technique
 			}
 		};
 	};
-};
-
-Technique
- : base("LightingCommon")
- : inherits("SurfaceData") =
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Common = 
-		{
-			#define PI 3.1415926
-			#define HALF_PI 1.5707963
-			
-			struct LightData
-			{
-				vec3 position;
-				float attRadius;
-				float srcRadius;
-				vec3 direction;
-				float luminance;
-				vec3 spotAngles;
-				float attRadiusSqrdInv;
-				vec3 color;
-				vec3 spotDiscPosition;
-			};
-									
-			vec3 calcMicrofacetFresnelShlick(vec3 F0, float LoH)
-			{
-				return F0 + (1.0f - F0) * pow(1.0f - LoH, 5.0f);
-			}
-
-			float calcMicrofacetShadowingSmithGGX(float roughness, float NoV, float NoL)
-			{
-				// Note: It's probably better to use the joint shadowing + masking version of this function
-				// Note: Pull these multiplies out, since they're used by the distribution function as well?
-				float roughness2 = roughness * roughness;
-				float roughness4 = roughness2 * roughness2;
-
-				// Note: Original GGX G1 multiplied by NoV & NoL (respectively), so that the microfacet function divisor gets canceled out
-				// See HLSL code for derivation
-				
-				float g1V = NoV + sqrt(NoV * (NoV - NoV * roughness4) + roughness4);
-				float g1L = NoL + sqrt(NoL * (NoL - NoL * roughness4) + roughness4);
-				return 1.0f / (g1V * g1L);
-			}
-			
-			float calcMicrofacetDistGGX(float roughness, float NoH)
-			{
-				float roughness2 = roughness * roughness;
-				float roughness4 = roughness2 * roughness2;
-				
-				float d = (NoH * roughness4 - NoH) * NoH + 1.0f;
-				return roughness4 / (PI * d * d);
-			}
-			
-			float calcDiffuseLambert(float color)
-			{
-				return color * (1.0f / PI);
-			}
-									
-			float getSpotAttenuation(vec3 worldPosToLight, vec3 direction, vec3 angles)
-			{
-				float atten = clamp((dot(-worldPosToLight, direction) - angles.y) * angles.z, 0.0, 1.0);
-				return atten * atten;
-			}
-			
-			vec3 getDirLightContibution(SurfaceData surfaceData, LightData lightData)
-			{
-				vec3 N = surfaceData.worldNormal.xyz;
-				vec3 L = -lightData.direction;
-				
-				float NoL = clamp(dot(N, L), 0.0, 1.0); // TODO - Add bias here?
-				return lightData.color * lightData.luminance * NoL;
-			}
-			
-			vec3 getPointLightContribution(vec3 L, vec3 worldPosition, SurfaceData surfaceData, LightData lightData)
-			{
-				vec3 N = surfaceData.worldNormal.xyz;
-
-				float distanceSqrd = dot(L, L);
-				float distanceAttenuation = 1/(distanceSqrd + 1);
-				
-				L = normalize(L);
-				float NoL = clamp(dot(N, L), 0.0, 1.0); // TODO - Add bias here?
-
-				float radiusAttenuation = distanceSqrd * lightData.attRadiusSqrdInv;
-				radiusAttenuation *= radiusAttenuation;
-				radiusAttenuation = clamp(1.0f - radiusAttenuation, 0.0, 1.0);
-				radiusAttenuation *= radiusAttenuation;
-				
-				float attenuation = distanceAttenuation * radiusAttenuation;
-				return lightData.color * lightData.luminance * ((NoL * attenuation));
-			}
-			
-			vec3 getPointLightContribution(vec3 worldPosition, SurfaceData surfaceData, LightData lightData)
-			{
-				vec3 L = lightData.position - worldPosition;
-				return getPointLightContribution(L, worldPosition, surfaceData, lightData);
-			}
-			
-			vec3 getSpotLightContribution(vec3 worldPosition, SurfaceData surfaceData, LightData lightData)
-			{
-				vec3 L = lightData.position - worldPosition;
-				vec3 pointLightContribution = getPointLightContribution(L, worldPosition, surfaceData, lightData);
-				float spotFalloff = getSpotAttenuation(L, lightData.direction, lightData.spotAngles);
-				
-				return pointLightContribution * spotFalloff;
-			}
-		};
-	};
 };

+ 0 - 93
Data/Raw/Engine/Includes/NormalVertexInput.bslinc

@@ -5,8 +5,6 @@ Technique
 	 : base("NormalVertexInput") =
 #endif
 {
-	Language = "HLSL11";
-	
 	Pass =
 	{
 		Common = 
@@ -100,95 +98,4 @@ Technique
 			}
 		};
 	};
-};
-
-Technique
-#ifdef USE_BLEND_SHAPES
-	 : base("MorphVertexInput") =
-#else
-	 : base("NormalVertexInput") =
-#endif
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Vertex =
-		{			
-			layout(location = 0) in vec3 bs_position;
-			layout(location = 1) in vec3 bs_normal;
-			layout(location = 2) in vec4 bs_tangent;
-			layout(location = 3) in vec2 bs_texcoord0;
-		
-			#ifdef USE_BLEND_SHAPES
-				layout(location = 4) in vec3 bs_position1;
-				layout(location = 5) in vec4 bs_normal1;
-			#endif
-		
-			layout(location = 0) out vec2 outUV0;
-			layout(location = 1) out vec3 outWorldPosition;
-			layout(location = 2) out vec3 outTangentToWorldZ;
-			layout(location = 3) out vec4 outTangentToWorldX;	
-		
-			out gl_PerVertex
-			{
-				vec4 gl_Position;
-			};
-		
-			struct VertexIntermediate
-			{
-				vec3 worldNormal;
-				vec4 worldTangent;
-			};
-					
-			void getTangentToLocal(vec3 normal, vec3 tangent, float tangentSign, out mat3 tangentToLocal)
-			{
-				vec3 bitangent = cross(normal, tangent) * tangentSign;
-
-				tangentToLocal[0] = tangent;
-				tangentToLocal[1] = bitangent;
-				tangentToLocal[2] = normal;
-			}
-
-			void getVertexIntermediate(out VertexIntermediate result)
-			{
-				vec3 normal = bs_normal * 2.0f - 1.0f;
-				vec3 tangent = bs_tangent.xyz * 2.0f - 1.0f;
-			
-				#ifdef USE_BLEND_SHAPES
-					vec3 deltaNormal = (bs_normal1.xyz * 2.0f - 1.0f) * 2.0f;
-					normal = normalize(normal + deltaNormal * bs_normal1.w);
-					tangent = normalize(tangent - dot(tangent, normal) * normal);
-				#endif
-			
-				float tangentSign = bs_tangent.w;
-				mat3 tangentToLocal;
-				getTangentToLocal(normal, tangent, tangentSign, tangentToLocal);
-				tangentSign *= gWorldDeterminantSign;
-				
-				mat3 tangentToWorld = mat3(gMatWorldNoScale) * tangentToLocal;
-				result.worldNormal = tangentToWorld[2]; // Normal basis vector
-				result.worldTangent = vec4(tangentToWorld[0].xyz, tangentSign); // Tangent basis vector
-			}
-			
-			void getVertexWorldPosition(VertexIntermediate intermediate, out vec4 result)
-			{
-				#ifdef USE_BLEND_SHAPES
-					vec4 position = vec4(bs_position + bs_position1, 1.0f);
-				#else
-					vec4 position = vec4(bs_position, 1.0f);
-				#endif
-			
-				result = gMatWorld * position;
-			}
-			
-			void populateVertexOutput(VertexIntermediate intermediate)
-			{
-				outUV0 = bs_texcoord0;
-				
-				outTangentToWorldZ = intermediate.worldNormal;
-				outTangentToWorldX = intermediate.worldTangent;
-			}
-		};
-	};
 };

+ 0 - 37
Data/Raw/Engine/Includes/PerCameraData.bslinc

@@ -37,8 +37,6 @@ Blocks =
 
 Technique : base("PerCameraData") =
 {
-	Language = "HLSL11";
-
 	Pass =
 	{
 		Common = 
@@ -74,39 +72,4 @@ Technique : base("PerCameraData") =
 			}
 		};
 	};
-};
-
-Technique : base("PerCameraData") =
-{
-	Language = "GLSL";
-
-	Pass =
-	{
-		Common = 
-		{
-			layout(binding = 0, std140) uniform PerCamera
-			{
-				vec3 gViewDir;
-				vec3 gViewOrigin;
-				mat4 gMatViewProj;
-				mat4 gMatView;
-				mat4 gMatProj;
-				mat4 gMatInvProj;
-				mat4 gMatInvViewProj;
-				mat4 gMatScreenToWorld;
-				vec2 gDeviceZToWorldZ;
-				vec2 gNDCZToWorldZ;
-				vec2 gNearFar;
-				ivec4 gViewportRectangle;
-				vec4 gClipToUVScaleOffset;
-				float gAmbientFactor;
-			};
-			
-			/** Converts Z value in range [0,1] into Z value in view space. */
-			float convertFromDeviceZ(float deviceZ)
-			{
-				return (1.0f / (deviceZ + gDeviceZToWorldZ.y)) * gDeviceZToWorldZ.x;	
-			}
-		};
-	};
 };

+ 0 - 27
Data/Raw/Engine/Includes/PerObjectData.bslinc

@@ -16,8 +16,6 @@ Blocks =
 
 Technique : base("PerObjectData") =
 {
-	Language = "HLSL11";
-
 	Pass =
 	{
 		Common = 
@@ -37,29 +35,4 @@ Technique : base("PerObjectData") =
 			}			
 		};
 	};
-};
-
-Technique : base("PerObjectData") =
-{
-	Language = "GLSL";
-
-	Pass =
-	{
-		Common = 
-		{
-			layout(binding = 2, std140) uniform PerObject
-			{
-				mat4 gMatWorld;
-				mat4 gMatInvWorld;
-				mat4 gMatWorldNoScale;
-				mat4 gMatInvWorldNoScale;
-				float gWorldDeterminantSign;
-			};
-			
-			layout(binding = 3, std140) uniform PerCall
-			{
-				mat4 gMatWorldViewProj;
-			};	
-		};
-	};
 };

+ 0 - 32
Data/Raw/Engine/Includes/ReflectionCubemapCommon.bslinc

@@ -1,7 +1,5 @@
 Technique : base("ReflectionCubemapCommon") =
 {
-	Language = "HLSL11";
-
 	Pass =
 	{
 		Common = 
@@ -65,34 +63,4 @@ Technique : base("ReflectionCubemapCommon") =
 			}	
 		};
 	};
-};
-
-Technique : base("ReflectionCubemapCommon") =
-{
-	Language = "GLSL";
-
-	Pass =
-	{
-		Common = 
-		{
-			vec3 getDirFromCubeFace(uint cubeFace, vec2 uv)
-			{
-				vec3 dir;
-				if(cubeFace == 0)
-					dir = vec3(1.0f, -uv.y, -uv.x);
-				else if(cubeFace == 1)
-					dir = vec3(-1.0f, -uv.y, uv.x);
-				else if(cubeFace == 2)
-					dir = vec3(uv.x, 1.0f, uv.y);
-				else if(cubeFace == 3)
-					dir = vec3(uv.x, -1.0f, -uv.y);
-				else if(cubeFace == 4)
-					dir = vec3(uv.x, -uv.y, 1.0f);
-				else
-					dir = vec3(-uv.x, -uv.y, -1.0f);
-					
-				return dir;
-			}			
-		};
-	};
 };

+ 0 - 2
Data/Raw/Engine/Includes/SHCommon.bslinc

@@ -1,7 +1,5 @@
 Technique : base("SHCommon") =
 {
-	Language = "HLSL11";
-
 	Pass =
 	{
 		Common = 

+ 2 - 138
Data/Raw/Engine/Includes/SkinnedVertexInput.bslinc

@@ -10,8 +10,6 @@ Technique
 	: base("SkinnedVertexInput") =
 #endif
 {
-	Language = "HLSL11";
-
 	Pass =
 	{
 		Common = 
@@ -29,7 +27,7 @@ Technique
 
 		Vertex =
 		{
-			StructuredBuffer<float4> boneMatrices;
+			Buffer<float4> boneMatrices;
 		
 			struct VertexInput
 			{
@@ -135,138 +133,4 @@ Technique
 			}
 		};
 	};
-};
-
-Technique
-#ifdef USE_BLEND_SHAPES
-	: base("SkinnedMorphVertexInput") =
-#else
-	: base("SkinnedVertexInput") =
-#endif
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Vertex =
-		{			
-			layout(location = 0) in vec3 bs_position;
-			layout(location = 1) in vec3 bs_normal;
-			layout(location = 2) in vec4 bs_tangent;
-			layout(location = 3) in vec2 bs_texcoord0;
-		
-			layout(location = 4) in ivec4 bs_blendindices;
-			layout(location = 5) in vec4 bs_blendweights;
-				
-			#ifdef USE_BLEND_SHAPES
-				layout(location = 6) in vec3 bs_position1;
-				layout(location = 7) in vec4 bs_normal1;
-			#endif
-			
-			layout(location = 0) out vec2 outUV0;
-			layout(location = 1) out vec3 outWorldPosition;
-			layout(location = 2) out vec3 outTangentToWorldZ;
-			layout(location = 3) out vec4 outTangentToWorldX;	
-			
-			layout(binding = 3) uniform samplerBuffer boneMatrices;
-		
-			struct VertexIntermediate
-			{
-				mat4x3 blendMatrix;
-			
-				vec3 worldNormal;
-				vec4 worldTangent;
-			};
-		
-			out gl_PerVertex
-			{
-				vec4 gl_Position;
-			};
-			
-			void getBoneMatrix(int idx, out mat4x3 result)
-			{
-				mat3x4 temp;
-			
-				temp[0] = texelFetch(boneMatrices, idx * 3 + 0);
-				temp[1] = texelFetch(boneMatrices, idx * 3 + 1);
-				temp[2] = texelFetch(boneMatrices, idx * 3 + 2);
-				
-				result = transpose(temp);				
-			}
-			
-			void getBlendMatrix(out mat4x3 result)
-			{
-				mat4x3 boneMatrix;
-				
-				getBoneMatrix(bs_blendindices.x, boneMatrix);
-				result = bs_blendweights.x * boneMatrix;
-				
-				getBoneMatrix(bs_blendindices.y, boneMatrix);
-				result += bs_blendweights.y * boneMatrix;
-				
-				getBoneMatrix(bs_blendindices.z, boneMatrix);
-				result += bs_blendweights.z * boneMatrix;
-				
-				getBoneMatrix(bs_blendindices.w, boneMatrix);
-				result += bs_blendweights.w * boneMatrix;
-			}
-			
-			void getSkinnedTangentToLocal(mat4x3 blendMatrix, out float tangentSign, out mat3x3 tangentToLocal)
-			{
-				tangentSign = bs_tangent.w * 2.0f - 1.0f;
-			
-				vec3 normal = bs_normal * 2.0f - 1.0f;
-				vec3 tangent = bs_tangent.xyz * 2.0f - 1.0f;
-				
-				#ifdef USE_BLEND_SHAPES
-					vec3 deltaNormal = (bs_normal1.xyz * 2.0f - 1.0f) * 2.0f;
-					normal = normalize(normal + deltaNormal * bs_normal1.w);
-					tangent = normalize(tangent - dot(tangent, normal) * normal);
-				#endif
-				
-				normal = (blendMatrix * vec4(normal, 0.0f)).xyz;
-				tangent = (blendMatrix * vec4(tangent, 0.0f)).xyz;
-				
-				vec3 bitangent = cross(normal, tangent) * tangentSign;
-				tangentSign *= gWorldDeterminantSign;
-				
-				tangentToLocal[0] = tangent.xyz;
-				tangentToLocal[1] = bitangent;
-				tangentToLocal[2] = normal;
-			}			
-			
-			void getVertexIntermediate(out VertexIntermediate result)
-			{
-				getBlendMatrix(result.blendMatrix);
-				
-				float tangentSign;
-				mat3 tangentToLocal;
-				getSkinnedTangentToLocal(result.blendMatrix, tangentSign, tangentToLocal);
-				
-				mat3 tangentToWorld = mat3(gMatWorldNoScale) * tangentToLocal;
-				result.worldNormal = tangentToWorld[2]; // Normal basis vector
-				result.worldTangent = vec4(tangentToWorld[0].xyz, tangentSign); // Tangent basis vector				
-			}
-			
-			void getVertexWorldPosition(VertexIntermediate intermediate, out vec4 result)
-			{
-				#ifdef USE_BLEND_SHAPES
-					vec4 position = vec4(bs_position + bs_position1, 1.0f);
-				#else
-					vec4 position = vec4(bs_position, 1.0f);
-				#endif
-			
-				position = vec4(intermediate.blendMatrix * position, 1.0f);
-				result = gMatWorld * position;
-			}
-			
-			void populateVertexOutput(VertexIntermediate intermediate)
-			{
-				outUV0 = bs_texcoord0;
-				
-				outTangentToWorldZ = intermediate.worldNormal;
-				outTangentToWorldX = intermediate.worldTangent;
-			}
-		};
-	};
-};
+};

+ 0 - 31
Data/Raw/Engine/Includes/Surface.bslinc

@@ -27,35 +27,4 @@ Technique
 {
 	Language = "HLSL11";
 	Tags = { "SkinnedMorph" };
-};
-
-Technique 
- : inherits("BasePass")
- : inherits("Surface") =
-{
-	Language = "GLSL";
-};
-
-Technique 
- : inherits("BasePassSkinned")
- : inherits("Surface") =
-{
-	Language = "GLSL";
-	Tags = { "Skinned" };
-};
-
-Technique 
- : inherits("BasePassMorph")
- : inherits("Surface") =
-{
-	Language = "GLSL";
-	Tags = { "Morph" };
-};
-
-Technique 
- : inherits("BasePassSkinnedMorph")
- : inherits("Surface") =
-{
-	Language = "GLSL";
-	Tags = { "SkinnedMorph" };
 };

+ 0 - 22
Data/Raw/Engine/Includes/SurfaceData.bslinc

@@ -1,7 +1,5 @@
 Technique : base("SurfaceData") =
 {
-	Language = "HLSL11";
-
 	Pass =
 	{
 		Common = 
@@ -41,24 +39,4 @@ Technique : base("SurfaceData") =
 #endif			
 		};
 	};
-};
-
-Technique : base("SurfaceData") =
-{
-	Language = "GLSL";
-
-	Pass =
-	{
-		Common = 
-		{
-			struct SurfaceData
-			{
-				vec4 albedo;
-				vec4 worldNormal;
-				float depth;
-				float roughness;
-				float metalness;
-			};
-		};
-	};
 };

+ 0 - 30
Data/Raw/Engine/Shaders/Default.bsl

@@ -3,8 +3,6 @@
 
 Technique : base("Surface") =
 {
-	Language = "HLSL11";
-	
 	Pass =
 	{
 		Fragment =
@@ -25,32 +23,4 @@ Technique : base("Surface") =
 			}	
 		};
 	};
-};
-
-Technique : base("Surface") =
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Fragment =
-		{
-			layout(location = 0) in vec2 uv0;
-			layout(location = 2) in vec3 tangentToWorldZ;
-			layout(location = 3) in vec4 tangentToWorldX;	
-		
-			layout(location = 0) out vec4[3] fragColor;
-		
-			void main()
-			{
-				SurfaceData surfaceData;
-				surfaceData.albedo = vec4(0.05f, 0.05f, 0.05f, 1.0f);
-				surfaceData.worldNormal.xyz = tangentToWorldZ;
-				surfaceData.roughness = 1.0f;
-				surfaceData.metalness = 0.0f;
-				
-				encodeGBuffer(surfaceData, fragColor[0], fragColor[1], fragColor[2]);
-			}	
-		};
-	};
 };

+ 0 - 38
Data/Raw/Engine/Shaders/Diffuse.bsl

@@ -16,8 +16,6 @@ Parameters =
 
 Technique : base("Surface") =
 {
-	Language = "HLSL11";
-	
 	Pass =
 	{
 		Fragment =
@@ -51,40 +49,4 @@ Technique : base("Surface") =
 			}	
 		};
 	};
-};
-
-Technique : base("Surface") =
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Fragment =
-		{
-			layout(location = 0) in vec2 uv0;
-			layout(location = 2) in vec3 tangentToWorldZ;
-			layout(location = 3) in vec4 tangentToWorldX;
-		
-			layout(binding = 4) uniform sampler2D gAlbedoTex;
-			layout(binding = 5) uniform sampler2D gNormalTex;
-			layout(binding = 6) uniform sampler2D gRoughnessTex;
-			layout(binding = 7) uniform sampler2D gMetalnessTex;
-			
-			layout(location = 0) out vec4 fragColor[3];
-			
-			void main()
-			{
-				vec3 normal = normalize(texture(gNormalTex, uv0).xyz * 2.0f - vec3(1, 1, 1));
-				vec3 worldNormal = calcWorldNormal(tangentToWorldZ, tangentToWorldX, normal);
-			
-				SurfaceData surfaceData;
-				surfaceData.albedo = texture(gAlbedoTex, uv0);
-				surfaceData.worldNormal.xyz = worldNormal;
-				surfaceData.roughness = texture(gRoughnessTex, uv0).x;
-				surfaceData.metalness = texture(gMetalnessTex, uv0).x;
-				
-				encodeGBuffer(surfaceData, fragColor[0], fragColor[1], fragColor[2]);
-			}	
-		};
-	};
 };

+ 0 - 118
Data/Raw/Engine/Shaders/LightGridLLCreation.bsl

@@ -163,122 +163,4 @@ Technique
 			}
 		};
 	};
-};
-
-Technique
- : inherits("PerCameraData")
- : inherits("LightingCommon")
- : inherits("LightGridCommon") =
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Compute = 
-		{
-			layout (local_size_x = THREADGROUP_SIZE, local_size_y = THREADGROUP_SIZE, local_size_z = THREADGROUP_SIZE) in;
-		
-			layout(std430, binding = 1) readonly buffer gLights
-			{
-				LightData[] gLightsData;
-			};
-			
-			layout(binding = 2, r32ui) uniform uimageBuffer gLinkedListCounter;
-			layout(binding = 3, r32ui) uniform uimageBuffer gLinkedListHeads;
-			layout(binding = 5, rgba32ui) uniform uimageBuffer gLinkedList;
-			
-			void calcCellAABB(uvec3 cellIdx, out vec3 center, out vec3 extent)
-			{
-				// Convert grid XY coordinates to clip coordinates
-				vec2 a = 2.0f / gGridSize.xy;
-			
-				vec3 ndcMin;
-				vec3 ndcMax;
-			
-				ndcMin.xy = cellIdx.xy * a - vec2(1.0f, 1.0f);
-				ndcMax.xy = (cellIdx.xy + 1) * a - vec2(1.0f, 1.0f);
-			
-				// Flip Y depending on render API, depending if Y in NDC is facing up or down
-				// (We negate the value because we want NDC with Y flipped, so origin is top left)
-				float flipY = -sign(gMatProj[1][1]);
-				ndcMin.y *= flipY;
-				ndcMax.y *= flipY;
-			
-				// Because we're viewing along negative Z, farther end is the minimum
-				float viewZMin = calcViewZFromCellZ(cellIdx.z + 1);
-				float viewZMax = calcViewZFromCellZ(cellIdx.z);
-			
-				ndcMin.z = convertToNDCZ(viewZMax);
-				ndcMax.z = convertToNDCZ(viewZMin);
-							
-				vec4 corner[8];
-				// Near
-				corner[0] = gMatInvProj * vec4(ndcMin.x, ndcMin.y, ndcMin.z, 1.0f);
-				corner[1] = gMatInvProj * vec4(ndcMax.x, ndcMin.y, ndcMin.z, 1.0f);
-				corner[2] = gMatInvProj * vec4(ndcMax.x, ndcMax.y, ndcMin.z, 1.0f);
-				corner[3] = gMatInvProj * vec4(ndcMin.x, ndcMax.y, ndcMin.z, 1.0f);
-			
-				// Far
-				corner[4] = gMatInvProj * vec4(ndcMin.x, ndcMin.y, ndcMax.z, 1.0f);
-				corner[5] = gMatInvProj * vec4(ndcMax.x, ndcMin.y, ndcMax.z, 1.0f);
-				corner[6] = gMatInvProj * vec4(ndcMax.x, ndcMax.y, ndcMax.z, 1.0f);
-				corner[7] = gMatInvProj * vec4(ndcMin.x, ndcMax.y, ndcMax.z, 1.0f);
-			
-				for(uint i = 0; i < 8; ++i)
-					corner[i].xy /= corner[i].w;
-			
-				vec3 viewMin = vec3(corner[0].xy, viewZMin);
-				vec3 viewMax = vec3(corner[0].xy, viewZMax);
-				
-				for(uint i = 1; i < 8; ++i)
-				{
-					viewMin.xy = min(viewMin.xy, corner[i].xy);
-					viewMax.xy = max(viewMax.xy, corner[i].xy);
-				}		
-				
-				extent = (viewMax - viewMin) * 0.5f;
-				center = viewMin + extent;
-			}
-
-			void main()
-			{
-				// Ignore pixels out of valid range
-				if (any(greaterThanEqual(gl_GlobalInvocationID.xy, gGridSize.xy)))
-					return;
-					
-				uint maxNumLinks = gNumCells * gMaxNumLightsPerCell;	
-				uint cellIdx = (gl_GlobalInvocationID.z * gGridSize.y + gl_GlobalInvocationID.y) * gGridSize.x + gl_GlobalInvocationID.x;
-				
-				vec3 cellCenter;
-				vec3 cellExtent;
-				calcCellAABB(gl_GlobalInvocationID, cellCenter, cellExtent);
-				
-				for(uint type = 1; type < 3; ++type)
-				{
-					uint lightOffset = gLightOffsets[type - 1];
-					uint lightEnd = gLightOffsets[type];
-					for(uint i = lightOffset; i < lightEnd; ++i)
-					{
-						vec4 lightPosition = gMatView * vec4(gLightsData[i].position, 1.0f);
-						float lightRadius = gLightsData[i].attRadius;
-						
-						// Calculate distance from box to light
-						vec3 distances = max(abs(lightPosition.xyz - cellCenter) - cellExtent, 0);
-						float distSqrd = dot(distances, distances);
-						
-						if(distSqrd <= (lightRadius * lightRadius))
-						{
-							uint nextLink = imageAtomicAdd(gLinkedListCounter, 0, 1U);
-							if(nextLink < maxNumLinks)
-							{
-								uint prevLink = imageAtomicExchange(gLinkedListHeads, int(cellIdx), nextLink);
-								
-								imageStore(gLinkedList, int(nextLink), uvec4(i, type, prevLink, 0));
-							}
-						}
-					}
-				}
-			}
-		};
-	};
 };

+ 0 - 66
Data/Raw/Engine/Shaders/LightGridLLReduction.bsl

@@ -105,70 +105,4 @@ Technique
 			}
 		};
 	};
-};
-
-Technique 
- : inherits("PerCameraData")
- : inherits("LightGridCommon") = 
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Compute = 
-		{
-			layout (local_size_x = THREADGROUP_SIZE, local_size_y = THREADGROUP_SIZE, local_size_z = THREADGROUP_SIZE) in;
-		
-			layout(binding = 1) uniform usamplerBuffer gLinkedListHeads;
-			layout(binding = 2) uniform usamplerBuffer gLinkedList;
-			
-			layout(binding = 3, r32ui) uniform uimageBuffer gGridDataCounter;
-			layout(binding = 5, rgba32ui) uniform uimageBuffer gGridLightOffsetAndSize;
-			layout(binding = 6, r32ui) uniform uimageBuffer gGridLightIndices;
-			
-			void main()
-			{
-				// Ignore pixels out of valid range
-				if (any(greaterThanEqual(gl_GlobalInvocationID.xy, gGridSize.xy)))
-					return;
-					
-				uint maxNumLinks = gNumCells * gMaxNumLightsPerCell;	
-				int cellIdx = int((gl_GlobalInvocationID.z * gGridSize.y + gl_GlobalInvocationID.y) * gGridSize.x + gl_GlobalInvocationID.x);
-				
-				// First count total number of lights affecting the tile
-				int currentIdx = int(texelFetch(gLinkedListHeads, cellIdx).x);
-				uint numRadialLights = 0;
-				uint numSpotLights = 0;
-				while(currentIdx != 0xFFFFFFFF)
-				{
-					uvec3 entry = texelFetch(gLinkedList, currentIdx).xyz;
-				
-					if(entry.y == 1) // Radial
-						numRadialLights++;
-					else // Spot
-						numSpotLights++;
-
-					currentIdx = int(entry.z);
-				}
-				
-				// Allocate enough room and remember the offset to indices
-				uint numLights = numRadialLights + numSpotLights;
-				uint indicesStart = imageAtomicAdd(gGridDataCounter, 0, numLights);
-				imageStore(gGridLightOffsetAndSize, cellIdx, uvec4(indicesStart, numRadialLights, numSpotLights, 0));
-
-				// Actually write light indices (reverse order, so that radial lights come first, as is the convention)
-				currentIdx = int(texelFetch(gLinkedListHeads, cellIdx).x);
-				uint lightIdx = 0;
-				while(currentIdx != 0xFFFFFFFF)
-				{
-					uvec3 entry = texelFetch(gLinkedList, currentIdx).xyz;
-				
-					imageStore(gGridLightIndices, int(indicesStart + numLights - 1 - lightIdx), uvec4(entry.x, 0, 0, 0));
-					
-					currentIdx = int(entry.z);
-					lightIdx++;
-				}
-			}
-		};
-	};
 };

+ 0 - 35
Data/Raw/Engine/Shaders/ReflectionCubeDownsample.bsl

@@ -40,39 +40,4 @@ Technique
 			}	
 		};
 	};
-};
-
-Technique
- : inherits("PPBase")
- : inherits("ReflectionCubemapCommon") =
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Fragment =
-		{
-			in VStoFS
-			{
-				layout(location = 0) vec2 uv0;
-			} FSInput;		
-		
-			layout(location = 0) out vec4 fragColor;
-		
-			layout(binding = 0) uniform Input
-			{
-				int gCubeFace;
-			};
-			
-			layout(binding = 1) uniform samplerCube gInputTex;
-			
-			void main()
-			{
-				vec2 scaledUV = FSInput.uv0 * 2.0f - 1.0f;
-				vec3 dir = getDirFromCubeFace(gCubeFace, scaledUV);
-
-				fragColor = texture(gInputTex, dir);
-			}	
-		};
-	};
 };

+ 0 - 35
Data/Raw/Engine/Shaders/ReflectionCubeImportanceSample.bsl

@@ -141,39 +141,4 @@ Technique
 			}	
 		};
 	};
-};
-
-Technique
- : inherits("PPBase")
- : inherits("ReflectionCubemapCommon") =
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Fragment =
-		{
-			in VStoFS
-			{
-				layout(location = 0) vec2 uv0;
-			} FSInput;		
-		
-			layout(location = 0) out vec4 fragColor;
-		
-			layout(binding = 0) uniform Input
-			{
-				int gCubeFace;
-			};
-			
-			layout(binding = 1) uniform samplerCube gInputTex;
-			
-			void main()
-			{
-				vec2 scaledUV = FSInput.uv0 * 2.0f - 1.0f;
-				vec3 N = getDirFromCubeFace(gCubeFace, scaledUV);
-				
-				fragColor = texture(gInputTex, dir);
-			}	
-		};
-	};
 };

+ 0 - 54
Data/Raw/Engine/Shaders/Skybox.bsl

@@ -53,58 +53,4 @@ Technique : inherits("PerCameraData") =
 				}
 		};	
 	};
-};
-
-Technique : inherits("PerCameraData") =
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Cull = CW;
-		CompareFunc = LTE;
-		DepthWrite = false;
-		
-		Vertex = 
-		{
-			layout(location = 0) in vec3 bs_position;
-			layout(location = 0) out vec3 dir;	
-		
-			out gl_PerVertex
-			{
-				vec4 gl_Position;
-			};
-		
-			void main()
-			{
-				vec4 pos = gMatViewProj * vec4(bs_position.xyz + gViewOrigin, 1);
-			
-				// Set Z = W so that final depth is 1.0f and it renders behind everything else
-				gl_Position = pos.xyww;
-				dir = bs_position;
-			}
-		};
-	
-		Fragment =
-		{
-			layout(location = 0) in vec3 dir;		
-			
-			layout(binding = 1) uniform samplerCube gSkyTex;
-			layout(binding = 2, std140) uniform Params
-			{
-				vec4 gClearColor;
-			};
-			
-			layout(location = 0) out vec4 fragColor;
-			
-			void main()
-			{
-			#ifdef SOLID_COLOR
-				fragColor = gClearColor;
-			#else
-				fragColor = textureLod(gSkyTex, dir, 0);
-			#endif
-			}	
-		};
-	};
 };

+ 0 - 311
Data/Raw/Engine/Shaders/TiledDeferredLighting.bsl

@@ -276,315 +276,4 @@ Technique
 			}
 		};
 	};
-};
-
-Technique 
-  : inherits("SurfaceData")
-  : inherits("PerCameraData")
-  : inherits("LightingCommon") =
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		Compute = 
-		{
-			// Arbitrary limit, increase if needed
-            #define MAX_LIGHTS 512
-		
-			layout (local_size_x = TILE_SIZE, local_size_y = TILE_SIZE) in;
-		
-			#if MSAA_COUNT > 1
-			layout(binding = 1) uniform sampler2DMS gGBufferATex;
-			layout(binding = 2) uniform sampler2DMS gGBufferBTex;
-			layout(binding = 3) uniform sampler2DMS gGBufferCTex;
-			layout(binding = 4) uniform sampler2DMS gDepthBufferTex;
-			#else
-			layout(binding = 1) uniform sampler2D gGBufferATex;
-			layout(binding = 2) uniform sampler2D gGBufferBTex;
-			layout(binding = 3) uniform sampler2D gGBufferCTex;
-			layout(binding = 4) uniform sampler2D gDepthBufferTex;
-			#endif
-			
-			SurfaceData decodeGBuffer(vec4 GBufferAData, vec4 GBufferBData, vec2 GBufferCData, float deviceZ)
-			{
-				SurfaceData surfaceData;
-				
-				surfaceData.albedo.xyz = GBufferAData.xyz;
-				surfaceData.albedo.w = 1.0f;
-				surfaceData.worldNormal = GBufferBData * vec4(2, 2, 2, 1) - vec4(1, 1, 1, 0);
-				surfaceData.worldNormal.xyz = normalize(surfaceData.worldNormal.xyz);
-				surfaceData.depth = convertFromDeviceZ(deviceZ);
-				surfaceData.roughness = GBufferCData.x;
-				surfaceData.metalness = GBufferCData.y;
-				
-				return surfaceData;
-			}
-			
-			#if MSAA_COUNT > 1
-			layout(binding = 5, rgba16f) uniform image2DMS gOutput;
-			
-			bool needsPerSampleShading(SurfaceData samples[MSAA_COUNT])
-			{
-				vec3 albedo = samples[0].albedo.xyz;
-				vec3 normal = samples[0].worldNormal.xyz;
-				float depth = samples[0].depth;
-
-				for(int i = 1; i < MSAA_COUNT; i++)
-				{
-					vec3 otherAlbedo = samples[i].albedo.xyz;
-					vec3 otherNormal = samples[i].worldNormal.xyz;
-					float otherDepth = samples[i].depth;
-
-					if(abs(depth - otherDepth) > 0.1f || abs(dot(abs(normal - otherNormal), vec3(1, 1, 1))) > 0.1f || abs(dot(albedo - otherAlbedo, vec3(1, 1, 1))) > 0.1f)
-					{
-						return true;
-					}
-				}
-				
-				return false;
-			}
-			
-			SurfaceData getGBufferData(ivec2 pixelPos, int sampleIndex)
-			{
-				vec4 GBufferAData = texelFetch(gGBufferATex, pixelPos, sampleIndex);
-				vec4 GBufferBData = texelFetch(gGBufferBTex, pixelPos, sampleIndex);
-				vec2 GBufferCData = texelFetch(gGBufferCTex, pixelPos, sampleIndex).rg;
-				float deviceZ = texelFetch(gDepthBufferTex, pixelPos, sampleIndex).r;
-				
-				return decodeGBuffer(GBufferAData, GBufferBData, GBufferCData, deviceZ);
-			}
-			
-			#else
-			
-			layout(binding = 5, rgba16f) uniform image2D gOutput;
-			
-			SurfaceData getGBufferData(ivec2 pixelPos)
-			{
-				vec4 GBufferAData = texelFetch(gGBufferATex, pixelPos, 0);
-				vec4 GBufferBData = texelFetch(gGBufferBTex, pixelPos, 0);
-				vec2 GBufferCData = texelFetch(gGBufferCTex, pixelPos, 0).rg;
-				float deviceZ = texelFetch(gDepthBufferTex, pixelPos, 0).r;
-				
-				return decodeGBuffer(GBufferAData, GBufferBData, GBufferCData, deviceZ);
-			}	
-			
-			#endif
-			
-			layout(std430, binding = 6) readonly buffer gLights
-			{
-				LightData gLightsData[];
-			};
-
-			layout(binding = 7, std140) uniform Params
-			{
-				// Offsets at which specific light types begin in gLights buffer
-				// Assumed directional lights start at 0
-				// x - offset to point lights, y - offset to spot lights, z - total number of lights
-				uvec3 gLightOffsets;
-				uvec2 gFramebufferSize;
-			};
-			
-			shared uint sTileMinZ;
-			shared uint sTileMaxZ;
-			
-			shared uint sNumLightsPerType[2];
-			shared uint sTotalNumLights;
-            shared uint sLightIndices[MAX_LIGHTS];
-			
-			vec4 getLighting(vec2 clipSpacePos, SurfaceData surfaceData)
-			{
-				// x, y are now in clip space, z, w are in view space
-				// We multiply them by a special inverse view-projection matrix, that had the projection entries that effect
-				// z, w eliminated (since they are already in view space)
-				// Note: Multiply by depth should be avoided if using ortographic projection
-				vec4 mixedSpacePos = vec4(clipSpacePos.xy * -surfaceData.depth, surfaceData.depth, 1);
-				vec4 worldPosition4D = gMatScreenToWorld * mixedSpacePos;
-				vec3 worldPosition = worldPosition4D.xyz / worldPosition4D.w;	
-				
-				float alpha = 0.0f;
-				vec3 lightAccumulator = vec3(0, 0, 0);
-				if(surfaceData.worldNormal.w > 0.0f)
-				{
-					for(uint i = 0; i < gLightOffsets[0]; ++i)
-					{
-						LightData lightData = gLightsData[i];
-						lightAccumulator += getDirLightContibution(surfaceData, lightData);
-					}
-					
-                    for (uint i = 0; i < sNumLightsPerType[0]; ++i)
-                    {
-                        uint lightIdx = sLightIndices[i];
-						LightData lightData = gLightsData[lightIdx];
-                        lightAccumulator += getPointLightContribution(worldPosition, surfaceData, lightData);
-                    }
-
-					for(uint i = sNumLightsPerType[0]; i < sTotalNumLights; ++i)
-                    {
-                        uint lightIdx = sLightIndices[i];
-						LightData lightData = gLightsData[lightIdx];
-                        lightAccumulator += getSpotLightContribution(worldPosition, surfaceData, lightData);
-                    }
-					
-					lightAccumulator += surfaceData.albedo.rgb * gAmbientFactor;
-					alpha = 1.0f;
-				}
-				
-				vec3 diffuse = surfaceData.albedo.xyz / PI; // TODO - Add better lighting model later				
-				return vec4(lightAccumulator * diffuse, alpha);
-			}
-			
-			void main()
-			{
-				uint threadIndex = gl_LocalInvocationID.y * TILE_SIZE + gl_LocalInvocationID.x;
-				ivec2 pixelPos = ivec2(gl_GlobalInvocationID.xy) + gViewportRectangle.xy;
-
-				// Get data for all samples, and determine per-pixel minimum and maximum depth values
-				SurfaceData surfaceData[MSAA_COUNT];
-				uint sampleMinZ = 0x7F7FFFFF;
-				uint sampleMaxZ = 0;
-
-				#if MSAA_COUNT > 1
-				for(int i = 0; i < MSAA_COUNT; ++i)
-				{
-					surfaceData[i] = getGBufferData(pixelPos, i);
-					
-					sampleMinZ = min(sampleMinZ, floatBitsToUint(-surfaceData[i].depth));
-					sampleMaxZ = max(sampleMaxZ, floatBitsToUint(-surfaceData[i].depth));
-				}
-				#else
-				surfaceData[0] = getGBufferData(pixelPos);
-				sampleMinZ = floatBitsToUint(-surfaceData[0].depth);
-				sampleMaxZ = floatBitsToUint(-surfaceData[0].depth);
-				#endif				
-				
-				// Set initial values
-				if(threadIndex == 0)
-				{
-					sTileMinZ = 0x7F7FFFFF;
-					sTileMaxZ = 0;
-					sNumLightsPerType[0] = 0;
-					sNumLightsPerType[1] = 0;
-					sTotalNumLights = 0;
-				}
-				
-				groupMemoryBarrier();
-				barrier();
-				
-				atomicMin(sTileMinZ, sampleMinZ);
-				atomicMax(sTileMaxZ, sampleMaxZ);
-				
-				groupMemoryBarrier();
-				barrier();
-				
-			    float minTileZ = uintBitsToFloat(sTileMinZ);
-				float maxTileZ = uintBitsToFloat(sTileMaxZ);
-				
-				// Create a frustum for the current tile
-				// See HLSL version for an explanation of the math
-				vec2 tileScale = gViewportRectangle.zw / vec2(TILE_SIZE, TILE_SIZE);
-				vec2 tileBias = tileScale - 1 - gl_WorkGroupID.xy * 2;
-				
-				float At = gMatProj[0][0] * tileScale.x;
-				float Ctt = gMatProj[2][0] * tileScale.x - tileBias.x;
-				
-				float Bt = gMatProj[1][1] * tileScale.y;
-				float Dtt = gMatProj[2][1] * tileScale.y + tileBias.y;
-				
-				// Extract left/right/top/bottom frustum planes from scaled projection matrix
-				vec4 frustumPlanes[6];
-				frustumPlanes[0] = vec4(At, 0.0f, gMatProj[2][3] + Ctt, 0.0f);
-				frustumPlanes[1] = vec4(-At, 0.0f, gMatProj[2][3] - Ctt, 0.0f);
-				frustumPlanes[2] = vec4(0.0f, -Bt, gMatProj[2][3] - Dtt, 0.0f);
-				frustumPlanes[3] = vec4(0.0f, Bt, gMatProj[2][3] + Dtt, 0.0f);
-				
-				// Normalize
-                for (uint i = 0; i < 4; ++i) 
-					frustumPlanes[i] /= length(frustumPlanes[i].xyz);
-				
-				// Generate near/far frustum planes
-				frustumPlanes[4] = vec4(0.0f, 0.0f, -1.0f, -minTileZ); 
-				frustumPlanes[5] = vec4(0.0f, 0.0f, 1.0f, maxTileZ);
-							
-				// Find radial & spot lights overlapping the tile
-				for(uint type = 0; type < 2; type++)
-				{
-					uint lightOffset = threadIndex + gLightOffsets[type];
-					uint lightsEnd = gLightOffsets[type + 1];
-					for (uint i = lightOffset; i < lightsEnd && i < MAX_LIGHTS; i += TILE_SIZE)
-					{
-						LightData lightData = gLightsData[i];
-						vec4 lightPosition = gMatView * vec4(lightData.position, 1.0f);
-						float lightRadius = lightData.attRadius;
-						
-						bool lightInTile = true;
-					
-						// First check side planes as this will cull majority of the lights
-						for (uint j = 0; j < 4; ++j)
-						{
-							float dist = dot(frustumPlanes[j], lightPosition);
-							lightInTile = lightInTile && (dist >= -lightRadius);
-						}
-
-						if (lightInTile)
-						{
-							bool inDepthRange = true;
-					
-							// Check near/far planes
-							for (uint j = 4; j < 6; ++j)
-							{
-								float dist = dot(frustumPlanes[j], lightPosition);
-								inDepthRange = inDepthRange && (dist >= -lightRadius);
-							}
-							
-							// In tile, add to branch
-							if (inDepthRange)
-							{
-								atomicAdd(sNumLightsPerType[type], 1U);
-								
-								uint idx = atomicAdd(sTotalNumLights, 1U);
-								sLightIndices[idx] = i;
-							}
-						}
-					}
-				}
-
-                groupMemoryBarrier();
-				barrier();	
-
-				vec2 screenUv = (vec2(gViewportRectangle.xy + pixelPos) + 0.5f) / vec2(gViewportRectangle.zw);
-				vec2 clipSpacePos = (screenUv - gClipToUVScaleOffset.zw) / gClipToUVScaleOffset.xy;
-				
-				uvec2 viewportMax = gViewportRectangle.xy + gViewportRectangle.zw;
-
-				// Ignore pixels out of valid range
-				if (all(lessThan(gl_GlobalInvocationID.xy, viewportMax))) 
-				{
-					#if MSAA_COUNT > 1
-					vec4 lighting = getLighting(clipSpacePos.xy, surfaceData[0]);
-					imageStore(gOutput, pixelPos, 0, lighting);
-
-					bool doPerSampleShading = needsPerSampleShading(surfaceData);
-					if(doPerSampleShading)
-					{
-						for(int i = 1; i < MSAA_COUNT; ++i)
-						{
-							lighting = getLighting(clipSpacePos.xy, surfaceData[i]);
-							imageStore(gOutput, pixelPos, i, lighting);
-						}
-					}
-					else // Splat same information to all samples
-					{
-						for(int i = 1; i < MSAA_COUNT; ++i)
-							imageStore(gOutput, pixelPos, i, lighting);
-					}
-					
-					#else
-					vec4 lighting = getLighting(clipSpacePos.xy, surfaceData[0]);
-					imageStore(gOutput, pixelPos, lighting);
-					#endif
-				}
-			}
-		};
-	};
 };

+ 0 - 98
Data/Raw/Engine/Shaders/Transparent.bsl

@@ -35,8 +35,6 @@ Technique
  : inherits("ImageBasedLighting")
  : base("Surface") =
 {
-	Language = "HLSL11";
-	
 	Pass =
 	{
 		DepthWrite = false;
@@ -109,100 +107,4 @@ Technique
 			}	
 		};
 	};
-};
-
-Technique 
- : inherits("LightingCommon")
- : inherits("LightGridCommon")
- : base("Surface") =
-{
-	Language = "GLSL";
-	
-	Pass =
-	{
-		DepthWrite = false;
-		
-		Target = 
-		{
-			Blend = true;
-			Color = { SRCA, SRCIA, ADD };
-		};
-	
-		Fragment =
-		{
-			layout(location = 0) in vec2 uv0;
-			layout(location = 1) in vec3 worldPosition;
-			layout(location = 2) in vec3 tangentToWorldZ;
-			layout(location = 3) in vec4 tangentToWorldX;			
-		
-			layout(binding = 5) uniform sampler2D gAlbedoTex;
-			layout(binding = 6) uniform sampler2D gNormalTex;
-			layout(binding = 7) uniform sampler2D gRoughnessTex;
-			layout(binding = 8) uniform sampler2D gMetalnessTex;
-			
-			layout(binding = 9) uniform usamplerBuffer gGridOffsetsAndSize;
-			layout(binding = 10) uniform usamplerBuffer gGridLightIndices;
-			layout(std430, binding = 11) readonly buffer gLights
-			{
-				LightData[] gLightsData;
-			};
-						
-			layout(binding = 12, std140) uniform MaterialParams
-			{
-				float gOpacity;
-			};
-			
-			layout(location = 0) out vec4 fragColor;
-			
-			void main()
-			{
-				vec3 normal = normalize(texture(gNormalTex, uv0).xyz * 2.0f - vec3(1, 1, 1));
-				vec3 worldNormal = calcWorldNormal(tangentToWorldZ, tangentToWorldX, normal);
-			
-				SurfaceData surfaceData;
-				surfaceData.albedo = texture(gAlbedoTex, uv0);
-				surfaceData.worldNormal.xyz = worldNormal;
-				surfaceData.roughness = texture(gRoughnessTex, uv0).x;
-				surfaceData.metalness = texture(gMetalnessTex, uv0).x;
-				
-				// Directional lights
-				vec3 lightAccumulator = vec3(0, 0, 0);
-				for(uint i = 0; i < gLightOffsets[0]; ++i)
-				{
-					LightData lightData = gLightsData[i];
-					lightAccumulator += getDirLightContibution(surfaceData, lightData);
-				}
-				
-				uvec2 pixelPos = uvec2(gl_FragCoord.xy);
-				int cellIdx = calcCellIdx(pixelPos, gl_FragCoord.z);
-				uvec3 offsetAndSize = texelFetch(gGridOffsetsAndSize, cellIdx).xyz;
-				
-				// Radial lights
-				int i = int(offsetAndSize.x);
-				uint end = offsetAndSize.x + offsetAndSize.y;
-				for(; i < end; i++)
-				{
-					uint lightIndex = texelFetch(gGridLightIndices, i).x;
-					LightData lightData = gLightsData[lightIndex];
-					
-					lightAccumulator += getPointLightContribution(worldPosition, surfaceData, lightData);
-				}
-				
-				// Spot lights
-				end += offsetAndSize.z;
-				for(; i < end; i++)
-				{
-					uint lightIndex = texelFetch(gGridLightIndices, i).x;
-					LightData lightData = gLightsData[lightIndex];
-					
-					lightAccumulator += getSpotLightContribution(worldPosition, surfaceData, lightData);
-				}
-				
-				lightAccumulator += surfaceData.albedo.xyz * gAmbientFactor;
-				
-				vec3 diffuse = surfaceData.albedo.xyz / PI; // TODO - Add better lighting model later
-				fragColor = vec4(diffuse * lightAccumulator, gOpacity); 
-			}	
-		};
-	};
 };