-
Notifications
You must be signed in to change notification settings - Fork 275
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
Support border corners with differing styles. #1199
Conversation
r? @kvark |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Just a few minor things, if you want perfection ;)
Anyhow, r=me
@@ -95,14 +123,16 @@ void main(void) { | |||
color1 = border.colors[1]; | |||
vClipCenter = corners.tl_outer + border.radii[0].xy; | |||
vClipSign = vec2(1.0); | |||
set_radii(border.style.x, | |||
style = select_style(prim.user_data.x, border.style.y, border.style.x); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we could have select_style
accepting vec2 styles
border.radii[0].zw, | ||
border.widths.zy, | ||
adjusted_widths.zy); | ||
set_edge_line(border.widths.zy, | ||
corners.tr_outer, | ||
vec2(-1.0, 1.0)); | ||
style = int(border.style.y); | ||
edge_distances = vec4(p1.x - adjusted_widths.z, | ||
p0.y + adjusted_widths.y, | ||
p1.x - border.widths.z + adjusted_widths.z, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line could use some inv_adjusted_widths
too
border.radii[1].xy, | ||
border.widths.zw, | ||
adjusted_widths.zw); | ||
set_edge_line(border.widths.zw, | ||
corners.br_outer, | ||
vec2(-1.0, -1.0)); | ||
style = int(border.style.z); | ||
edge_distances = vec4(p1.x - adjusted_widths.z, | ||
p1.y - adjusted_widths.w, | ||
p1.x - border.widths.z + adjusted_widths.z, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarly, this could use inv_adjusted_widths
, even in a vectorized (short) form
batch.add_instance(base_instance.build(border_segment, 0, 0)); | ||
for (i, instance_kind) in border_cpu.corner_instances.iter().enumerate() { | ||
let sub_index = i as i32; | ||
match *instance_kind { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this match
could be simplified if it only returned &[BorderCornerSide]
This handles all border corners styles except those with dashed and/or dotted styles. Those require changes to the border clip mask shader, which will be done in a follow up. The basic idea is to draw the corner twice, once for each style and mask out the other side of the corner. This results in more pixels being drawn than necessary, and can sometimes result in the AA between the corner segments being slightly incorrect. Those issues can be fixed at a later time.
@kvark Thanks - fixed the @bors-servo r=kvark |
📌 Commit c1efd22 has been approved by |
Support border corners with differing styles. This handles all border corners styles except those with dashed and/or dotted styles. Those require changes to the border clip mask shader, which will be done in a follow up. The basic idea is to draw the corner twice, once for each style and mask out the other side of the corner. This results in more pixels being drawn than necessary, and can sometimes result in the AA between the corner segments being slightly incorrect. Those issues can be fixed at a later time. <!-- 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/1199) <!-- Reviewable:end -->
☀️ Test successful - status-travis |
@glennw I think this patch does actually trigger all those test failures in the gecko try push we were talking about yesterday (tracked in bug 1363683). It looks like possibly an infinite loop somewhere inside the render function - or at least something that causes the render function take upwards of 5 minutes to run, at which point the timeout kills the test. I was able to reproduce locally on the gecko |
@staktrace that is worrisome... I re-inspected the code and didn't see a potential cause of endless loops. Perhaps, the hang/delay is coming from the driver or the hardware doesn't like the new code for some reason. I think we should back the PR out and try reproducing your case on Gecko locally. |
@staktrace @kvark Hmm, that backtrace does indeed suggest the shader change is causing some kind of issue inside llvmpipe. I'm guessing that the shader change has triggered a bug in mesa / llvmpipe :( |
@staktrace @kvark I will try to reproduce this locally on llvmpipe today. |
I imagine it will just be some tweak to the shader needed to avoid triggering the bug in mesa / llvm - hopefully. |
I reproduced this locally. It appears to be a bug in the shader compiler in mesa / llvm. I've opened a PR here #1242 which works around the hang by slightly tweaking the structure of the shader. It shouldn't have any functional effect, but fixes the problem for me. Is the simplest way to test this just to get it merged and try to do an update? |
If the PR can be applied (without too much rebasing) directly onto the copy of webrender in mozilla-central or graphics, that would be the best thing to push to try - that way we start from a known good revision and just test this change in isolation. However if it depends on other things that landed since the last WR update into gecko, or is otherwise problematic to rebase, then it's probably easiest to just get it merged and my next simulated WR update will test it. |
This handles all border corners styles except those with
dashed and/or dotted styles. Those require changes to the
border clip mask shader, which will be done in a follow up.
The basic idea is to draw the corner twice, once for each style
and mask out the other side of the corner. This results in more
pixels being drawn than necessary, and can sometimes result in the
AA between the corner segments being slightly incorrect. Those
issues can be fixed at a later time.
This change is