Skip to content

wgpu: Directly copy BitmapData gpu buffer to Stage3D texture #17171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Aaron1011
Copy link
Member

We now immediately flush our in-progress buffer CommandEncoder after executing a CopyBitmapToTexture command, to ensure that we don't pick up any future avm2-side changes to the BitmapData gpu texture.

The Vec -> gpu buffer copy implementation is moved to a new CopyBytesToTexture command, which we use for copying AGAL textures.

@Fancy2209
Copy link
Contributor

Fancy2209 commented Jul 19, 2024

World 4 Part 1 seems to break with this

thread 'main' panicked at C:\Users\paulo\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.20.1\src\backend\wgpu_core.rs:2996:5:
wgpu error: Validation Error

Caused by:
    In CommandEncoder::copy_texture_to_texture
    Copy error
    Copy of Y 0..4095 would end up overrunning the bounds of the Source texture of Y size 3571
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
AVM2 stack trace:
        at flash.display3D.textures::RectangleTexture/flash::display3D::textures::RectangleTexture::uploadFromBitmapData()
        at starling.textures::ConcreteRectangleTexture/upload()
        at starling.textures::ConcreteRectangleTexture/uploadBitmapData()
        at starling.textures::Texture$/fromBitmapData()
        at com.emibap.textureAtlas::DynamicAtlas$/fromMovieClipContainer()
        at StarlingBackgrounds$/createEffect()
        at StarlingBackgrounds$/createAllAtlases()
        at StarlingBackgrounds$/startAfterStarling()
        at starling.core::Starling/initializeRoot()
        at starling.core::Starling/initialize()
        at starling.core::Starling/onContextCreated()
        at flash.events::EventDispatcher/flash::events::EventDispatcher::dispatchEvent()
        at flash.display::Stage3D/flash::display::Stage3D::requestContext3D_internal()
        at MethodInfo-2025()

We now immediately flush our in-progress buffer CommandEncoder
after executing a `CopyBitmapToTexture` command, to ensure that
we don't pick up any future avm2-side changes to the BitmapData
gpu texture.

The Vec -> gpu buffer copy implementation is moved to a new
`CopyBytesToTexture` command, which we use for copying AGAL
textures.
@Aaron1011 Aaron1011 force-pushed the copy-bitmapdata-directly branch from dd40b2a to 329dc65 Compare July 20, 2024 02:49
@Aaron1011
Copy link
Member Author

This needs additional work to ensure that we submit pending bitmapdata gpu commands before copying from the texture

@Aaron1011 Aaron1011 marked this pull request as draft July 20, 2024 03:02
@danielhjacobs danielhjacobs added A-rendering Area: Rendering & Graphics render-wgpu Issues relating to the wgpu renderer T-fix Type: Bug fix (in something that's supposed to work already) labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rendering Area: Rendering & Graphics render-wgpu Issues relating to the wgpu renderer 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.

3 participants