Skip to content

windows on arm support, #82

Open
Open

Description

@ahmedNY

a native windows on arm build is not available, rendering video using the x86 binares cause issues

raea-motion.mp4
raea-scene3d.mp4

there is white horizontal lines, and the resolution is low

Activity

  1. shinyobjectz commented on Nov 10, 2026

    @shinyobjectz
    Owner

    Thanks for the two videos, they made this findable.

    The stripes come from raea's GPU step that turns each frame into the video's YUV format. It packs four pixels into one 32-bit word, and the last pixel is shifted into the word's sign bit. Your GPU's shader compiler handles that shift differently from the GPUs we test on, so wherever the pixels are bright, two of every four come out at full white. Your luma plane shows exactly that: in every group of four whose second pixel is bright, the last two read 255, and darker groups are untouched.

    It's fixed on main (05c9788): the shift is now unsigned, which every compiler agrees on. The fix will be in the next v0.1.1 build, and I'll post here when that build is up.

    On ARM64: that conversion runs natively on the GPU whether raea itself runs as x86_64 under emulation or not, so a native build wouldn't have avoided this. There's no Windows on ARM build yet; I've noted the request.

    On resolution: both of your files are 1920x1080 at 30 fps, so I think the stripes are what made them look soft. If anything still looks low-res after the fix, send the composition and I'll look.

    Two things would help confirm it:

    1. Your device, its GPU (for example a Snapdragon X Elite with an Adreno X1-85) and the GPU driver version.
    2. Whether PNG frames come out clean: raea render your-composition.tsx -o frames/. Stills don't go through that conversion, so clean PNGs would confirm the cause, and you can use them until the new build is out (ffmpeg -framerate 30 -i frames/frame-%05d.png -pix_fmt yuv420p out.mp4 turns them into a video, without sound).
  2. ahmedNY commented on Nov 10, 2026

    @ahmedNY
    Author

    Thanks for the quick fix!

    To be upfront: none of the work below is mine. Claude Code (Anthropic's coding agent) did all of it on my laptop. It built raea from source, ran every test and render, measured the results, found the workaround and wrote this report. I'm only posting it.

    Claude built main at 07e47b4 natively for Windows on ARM (aarch64-pc-windows-msvc) and tested it. The stripes are still there on this GPU, and PNG frames are affected too.

    Device: Snapdragon X (Qualcomm Adreno X1-85), Windows 11 Home 26200. wgpu picks Vulkan by default here.

    What Claude found on 07e47b4

    • shl_into_the_sign_bit_is_unsigned passes.
    • A 2D composition (title text, then bar chart) still renders with vertical white stripes on bright areas in the mp4. The yellow bar is striped top to bottom.
    • PNG stills (raea render x.tsx --frame N -o f.png) are striped too: horizontal line patterns over the bars, and a grey box behind text that is fading in. Compared against the same frame rendered on DX12, about 15% of pixels differ, in every frame it checked.

    What the driver actually gets wrong (nv12 kernel)

    Claude ran K kernels on this GPU against raea_core_k::Cpu on random input. The trigger isn't the sign bit on its own. It's a value from clamp (or min/max) that's then shifted and or'd into a word:

    kernel (4 luma bytes from 4 words, packed) wrong words of 262,144
    y:clamp[16+shr[(47*r)+(157*g)+(16*b)+128;8];0;255], packed with or/shl 128,319
    same, packed with + and multiplies 0
    same, no clamp, packed with or/shl 0
    and[..;255] instead of clamp, packed with or/shl 0
    clamp as 0|255&x (min/max), packed with or/shl 128,319
    clamp, packed with or/shl, with the unsigned shl from 05c9788 128,319

    The new test packs and[word[F;i];255] with no clamp, so it passes on this driver with or without 05c9788. With the full nv12buf.k on a 1920x1080 frame of random colours, 253,013 of 518,400 luma words are wrong. In each wrong word the top two bytes are 0xff; chroma is fine.

    Claude's guess is that the compiler fuses "clamp to a byte, shift, or into a word" into a saturating pack and gets it wrong. Rewriting the clamp doesn't help (a sel chain, and[clamp[..];255], xor[..;0] all fail), because the compiler still knows the range.

    What fixed it here

    In systems/k/src/wgsl.rs, clamp, min and max get their bounds offset by a zero the compiler can't prove is zero:

    // in main, after k_i:
    s.push_str("  let kz: i32 = i32(shape.n >> 31u);\n");
    // in Gen::e:
    '&' => format!("min({x}, {y} + kz)"),
    '|' => format!("max({x}, {y} + kz)"),
    "clamp" => format!("clamp({}, {} + kz, {} + kz)", self.e(&a[0])?, self.e(&a[1])?, self.e(&a[2])?),

    That brings the clamp/min/max cases above to 0 wrong, with the same bits as the interpreter.

    The PNG stripes are a separate problem: Vello on Adreno Vulkan

    Even with every K kernel exact, 2D pages come out wrong on Vulkan: the striped bars and the grey box behind fading text. Raising Vello's buffers (RAEA_VELLO_BUMP=full) doesn't change it. On DX12 (WGPU_BACKEND=dx12) 2D pages are clean, and video stills match the DX12 PNGs apart from normal 4:2:0 edge loss. However, 3D scenes draw wrong on DX12 (the floor cuts through objects that render correctly on Vulkan).

    Since my videos are all 2D, Claude made raea default to DX12 on Windows (gpu/device: backends = DX12 unless WGPU_BACKEND is set, falling back to wgpu's order if there's no DX12 adapter). That isn't a general fix, given the DX12 3D issue.

    Also noticed: on Windows, --kbps and --quality produce byte-identical files (about 0.5 Mbit/s at 1080p30). OpenH264 logs bEnableFrameSkip = 0, bitrate can't be controlled for RC_QUALITY_MODE, RC_BITRATE_MODE and RC_TIMESTAMP_MODE without enabling skip frame.

    Building natively for Windows ARM64 needed these, in case it helps the ARM64 build request:

    • clang for ring;
    • CC_aarch64_pc_windows_msvc=clang-cl, because cl.exe silently skips rav1d's GNU-syntax .S files and the link then fails;
    • metis-sys's GKlib stdint/inttypes stand-ins clash with MSVC ARM64, so Claude used <stdint.h>, <inttypes.h> and <io.h>;
    • jq's CRLF in tools/bevy-plugins.sh (the -b wrapper from release.yml).

    Claude can run test builds on this machine if you'd like anything checked.

    Image Image Image Image Image Image
  3. shinyobjectz commented on Nov 10, 2026

    @shinyobjectz
    Owner

    Thank you, this is a great report, and you're right: 05c9788 didn't fix it. The unsigned shl stays (an i32 shift into the sign bit is still left to the compiler), but it wasn't the cause.

    The luma stripes. Your fix is on main as 9b9dd9e: every K clamp, min and max now takes its bounds plus kz = i32(shape.n >> 31u), as you wrote it. The new test runs your two failing kernels on random pixels (clamp, and 0|255&x, each packed with or/shl) against the interpreter. It passes on Apple's GPU, which never showed the bug, so your Adreno is the real test. It will be in the next v0.1.1 build, and I'll post here when that's up.

    The PNG stripes and the grey box. Your screenshots suggest a pattern: on Vulkan, what goes wrong looks like what is drawn inside a layer (an opacity or a clip). The fading "68" gets a box the size of its layer, Thu's bar is too light, and the striped frame looks like the chart part-way through its entrance, while the plain bars are right. Vello keeps the colour under each open layer in a small per-pixel array (blend_stack in vendor/vello_shaders/shader/fine.wgsl, indexed by the clip depth) and moves to a storage buffer past four levels. That makes it my first suspect. If your Claude has time, these would narrow it down quickly, one at a time:

    1. In vendor/vello_shaders/shader/shared/config.wgsl, set BLEND_STACK_SPLIT = 0u. Every layer then goes through blend_spill (the buffer), not the array. If the frame comes out right, the array is the problem.
    2. In fine.wgsl's CMD_BEGIN_CLIP and CMD_END_CLIP, replace pack4x8unorm/unpack4x8unorm with an explicit pack (round, u32, shifts), to see whether the driver's pack is the problem, as it was in K.

    Someone porting Vello's fine stage also hit an Adreno X1-85 miscompile there, with invisible text. Their notes are in gogpu/gg's changelog, 0.40.1, in case it helps.

    DX12 as the default. I'd rather not switch, since 3D draws wrong on DX12 on your GPU. Could you attach a DX12 frame of that 3D scene, with the scene itself? Then I can look at the floor cutting through objects as its own bug.

    --kbps and --quality. I see the same on an RTX 4070 with rc2, and here's the reason. OpenH264's rate control never goes below quantiser 12, its finest. Once a frame fits at QP 12, a higher target has nothing left to buy, so the default, --kbps 20000 and --quality master came out the same size to the byte there too (blocks.tsx: 377,423 bytes, 1.0 Mbit/s). Lower targets do change the file: --kbps 1000 gave 0.79 Mbit/s. A simple 2D page at 0.5 Mbit/s is already at that floor. The warning is OpenH264's, logged because raea keeps frame skipping off on purpose (every frame of an edit is in the video). The --quality docs now say so (e98085b).

    The ARM64 build notes (clang for ring, clang-cl for rav1d's .S files, metis-sys's GKlib headers, jq's CRLF): thanks, they're on the ARM64 build request.

  4. added
    needs confirmingFixed in a build; waiting for the reporter to confirm it on their machine
    on Nov 12, 2026
  5. added a commit that references this issue on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs confirmingFixed in a build; waiting for the reporter to confirm it on their machine

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions