Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport repetition in brush shaders #2621
Conversation
|
If we do this we can implement repeating images and gradients much more easily than with CPU-side decomposition. I think that the extra per-fragment cost is small enough that it shouldn't matter for the non-repeated case, while it saves a lot of CPU work in the repeated case. If the extra instructions are really a concern we can probably optimize it some more. Spacing would be implemented on top of this and #2619 using a render task to add the transparent space. @glennw what do you think? |
|
Yup, I agree, it makes sense to do the repetition here and handle spacing separately. There's a number of CI test failures - I haven't looked into what causes them yet. We'll also want a try run once those are fixed up. |
4a3952e
to
04b11ea
|
The remaining failure is a sampling artifact when a non-axis-aligned transform is applied due to the inflation of the primitive causing the extra pixels to be on the wrong repetition. I am looking into addressing this by passing the (equivalent of the) non-inflated local rect to the fragment shader and clamping the uv based on that before the modulo. |
|
The sampling issue due to the aa inflation is fixed. The solution is a little ugly but it doesn't cost anything in the opaque pass and removes the "fail-safe" part in the brush_image shader which was even uglier in the sense that it was removing half of the anti-aliasing shades (making inflation useless). So as a bonus the antialiasing of transformed images looks noticeably better now. |
|
Looks like I managed to break another test in the process. Investigating. |
e4e9eca
to
7ee166a
|
The remaining issues are fixed. I suggest reviewing the image part separately from the gradients. The idea is the same but while the gradient shaders both operate in local layout space (-ish), the image shader works in texture space which introduces a few subtle differences (for example an offset to take into account). |
|
r? @glennw |
|
Note: reviewed in #2644 |
|
@bors-servo r=glennw |
|
|
Support repetition in brush shaders Add support for repeating in the shader rather than decomposing on the CPU. <!-- 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/2621) <!-- Reviewable:end -->
|
|
|
New reftest failures from outer space :( |
|
@glennw looks like this was broken by this code: webrender/webrender/src/picture.rs Line 575 in 565e240 I am not sure how this works (the drop shadow hack). I'll have a look tomorrow but if off the top of your head there is a simple way to shift that data by another vec4 and leave the parameter available for repetitions it'd be great. |
2a820a7
to
d6e50f3
|
@bors-servo r=glennw |
|
|
Support repetition in brush shaders Add support for repeating in the shader rather than decomposing on the CPU. <!-- 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/2621) <!-- Reviewable:end -->
|
|
Use the brush shaders for repeated images/gradient in some cases. Built on top of #2621, this PR makes use of the repetition support added in the brush shaders in the simple case (no tile spacing). <!-- 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/2644) <!-- Reviewable:end -->
Use the brush shaders for repeated images/gradient in some cases. Built on top of #2621, this PR makes use of the repetition support added in the brush shaders in the simple case (no tile spacing). <!-- 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/2644) <!-- Reviewable:end -->
Use the brush shaders for repeated images/gradient in some cases. Built on top of #2621, this PR makes use of the repetition support added in the brush shaders in the simple case (no tile spacing). <!-- 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/2644) <!-- Reviewable:end -->
Use the brush shaders for repeated images/gradient in some cases. Built on top of #2621, this PR makes use of the repetition support added in the brush shaders in the simple case (no tile spacing). <!-- 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/2644) <!-- Reviewable:end -->
Prerender tile spacing and use the brush shader. On top of #2621 and #2644, bake the tile spacing into an image using a blit render task. This lets us use the brush shader with tile spacing. In order for spacing to fully work the way we intend it to we need a bit more work (see #2659), but since the image shader we use for tile spacing doesn't do the right thing either, I don't think it would be a problem to move forward with this independently of #2659's resolution. <!-- 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/2664) <!-- Reviewable:end -->
nical commentedApr 5, 2018
•
edited by larsbergstrom
Add support for repeating in the shader rather than decomposing on the CPU.
This change is