Render Stages Plug-Ins

This topic provides information about render stage plug-ins in the non-ScreenPlay variant.

Variant: Non-ScreenPlay. Target audience: Device creators.

Note: In the non-ScreenPlay variant, the render stage interfaces are at a prototype stage of development.

For information about render stages in ScreenPlay, see ScreenPlay Render Stages.

Introduction

The primary use case for render stages is transition effects. During transition effects, we want to capture draw operations for transition participants into an offscreen target. Then over a series of frames, we want to perform some transformation of the draw operations, and reintroduce them into the scene. For example, for a disappearing menu, we want to capture the draw operations for the menu, and then perhaps play them back but with different offsets, so that the menu appears to slide off the screen.

Render stages make it possible to redirect the drawing, so that we can capture the draw operations. They also make it possible to introduce new draw operations into the stream, so that we can play back the transition effect.

The default render stage does neither of these things, simply rendering the draw ops to the default screen target as expected.

Using render stages

The high level steps to creating and using render stages are shown here:

  1. Screen creates render stage chain at construction time

  2. Render stage performs custom rendering

1. Screen creates render stage chain at construction time

Setup in WSINI.INI file

The render stages to be used are specified on a per screen basis.

For example:

[SCREEN 1]

RENDERSTAGES FLICKERFREE STD

If no render stages are specified, the default render stages will be used.

Process

The following code is required:

CScreenRedraw::ConstructL() - this constructs a CScreenRedraw object

WsIniFile->FindVar(iScreenNumber, “RENDERSTAGES”) - this returns the list of render stages to be used on this screen

For each specified render stage, call CWsPluginManager::FindNamedImplementation<MWsRenderStageFactory>()

For each plug-in in the list:

  • Call ResolveObjectInterface(“MWsRenderStageFactory”) on the CWsPlugin instance. If the plug-in is a render stage factory, it is required to “return this ”, otherwise “return NULL ”.

  • If an MWsRenderStageFactory pointer is returned, and the plug-in has the correct name, return the MWsRenderStageFactory.

Endfor (plug-ins)

Call MWsRenderStageFactory::CreateStageL() - this calls into the plug-in’s render stage factory. The implementor of the SPI is required to return a CWsRenderStage * which is pointing to an instance of a custom subclass.

Connect the output of one stage to the input of the next

Endfor (specified render stages)

2. Render stage performs custom rendering

Process

The following code is required:

CScreenRedraw::OnAnimation() - WSERV redraw scheduler causes rendering to occur

Call CWsRenderStage::Begin() on the first render stage. This returns the CFbsBitGc* to be used for drawing

Issue draw operations to the CFbsBitGc*

The render stage processes the draw operations

Call CWsRenderStage::End() on the first render stage

Note: Note that WSERV only talks to the first render stage. This may in turn talk to the second render stage and so on, but WSERV won’t know anything about this.