Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 非正方形(512x1024)astc纹理mipmap在原生android上崩溃 #16820

Closed
Yuki001 opened this issue Mar 25, 2024 · 9 comments
Closed
Assignees
Labels
Bug Env: Android Env: Native General issue on all native platforms including iOS, Android, MacOS, Windows
Milestone

Comments

@Yuki001
Copy link

Yuki001 commented Mar 25, 2024

Cocos Creator version

3.7.3

System information

window10

Issue description

(This bug was reported in cocos chinese form 4 month ago,but no offical programmer reply it ,so I copy it here, and lazy for translate to english. )

引擎版本:3.7.3
在web端和小游戏端没问题,在android端崩溃。

我自己已经修复了,原因是原生代码里面对width和height的取值 >> level ,没有判断<1
region.texExtent.width = _textureWidth >> level;
改成
region.texExtent.width = std::max(_textureWidth >> level,1U);
有4-5个地方要改的。

在web端和小游戏端没问题是因为调用的gl.texSubImage2D选择的是不传width/height的版本,所以不会出错。native端调用的glCompressedTexSubImage2D是需要传width/height的,一传就错了。

Relevant error log output

No response

Steps to reproduce

在android 上使用非正方形(512x1024)astc纹理

Minimal reproduction project

No response

@Yuki001 Yuki001 added Bug Needs Triage Needs to be assigned by the team labels Mar 25, 2024
@minggo minggo self-assigned this Mar 26, 2024
@minggo minggo added this to the 3.8.4 milestone Mar 26, 2024
@minggo minggo added Env: Android Env: Native General issue on all native platforms including iOS, Android, MacOS, Windows and removed Needs Triage Needs to be assigned by the team labels Mar 26, 2024
@minggo
Copy link
Contributor

minggo commented Mar 26, 2024

在android 上使用非正方形(512x1024)astc纹理

只需要场景里有用到就会出现问题吗?如果能够直接给个重现的 demo 会更好些。

@Yuki001
Copy link
Author

Yuki001 commented Mar 28, 2024

DemoForBugProject_1.zip

这个demo工程,注意这个图片的filter mode 要设置成mipmap才行,压缩纹理只选astc
Snipaste_2024-03-28_17-35-51

打出来的apk 18m我就不传了。在一部分真机上崩溃,一部分真机上能进去但是一半在闪烁,在电脑模拟器上显示半黑(说明mipmap错了)

web
web

pc 模拟器
pc simulator

@Yuki001
Copy link
Author

Yuki001 commented Mar 28, 2024

DemoForBugProject_1-release.zip
apk 还是传上来吧。

@minggo
Copy link
Contributor

minggo commented Mar 28, 2024

好的,谢谢。

@minggo
Copy link
Contributor

minggo commented Mar 29, 2024

我使用三星的 galaxy 12 测试,显示是正常的。你用什么手机测试的?

@minggo
Copy link
Contributor

minggo commented Mar 29, 2024

但是用你上传的 apk 就有问题。编辑器的配置我看了也一样。

@minggo
Copy link
Contributor

minggo commented Mar 29, 2024

我用的引擎是 3.8.3 最新的版本(还未发布)测试的。你可以用 3.8.2 试一下。

@Yuki001
Copy link
Author

Yuki001 commented Mar 30, 2024

好的,我是3.7.3 的编辑器,我自己修复也是在3.7.3的引擎上的。如果你这边测试新的引擎没问题,那可能就已经在其他的地方顺带修复了这个问题。
这个issue如果没问题就可以先关了,不过就是麻烦多测试一下这个情况了。
另外也可以看看你那边打出来的apk是不是这个图片仅有astc。就确保这个astc的纹理被使用上。

@minggo
Copy link
Contributor

minggo commented Apr 1, 2024

确认过是 astc 文件,我们多找几个设备试一下。

@Yuki001 Yuki001 closed this as completed Apr 2, 2024
@minggo minggo added the QA: Open label Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Env: Android Env: Native General issue on all native platforms including iOS, Android, MacOS, Windows
Projects
None yet
Development

No branches or pull requests

2 participants