-
Creator 版本:3.8.8
-
目标平台: ios
-
重现方式:使用自定义shader
-
首个报错:
[ERROR]: [ERROR] file /Applications/Cocos/Creator/3.8.8/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-base/SPIRVUtils.cpp: line 147
17:41:24 [ERROR]: GLSL Linking Failed:
ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
17:41:24 [ERROR]: [ERROR] file /Applications/Cocos/Creator/3.8.8/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-base/SPIRVUtils.cpp: line 147
17:41:24 [ERROR]: GLSL Linking Failed:
ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
17:41:24 [INFO]: …/bundle/gui/lobby/vipLevel/effect/VerticalThreeColorEffect|VerticalThreeColorEffect-vs:vert|VerticalThreeColorEffect-fs:frag|USE_TEXTURE1 compile succeed.
17:41:24 [ERROR]: [ERROR] file /Applications/Cocos/Creator/3.8.8/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-metal/MTLPipelineState.mm: line 219
17:41:24 [ERROR]: Failed to create pipeline state, please check if shader/pileinelayout match with each other!
-[MTLDebugRenderCommandEncoder setRenderPipelineState:]:1604: failed assertion `Set Render Pipeline State Validation
renderPipelineState must not be nil.
- 重现概率: 100%
这个是我靠AI生成的一个三色渐变的着色器安卓和web都是正常的,ios打包后一运行就报错有没有大神知道为什么
CCEffect %{
techniques:
- name: opaque
passes:
- vert: general-vs:vert
frag: three-color-gradient-frag:frag
properties: &props
color1: { value: [1.0, 0.0, 0.0, 1.0], editor: { type: color } }
color2: { value: [0.0, 1.0, 0.0, 1.0], editor: { type: color } }
color3: { value: [0.0, 0.0, 1.0, 1.0], editor: { type: color } }
angle: { value: 0.0, editor: { range: [0.0, 360.0] } }
- name: transparent
passes:
- vert: general-vs:vert
frag: three-color-gradient-frag:frag
properties: *props
blendState:
targets:
- blend: true
blendSrc: src_alpha
blendDst: one_minus_src_alpha
}%
CCProgram general-vs %{
precision highp float;
#include <builtin/uniforms/cc-global>
in vec3 a_position;
in vec4 a_color;
in vec2 a_texCoord;
out vec4 v_color;
out vec2 v_uv;
vec4 vert () {
vec4 pos = vec4(a_position, 1.0);
v_color = a_color;
v_uv = a_texCoord;
return cc_matViewProj * pos;
}
}%
CCProgram three-color-gradient-frag %{
precision highp float;
#include <builtin/uniforms/cc-global>
#include <builtin/uniforms/cc-local>
in vec4 v_color;
in vec2 v_uv;
uniform Properties {
vec4 color1;
vec4 color2;
vec4 color3;
float angle;
};
#pragma builtin(local)
layout(set = 2, binding = 12) uniform sampler2D cc_spriteTexture;
vec2 rotateUV(vec2 uv, float angle_degrees) {
float rad = radians(angle_degrees);
float cosA = cos(rad);
float sinA = sin(rad);
vec2 centered = uv - 0.5;
vec2 rotated;
rotated.x = centered.x * cosA - centered.y * sinA;
rotated.y = centered.x * sinA + centered.y * cosA;
return vec2(rotated.x + 0.5, rotated.y + 0.5);
}
vec4 frag () {
vec2 rotated_uv = rotateUV(v_uv, angle);
float t = clamp(rotated_uv.x, 0.0, 1.0);
vec4 finalColor;
if (t < 0.5) {
float segmentT = t * 2.0;
finalColor = mix(color1, color2, segmentT);
} else {
float segmentT = (t - 0.5) * 2.0;
finalColor = mix(color2, color3, segmentT);
}
vec4 texColor = texture(cc_spriteTexture, v_uv);
finalColor *= texColor;
finalColor *= v_color;
return finalColor;
}
}%