Commit Graph

70 Commits

Author SHA1 Message Date
Aaron Hill e73819d531 Use supported_sample_count for Context3D sample count
This rounds the requested sample count down to a value
that's supported by the device.
2024-01-21 12:47:13 -05:00
TÖRÖK Attila bf9cf92af8 render/wgpu: Update wgpu to 0.18.0, naga to 0.14.1, naga_oil to 0.11.0, egui to 0.24.1 2023-12-14 01:36:42 +01:00
Aaron Hill 01b1e36ef5
wgpu: Rename DepthBuffer to StencilBuffer and stop providing depth_ops (#13302) 2023-09-24 20:19:14 +00:00
Aaron Hill 583caa3389
avm2: Implement DisplayObject.blendShader (#12238) 2023-07-26 23:25:26 +00:00
Nathan Adams 7f4d855de9 wgpu: Move Surface::apply_filter to Filters::apply, removing need for a surface at all 2023-06-28 22:42:31 +02:00
Nathan Adams 4f6bac7840 wgpu: Refactor out filters into their own files 2023-06-28 22:42:31 +02:00
Nathan Adams e37958351e wgpu: Removed most uniforms from filters, they're not used or needed 2023-06-26 22:07:52 +02:00
Lord-McSweeney 8c40e97ab5 wgpu: nit: Fix incorrect label in blur filter 2023-06-26 00:00:03 +02:00
Nathan Adams 44c870ba91 wgpu: Move run_copy_pipeline to utils 2023-06-25 21:58:46 +02:00
Nathan Adams 4dde126e64 wgpu: Take in a &wgpu::Texture not our own texture as we don't need omore than that 2023-06-25 21:58:46 +02:00
Nathan Adams 0c71b83e36 wgpu: Don't perform copy inside Surface::apply_filter 2023-06-25 21:58:46 +02:00
Nathan Adams f43560ab88 render: Switch to providing cacheAsBitmap entries all at once on submit frame 2023-06-24 01:42:04 +02:00
Nathan Adams 36aee1efcf wgpu: Specialise render_offscreen_for_cache to render directly to the texture 2023-06-24 01:42:04 +02:00
Nathan Adams 2594453831 render: Add render_offscreen_for_cache for more optimised CacheAsBitmap 2023-06-24 01:42:04 +02:00
Aaron Hill 2cd518013c
wgpu: Don't skip alpha/erase blend modes for BitmapData.draw (#11323)
We can skip these when we're drawing to a fresh buffer, but not when we're blending over an existing BitmapData texture.
2023-06-02 21:16:05 +00:00
Aaron Hill 7809000170 wgpu: Fix filter texture copy size calculation
I incorrectly changed this in #10373

Fixes #10380
2023-04-01 11:04:55 -05:00
Nathan Adams f0ebefd624 tests: Add bitmapdata recursive draw test 2023-03-31 16:57:52 +02:00
Nathan Adams c85910b46d wgpu: Fixed panic when rendering texture to itself, by always rendering to an intermediary 2023-03-31 16:57:52 +02:00
Aaron Hill b140029e95 render: Fix BitmapData.applyFilter with non-full sourceRect
Previously, we were scaling down the source image to fit into
the smaller sourceRect, instead of cropping at the original scale.
This broke the background textures in Fancy Pants World 4 Part 2,
as the scaled-down output image resulted in a smaller rectangle
being returned from 'getColorBoundsRect'

We now crop the image by properly constructing the UV-coordinate
transformation matrix. We were also using the wrong value for the
'destPoint' y coordinate, which I fixed.

This slightly changes the image output of two tests - the new images
now more closely match the Flash output.
2023-03-25 18:44:01 -07:00
Nathan Adams eb44cc5395 render: Made ShapeHandle an Arc of an internal, droppable mesh 2023-03-23 01:44:27 -07:00
Nathan Adams 078672782c wgpu: Skip Alpha/Erase blends with no parent Layer 2023-03-19 14:59:48 -07:00
Nathan Adams f79015e201 render: Use swf Filter types where possible. Gradient types had to be split into duplicate classes to allow for different trait impls based on which gradient filter type it is. 2023-02-28 16:25:12 +01:00
Nathan Adams 9c1f6ea129 render: Add Filter::BevelFilter 2023-02-28 16:25:12 +01:00
Aaron Hill 455124d3ba render: Fix blending onto BitmapData contents
When rendering to an offscreen texture for `Bitmapdata.draw`,
we first render to a temporary frame buffer, and then copy the contents
of the frame buffer back to the target texture. However, this results
in blend modes being incorrectly applied - for example, rendering with
BlendMode.SUBTRACT will subtract against the framebuffer (which starts
with each pixel as 0x00000000), instead of the previous BitmapData
contents.

To fix this, we now use our texture target as the frame buffer
when performing `render_offscreen`. This ensure that we blend
over existing pixels (taking into account the `blendMode` provided
in the `BitmapData.draw` call).

When multisampling is enabled, we use a copy pipeline to copy
the existing contents of our texture to a fresh multisampled frame
buffer (the non-multisampled texture target becomes our resolve buffer).
2023-02-23 09:52:56 -06:00
Aaron Hill c597f9f996 core: Fix Clippy lints on nightly 2023-02-13 03:38:54 +01:00
Nathan Adams 0e9b1e4a77 wgpu: Better support for 2x and 8x msaa 2023-02-06 16:08:04 +01:00
Nathan Adams 1cb3ea7bf9 wgpu: Store quality, not sample_count, and calculate the correct sample count per format 2023-02-06 16:08:04 +01:00
Nathan Adams 3411a04cef render: Made render specific Filter enum & structs, as swf ones don't map 1:1 to potential filters 2023-02-05 18:41:43 +01:00
Nathan Adams e73389aa71 wgpu: Implement blur filter 2023-02-05 18:41:43 +01:00
Nathan Adams 284a58c817 avm2: Implement BitmapData.apply_filter for ColorMatrixFilter 2023-02-05 18:41:43 +01:00
Nathan Adams f9b378b29a wgpu: Changed most pipelines & shaders to only use Pos, not Pos and Color, as vertex attribs 2023-02-05 18:02:19 +01:00
Nathan Adams 5dd3060a28 wgpu: Ensure we clear before blending an object onto nothing 2023-01-29 20:45:01 +01:00
Nathan Adams ae75a3c166 wgpu: Use push constants for both Transforms and ColorAdjustments, when available 2023-01-10 09:39:28 +01:00
Nathan Adams 4e5749a7e4 wgpu: When push constants are available, use those for Transforms 2023-01-10 09:39:28 +01:00
Nathan Adams b07a01da57 wgpu: Cache texture views along side their owned textures in texture pool 2023-01-09 20:40:45 +01:00
Nathan Adams 4d85b6a75b wgpu: Hook up wgpu renderer, and wgpu's profiling, to tracy 2023-01-08 20:02:26 +01:00
Nathan Adams a69d30bb67 render: Add debug info method to renderer backends 2023-01-05 05:51:32 +01:00
Nathan Adams eaff82ea7e wgpu: Cleaned up some buffer binding api 2023-01-03 03:39:13 +01:00
Nathan Adams 28768f2ad8 render: Make CommandList a struct instead of a tuple 2023-01-03 03:39:13 +01:00
Nathan Adams 3dd9c4daa3 wgpu: Moved ColorAdjustments into its own bind group, and reuse ColorAdjustments::IDENTITY where we can 2023-01-03 03:39:13 +01:00
Nathan Adams ae5d92693f wgpu: Moved DrawCommand handling to CommandRenderer::execute 2023-01-03 03:39:13 +01:00
Nathan Adams 7944b6dd9e wgpu: Inlined CommandRenderer::execute into Surface::draw_commands 2023-01-03 03:39:13 +01:00
Nathan Adams a71b5b4570 wgpu: Move command renderer to surface/commands.rs 2023-01-03 03:39:13 +01:00
Nathan Adams 0272eda121 wgpu: Refactor surface command target to its own file 2023-01-03 03:39:13 +01:00
Nathan Adams 986b95c50c wgpu: Share texture pool across all frames, and ensure targets are cleared properly 2023-01-03 03:39:13 +01:00
Nathan Adams 1863c93be1 wgpu: Add some more debug labels 2023-01-03 03:39:13 +01:00
Nathan Adams 257bbc8ec9 wgpu: Revert using same pool for whole frame - breaks bitmapdata.draw and I'm not sure why yet 2023-01-03 03:39:13 +01:00
Nathan Adams 342b9b9007 wgpu: Removed some needless copies in command iteration 2023-01-03 03:39:13 +01:00
Nathan Adams 75790606a0 wgpu: Share the buffer pool throughout the entire frame 2023-01-03 03:39:13 +01:00
Nathan Adams 03b62a93e6 wgpu: Pool textures during the same frame, and drop whatever we don't need immediately 2023-01-03 03:39:13 +01:00