From: uis Date: Thu, 11 Jan 2024 18:26:12 +0000 (+0300) Subject: Remove redundant texture sampling X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=974b8f9fe0afc702238020489c38e0ff31151fe7;p=xonotic%2Fdarkplaces.git Remove redundant texture sampling --- diff --git a/shader_glsl.h b/shader_glsl.h index e56bcc1a..954fda21 100644 --- a/shader_glsl.h +++ b/shader_glsl.h @@ -324,25 +324,21 @@ " vec3 x4 = dp_texture2D(Texture_First, TexCoord1.xy + vec2( px.x, px.y)).rgb;\n", " vec3 x5 = dp_texture2D(Texture_First, TexCoord1.xy + vec2( px.x, 0.0)).rgb;\n", " vec3 x6 = dp_texture2D(Texture_First, TexCoord1.xy + vec2( px.x,-px.y)).rgb;\n", -" vec3 y1 = dp_texture2D(Texture_First, TexCoord1.xy + vec2( px.x,-px.y)).rgb;\n", " vec3 y2 = dp_texture2D(Texture_First, TexCoord1.xy + vec2( 0.0,-px.y)).rgb;\n", -" vec3 y3 = dp_texture2D(Texture_First, TexCoord1.xy + vec2(-px.x,-px.y)).rgb;\n", -" vec3 y4 = dp_texture2D(Texture_First, TexCoord1.xy + vec2( px.x, px.y)).rgb;\n", " vec3 y5 = dp_texture2D(Texture_First, TexCoord1.xy + vec2( 0.0, px.y)).rgb;\n", -" vec3 y6 = dp_texture2D(Texture_First, TexCoord1.xy + vec2(-px.x, px.y)).rgb;\n", " float px1 = -1.0 * dot(vec3(0.3, 0.59, 0.11), x1);\n", " float px2 = -2.0 * dot(vec3(0.3, 0.59, 0.11), x2);\n", " float px3 = -1.0 * dot(vec3(0.3, 0.59, 0.11), x3);\n", " float px4 = 1.0 * dot(vec3(0.3, 0.59, 0.11), x4);\n", " float px5 = 2.0 * dot(vec3(0.3, 0.59, 0.11), x5);\n", " float px6 = 1.0 * dot(vec3(0.3, 0.59, 0.11), x6);\n", -" float py1 = -1.0 * dot(vec3(0.3, 0.59, 0.11), y1);\n", +" float py1 = -px6;\n", " float py2 = -2.0 * dot(vec3(0.3, 0.59, 0.11), y2);\n", -" float py3 = -1.0 * dot(vec3(0.3, 0.59, 0.11), y3);\n", -" float py4 = 1.0 * dot(vec3(0.3, 0.59, 0.11), y4);\n", +" float py3 = px3;\n", +" float py4 = px4;\n", " float py5 = 2.0 * dot(vec3(0.3, 0.59, 0.11), y5);\n", -" float py6 = 1.0 * dot(vec3(0.3, 0.59, 0.11), y6);\n", -" sobel = 0.25 * abs(px1 + px2 + px3 + px4 + px5 + px6) + 0.25 * abs(py1 + py2 + py3 + py4 + py5 + py6);\n", +" float py6 = -px1;\n", +" sobel = 0.25 * (abs(px1 + px2 + px3 + px4 + px5 + px6) + abs(py1 + py2 + py3 + py4 + py5 + py6));\n", " dp_FragColor += dp_texture2D(Texture_First, TexCoord1.xy + PixelSize*UserVec1.x*vec2(-0.987688, -0.156434)) * UserVec1.y;\n", " dp_FragColor += dp_texture2D(Texture_First, TexCoord1.xy + PixelSize*UserVec1.x*vec2(-0.156434, -0.891007)) * UserVec1.y;\n", " dp_FragColor += dp_texture2D(Texture_First, TexCoord1.xy + PixelSize*UserVec1.x*vec2( 0.891007, -0.453990)) * UserVec1.y;\n",