GPU: Small optimization to lanczos shader

Apparently the Adreno shader compiler can't do this on its own.

~23% performance improvement.
This commit is contained in:
Stenzek 2025-02-15 17:43:59 +10:00
parent 958fd0049c
commit ce8b1f0996
No known key found for this signature in database

View File

@ -109,14 +109,12 @@ CONSTANT float PI = 3.14159265359;
float lanczos(float x)
{
x = abs(x);
if (x < 0.0001)
return 1.0;
if (x > float(KERNEL_SIZE))
return 0.0;
float px = PI * x;
return (float(KERNEL_SIZE) * sin(px) * sin(px / float(KERNEL_SIZE))) / (px * px);
float v = (float(KERNEL_SIZE) * sin(px) * sin(px / float(KERNEL_SIZE))) / (px * px);
v = (x < 0.0001) ? 1.0 : v;
v = (x > float(KERNEL_SIZE)) ? 0.0 : v;
return v;
}
)";