Skip to content
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

Webrender asserts when rendering text on Windows #663

Closed
matprec opened this issue Dec 22, 2016 · 8 comments
Closed

Webrender asserts when rendering text on Windows #663

matprec opened this issue Dec 22, 2016 · 8 comments
Labels

Comments

@matprec
Copy link
Contributor

@matprec matprec commented Dec 22, 2016

Code

println!("Execution begins!");
println!("Rect: {:?}", rect);
println!("Clip: {:?}", clip_region);
println!("Text: {:?}", text.text);
println!("FontKey: {:?}", text.key);
println!("Color: {:?}", color);
println!("Size: {:?}", size);
println!("Blur: {:?}", blur);
self.display_list.push_text(rect,
                            clip_region,
                            text.text.clone(),
                            text.key,
                            color,
                            size,
                            blur);

Later on in the code

self.render.update();
println!("Rendering");
self.render.render(DeviceUintSize::new(self.width, self.height));
println!("Will not get executed!");

Output

Execution begins!
Rect: TypedRect(1024×768 at (0,0))
Clip: ClipRegion { main: TypedRect(1024×768 at (0,0)), complex: ItemRange { start: 0, length: 0 }, image_mask: None }
Text: [GlyphInstance { index: 43, x: 49.5, y: 49.5 }, GlyphInstance { index: 72, x: 70.18532, y: 49.5 }, GlyphInstance { index: 79, x: 86.11539, y: 49.5 }, GlyphInstance { index: 79, x: 92.47902, y: 49.5 }, GlyphInstance { index: 82, x: 98.84265, y: 49.5 }, GlyphInstance { index: 15, x: 114.77273, y: 49.5 }, GlyphInstance { index: 3, x: 122.73077, y: 49.5 }, GlyphInstance { index: 58, x: 130.68881, y: 49.5 }, GlyphInstance { index: 82, x: 157.2063, y: 49.5 }, GlyphInstance { index: 85, x: 173.13635, y: 49.5 }, GlyphInstance { index: 79, x: 182.67482, y: 49.5 }, GlyphInstance { index: 71, x: 189.03845, y: 49.5 }, GlyphInstance { index: 4, x: 204.96852, y: 49.5 }]
FontKey: FontKey(1, 0)
Color: ColorF { r: 0, g: 1, b: 0, a: 1 }
Size: 32px
Blur: 0px
New frame ready
Rendering
thread 'main' panicked at 'assertion failed: (data.len() as u32) == bpp * row_length * height', SomeSystemPath\webrender\webrender\src\device.rs:1536

When ommiting the above code snippet, app runs fine. Wr-sample also runs fine, but it doesn't render text.

Old commit, before updating (if i read git reflog correctly)
And the current one: Commit/Version: 845dcc9
OS: Windows
~
Edit: I cloned the repo at version 2be6798 (Nov. 2) and things worked, therefore it must have happend between this and the current one.~

Edit 2: Cause is found, see below

@kvark
Copy link
Member

@kvark kvark commented Dec 22, 2016

Thanks for your report @MSleepyPanda !
Do you have a test case, or are you saying wr-sample doesn't work correctly?

@matprec
Copy link
Contributor Author

@matprec matprec commented Dec 22, 2016

According to git bisect, following commit broke it for me 0c34b65.

cc @vvuk

@matprec
Copy link
Contributor Author

@matprec matprec commented Dec 22, 2016

Actually it's from a project i have locally (not published yet), but i'll create an example based on wr-sample

@matprec
Copy link
Contributor Author

@matprec matprec commented Dec 22, 2016

Spend a few hours trying to replicate the issue, it crashes when enabling AntiAliasing!

How to trigger: modified wr-sample

Edit: Note that this only applies to windows

@matprec matprec changed the title Webrender asserts when rendering text Webrender asserts when rendering text on Windows Dec 23, 2016
@MortimerGoro
Copy link
Contributor

@MortimerGoro MortimerGoro commented Dec 26, 2016

Sample problem for me on Windows after rebasing. The default URL & WebVR samples I'm testing crash with assertion fail:

assertion failed: (data.len() as u32) == bpp * row_length * height (thread main, at C:\Users\mortimer\Projects\servo\.cargo\git\checkouts\webrender-c3596abe1cf4f320\845dcc9\webrender\src\device.rs:1536)
stack backtrace:
   0:     0x7ff67df13534 - backtrace::backtrace::trace<closure>
                        at C:\Users\mortimer\Projects\servo\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.2.3\src\backtrace\mod.rs:70
   1:     0x7ff67df146bd - backtrace::capture::Backtrace::new
                        at C:\Users\mortimer\Projects\servo\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.2.3\src\lib.rs:96
   2:     0x7ff67b6bc47b - servo::main::{{closure}}
                        at c:\Users\mortimer\Projects\servo\ports\servo\main.rs:122
   3:     0x7ff68008fb2f - std::panicking::rust_panic_with_hook
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:554
   4:     0x7ff67efafbd8 - std::panicking::begin_panic<&str>
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:515
   5:     0x7ff67f163359 - webrender::device::Device::update_texture
                        at C:\Users\mortimer\Projects\servo\.cargo\git\checkouts\webrender-c3596abe1cf4f320\845dcc9\webrender\src\device.rs:1536
   6:     0x7ff67f1b60d9 - webrender::renderer::Renderer::update_texture_cache
                        at C:\Users\mortimer\Projects\servo\.cargo\git\checkouts\webrender-c3596abe1cf4f320\845dcc9\webrender\src\renderer.rs:919
   7:     0x7ff67f1b5683 - webrender::renderer::{{impl}}::render::{{closure}}
                        at C:\Users\mortimer\Projects\servo\.cargo\git\checkouts\webrender-c3596abe1cf4f320\845dcc9\webrender\src\renderer.rs:816
   8:     0x7ff67f17beaf - webrender::profiler::TimeProfileCounter::profile<(),closure>
                        at C:\Users\mortimer\Projects\servo\.cargo\git\checkouts\webrender-c3596abe1cf4f320\845dcc9\webrender\src\profiler.rs:150
   9:     0x7ff67f1b5119 - webrender::renderer::Renderer::render
                        at C:\Users\mortimer\Projects\servo\.cargo\git\checkouts\webrender-c3596abe1cf4f320\845dcc9\webrender\src\renderer.rs:805
  10:     0x7ff67b67e772 - compositing::compositor::{{impl}}::composite_specific_target::{{closure}}<glutin_app::window::Window>
                        at C:\Users\mortimer\Projects\servo\components\compositing\compositor.rs:1476
  11:     0x7ff67b5f3cbe - profile_traits::time::profile<(),closure>
                        at C:\Users\mortimer\Projects\servo\components\profile_traits\time.rs:120
  12:     0x7ff67b67d42d - compositing::compositor::IOCompositor<glutin_app::window::Window>::composite_specific_target<glutin_app::window::Window>
                        at C:\Users\mortimer\Projects\servo\components\compositing\compositor.rs:1470
  13:     0x7ff67b68421c - compositing::compositor::IOCompositor<glutin_app::window::Window>::composite<glutin_app::window::Window>
                        at C:\Users\mortimer\Projects\servo\components\compositing\compositor.rs:1415
  14:     0x7ff67b674acf - compositing::compositor::IOCompositor<glutin_app::window::Window>::handle_events<glutin_app::window::Window>
                        at C:\Users\mortimer\Projects\servo\components\compositing\compositor.rs:1628
  15:     0x7ff67b5fbb60 - servo::Browser<glutin_app::window::Window>::handle_events<glutin_app::window::Window>
                        at C:\Users\mortimer\Projects\servo\components\servo\lib.rs:230
  16:     0x7ff67b6bbaa3 - servo::main
                        at c:\Users\mortimer\Projects\servo\ports\servo\main.rs:156
  17:     0x7ff680091102 - panic_unwind::__rust_maybe_catch_panic
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libpanic_unwind\lib.rs:98
  18:     0x7ff68009012b - std::rt::lang_start
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\rt.rs:51
  19:     0x7ff67b6bcaec - main
  20:     0x7ff68096a7c9 - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
  21:     0x7ffda14a8364 - BaseThreadInitThunk
ERROR:servo: assertion failed: (data.len() as u32) == bpp * row_length * height
Servo exited with return value 101
@kvark kvark added the type: bug label Dec 26, 2016
@glennw
Copy link
Member

@glennw glennw commented Dec 26, 2016

cc @vvuk

@kvark
Copy link
Member

@kvark kvark commented Dec 26, 2016

@vvuk
Copy link
Contributor

@vvuk vvuk commented Dec 26, 2016

bors-servo added a commit that referenced this issue Dec 27, 2016
Don't overallocate data buffer size for windows fonts.

Fixes #663. Buffer was overallocated in the grayscale AA case.  Not sure how I didn't catch this in testing, since I tested both grayscale AA and cleartype AA...

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/667)
<!-- Reviewable:end -->
simonvandel added a commit to simonvandel/servo that referenced this issue Jan 7, 2017
I had the same problems as described in servo/webrender#663 which is now fixed in the updated webrender.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.