A GPU port story · Pinyon Shift on Android

The GPU that doesn’t speak the game’s language.

32×32 px blocks

Making an Xbox 360 recompilation run on a Mali-G720 phone, and what it cost in memory, in wrong turns, and in two pull requests.

Scroll ↓
The short version

A game built for a console, on a phone chip it wasn’t made for.

The problem

The chip can’t do two things the game expects.

The game was written for the Xbox 360’s graphics chip. The phone’s Mali chip can’t read the game’s picture files in their own format, and it lacks one drawing trick. The distant landscape flashed, and the pictures took nearly three times the memory they should.

Two fixes

One from the maintainers, one from me.

The project’s maintainers added a setting that skips the missing trick, and the flashing stopped. My change, the one I submitted, translates the picture files into a format the Mali chip reads directly.

The result

Same smoothness, a third of the memory.

Picture memory fell from 918 to 327 MB. The game runs at the same speed as before, so this is a saving, not a speed-up. One small cost: some see-through edges are drawn with fewer steps.

Each square is 10 MB. Orange: before (918). Teal: now (327).
Chapter 1 · The game

An Xbox 360 racing game, translated to run on a phone.

First-person view from a red Chevrolet Corvette on a city road with the pause menu open
A frame from the PC build in photo mode, shown to describe the project. The game belongs to its owners; Pinyon Shift is not affiliated with them.
Game
Forza Horizon, Xbox 360 release, 2012
Project
Pinyon Shift: the game’s PowerPC code translated to C++ and compiled ahead of time. Nothing is interpreted while you play.
Runs on
Windows, Linux, Steam Deck, Apple silicon Macs, and an Android alpha
Renderer
Vulkan 1.3 only
My part
Android on Mali GPUs: the POCO X7 Pro, a Mali-G720 MC7 with Android 16
You supply
Your own disc. The project ships no game files.
How the game gets to your phone
  1. Your discYou supply the game. It stays on your devices.
  2. TranslatedIts code becomes C++ and is compiled once, ahead of time.
  3. Drawn with VulkanThe Xbox graphics calls become Vulkan calls.
  4. Your phone’s GPUMali has gaps to fill. This is where my work is.
Chapter 2 · The phone

The game asks for two things this GPU doesn’t have.

What the game uses
BC / DXT textureseverywhere
Vertex shader memexportstores from vertex stage

POCO X7 Pro · Mali-G720 MC7

textureCompressionBCthe format the game ships in
✕
vertexPipelineStoresAndAtomicsneeded for memexport in vertex shaders
✕
textureCompressionASTC_LDRthe one compressed format it does have
✓
timestampPeriodreported as 0: no GPU timer. The game doesn’t need it; it limited my profiling.
0

Source: the Vulkan capability report from the phone, Android 16.

Chapter 3 · The symptoms

It ran. It also had two problems.

Problem 1 · the distant landscape flashed on and off (illustration)
Problem 2 · textures used far more memory than they should
918 megabytes MB

of textures decoded to RGBA8 on the phone, because it can’t read BC. Driving held 26–35 ms a frame.

Chapter 4 · The detective work

Four suspects. Each one needed its own experiment.

The flashing needed the maintainers’ setting. The memory problem is the one my change fixes. The other two suspects were checked and set aside or worked around.

Ruled out

Shader compiles while driving

A fresh run compiled 686 pipelines at start and only 4 afterwards. Mid-drive compiles can’t explain the flashing.

686 at start · 4 later
Fixed

Vertex memexport on a GPU without vertex stores

Upstream added an opt-in setting that skips those stores. I took it instead of my own patch, and the flashing was gone.

--vulkan_require_vertex_pipeline_stores_and_atomics=false
Fixed

The memory trim

On a low-memory signal the texture cache was cut from 708 to 251 MB in one step. It now trims to 60% of current use, with a floor of 256 MB.

708 → 251 MB before · 60% steps after
Worked around

Occlusion queries

The driver crashed in vkCmdEndQuery. Turning queries off in the phone’s config avoids it. A fix in code is still open.

occlusion_query_enable=false
Chapter 5 · The fix

Translate each 4×4 block instead of unpacking it.

A BC1 block is two colours and sixteen 2-bit steps between them. An ASTC 4×4 block can hold the same two colours and the same steps. So the compute shader rewrites the bits and the pixels stay compressed. Click a pixel to change its step.

BC1 block · 8 bytes
ASTC 4×4 block · 16 bytes

This demo is a small re-implementation to show the idea. The tested code is the C++ in the SDK: 7 tests and 89,098 assertions pass, and its output matches Mesa’s ASTC decoder.

Bytes for one 4×4 block of pixels
RGBA8 (before)
64 B
BC1 source
8 B
BC3 source
16 B
ASTC 4×4 (now)
16 B

BC1 doubles in size, BC3 stays the same, and both are far under RGBA8. Alpha in BC3 drops from 8 levels to 4, with fully clear and fully opaque kept exact.

Chapter 6 · The result

Less memory. The frame time didn’t move.

RGBA8 decode
918 MB
ASTC transcode
327 MB
3.0 → 2.55 GB
resident memory
26.2 → 25.3 ms
median frame time: about the same (the two routes differ)
8 → 4 levels
BC3 alpha steps, the one visible cost
The horizon stays putNo more flashing on the far landscape. Thanks to the maintainers’ setting. (Illustration)
It runs at the same paceAbout 25 ms a frame, as before. Not faster.
A third of the picture memory918 MB down to 327 MB. One square is 10 MB.
Frame time over a free-roam run. Both builds hold about 25 to 26 milliseconds, with one 6,071 millisecond frame in the transcode run.
upstreamwith transcodewhole run, median of each time slice, ms per frame

One run of each build on the POCO X7 Pro. The grey band is the title, menus and loading; driving starts at its right edge. The transcode run has one frame of 6,071 ms, just before driving starts, that I haven’t explained. A median can’t show it, so it is marked. The medians above are the free-roam figures from the pull request docs. I’m not claiming a speed-up: only the memory number is a clear difference.

Chapter 7 · The contribution

Two pull requests on a clean history.

I rebuilt my Mali branch on top of the maintainers’ latest dev.
I dropped my own vertex-store patch for their opt-in setting (PR #738 by MoaazHF).
Five commits in the main repo, two in the SDK, each one change and each with its tests.
The main PR also carries two crash-report fixes and the Mali notes in the Android docs.
The SDK pin changes in two places that must agree, and a release test checks it.

Pinyon Shift is the work of its maintainers. The Mali support builds on their code, and the vertex-store setting that stopped the flashing is theirs.

Chapter 8 · Try it

Fetch my change and play it.

You need a disc image of the game you own, a PC where Pinyon Shift already builds and plays, and an Android phone with a Vulkan 1.3 driver. The game is built from your disc on your machine and is never downloaded from here.

  1. Get the branch

    My work is on my fork until the pull requests merge. The SDK commit it pins exists only on my SDK fork, so point the submodule there first.

    git clone https://github.com/L0ic4/pinyon-shift.git
    cd pinyon-shift
    git checkout android/mali-g720-v2
    git config submodule.thirdparty/shiftglue-sdk.url \
      https://github.com/L0ic4/shiftglue-sdk.git
    git submodule update --init --recursive
  2. Build and install the app

    Connect the phone with adb (USB or wireless), then:

    python tools/pinyon.py android build
    python tools/pinyon.py android install
    python tools/pinyon.py android push-data

    The first build takes 20 to 60 minutes. push-data copies your extracted game to the phone. The Android guide in the repo has the Wi-Fi route that needs no USB debugging.

  3. Turn on the Mali setting

    In the app’s setup screen, tick the Experimental option Allow GPUs without vertex stores. That is the maintainers’ setting that stops the flashing. The texture transcode needs no switch: it is on by default when the GPU has no BC but has ASTC.

  4. Check it worked

    The log’s Vulkan device line names the Mali GPU. In my free-roam run the texture cache peaked at 327 MB, against 918 MB without the transcode. If you see a problem, open an issue on the pull request.

I ran this exact build on the POCO X7 Pro. I haven’t repeated these commands from a fresh clone, and I haven’t tested other Mali phones.

Pull request #823 · SDK #13 · the branch

Chapter 9 · Still open

What I haven’t finished.

  • Image quality on real game textures. Random-block tests give BC1 52.8 dB, BC3 colour 43.9 dB, BC3 alpha 28.6 dB.
  • DXN, DXT5A and sizes that aren’t multiples of 4 still decode to RGBA8.
  • The 6-second stall frame.
  • The occlusion-query crash, fixed in code and not in config.
  • The full SDK unit-test build and the repository boundary check, left to CI.
  • ETC2 for BC1, to stop it doubling.

Where this stands on 2026-11-12. Both pull requests are still open — #13 and #823, the second now conflicting with dev — and neither has been reviewed. Upstream did not stay still: on 2026-11-01 they opened their own Mali backlog on a Galaxy Tab S10 Ultra (Dimensity 9300+, the same Mali-G720 family), measured it, and closed it on 2026-11-02 once two driver crashes were fixed. Their texture-bandwidth row (MT-1.5) is the useful confirmation: capping textures at 512 texels changed nothing in frame time, so a BC transcoder is “a memory item for 8 GB devices, not a speed one” — what I measured, and why the compressed-texture row (AP-2.4) stays open in their backlog. The transcode is not in the tree today.

How this was done. An AI agent working inside the repository: it read the renderer’s texture path and the Android backlog, wrote the host-side block translator, checked its bitstream against Mesa’s ASTC decoder, wired the compute shader into the cache, then ran the A/B on the phone over adb one variable at a time. I chose the target format (ASTC 4×4 rather than ETC2, because the 4×4 footprint matches BC, so the existing size and mip logic still applies), set the success criteria, and checked every number on this page against a log.

↗

The other case study: Uncharted on Linux

a Windows-only port built and run natively on Linux — and what upstream shipped 24 hours later