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.
This commit is contained in:
parent
3c0a530eba
commit
373b90af00
9 changed files with 206 additions and 20 deletions
24
src/shader.h
24
src/shader.h
|
@ -87,6 +87,17 @@ protected:
|
|||
GLint u_texSizeInv, u_translation;
|
||||
};
|
||||
|
||||
class FlatColorShader : public ShaderBase
|
||||
{
|
||||
public:
|
||||
FlatColorShader();
|
||||
|
||||
void setColor(const Vec4 &value);
|
||||
|
||||
private:
|
||||
GLint u_color;
|
||||
};
|
||||
|
||||
class SimpleShader : public ShaderBase
|
||||
{
|
||||
public:
|
||||
|
@ -191,6 +202,17 @@ private:
|
|||
GLint u_tone, u_color, u_flash, u_opacity;
|
||||
};
|
||||
|
||||
class GrayShader : public ShaderBase
|
||||
{
|
||||
public:
|
||||
GrayShader();
|
||||
|
||||
void setGray(float value);
|
||||
|
||||
private:
|
||||
GLint u_gray;
|
||||
};
|
||||
|
||||
class TilemapShader : public ShaderBase
|
||||
{
|
||||
public:
|
||||
|
@ -285,6 +307,7 @@ private:
|
|||
/* Global object containing all available shaders */
|
||||
struct ShaderSet
|
||||
{
|
||||
FlatColorShader flatColor;
|
||||
SimpleShader simple;
|
||||
SimpleColorShader simpleColor;
|
||||
SimpleAlphaShader simpleAlpha;
|
||||
|
@ -292,6 +315,7 @@ struct ShaderSet
|
|||
AlphaSpriteShader alphaSprite;
|
||||
SpriteShader sprite;
|
||||
PlaneShader plane;
|
||||
GrayShader gray;
|
||||
TilemapShader tilemap;
|
||||
FlashMapShader flashMap;
|
||||
TransShader trans;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue