bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-Test_VertexShaderDepthTexture-in.txt

41 lines
831 B
Text
Raw Normal View History

2012-04-03 23:30:07 -04:00
struct v2f_vertex_lit {
vec2 uv;
vec4 diff;
vec4 spec;
};
struct v2f_img {
vec4 pos;
vec2 uv;
};
struct appdata_img {
vec4 vertex;
vec2 texcoord;
};
struct v2f {
vec4 pos;
vec2 uv;
};
struct appdata_base {
vec4 vertex;
vec3 normal;
vec4 texcoord;
};
uniform sampler2D _CameraDepthTexture;
uniform vec4 _ZBufferParams;
float Linear01Depth( in float z );
vec4 frag( in v2f i );
float Linear01Depth( in float z ) {
return (1.00000 / ((_ZBufferParams.x * z) + _ZBufferParams.y ));
}
vec4 frag( in v2f i ) {
return vec4( (1.00000 - Linear01Depth( texture2D( _CameraDepthTexture, i.uv).x )));
}
void main() {
vec4 xl_retval;
v2f xlt_i;
xlt_i.pos = vec4(0.0);
xlt_i.uv = vec2( gl_TexCoord[0]);
xl_retval = frag( xlt_i);
gl_FragData[0] = vec4( xl_retval);
}