implement framebuffer fetch on iOS for bleding
This commit is contained in:
@@ -85,16 +85,27 @@ void App::initShaders()
|
||||
"}\n";
|
||||
static const char* shader_blend_f =
|
||||
SHADER_VERSION
|
||||
#ifdef __IOS__
|
||||
"#extension GL_EXT_shader_framebuffer_fetch : enable\n"
|
||||
#endif
|
||||
"uniform sampler2D tex;\n"
|
||||
"uniform sampler2D tex_alpha;\n"
|
||||
"uniform sampler2D tex_bg;\n"
|
||||
"uniform mediump float alpha;\n"
|
||||
"uniform int blend_mode;\n"
|
||||
"in mediump vec2 uv;\n"
|
||||
#ifdef __IOS__
|
||||
"inout mediump vec4 frag;\n"
|
||||
#else
|
||||
"out mediump vec4 frag;\n"
|
||||
#endif
|
||||
SHADER_FUNCTION_BLEND
|
||||
"void main() {\n"
|
||||
#ifdef __IOS__
|
||||
" mediump vec4 bg = frag;\n"
|
||||
#else
|
||||
" mediump vec4 bg = texture(tex_bg, uv);\n"
|
||||
#endif
|
||||
" mediump vec4 fg = vec4(texture(tex, uv).rgb, texture(tex_alpha, uv).a);\n"
|
||||
" if (fg.a == 0.0) { frag = bg; return; }\n"
|
||||
" mediump float contribution = (1.0 - bg.a) * fg.a;\n"
|
||||
@@ -338,7 +349,6 @@ void App::initShaders()
|
||||
SHADER_VERSION
|
||||
#ifdef __IOS__
|
||||
"#extension GL_EXT_shader_framebuffer_fetch : enable\n"
|
||||
// "#extension GL_EXT_shader_image_load_store : enable\n"
|
||||
#endif
|
||||
"uniform mediump sampler2D tex;\n"
|
||||
"uniform mediump sampler2D tex_bg;\n"
|
||||
|
||||
Reference in New Issue
Block a user