Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Graphics: Optimize Viewport effect rendering
Using the kitchen sink plane shader for viewport effects, even if only a small part of them are active, incurs great performance loss on mobile, so split the rendering into multiple optional passes which additionally use the blending hardware for faster mixing (lerping). Also, don't mirror the PingPong textures if the viewport effect covers the entire screen area anyway.
- Loading branch information
Showing
9 changed files
with
206 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
uniform lowp vec4 color; | ||
|
||
void main() | ||
{ | ||
gl_FragColor = color; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
uniform sampler2D texture; | ||
uniform lowp float gray; | ||
|
||
varying vec2 v_texCoord; | ||
|
||
const vec3 lumaF = vec3(.299, .587, .114); | ||
|
||
void main() | ||
{ | ||
/* Sample source color */ | ||
vec4 frag = texture2D(texture, v_texCoord); | ||
|
||
/* Apply gray */ | ||
float luma = dot(frag.rgb, lumaF); | ||
frag.rgb = mix(frag.rgb, vec3(luma), gray); | ||
|
||
gl_FragColor = frag; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
uniform mat4 projMat; | ||
attribute vec2 position; | ||
|
||
void main() | ||
{ | ||
gl_Position = projMat * vec4(position, 0, 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters