]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Remove redundant texture sampling
authoruis <uis9936@gmail.com>
Thu, 11 Jan 2024 18:26:12 +0000 (21:26 +0300)
committeruis <uis9936@gmail.com>
Thu, 11 Jan 2024 18:26:12 +0000 (21:26 +0300)
shader_glsl.h

index 230e754b32124cd61ebf3cbaf55be9c253fb4af7..9d084f6f5707b952e57329801bf7ad94eb417d0b 100644 (file)
 "      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",