Commit Graph

7533 Commits

Author SHA1 Message Date
Nathan Adams f36bcac742 wgpu: Move actual frame rendering to Surface, deduplicates some code 2022-09-11 09:07:53 +02:00
Nathan Adams b2ecd39648 wgpu: Enable MSAA for offscreen textures 2022-09-11 09:07:53 +02:00
Nathan Adams 69aba474e1 wgpu: Split off srgb and msaa code from backend to a Surface enum 2022-09-11 09:07:53 +02:00
Nathan Adams 03f7719c49 wgpu: Move quad into its own structure under Descriptors 2022-09-11 09:07:53 +02:00
Nathan Adams a8e8b01a6c wgpu: Use a static buffer for srgb transform uniforms, reworked it from Frame 2022-09-11 09:07:53 +02:00
Nathan Adams a1d1da5d25 wgpu: Simplify stencil usage from Frame's perspective 2022-09-11 09:07:53 +02:00
Nathan Adams 794b30e10e wgpu: Split draw_x into prep_x and draw 2022-09-11 09:07:53 +02:00
Nathan Adams 91f3230a45 wgpu: Split off Frame into CommandRenderer and Frame - command renderer translates commands into draw calls on frame 2022-09-11 09:07:53 +02:00
Nathan Adams 22ba32b785 wgpu: Remove target from Frame 2022-09-11 09:07:53 +02:00
Nathan Adams 8616c898cc wgpu: Remove globals from Frame 2022-09-11 09:07:53 +02:00
Nathan Adams 14ecc98780 wgpu: Pass quad vbo/ibo as slices 2022-09-11 09:07:53 +02:00
Nathan Adams 09172c8b12 wgpu: Simplified rendering code down to 'apply transform, draw x' 2022-09-11 09:07:53 +02:00
Nathan Adams 5f671c0018 wgpu: Fixed panic if rendering to a texture smaller than 1x1 2022-09-11 09:07:53 +02:00
Nathan Adams d5ab88f40d wgpu: Make buffer blocks Pin<Box<Block>> 2022-09-11 09:07:53 +02:00
Nathan Adams 08471c6fb7 wgpu: Don't keep setting globals bind group, it only needs to be set once 2022-09-11 09:07:53 +02:00
Nathan Adams 41239039eb wgpu: Moved all bind group layouts into their own struct 2022-09-11 09:07:53 +02:00
Nathan Adams f33e6904cd wgpu: Moved bind layouts out of Pipelines, they don't change 2022-09-11 09:07:53 +02:00
Nathan Adams 39e1224bda wgpu: Don't recompile shaders for each Pipelines 2022-09-11 09:07:53 +02:00
Nathan Adams 7e013183a7 wgpu: Removed Descriptors::pipelines, we don't need 3 pipelines 2022-09-11 09:07:53 +02:00
Nathan Adams 8b6c6f8a62 wgpu: Removed DescriptorsTargetData::surface_format and frame_buffer_format as they aren't needed to be target specific 2022-09-11 09:07:53 +02:00
Nathan Adams 6755e1ccbd wgpu: Pass the pipelines to frame instead of deciding based on a macro 2022-09-11 09:07:53 +02:00
Nathan Adams 13657e16ca wgpu: Make render_offscreen use its own Frame instead of making a whole new renderer backend 2022-09-11 09:07:53 +02:00
Nathan Adams 697369536c wgpu: Split off code that actually renders a frame 2022-09-11 09:07:53 +02:00
Nathan Adams 267ea0fd13 render: Introduced render commands, moved to a command list model instead of direct rendering 2022-09-11 09:07:53 +02:00
Nathan Adams c7f420dde5 wgpu: Moved WgpuRenderBackend into backend.rs 2022-09-11 09:07:53 +02:00
Nathan Adams 70d96654d7 wgpu: Move descriptors out into its own file 2022-09-11 09:07:53 +02:00
Aaron Hill a638b0498e core: Render Bitmap even if bitmap_data is None
We only need to access bitmap_data to check if we need to
update a dirty texture.
2022-09-11 07:06:11 +03:00
Aaron Hill 8370bc792d core: Use correct background alpha in BitmapData.draw
Previously, we would always use a transparent background,
even if the BitmapData is not transparent. This would normally
be corrected on the next frame when we copied the pixels to the
CPU. However, if an SWF ran `BitmapData.draw` on every frame,
this would never be corrected.
2022-09-09 19:24:21 -05:00
Aaron Hill 5de21428f5 core: Update dirty BitmapData before rendering
We now have a `MutationContext` available, so this doesn't need
to be done in `run_frame`
2022-09-09 16:36:40 -07:00
Aaron Hill 2f81f5814d render: Add `premultiplied_alpha` parameter for image capture
When rendering offscreen, we want the resulting image to use
premultiplied alpha, since the image will be stored in a texture.

However, when capturing an image in the exporter or test framework,
we want to use straight alpha, so that the resulting image can
be saved as a PNG.

Previously, we incorrectly used straight alpha everywhere, resulting
in incorrect output when using BitmapData.draw with transparency.
2022-09-09 15:46:48 -07:00
Adrian Wielgosik 4421fbff6a
avm2: Convert all Qname::new(...).into() to Multiname::new() (#7930) 2022-09-09 23:33:30 +02:00
Aaron Hill ca030169f7 avm2: Implement BitmapData.rect and stub BitmapData.applyFilter
These are the last BitmapData methods needed for Solarmax
(the victory screen after beating the last level now renders).
2022-09-09 13:05:13 -05:00
Aaron Hill bb138d9082 avm2: Implement some of SharedObject
Our AVM2 `SharedObject` support is now *almost* equivalent
to our avm1 `SharedObject` support. We implement serialization
and deserialization for primitives, arrays, and `Object` instances
with local properties. We also implement serialization for `Date`,
but not `Xml` (since our AVM2 `Xml` class is just a stub at the moment).

This is enough to make 'This is the only level too' save level
progress to disk.

Currently, we always serialize to AMF3. When we implement
the `defaultObjectEncoding` and `objectEncoding`, we'll need
to adjust this.
2022-09-08 21:22:05 -05:00
relrelb ca701c4aeb webgl: Remove `Texture` wrapper
`width` and `height` are already stored in `Bitmap`, so simply use
a `WebGlTexture` directly.
2022-09-08 21:04:02 -05:00
Aaron Hill 974738fe10 tests: Add BitmapData.copyPixels image test from PR #2488 2022-09-08 19:52:48 -05:00
Aaron Hill c090fe30ad core: Mark DisplayObject as non-removed when added to display list
An AVM2 movie can repeatedly remove and add a DisplayObject from/to
a parent. This was causing SolarMax to stop working after advancing
to the next level.
2022-09-08 18:19:25 -05:00
relrelb 7ec587355b text: Store background and border colors as `swf::Color`
Instead of `u32`.
2022-09-08 08:44:50 +03:00
EmperorBale ece4b9a76d avm2: Small cleanup 2022-09-07 13:54:33 -07:00
EmperorBale 5791423d43 tests: Enable avm_debug for regression tests 2022-09-07 13:54:33 -07:00
EmperorBale 7da912bbb4 avm2: Only store stack traces if avm_debug is enabled 2022-09-07 13:54:33 -07:00
EmperorBale a9d95b7d4e core: Fix code generator creating invalid code 2022-09-07 13:54:33 -07:00
EmperorBale a5c3c0cab5 tests: Add test for Error.getStackTrace 2022-09-07 13:54:33 -07:00
EmperorBale 53ae55ff6f avm2: Improve stack trace output 2022-09-07 13:54:33 -07:00
EmperorBale 7fa19c2ea3 avm2: Store stack trace in Error objects 2022-09-07 13:54:33 -07:00
relrelb e0aba46bb2 chore: Remove unused `image` dependency
This basically reverts #7254 for all `.toml` files, except for `wgpu`
where it's actually needed on both desktop and web.
2022-09-07 13:09:29 -07:00
Aaron Hill 7218146e04 avm2: Implement BitmapData.dispose
We now check if a BitmapData has been disposed by checking
for a zero width or height (which cannot happen otherwise).
As a result, we no longer need the 'disposed' field on the AVM1
BitmapData object.
2022-09-07 11:02:53 -07:00
Aaron Hill b764c4f6c1 avm2: Implement BitmapData.fillRect and BitmapData.getPixel32 2022-09-07 12:29:49 -05:00
Mike Welsh de114f0a3d swf: Read font height in DefineEditText when HasFontClass is set
The SWF19 specs incorrectly state DefineEditText tag only contains
font height if the HasFont flag is set. The tag also contains
the height if the HasFontClass flag is set. This indicates that a
font is used via runtime sharing.
2022-09-06 20:02:23 -07:00
Mike Welsh 2ffbd8a1c7 core: Remove EditTextStaticData 2022-09-06 20:02:23 -07:00
Mike Welsh 459a19f146 core: Use bitflags for EditText 2022-09-06 20:02:23 -07:00