Closed Bug 1179935 Opened 9 years ago Closed 9 years ago

replace Compositor::PrepareViewport with projection info stored on render targets

Categories

(Core :: Graphics: Layers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: vlad, Assigned: vlad)

Details

(Whiteboard: [gfx-noted][vrm2])

Attachments

(1 file)

With VR (and possibly other things in the future), we may need to specify a complex viewport and projection.  Instead of extending PrepareViewport and needing to carry this data around, this introduces projection information directly on CompositingRenderTarget which is applied when SetRenderTarget is called.

The default projection is a simple one, like what PrepareViewport normally sets up.  Calling ClearProjection() on a rendertarget returns to this projection.  Calling SetProjection() allows the caller to specify a full projection matrix, znear/zfar, and whether depth buffering should be enabled.
Attachment #8629031 - Flags: review?(mstange)
Assignee: nobody → vladimir
Whiteboard: [gfx-noted]
Comment on attachment 8629031 [details] [diff] [review]
Compositor complex projections, v0

Review of attachment 8629031 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/composite/TextureHost.h
@@ +760,5 @@
>    gfx::IntPoint mOrigin;
> +
> +  bool mHasComplexProjection;
> +  gfx::Matrix4x4 mProjectionMatrix;
> +  bool mEnableDepthBuffer;

Might want to move the bools to the end, for better packing.

::: gfx/layers/opengl/CompositingRenderTargetOGL.cpp
@@ +38,4 @@
>    if (mInitParams.mStatus != InitParams::INITIALIZED) {
>      InitializeImpl();
> +    if (mInitParams.mInit == INIT_MODE_CLEAR) {
> +      needsClear = true;

What required this change? Does it fix an existing bug?

::: gfx/layers/opengl/CompositorOGL.cpp
@@ +545,4 @@
>      = static_cast<CompositingRenderTargetOGL*>(aSurface);
>    if (mCurrentRenderTarget != surface) {
>      mCurrentRenderTarget = surface;
> +    if (mCurrentRenderTarget) {

What prompted this change?
Attachment #8629031 - Flags: review?(mstange) → review+
(In reply to Markus Stange [:mstange] from comment #1)
> Comment on attachment 8629031 [details] [diff] [review]
> Compositor complex projections, v0
> 
> Review of attachment 8629031 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: gfx/layers/composite/TextureHost.h
> @@ +760,5 @@
> >    gfx::IntPoint mOrigin;
> > +
> > +  bool mHasComplexProjection;
> > +  gfx::Matrix4x4 mProjectionMatrix;
> > +  bool mEnableDepthBuffer;
> 
> Might want to move the bools to the end, for better packing.
> 
> ::: gfx/layers/opengl/CompositingRenderTargetOGL.cpp
> @@ +38,4 @@
> >    if (mInitParams.mStatus != InitParams::INITIALIZED) {
> >      InitializeImpl();
> > +    if (mInitParams.mInit == INIT_MODE_CLEAR) {
> > +      needsClear = true;
> 
> What required this change? Does it fix an existing bug?

No -- the code that did this was previously in InitializeImpl, and was removed from there to consolidate it in one place (see the chunk below), to avoid duplicating additional code.

> ::: gfx/layers/opengl/CompositorOGL.cpp
> @@ +545,4 @@
> >      = static_cast<CompositingRenderTargetOGL*>(aSurface);
> >    if (mCurrentRenderTarget != surface) {
> >      mCurrentRenderTarget = surface;
> > +    if (mCurrentRenderTarget) {
> 
> What prompted this change?

The mContextStateTracker.PushOGLSection(gl(), "Frame"); was removed just below (from BeginFrame), again to consolidate code so that SetRenderTarget() could do extra work without needing to duplicate it twice in BeginFrame. A compositor frame starts with mCurrentRenderTarget == nullptr, so this would cause a mismatched Pop() otherwise.
Whiteboard: [gfx-noted] → [gfx-noted][vrm2]
https://hg.mozilla.org/mozilla-central/rev/fa2405094adb
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: