Skip to content

Commit

Permalink
shaders: don't use textureGrad() in powersurge_effect
Browse files Browse the repository at this point in the history
Apparently it has bad performance at least on some intel iGPUs (my
laptop), and it does nothing visually here.
  • Loading branch information
Akaricchi committed May 22, 2024
1 parent 149a261 commit d288f2b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions resources/00-taisei.pkgdir/shader/powersurge_effect.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ vec4 colormap(vec4 c) {

void main(void) {
vec2 uv = texCoord;
vec2 gradX = dFdx(uv);
vec2 gradY = dFdy(uv);
vec4 c = textureGrad(shotlayer, uv, gradX, gradY);
vec4 c = texture(shotlayer, uv);

#ifdef ENABLE_ALPHA_CULLING
if(all(lessThan(c, vec4(1.0 / 255.0)))) {
Expand All @@ -49,9 +47,9 @@ void main(void) {
vec4 m = vec4(vec3(0), 1);
float t = (time + c.a * 0.2) * 0.1 + 92.123431 + fwidth(c.a);

m.rgb += textureGrad(flowlayer, uv + 0.0524 * vec2(3.123*sin(t*1.632), t*36.345), gradX, gradY).rgb;
m.rgb += textureGrad(flowlayer, uv + 0.0531 * vec2(t*13.624, -t*49.851), gradX, gradY).rgb;
m.rgb += textureGrad(flowlayer, uv + 0.0543 * vec2(-t*12.931, -t*24.341), gradX, gradY).rgb;
m.rgb += texture(flowlayer, uv + 0.0524 * vec2(3.123*sin(t*1.632), t*36.345)).rgb;
m.rgb += texture(flowlayer, uv + 0.0531 * vec2(t*13.624, -t*49.851)).rgb;
m.rgb += texture(flowlayer, uv + 0.0543 * vec2(-t*12.931, -t*24.341)).rgb;

m.rgb = hueShift(clamp(m.rgb / 2.5, 0, 1), time * 0.1 + uv.y);

Expand Down

0 comments on commit d288f2b

Please sign in to comment.