ruffle/render/src
Aaron Hill e2954821ea
core: Take two - delay reading image back from render backend using `SyncHandle` (#9184)
* Take two: Delay reading image back from render backend using `SyncHandle`

This allows us to avoid blocking immediately after a `BitmapData.draw` call.
Instead, we only attempt to use the `SyncHandle` when performing an operation
that requires the CPU-side pixels (e.g. BitmapData.getPixel or BitmapData.setPixel).

In the best case, the SWF will never explicitly access the pixels of
the target BitmapData, removing the need to ever copy back the render backend
image to our BitmapData. If the SWF doesn't require access to the pixels immediately,
we can delay copying the pixels until they're actually needed, hopefully allowing
the render backend to finish processing the BitmapData.draw operation in
the backenground before we need the result.

Now that the CPU and GPU pixels can be intentionally out of sync with
each other, we need to ensure that we don't accidentally expose 'stale'
CPU-side pixels to ActionScript (which needs to remain unaware of
our internal laziness). We now use a wrapper type `BitmapDataWrapper`
to enforce that the `SyncHandle` is consumed before accessing the
underlying `BitmapData.

* core: Skip GPU->CPU sync for source and target BitmapData during draw

* Introduce DirtyState enum
2023-01-21 21:08:04 +00:00
..
backend core: Take two - delay reading image back from render backend using `SyncHandle` (#9184) 2023-01-21 21:08:04 +00:00
backend.rs core: Take two - delay reading image back from render backend using `SyncHandle` (#9184) 2023-01-21 21:08:04 +00:00
bitmap.rs core: Take two - delay reading image back from render backend using `SyncHandle` (#9184) 2023-01-21 21:08:04 +00:00
bounding_box.rs avm2: Button bounds_with_transform should include bounds of current state child 2022-12-18 13:32:24 -07:00
color_transform.rs core: `ColorTransform` cleanup 2022-09-23 11:10:12 +03:00
commands.rs render: Make render commands take in an actual value, not ref for immediate cloning 2023-01-10 09:39:28 +01:00
error.rs render: Treat `update_texture` with invalid `BitmapHandle` as an error 2022-09-16 22:03:15 -06:00
lib.rs render: Disallow unwrap() and unwrap_err() in render crate 2023-01-10 11:10:46 +01:00
matrix.rs render: Moved Matrix from core to render 2022-08-14 18:38:14 -07:00
shape_utils.rs render: Better error message when points is empty 2023-01-10 11:10:46 +01:00
tessellator.rs wgpu: Split up gradient shader based on type and repeat 2023-01-03 03:39:13 +01:00
transform.rs render: Make render commands take in an actual value, not ref for immediate cloning 2023-01-10 09:39:28 +01:00
utils.rs core: nit: Use `strip_prefix` instead of `starts_with` and subslicing. 2023-01-16 17:33:41 +01:00