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:
Jonas Kulla 2014-12-23 18:56:00 +01:00
parent 3c0a530eba
commit 373b90af00
9 changed files with 206 additions and 20 deletions

View file

@ -35,11 +35,14 @@
#include "transSimple.frag.xxd"
#include "bitmapBlit.frag.xxd"
#include "plane.frag.xxd"
#include "gray.frag.xxd"
#include "flatColor.frag.xxd"
#include "simple.frag.xxd"
#include "simpleColor.frag.xxd"
#include "simpleAlpha.frag.xxd"
#include "simpleAlphaUni.frag.xxd"
#include "flashMap.frag.xxd"
#include "minimal.vert.xxd"
#include "simple.vert.xxd"
#include "simpleColor.vert.xxd"
#include "sprite.vert.xxd"
@ -269,6 +272,21 @@ void ShaderBase::setTranslation(const Vec2i &value)
}
FlatColorShader::FlatColorShader()
{
INIT_SHADER(minimal, flatColor, FlatColorShader);
ShaderBase::init();
GET_U(color);
}
void FlatColorShader::setColor(const Vec4 &value)
{
setVec4Uniform(u_color, value);
}
SimpleShader::SimpleShader()
{
INIT_SHADER(simple, simple, SimpleShader);
@ -480,6 +498,21 @@ void PlaneShader::setOpacity(float value)
}
GrayShader::GrayShader()
{
INIT_SHADER(simple, gray, GrayShader);
ShaderBase::init();
GET_U(gray);
}
void GrayShader::setGray(float value)
{
gl.Uniform1f(u_gray, value);
}
TilemapShader::TilemapShader()
{
INIT_SHADER(tilemap, simple, TilemapShader);