Skip to content

avm2: Implement UVT-mapped bitmap triangles across render backends and move triangles outside tassellation - #24254

Open
wsxarcher wants to merge 4 commits into
ruffle-rs:masterfrom
wsxarcher:wsxarcher/implementuvttriangles
Open

avm2: Implement UVT-mapped bitmap triangles across render backends and move triangles outside tassellation#24254
wsxarcher wants to merge 4 commits into
ruffle-rs:masterfrom
wsxarcher:wsxarcher/implementuvttriangles

Conversation

@wsxarcher

@wsxarcher wsxarcher commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Description

This PR makes AVM2 Graphics.drawTriangles and GraphicsTrianglePath first-class indexed triangle primitives. Vertices, indices, UV/UVT data, and culling are validated before rendering, while bounds, hit testing, active fill state, and Flash’s independent-triangle winding behavior are preserved.

Triangles now bypass Lyon tessellation and are uploaded directly across Canvas, WebGL, and WGPU. WebGL and WGPU use dedicated UVT vertex layouts and perspective-correct homogeneous interpolation without increasing ordinary shape vertex sizes; Canvas computes a bitmap transform per triangle. Unit and visual coverage includes UV/UVT conversion, invalid data, winding, drawing state, hit testing, and bitmap mapping.

Fixes #17639

Checklist

  • I, a human, have self-reviewed this PR and fully understand the changes within.
  • I have made or updated tests where possible.
  • All of my commits are properly scoped, compile successfully, and pass all tests.
  • This PR does not make sense to split up into smaller PRs.
  • An LLM was involved in the authoring of this code.

@Lord-McSweeney Lord-McSweeney added A-avm2 Area: AVM2 (ActionScript 3) T-fix Type: Bug fix (in something that's supposed to work already) llm The PR contains mostly LLM-generated code labels Jul 20, 2026
@kjarosh

kjarosh commented Jul 20, 2026

Copy link
Copy Markdown
Member

@wsxarcher

Copy link
Copy Markdown
Contributor Author

Only the second one and took inspiration as I thought it was abandoned, the focus was making the game work. Did not know about the first PR, but I can wait to rebase if there is an ongoing refactor.

@kjarosh

kjarosh commented Jul 20, 2026

Copy link
Copy Markdown
Member

The second one mentions the issue: triangles probably should not go through tessellation. Triangles in Flash Player behave differently compared to drawn shapes (cf. unfinished strokes/fills), and in addition, it doesn't make sense to tessellate triangles in general, as they are primitive shapes and the point of using them is performance in the first place.

@wsxarcher wsxarcher changed the title avm2: Implement UVT-mapped bitmap triangles across render backends avm2: Implement UVT-mapped bitmap triangles across render backends and move triangles outside tassellation Jul 21, 2026
@wsxarcher

Copy link
Copy Markdown
Contributor Author

You are right, now it has a new drawing command just for triangles like your draft and I added the tests from the old PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-avm2 Area: AVM2 (ActionScript 3) llm The PR contains mostly LLM-generated code T-fix Type: Bug fix (in something that's supposed to work already)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3D rendering is broken in Pyongyang Racer

3 participants