mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix Android crash in Cartoon
Fix Android crash in Cartoon Fix Android crash in Natural Fix Android crash in Natural
This commit is contained in:
parent
29dd284372
commit
58de5ce2fe
4 changed files with 63 additions and 40 deletions
|
@ -14,17 +14,25 @@ const float bb = 0.5; // effects black border sensitivity; from 0.0 to 1.0
|
|||
|
||||
uniform sampler2D sampler0;
|
||||
|
||||
varying vec4 v_texcoord0;
|
||||
varying vec4 v_texcoord1;
|
||||
varying vec4 v_texcoord2;
|
||||
varying vec4 v_texcoord3;
|
||||
varying vec4 v_texcoord4;
|
||||
varying vec4 v_texcoord5;
|
||||
varying vec4 v_texcoord6;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 c00 = texture2D(sampler0, gl_TexCoord[5].xy).xyz;
|
||||
vec3 c10 = texture2D(sampler0, gl_TexCoord[1].xy).xyz;
|
||||
vec3 c20 = texture2D(sampler0, gl_TexCoord[2].zw).xyz;
|
||||
vec3 c01 = texture2D(sampler0, gl_TexCoord[3].xy).xyz;
|
||||
vec3 c11 = texture2D(sampler0, gl_TexCoord[0].xy).xyz;
|
||||
vec3 c21 = texture2D(sampler0, gl_TexCoord[4].xy).xyz;
|
||||
vec3 c02 = texture2D(sampler0, gl_TexCoord[1].zw).xyz;
|
||||
vec3 c12 = texture2D(sampler0, gl_TexCoord[2].xy).xyz;
|
||||
vec3 c22 = texture2D(sampler0, gl_TexCoord[6].xy).xyz;
|
||||
vec3 c00 = texture2D(sampler0, v_texcoord5.xy).xyz;
|
||||
vec3 c10 = texture2D(sampler0, v_texcoord1.xy).xyz;
|
||||
vec3 c20 = texture2D(sampler0, v_texcoord2.zw).xyz;
|
||||
vec3 c01 = texture2D(sampler0, v_texcoord3.xy).xyz;
|
||||
vec3 c11 = texture2D(sampler0, v_texcoord0.xy).xyz;
|
||||
vec3 c21 = texture2D(sampler0, v_texcoord4.xy).xyz;
|
||||
vec3 c02 = texture2D(sampler0, v_texcoord1.zw).xyz;
|
||||
vec3 c12 = texture2D(sampler0, v_texcoord2.xy).xyz;
|
||||
vec3 c22 = texture2D(sampler0, v_texcoord6.xy).xyz;
|
||||
vec3 dt = vec3(1.0,1.0,1.0);
|
||||
|
||||
float d1=dot(abs(c00-c22),dt);
|
||||
|
|
|
@ -2,10 +2,17 @@ attribute vec4 a_position;
|
|||
attribute vec2 a_texcoord0;
|
||||
uniform mat4 u_viewproj;
|
||||
|
||||
varying vec4 v_texcoord0;
|
||||
varying vec4 v_texcoord1;
|
||||
varying vec4 v_texcoord2;
|
||||
varying vec4 v_texcoord3;
|
||||
varying vec4 v_texcoord4;
|
||||
varying vec4 v_texcoord5;
|
||||
varying vec4 v_texcoord6;
|
||||
|
||||
float size = 2.0; //edge detection offset, 2.0-5.0 suitable range
|
||||
|
||||
void main()
|
||||
|
||||
{
|
||||
float x = (0.125/480.0)*size;
|
||||
float y = (0.25/272.0)*size;
|
||||
|
@ -14,14 +21,14 @@ vec2 dg2 = vec2(-x,y);
|
|||
vec2 dx = vec2(x,0.0);
|
||||
vec2 dy = vec2(0.0,y);
|
||||
gl_Position = u_viewproj * a_position;
|
||||
gl_TexCoord[0]=a_texcoord0.xyxy;
|
||||
gl_TexCoord[1].xy = gl_TexCoord[0].xy - dy;
|
||||
gl_TexCoord[2].xy = gl_TexCoord[0].xy + dy;
|
||||
gl_TexCoord[3].xy = gl_TexCoord[0].xy - dx;
|
||||
gl_TexCoord[4].xy = gl_TexCoord[0].xy + dx;
|
||||
gl_TexCoord[5].xy = gl_TexCoord[0].xy - dg1;
|
||||
gl_TexCoord[6].xy = gl_TexCoord[0].xy + dg1;
|
||||
gl_TexCoord[1].zw = gl_TexCoord[0].xy - dg2;
|
||||
gl_TexCoord[2].zw = gl_TexCoord[0].xy + dg2;
|
||||
v_texcoord0=a_texcoord0.xyxy;
|
||||
v_texcoord1.xy = v_texcoord0.xy - dy;
|
||||
v_texcoord2.xy = v_texcoord0.xy + dy;
|
||||
v_texcoord3.xy = v_texcoord0.xy - dx;
|
||||
v_texcoord4.xy = v_texcoord0.xy + dx;
|
||||
v_texcoord5.xy = v_texcoord0.xy - dg1;
|
||||
v_texcoord6.xy = v_texcoord0.xy + dg1;
|
||||
v_texcoord1.zw = v_texcoord0.xy - dg2;
|
||||
v_texcoord2.zw = v_texcoord0.xy + dg2;
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
|
||||
uniform sampler2D sampler0;
|
||||
varying vec4 v_texcoord0;
|
||||
varying vec4 v_texcoord1;
|
||||
varying vec4 v_texcoord2;
|
||||
varying vec4 v_texcoord3;
|
||||
|
||||
const mat3 RGBtoYIQ = mat3(0.299, 0.596, 0.212,
|
||||
0.587,-0.275,-0.523,
|
||||
|
@ -18,25 +22,25 @@ void main()
|
|||
{
|
||||
vec3 c0,c1;
|
||||
|
||||
c0 = texture2D(sampler0,gl_TexCoord[0].xy).xyz;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[0].zy).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[0].xw).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[0].zw).xyz)*0.125;
|
||||
c0 = texture2D(sampler0,v_texcoord0.xy).xyz;
|
||||
c0+=(texture2D(sampler0,v_texcoord0.zy).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,v_texcoord0.xw).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,v_texcoord0.zw).xyz)*0.125;
|
||||
|
||||
c0+= texture2D(sampler0,gl_TexCoord[1].xy).xyz;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[1].zy).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[1].xw).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[1].zw).xyz)*0.125;
|
||||
c0+= texture2D(sampler0,v_texcoord1.xy).xyz;
|
||||
c0+=(texture2D(sampler0,v_texcoord1.zy).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,v_texcoord1.xw).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,v_texcoord1.zw).xyz)*0.125;
|
||||
|
||||
c0+= texture2D(sampler0,gl_TexCoord[2].xy).xyz;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[2].zy).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[2].xw).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[2].zw).xyz)*0.125;
|
||||
c0+= texture2D(sampler0,v_texcoord2.xy).xyz;
|
||||
c0+=(texture2D(sampler0,v_texcoord2.zy).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,v_texcoord2.xw).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,v_texcoord2.zw).xyz)*0.125;
|
||||
|
||||
c0+= texture2D(sampler0,gl_TexCoord[3].xy).xyz;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[3].zy).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[3].xw).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,gl_TexCoord[3].zw).xyz)*0.125;
|
||||
c0+= texture2D(sampler0,v_texcoord3.xy).xyz;
|
||||
c0+=(texture2D(sampler0,v_texcoord3.zy).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,v_texcoord3.xw).xyz)*0.25;
|
||||
c0+=(texture2D(sampler0,v_texcoord3.zw).xyz)*0.125;
|
||||
c0*=0.153846153846;
|
||||
|
||||
c1=RGBtoYIQ*c0;
|
||||
|
|
|
@ -3,14 +3,18 @@ uniform vec4 u_texcoordDelta;
|
|||
attribute vec4 a_position;
|
||||
attribute vec2 a_texcoord0;
|
||||
uniform mat4 u_viewproj;
|
||||
varying vec2 v_texcoord0;
|
||||
|
||||
varying vec4 v_texcoord0;
|
||||
varying vec4 v_texcoord1;
|
||||
varying vec4 v_texcoord2;
|
||||
varying vec4 v_texcoord3;
|
||||
void main()
|
||||
{
|
||||
gl_Position=u_viewproj * a_position;
|
||||
|
||||
gl_TexCoord[0]=a_texcoord0.xyxy+vec4(-0.5,-0.5,-1.5,-1.5)*u_texcoordDelta.xyxy;
|
||||
gl_TexCoord[1]=a_texcoord0.xyxy+vec4( 0.5,-0.5, 1.5,-1.5)*u_texcoordDelta.xyxy;
|
||||
gl_TexCoord[2]=a_texcoord0.xyxy+vec4(-0.5, 0.5,-1.5, 1.5)*u_texcoordDelta.xyxy;
|
||||
gl_TexCoord[3]=a_texcoord0.xyxy+vec4( 0.5, 0.5, 1.5, 1.5)*u_texcoordDelta.xyxy;
|
||||
v_texcoord0=a_texcoord0.xyxy+vec4(-0.5,-0.5,-1.5,-1.5)*u_texcoordDelta.xyxy;
|
||||
v_texcoord1=a_texcoord0.xyxy+vec4( 0.5,-0.5, 1.5,-1.5)*u_texcoordDelta.xyxy;
|
||||
v_texcoord2=a_texcoord0.xyxy+vec4(-0.5, 0.5,-1.5, 1.5)*u_texcoordDelta.xyxy;
|
||||
v_texcoord3=a_texcoord0.xyxy+vec4( 0.5, 0.5, 1.5, 1.5)*u_texcoordDelta.xyxy;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue