Saturday, September 7, 2024
HomeGame DevelopmentVertexShader compilation failed in previous Android cellphone - Cocos Creator

VertexShader compilation failed in previous Android cellphone – Cocos Creator


Hello everybody, I’ve seen an issue after I use customized shader code, on previous gadget the sport cease lauching and it log numerous errors about shader compilation failed. This practice shader work effective for different gadgets. For now the previous cellphone solely work effective with built-in shaders. How can I repair this?
System: OPPO a83, android 7.1.1
Cocos creator I’m utilizing: 3.5.1


too much less data, you’re supposed to supply extra data of the shader, and all the error messages.

Yeah, we have to know the tip of the message, it ought to point out which line causes the difficulty and the basis purpose, by the way in which, we’ve got this gadget coated, so it must 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;
  #embrace <cc-global>
  #if USE_LOCAL
    #embrace <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 = ground(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;
  #embrace <embedded-alpha>
  #embrace <alpha-test>
  #embrace <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 just isn’t so useful for rendering points

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments