 			#if 0
 				vec3 coord = _coord.xyz * rcp(_coord.w);
 				float occluder = tex2D(_sampler, coord.xy).x;
-				return step(coord.z * 2.0 - 1.0, occluder);
+				return step(coord.z, occluder);
 			#else
 				return tex2Dproj(_sampler, _coord).x;
 			#endif // 0
 			}
 
-			#		define SAMPLER2D(_name, _reg) uniform sampler2D _name : register(s ## _reg)
+			#		define SAMPLER2D(_name, _reg) uniform sampler2D _name : REGISTER(s, _reg)
+			#		define SAMPLER2DMS(_name, _reg) uniform sampler2DMS _name : REGISTER(s, _reg)
 			#		define texture2D(_sampler, _coord) tex2D(_sampler, _coord)
 			#		define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord)
 
-			#		define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name : register(s ## _reg)
+			#		define SAMPLER2DARRAY(_name, _reg) SAMPLER2D(_name, _reg)
+			#		define texture2DArray(_sampler, _coord) texture2D(_sampler, (_coord).xy)
+			#		define texture2DArrayLod(_sampler, _coord, _lod) texture2DLod(_sampler, _coord, _lod)
+
+			#		define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name : REGISTER(s, _reg)
 			#		define shadow2D(_sampler, _coord) bgfxShadow2D(_sampler, _coord)
 			#		define shadow2DProj(_sampler, _coord) bgfxShadow2DProj(_sampler, _coord)
 
-			#		define SAMPLER3D(_name, _reg) uniform sampler3D _name : register(s ## _reg)
+			#		define SAMPLER3D(_name, _reg) uniform sampler3D _name : REGISTER(s, _reg)
 			#		define texture3D(_sampler, _coord) tex3D(_sampler, _coord)
 
-			#		define SAMPLERCUBE(_name, _reg) uniform samplerCUBE _name : register(s[_reg])
+			#		define SAMPLERCUBE(_name, _reg) uniform samplerCUBE _name : REGISTER(s, _reg)
 			#		define textureCube(_sampler, _coord) texCUBE(_sampler, _coord)
 
 			#		if BGFX_SHADER_LANGUAGE_HLSL == 2
 			#			define texture2DLod(_sampler, _coord, _level) tex2D(_sampler, (_coord).xy)
+			#			define texture2DGrad(_sampler, _coord, _dPdx, _dPdy) tex2D(_sampler, _coord)
 			#			define texture3DLod(_sampler, _coord, _level) tex3D(_sampler, (_coord).xyz)
 			#			define textureCubeLod(_sampler, _coord, _level) texCUBE(_sampler, (_coord).xyz)
 			#		else
 			#			define texture2DLod(_sampler, _coord, _level) tex2Dlod(_sampler, vec4( (_coord).xy, 0.0, _level) )
+			#			define texture2DGrad(_sampler, _coord, _dPdx, _dPdy) tex2Dgrad(_sampler, _coord, _dPdx, _dPdy)
 			#			define texture3DLod(_sampler, _coord, _level) tex3Dlod(_sampler, vec4( (_coord).xyz, _level) )
 			#			define textureCubeLod(_sampler, _coord, _level) texCUBElod(_sampler, vec4( (_coord).xyz, _level) )
 			#		endif // BGFX_SHADER_LANGUAGE_HLSL == 2
 
 			#	endif // BGFX_SHADER_LANGUAGE_HLSL > 3
-
-			vec2 vec2_splat(float _x) { return vec2(_x, _x); }
-			vec3 vec3_splat(float _x) { return vec3(_x, _x, _x); }
-			vec4 vec4_splat(float _x) { return vec4(_x, _x, _x, _x); }
-
-			uvec2 uvec2_splat(uint _x) { return uvec2(_x, _x); }
-			uvec3 uvec3_splat(uint _x) { return uvec3(_x, _x, _x); }
-			uvec4 uvec4_splat(uint _x) { return uvec4(_x, _x, _x, _x); }
 
 			vec3 instMul(vec3 _vec, mat3 _mtx) { return mul(_mtx, _vec); }
 			vec3 instMul(mat3 _mtx, vec3 _vec) { return mul(_vec, _mtx); }


			#endif // __cplusplus

			vec4 encodeRE8(float _r)
			{
				float exponent = ceil(log2(_r) );

	common = {
		code = "
			/*
			 * Copyright 2011-2017 Branimir Karadzic. All rights reserved.
			 * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
			 */

			#ifndef BGFX_SHADER_H_HEADER_GUARD
			#define BGFX_SHADER_H_HEADER_GUARD

			#if !defined(BGFX_CONFIG_MAX_BONES)
			#	define BGFX_CONFIG_MAX_BONES 32
