mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 20:15:32 +00:00
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:
parent
958fd0049c
commit
ce8b1f0996
@ -109,14 +109,12 @@ CONSTANT float PI = 3.14159265359;
|
|||||||
float lanczos(float x)
|
float lanczos(float x)
|
||||||
{
|
{
|
||||||
x = abs(x);
|
x = abs(x);
|
||||||
if (x < 0.0001)
|
|
||||||
return 1.0;
|
|
||||||
|
|
||||||
if (x > float(KERNEL_SIZE))
|
|
||||||
return 0.0;
|
|
||||||
|
|
||||||
float px = PI * x;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
)";
|
)";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user