Closed Bug 1286412 Opened 8 years ago Closed 8 years ago

Add compositor support for triangle layers (for OpenGL backend)

Categories

(Core :: Graphics: Layers, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: mikokm, Assigned: mikokm)

References

Details

(Keywords: feature, Whiteboard: gfx-noted)

Attachments

(3 files)

This bug is about implementing bug 1285380, specifically for the OpenGL backend.
Blocks: 1286716
Keywords: feature
Priority: -- → P3
Whiteboard: gfx-noted
These changes implement polygon clipping, triangulation, and triangle rendering for the OpenGL compositor. This enables rendering of non-rectangular layers and will be used to fix bug 1286716.


BSPTree, Polygon and related tests
----------------------------------
- Added gfx::Triangle struct which stores three 2D points.

- Implemented polygon triangulation.

- Implemented polygon clipping. This uses polygon splitting code from BSPTree, which was moved to Polygon class.

- Added some unit tests to test triangulation and clipping. These tests share code with TestBSPTree, and the shared code was moved to PolygonTestUtils.


Matrix4x4
---------
- Added TransformAndClipBounds() overload for gfx::Triangle.


Compositor
----------
- Added DrawGeometry method to support drawing layers with non-rectangular geometry. If no geometry is supplied, the method renders the layer with a single DrawQuad() call. Otherwise the geometry is clipped and triangulated, and the layer is rendered using one or more DrawTriangle() calls.

- Added DrawTriangle() method stub.

- Added ComputeBackdropCopyRect() overload for gfx::Triangle.


CompositorOGL
-------------
- Generalized DrawQuad() with templates and renamed it to DrawGeometry().

- DrawQuad() now calls DrawGeometry<gfx::Rect>() and DrawTriangle() calls DrawGeometry<gfx::Triangle>().

- Implemented rendering of triangle layers.


OGLShaderProgram
----------------
- Added new triangle mode option that allows passing arbitrary vertex and texture coordinates.
Comment on attachment 8797823 [details]
Bug 1286412 - Use surface->GetSize() instead of aRect dimensions.

https://reviewboard.mozilla.org/r/83398/#review82016
Attachment #8797823 - Flags: review?(matt.woodrow) → review+
Blocks: 1274673
Comment on attachment 8797824 [details]
Bug 1286412 - Implement polygon clipping and triangulation.

https://reviewboard.mozilla.org/r/83400/#review82312

Looks great
Attachment #8797824 - Flags: review?(kgilbert) → review+
Could you use the word "tesselate" instead of "triangulate"? I think that would be clearer.
Comment on attachment 8797825 [details]
Bug 1286412 - Add compositor support for triangle layers (for OpenGL backend)

https://reviewboard.mozilla.org/r/83402/#review82574

::: gfx/layers/opengl/OGLShaderProgram.h:44
(Diff revision 1)
>    ENABLE_BLUR=0x200,
>    ENABLE_COLOR_MATRIX=0x400,
>    ENABLE_MASK=0x800,
>    ENABLE_NO_PREMUL_ALPHA=0x1000,
> -  ENABLE_DEAA=0x2000
> +  ENABLE_DEAA=0x2000,
> +  ENABLE_TRIANGLE_MODE=0x4000

The _MODE suffix doesn't really match the other options.
Attachment #8797825 - Flags: review?(jmuizelaar) → review+
(In reply to Jeff Muizelaar [:jrmuizel] from comment #8)
> Comment on attachment 8797825 [details]
> Bug 1286412 - Add compositor support for triangle layers (for OpenGL backend)
> 
> https://reviewboard.mozilla.org/r/83402/#review82574
> 
> ::: gfx/layers/opengl/OGLShaderProgram.h:44
> (Diff revision 1)
> >    ENABLE_BLUR=0x200,
> >    ENABLE_COLOR_MATRIX=0x400,
> >    ENABLE_MASK=0x800,
> >    ENABLE_NO_PREMUL_ALPHA=0x1000,
> > -  ENABLE_DEAA=0x2000
> > +  ENABLE_DEAA=0x2000,
> > +  ENABLE_TRIANGLE_MODE=0x4000
> 
> The _MODE suffix doesn't really match the other options.
Renamed ENABLE_TRIANGLE_MODE to more descriptive ENABLE_DYNAMIC_GEOMETRY.

(In reply to Markus Stange [:mstange] from comment #7)
> Could you use the word "tesselate" instead of "triangulate"? I think that
> would be clearer.
After a quick chat on IRC, renamed Triangulate() to ToTriangles().
Pushed by dholbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3530286e1cc6
Use surface->GetSize() instead of aRect dimensions. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/5fffd1068dae
Implement polygon clipping and triangulation. r=kip
https://hg.mozilla.org/integration/autoland/rev/308d2aa48313
Add compositor support for triangle layers (for OpenGL backend) r=jrmuizel
https://hg.mozilla.org/mozilla-central/rev/3530286e1cc6
https://hg.mozilla.org/mozilla-central/rev/5fffd1068dae
https://hg.mozilla.org/mozilla-central/rev/308d2aa48313
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
This just came up on our features radar for Fx52. Miko, is this something manual QA could help test?
Flags: qe-verify?
Flags: needinfo?(mikokm)
(In reply to Andrei Vaida, QA [:avaida] – please ni? me from comment #19)
> This just came up on our features radar for Fx52. Miko, is this something
> manual QA could help test?

The new rendering path (Compositor::DrawGeometry) is not used until changes to Layers code are complete. Bug 1274673 tracks this progress.
Otherwise, the current behavior should be the same, and as such, I don't believe that manual QA is necessary.
Flags: needinfo?(mikokm)
Thank you for following up on this, Miko. Updating flags accordingly.
Flags: qe-verify? → qe-verify-
Depends on: 1345849
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: