Stacked on #284 (same policy header). This PR's base is #284's branch; GitHub retargets it to main once #284 is merged.
Shared code: the Vulkan engine (Android and HarmonyOS). Only Qualcomm Adreno 6xx default differently. Inlining needs SPIRV-Tools, which only the Android package has, so HarmonyOS is unaffected. Tested on Android only.
For #266 and #265 (white / coloured squares on fire and smoke on the Adreno 660).
Cause
@tranco447's log from a Galaxy Z Fold 3 (Adreno 660, driver 0x80212000) in #266:
NVN shaders with subgroup helpers are inlined at load=0
NVN pipelines skipped=1 (gfx-pipe-skip)
NVN pipeline c:098a126f92bf533a skipped (gfx-pipe-skip)The fluid shader 098a126f92bf533a crashed the driver's compiler on earlier boots, so the crash guard put it on the skip list, and fire and smoke lose it. That's the compiler crash inlining already fixes on the Adreno 750 family and the 735 (#284). On an Adreno 650 the same shader compiles once inlined (@kieusonlam, #243).
Change
xbg_adreno_compiler_needs_inline: also the 6xx (600–699).- Retrying old skips. A skip entry recorded without inlining would keep the shader skipped forever, even after an update turns inlining on, so
gfx-pipe-skipentries recorded with inlining on now end ini.- Where inlining is newly on (the 6xx and 735 defaults, or the
gfx-inlinemarker), an entry withoutiis dropped once and the pipeline is built again, inlined (NVN pipeline ... was skipped without inlining; retried with inlining). - If it still crashes, the guard records it again with
iafter two boots, and it stays skipped. No crash loop. - The 750–799 have been inlined since v2.0.2, so their entries are not retried. Retrying them would cost those users up to two crashes after updating.
- Where inlining is newly on (the 6xx and 735 defaults, or the
- What players may see after updating (worth a line in the release notes). Only Adreno 6xx and 735 phones whose skip list already has entries are affected, that is, phones that hit a driver crash before. Each old entry gets one retry. If its pipeline still crashes when inlined, the app closes when that pipeline is built: at start, or for a compute effect like
098a126f92bf533a, on entering a game. That happens up to twice. The start after a crash builds pipelines one at a time, so it is slower. After the second crash the entry is skipped again, as it was before the update. So a crash or two right after updating is this retry, not a new bug. A log withretried with inliningfollowed bywas being built when the last two boots endedconfirms it.
Tests
dm/gfx/vulkan/engine/tests/adreno_policy_test.cpppasses: inlining for 618, 650 and 660, not the 540 or 730; "newly inlined" for the 6xx and 735, not the 750 or 730, nor other vendors.- Redmi K50 Ultra (Adreno 730), debug APK and pack from this branch, with
gfx-inline= 1:- With
gfx-pipe-skip=c:098a126f92bf533a, the entry was retried,098a126f92bf533aloaded withinlined=1and wasn't skipped, and the file was empty afterwards. - With
c:098a126f92bf533a i, it stayed skipped. - Both camp runs were clean: 392 warm-up builds, 0 failed, 0 pipelines created during play.
- With
- Full build: debug APK in docker (NDK 29).
Tester result (Adreno 735, #286)
On @xfl1996's 735 (#286), c:098a126f92bf533a and c:6a7a308d61928982 were on the skip list from real compiler crashes without inlining, and the player light was missing as a result. Turning inlining on and clearing those entries brought the light back with no crashes. With this PR, those untagged entries are retried once automatically on the 735, so existing players recover after updating without touching the file.
Tester result (Adreno 660)
@tranco447's build of this branch (Z Fold 3, Adreno 660, driver 0x80212000, fresh install): inlined at load=1, and 13 shaders were inlined, including 098a126f92bf533a and 6a7a308d61928982. There were no crashes. c:098a126f92bf533a now fails cleanly (failed to build (result=-13)) instead of crashing, and it is still skipped, so the fire squares remain. This PR alone does not fix #266. The same shader also gets the warp32 rewrite (40 rewrites), which is the next suspect.
No Adreno 6xx here. @tranco447 (Z Fold 3, 660) and @Shaft455 (Adreno 650, driver 0x801f6000, #155), could you try this branch?
- Build both the APK and the import pack from this branch (the app accepts only a pack made from the same code), copy the new
androidfolder to the phone, and let the app import it again. - A self-built APK is signed differently, so installing it means uninstalling the official app, which deletes your saves. Back them up first.
- Then look at fire spells and torches. If it's still wrong, attach
adb logcat -d -s dmfrom that session.
Uninstalling also removes the old skip list, so the retry matters mainly for updates installed over an existing app.
🤖 Generated with Claude Code
Activity
8ok, im trying to build the apk and the import pack with google gemini...im a n00b at this, so i have no idea i never did this before.. but, i already have git and docker installed, now its building the environment, docker build -t dm-android-build:1 dm/android/docker
then im going to build i guess whats needed....gemini helps me giving me the commands...ill let you know if i fail or i managed to do the apk and the import pack.... then test the game, and reply the results....the zip i donwloaded from here, so i guess it has the fixes needed no ?
Heres the log: d2r_adreno6xx_test.log
Ok, i made good progress , So, i did the test... ive built the debug apk, and the new android import pack....—building an entire Android NDK + .NET + Vulkan toolchain from scratch just to test a PR is a huge grind, and I actually pulled off the hardest part cleanly. It took me 2-3 hours, maybe 4. Now im wiping Docker and evrything Git downloaded for this.....i need to reclaim all ~21 GB of my SSD.. The fix DID NOT work. Sadly. Im no coder, nor programmer i used ai to make me the apk, and the full vulkan environment on my pc... it all works. The bug, is NOT fixed. (and im annoyed to be frank here, lol)
i could share the apk and the android import, but it may be a problem for the DMCA, so its probably not a good idea ??? --- i hope my effort amounts to something, to progress this project further, and i wanted to help the project here work on older devices too, but this fix did not help sadly.
Thanks for trying! One thing first: a zip from the repository's front page or a release does not have this fix yet, because #287 isn't merged. You need the PR's own branch, adreno-6xx-inline. It already includes #284, which it builds on. Since you have git:
git clone --branch adreno-6xx-inline https://github.com/jhaizhou-ops/d2r-mobile.git
cd d2r-mobile
git log -1 --onelineThe last command should print 9803dd3. If you'd rather download a zip, use https://github.com/jhaizhou-ops/d2r-mobile/archive/refs/heads/adreno-6xx-inline.zip
Then build both from that same folder:
- APK: follow "Build locally" in
dm/android/README.md. The Docker route runs on Linux or WSL. It also needs three header files generated from your game files (dm_vault_tab.h,dm_hud_exp.h,dm_bright_levels.inc, made with the rules indm/host/Makefile); pass their folder asDM_GEN_DIR. - Import pack: step 1 of
docs/ANDROID.md(python3 dm/tools/d2rm_android.py <game files> <output>). Copy the newandroidfolder toDownload/S2X/D2R Mobile/so the app imports it again.
When you play, look at fire spells and torches. If you can, attach adb logcat -d -s dm from that session, or the file from the pause menu's Share Diagnostics, which this branch has. A line saying was skipped without inlining; retried with inlining (gfx-pipe-skip) means the fix kicked in for your saved skip entry.
One thing to expect: if the fire effect still crashes your driver even with this fix, the game may close once or twice when you enter a game, because that's when the effect is first built. After the second time it puts the effect back on its skip list and runs as before, with the squares. That's the safety net, not a new bug. Please still tell us and attach the log, because it would mean this fix isn't enough for your driver. Uninstalling the old app also clears its old skip list, so the fix gets a clean try on your phone.
I know that the front page doesnt have this fix, i thought my ai pulled the files from here, so this post, #287. At least thats what i instructed it to do. But if you checked my log, "d2r_adreno6xx_test.log", and you say the stupid ai pulled the zip from the main page instead...im even more annoyed lol, because i worked hard for absolute nothing then. I showed the Gemini ai this post #287, i gave it your instructions, and it told me step by step what to do, what to download, what to install, etc...it was a very long process, and if in the end i built the basic apk...lol....id be very mad. Anyway, i deleted everything, because the apk i built didnt fix the problem. If i were to do it again, id have to start from zero again.
Sorry, my mistake: I wrote that reply to your earlier question and missed your test log. Your build was right. The log shows this branch's code running: inlined at load=1 is new in #287 for the 660, and the fire shader loaded with inlined=1. So your 3–4 hours weren't wasted. The log tells us something we couldn't have learned otherwise:
- With inlining, your driver (
0x80212000) no longer crashes on the fire shader098a126f92bf533a. Instead it refuses it cleanly (failed to build (result=-13)). The game still skips it, so the squares stay. Every other shader built fine, with no crashes. - So inlining is not the fix for that shader on the 660. The next suspect is the 32-lane warp rewrite that the same shader gets (
warp32 ... rewrites=40).
No need to rebuild anything. If the APK you built is still on the phone and you have a couple of minutes, one test needs only adb:
adb shell "run-as com.xiaoboluo.d2r sh -c 'printf 0 > files/dm/gfx-warp32; rm -f files/dm/gfx-pipe-skip'"Then start the game, cast a fire spell, and attach adb logcat -d -s dm. If the game closes once or twice, that's the crash guard; send the log anyway. Afterwards, turn the switch back on with adb shell "run-as com.xiaoboluo.d2r rm files/dm/gfx-warp32". If you've already removed the app, don't worry about it.
i have no idea how to do that, and regarding the saves, at this point, it doesnt matter, if it fixes the shader phenomenon.
im gonna try to use gemini to help me build this thing