Hi Matt, I have a question about getting the `DrawTarget` on the compositor thread for web-renderer. Actually, what I want is to build a `gfx::Path` in `AnimationHelper::SampleAnimations()`. Here is my [original code](https://searchfox.org/mozilla-central/rev/171109434c6f2fe086af3b2322839b346a112a99/layout/base/nsLayoutUtils.cpp#10332-10338) for building the `gfx::Path` on main thread, and the compositor thread on non-wr: ``` RefPtr<gfx::DrawTarget> drawTarget; gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget(); RefPtr<gfx::PathBuilder> builder = drawTarget->CreatePathBuilder(gfx::FillRule::FILL_WINDING); return SVGPathData::BuildPath(..., builder, ...); ``` However, it seems we cannot use `gfxPlatform()::GetPlatform()` for web-renderer on the compsitor thread (which is in GPU process?). I hit the assertion in `gfxPlatform::Init()` [1]. So how do I get the draw target on the compositor thread for web-render? I may use it in `AnimationHelper::SampleAnimations()` [2]. Thank you. [1] Assertion failure: !XRE_IsGPUProcess() (GFX: Not allowed in GPU process.), at https://searchfox.org/mozilla-central/rev/171109434c6f2fe086af3b2322839b346a112a99/gfx/thebes/gfxPlatform.cpp#857 [2] https://searchfox.org/mozilla-central/rev/171109434c6f2fe086af3b2322839b346a112a99/gfx/layers/AnimationHelper.cpp#552
Bug 1429305 Comment 5 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Hi Matt, I have a question about getting the `DrawTarget` on the compositor thread for web-renderer. Actually, what I want is to build a `gfx::Path` in `AnimationHelper::SampleAnimations()`. Here is my [original code](https://searchfox.org/mozilla-central/rev/171109434c6f2fe086af3b2322839b346a112a99/layout/base/nsLayoutUtils.cpp#10332-10338) for building the `gfx::Path` on main thread, and the compositor thread on non-wr: ``` RefPtr<gfx::DrawTarget> drawTarget; gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget(); RefPtr<gfx::PathBuilder> builder = drawTarget->CreatePathBuilder(gfx::FillRule::FILL_WINDING); return SVGPathData::BuildPath(..., builder, ...); ``` However, it seems we cannot use `gfxPlatform()::GetPlatform()` for web-renderer on the compsitor thread (which is in GPU process?). I hit the assertion in `gfxPlatform::Init()` [1]. So how do I get the draw target on the compositor thread for web-renderer? I may use it in `AnimationHelper::SampleAnimations()` [2]. Thank you. [1] Assertion failure: !XRE_IsGPUProcess() (GFX: Not allowed in GPU process.), at https://searchfox.org/mozilla-central/rev/171109434c6f2fe086af3b2322839b346a112a99/gfx/thebes/gfxPlatform.cpp#857 [2] https://searchfox.org/mozilla-central/rev/171109434c6f2fe086af3b2322839b346a112a99/gfx/layers/AnimationHelper.cpp#552