Hello everybody, I’ve seen an issue after I use customized shader code, on outdated gadget the sport cease lauching and it log loads of errors about shader compilation failed. This practice shader work superb for different gadgets. For now the outdated telephone solely work superb with built-in shaders. How can I repair this?
Machine: OPPO a83, android 7.1.1
Cocos creator I’m utilizing: 3.5.1
too much less information, you might be supposed to supply extra information of the shader, and your complete error messages.
Yeah, we have to know the tip of the message, it ought to point out which line causes the problem and the basis purpose, by the way in which, we now have this gadget lined, so it ought to be working
Right here is the log file:
1658735420227.zip (5.9 KB)
It simply print the shader supply code out.
Right here is an instance of my customized shader code, it simply replace picture uv in realtime:
// Copyright (c) 2017-2020 Xiamen Yaji Software program Co., Ltd.
CCEffect %{
methods:
- passes:
- vert: sprite-vs:vert
frag: sprite-fs:frag
depthStencilState:
depthTest: false
depthWrite: false
blendState:
targets:
- mix: true
blendSrc: src_alpha
blendDst: one_minus_src_alpha
blendDstAlpha: one_minus_src_alpha
rasterizerState:
cullMode: none
properties:
alphaThreshold: { worth: 0.5 }
}%
CCProgram sprite-vs %{
precision highp float;
#embody <cc-global>
#if USE_LOCAL
#embody <cc-local>
#endif
in vec3 a_position;
in vec2 a_texCoord;
in vec4 a_color;
out vec4 colour;
out vec2 uv0;
vec4 vert () {
vec4 pos = vec4(a_position, 1);
#if USE_LOCAL
pos = cc_matWorld * pos;
#endif
#if USE_PIXEL_ALIGNMENT
pos = cc_matView * pos;
pos.xyz = flooring(pos.xyz);
pos = cc_matProj * pos;
#else
pos = cc_matViewProj * pos;
#endif
uv0 = a_texCoord;
colour = a_color;
return pos;
}
}%
CCProgram sprite-fs %{
precision highp float;
#embody <embedded-alpha>
#embody <alpha-test>
#embody <cc-global>
in vec4 colour;
#if USE_TEXTURE
in vec2 uv0;
#pragma builtin(native)
format(set = 2, binding = 10) uniform sampler2D cc_spriteTexture;
#endif
vec4 frag () {
vec2 uv = vec2(
uv0.x + (sin(cc_time.x * 0.5 + uv0.x * 10.0) - 0.5) * 0.01,
uv0.y + (sin(cc_time.x * 0.5 + uv0.y * 2.5) - 0.5) * 0.01
);
vec4 t_image = CCSampleWithAlphaSeparated(cc_spriteTexture, uv);
return t_image;
}
}%
I believe it could possibly be associated to out of reminiscence, and please use Android Studio logcat or Chrome devtools to seize logs, vconsole isn’t so useful for rendering points
Sadly the log from chrome devtools is identical because the one I confirmed above. I believe I ought to discover a strategy to debug it from preview mode on my telephone.
Please examine the reminiscence of your telephone, it could possibly be 2GB to 4GB
Chrome might use loads of reminiscence beneath the hood, and it’d inflicting the GL fail to compile the shader. That’s the primary purpose why it doesn’t work. You’ll be able to attempt to construct Android apk with GLES and if that works, then shaders are alright