不支持 BC 的设备(A16)上 iOS 版闪退:贴图视图 R8Unorm → RGBA16Uint 断言失败
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start in nvn_mtl.m at attach() around line 1858 and tex_by_id(); the report traces the crash to a BC4 GPU encoded texture using an RGBA16Uint view when BC compression is unavailable. Read the texture format handling and reproduce on Mac with DM_TEST_NO_BC=1. Done means the texture view is handled without the Metal assertion while preserving the encoded texture content; also inspect the reported g_red_once bounds issue.
Written by the indexing model from the issue text.
Description
设备: iPhone 14 Pro(A16,supportsBCTextureCompression = NO),iOS 27.0
版本: main @ 9579030,档案 01007EF00011E000(1.9.0 更新)
现象
启动几秒后闪退,日志最后一行 SetDepthClamp 开:宿主暂忽略 之后紧跟:
_mtlValidateArgumentsForTextureViewOnDevice:1877: failed assertion `Texture Creation
source texture pixelFormat (MTLPixelFormatR8Unorm) not compatible with texture view pixelFormat (MTLPixelFormatRGBA16Uint).'
Mac 上可复现:DM_TEST_NO_BC=1(不用开调试层)。调用栈:
_mtlValidateArgumentsForTextureViewOnDevice
-[AGXTexture initWithTexture:pixelFormat:resourceIndex:]
attach nvn_mtl.m:1858
rp_begin_ex_ nvn_mtl.m:1888
draw nvn_mtl.m:4868
mtl_exec nvn_mtl.m:5747
h_nvnQueueSubmitCommands hle_nvn.c:846
原因
游戏在 GPU 上编码一张 BC4 贴图:通过 RGBA16Uint 视图往里画(NVN 贴图格式 0x49,视图格式 0x2c,一个像素对应一个 8 字节块)。无 BC 时 tex_desc 把这张贴图建成解压格式(R8Unorm),原始块视图没有对应的存储,Metal 直接断言。
我本地的绕过办法(nvn_mtl.m)
attach():bc_unpack(t->d.format)为真且视图格式不是 BC 时,不挂这个附件(和上面压缩格式附件的处理一样),打一条红行。tex_by_id():采样视图做同样判断,按空槽处理。
改完后 DM_TEST_NO_BC=1 下能读档进到野外,肉眼没看出画面差异;但 GPU 编码的那张 BC4 贴图内容丢了,正式修法可能要把写入的块解码回 R8 贴图(或保留一份原始块的影子贴图)。
顺带:g_red_once 声明为 84 个元素,但代码里用了 RED_ONCE(84, …),越界一位。
另外无 BC 时野外的内存占用约 3.9 GB(有 BC 时约 2.8 GB),在 6 GB 内存的 iPhone 上可能超过单个 App 的上限。
- Dominant language
- C
- Stars
- 438
- Forks
- 102
- Avg merge
- 11h 32m
- Merged PRs (30d)
- 30
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from seedds/nxnative
-
Hide the cursorOpen
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
seedds/nxnative#675 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 77/100
seedds/nxnative#502 · 1 reaction ·
Maintainers usually reply within 1 day
-
.IPA without macOpen
Difficulty 5/5 Over a week Newbie friendliness 22/100
Maintainers usually reply within 1 day
-
Mac app: the settings window stays on screen after Play until the game endsPossibly taken @surajmandalcell claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
DrawTexture decodes the sampler ID from the full 64-bit handle (+5 smaller findings from LumaNX's sync review)Possibly taken @thehobbit85 claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
seedds/nxnative#687 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
JustAResearcher/gpu-unlock-ada#124 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
inflate: total_in uses plain += on c_ulong (32-bit on Windows), panics in debug for streams > 4 GiBOpen
Difficulty 1/5 Under an hour Newbie friendliness 85/100
trifectatechfoundation/zlib-rs#570 · 1 comment ·
-
vim.filetype.match() prefixes a URL buffer name with the cwd before passing it to filetype functionsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
compilation errorOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
COVESA/dlt-daemon#925 · 1 reaction ·