cocos-engine icon indicating copy to clipboard operation
cocos-engine copied to clipboard

[3.8.3] PostProcess fails with GL error 0x501, 0x506

Open Skroopa opened this issue 1 year ago • 11 comments

Cocos Creator version

3.8.3

System information

Android 5.1

Issue description

None of built-in PostProcess effects work on my DIGMA Linx A400 3G LT4001PG (Android 5.1) device. First, it fails with GL error: 0x501 and then GL error: 0x506 every update

Relevant error log output

D/Cocos: 21:47:46 [DEBUG]: JS: Cocos Creator v3.8.3
E/Cocos: 21:47:46 [ERROR]: [SE_ERROR]  (C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/bindings/manual/jsb_global.cpp, 1370): wrong number of arguments: 0, was expecting 1
E/Cocos: 21:47:46 [ERROR]: E/ [ERROR] Failed to invoke js_TextDecoder_decode
D/Cocos: 21:47:46 [DEBUG]: JS: Using custom pipeline
I/Cocos: 21:47:46 [INFO]: Shader 'util/splash-screen|splash-screen-vs:vert|splash-screen-fs:frag' compilation succeeded.
D/Cocos: 21:47:48 [DEBUG]: JS: Success to load scene: db://assets/scenes/main.scene
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 636 
E/Cocos: 21:47:48 [ERROR]: glTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternalFmt, w, h, 0, gpuTexture->glFormat, gpuTexture->glType, nullptr) returned GL error: 0x501
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 1512 
E/Cocos: 21:47:48 [ERROR]: checkFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 636 
E/Cocos: 21:47:48 [ERROR]: glTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternalFmt, w, h, 0, gpuTexture->glFormat, gpuTexture->glType, nullptr) returned GL error: 0x501
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 1512 
E/Cocos: 21:47:48 [ERROR]: checkFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 1512 
E/Cocos: 21:47:48 [ERROR]: checkFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT
I/Cocos: 21:47:48 [INFO]: Shader 'for2d/builtin-sprite|sprite-vs:vert|sprite-fs:frag|CC_USE_EMBEDDED_ALPHA0|USE_TEXTURE1|IS_GRAY0' compilation succeeded.
I/Cocos: 21:47:48 [INFO]: Shader 'pipeline/post-process/fxaa-hq|fxaa-vs|fxaa-edge-fs:frag' compilation succeeded.
I/Cocos: 21:47:48 [INFO]: Shader 'pipeline/post-process/post-final|vs|fs' compilation succeeded.
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 1512 
E/Cocos: 21:47:48 [ERROR]: checkFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT
I/Cocos: 21:47:48 [INFO]: Shader 'pipeline/post-process/blit-screen|vs|fs' compilation succeeded.
I/Cocos: 21:47:48 [INFO]: Shader 'util/profiler|profiler-vs:vert|profiler-fs:frag' compilation succeeded.
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 1793 
E/Cocos: 21:47:48 [ERROR]: glClear(glClears) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 1793 
E/Cocos: 21:47:48 [ERROR]: glClear(glClears) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 1793 
E/Cocos: 21:47:48 [ERROR]: glClear(glClears) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 1793 
E/Cocos: 21:47:48 [ERROR]: glClear(glClears) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 1793 
E/Cocos: 21:47:48 [ERROR]: glClear(glClears) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 1793 
E/Cocos: 21:47:48 [ERROR]: glClear(glClears) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:48 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 2605 
E/Cocos: 21:47:48 [ERROR]: glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset) returned GL error: 0x506
E/Cocos: 21:47:49 [ERROR]: [ERROR] file C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp: line 1793 
E/Cocos: 21:47:49 [ERROR]: glClear(glClears) returned GL error: 0x506

Screenshot_2024-06-27-22-03-23

Steps to reproduce

Run any PostProcess effect

Minimal reproduction project

Run any PostProcess effect

Skroopa avatar Jun 27 '24 20:06 Skroopa

Do you have a demo to reproduce it?

minggo avatar Jul 02 '24 02:07 minggo

just enable PostProcess for your project and on this specific Android device you will not see anything on the screen. In any case, I created an example for you: pp_bug.zip I could help with testing, if it will be required.

Skroopa avatar Jul 02 '24 08:07 Skroopa

Have you tried on other Android devices? I don't have the specific Android device.

minggo avatar Jul 02 '24 08:07 minggo

no problems on other Android devices that I have

Skroopa avatar Jul 02 '24 08:07 Skroopa

The issue seems caused by it

E/Cocos: 21:47:46 [ERROR]: [SE_ERROR]  (C:/ProgramData/cocos/editors/Creator/3.8.3/resources/resources/3d/engine/native/cocos/bindings/manual/jsb_global.cpp, 1370): wrong number of arguments: 0, was expecting 1

Could you please print the javascript call stack by invoking ScriptEngine::getInstance()->getCurrentStackTrace()

minggo avatar Jul 02 '24 08:07 minggo

Doesn't look like it, something wrong with GLES setup itself. Texture cannot be created:

glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8_OES, 800, 480, 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, nullptr)

Skroopa avatar Jul 03 '24 18:07 Skroopa

This line causes the issue: https://github.com/cocos/cocos-engine/blob/983232bff571bae3ca4f78325a689c86d920afb8/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp#L141 And it must be:

        case Format::DEPTH_STENCIL: return GL_DEPTH_STENCIL_OES;

Since GL_DEPTH24_STENCIL8_OES is not supported on some devices with GLES2.0 backend (see Usage Example section). Could you make a PR? Or I could do this.

Skroopa avatar Jul 03 '24 21:07 Skroopa

@Skroopa thanks a lot. We can make a PR if it is not convenient for you to do it.

minggo avatar Jul 04 '24 01:07 minggo

yes please, create the PR. NOTE: PostProcess doesn't work still, but this fix will help only with 0x501, 0x506 GL errors on texture creation.

Skroopa avatar Jul 04 '24 07:07 Skroopa

This line causes the issue:

https://github.com/cocos/cocos-engine/blob/983232bff571bae3ca4f78325a689c86d920afb8/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp#L141

And it must be:

        case Format::DEPTH_STENCIL: return GL_DEPTH_STENCIL_OES;

Since GL_DEPTH24_STENCIL8_OES is not supported on some devices with GLES2.0 backend (see Usage Example section). Could you make a PR? Or I could do this.

As less bit will have less precision. So i am not sure if it is a good idea to modify it for all android devices.

minggo avatar Jul 04 '24 08:07 minggo

I think we should check extension to do it.

minggo avatar Jul 04 '24 08:07 minggo