我試圖在Galaxy Tab 3上使用自定義着色器,但它們未能編譯或鏈接。這是代碼。 這是頂點着色器在Vivante GC1000 GPU(Galaxy Tab 3)上編譯/鏈接着色器
attribute vec4 a_position;
attribute vec2 a_texCoord;
uniform sampler2D u_texture;
varying vec2 blurs[8];
uniform vec2 blurSize;
#ifdef GL_ES
varying lowp vec2 v_texCoord;
#else
varying vec2 v_texCoord;
#endif
void main()
{
gl_Position = CC_MVPMatrix * a_position;
v_texCoord = a_texCoord;
blurs[0] = v_texCoord + vec2(-0.016, 0.0) * blurSize;
blurs[1] = v_texCoord + vec2(-0.012, 0.0) * blurSize;
blurs[2] = v_texCoord + vec2(-0.008, 0.0) * blurSize;
blurs[3] = v_texCoord + vec2(-0.004, 0.0) * blurSize;
blurs[4] = v_texCoord + vec2(0.004, 0.0) * blurSize;
blurs[5] = v_texCoord + vec2(0.008, 0.0) * blurSize;
blurs[6] = v_texCoord + vec2(0.012, 0.0) * blurSize;
blurs[7] = v_texCoord + vec2(0.016, 0.0) * blurSize;
}
這是片段着色器
#ifdef GL_ES
precision lowp float;
#endif
varying vec2 v_texCoord;
varying vec2 blurs[8];
uniform sampler2D u_texture;
//uniform vec2 blurSize;
uniform vec4 substract;
void main() {
gl_FragColor = vec4(0.0);
gl_FragColor += texture2D(u_texture, blurs[0])*0.0443;
gl_FragColor += texture2D(u_texture, blurs[1])*0.0776;
gl_FragColor += texture2D(u_texture, blurs[2])*0.1158;
gl_FragColor += texture2D(u_texture, blurs[3])*0.1473;
gl_FragColor += texture2D(u_texture, v_texCoord )*0.1595;
gl_FragColor += texture2D(u_texture, blurs[4])*0.1473;
gl_FragColor += texture2D(u_texture, blurs[5])*0.1158;
gl_FragColor += texture2D(u_texture, blurs[6])*0.0776;
gl_FragColor += texture2D(u_texture, blurs[7])*0.0443;
}
在ipad,結點設備和星系S3/S4和說明3能正常工作。但在galaxy標籤3(與vivante gc1000 gpu)無法編譯或鏈接;我不確定哪一個失敗。 下面是logcat的錯誤:
03-25 20:59:36.328 D/v_gal (3167): [tid=3179] gcmONERROR: status=-10(gcvSTATUS_TOO_COMPLEX) @ _GenerateStates(10194)
03-25 20:59:36.328 D/v_gal (3167): [tid=3179] gcmONERROR: status=-10(gcvSTATUS_TOO_COMPLEX) @ gcLINKTREE_GenerateStates(11342)
03-25 20:59:36.328 D/v_gal (3167): [tid=3179] gcmERR_BREAK: status=-10(gcvSTATUS_TOO_COMPLEX) @ gcLinkShaders(7831)
03-25 20:59:36.328 D/cocos2d-x debug info(3167): cocos2d: ERROR: Failed to link program: 25
03-25 20:59:36.328 D/cocos2d-x debug info(3167): cocos2d: ERROR LOG PROGRAM: (null)
03-25 20:59:36.328 D/v_gal (3167): [tid=3179] gl2mERROR: result=0x0501 @ glGetShaderiv(886)
03-25 20:59:36.328 D/cocos2d-x debug info(3167): cocos2d: ERROR LOG VERTEX: (null)
03-25 20:59:36.328 D/v_gal (3167): [tid=3179] gl2mERROR: result=0x0501 @ glGetShaderiv(886)
03-25 20:59:36.328 D/cocos2d-x debug info(3167): cocos2d: ERROR LOG FRAG: (null)
錯誤日誌程序,錯誤日誌VERTEX,錯誤日誌FRAG是glGetProgramInfoLog和glGetShaderInfoLog呼叫。他們都返回null
Andres,這種模糊效果對你有好處嗎?我假設有一個垂直模糊的第二遍,對吧?你有任何截圖嗎? – nmr