Sei sulla pagina 1di 53

Arno Gourdol

Flash Camp Brazil April 8, 2011

Adobe Flash Runtime Team

I skate to where the puck is going to be, not where it has been.
Wayne Gretzky

(in millions) 2,000

By 2013 mobile users > desktop users

1,500

1,000

500

0 2003

2005

2008

2014

Mobile
Source: Gartner

Desktop

Flash Runtime Release Cadence


2011
Q2 Q3 Q4 Q1

2012
Q2 Q3 Q4 Q1

2013
Q2 Q3 Q4 Q1

2014
Q2 Q3 Q4

&

ActionScript Video Graphics

Faster Garbage Collection

Incremental GC
Avoids GC clusters

Faster GC

Reducing allocation cost GC hint API Towards a generational collector without copy

Faster Actionscript

Advanced JITing

Faster ActionScript

Type-based optimizations Numeric optimizations Nullability IEEE 32-bit Ecient Vector.< oat> Also oat4 Faster number crunching

New numeric type: oat

Concurrency

er: aim re scl tu Di Fu

var myWorker:Worker = new Worker("myworker.swf");

myWorker.addEventListener(WorkerExitEvent.WORKER_EXIT, function(e:WorkerExitEvent) { trace("worker finished") }); myWorker.load({myMessage: "world"});

myworker.swf
trace("Hello " + Worker.parameters.myMessage)

er: aim re scl tu Di Fu

[Entrypoint] class MyWorkerDef {

trace("Hello " + Worker.parameters.myMessage);

Worker.parameters.myConnection.call("talkback", null, "all fine on the worker front"); }; var myWorker:Worker = new Worker(MyWorkerDef); var c:WorkerConnection = new WorkerConnection(); c.client = { talkback: function(message) { trace("worker said: " + message) } myWorker.load({myMessage: "world", myConnection: c});

Multiple ActionScript workers

Concurrency

Shared-nothing isolation model UI not blocked Leverage multi-core CPUs

StageVideo

1 frame
33ms

Traditional

CPU

Net I/O

Decode H.264 Stream

Execute ActionScript

Render Stage

YUV to RGB

Composite

GPU

Blit

StageVideo

CPU

Net I/O

Execute ActionScript

Render Stage

GPU

Decode H.264 Stream

YUV to RGB

Blit

Reduced CPU usage

StageVideo

Improved ba ery life Improved framerate Works with existing video Available today
in FP 10.2

Threaded Video Pipeline

1 frame
33ms

1 frame
33ms

Traditional

CPU

Execute ActionScript

Render Stage

Render Video

Execute ActionScript

Render Stage

Render Video

GPU

Blit

Blit

Skip Video Frame

Skip Stage Frame


Execute ActionScript Render Video

Overloaded

CPU

Execute ActionScript

Render Stage

GPU

Blit

Blit

1 frame
33ms

Traditional

CPU

Execute ActionScript

Render Stage

Net I/O

Decode Stream

YUV to RGB

Composite

GPU

Blit

New Video Pipeline

CPU

Execute ActionScript Net I/O

Render Stage Decode Stream

Composite

CPU

GPU

Blit

1 frame
33ms

StageVideo

CPU

Net I/O

Execute ActionScript

Render Stage

GPU

Decode H.264 stream

YUV to RGB

Blit

New Video Pipeline

CPU

Execute ActionScript Net I/O

Render Stage

CPU

GPU

Decode H.264 Stream

YUV to RGB

Blit

Threaded Video Pipeline

Smoother playback Be er hardware usage Coming soon

Hardware renderer

e Sun

Stage

e Sun
Text: e Sun e Sun DisplayObject

Bitmap: sun.png

Shape: circle

Stage

Flash so ware renderer


Text: e Sun e Sun DisplayObject

Retained renderer Scan-line rasterization Each pixel rendered once


Shape: circle

Bitmap: sun.png

Stage

Flash hardware renderer


Text: e Sun e Sun DisplayObject

Bitmap: sun.png

Shape: circle

Immediate renderer Build scene graph Bitmaps as surfaces Readback is very expensive

er: aim re scl tu Di Fu

1 frame
33ms

Traditional

CPU CPU GPU

Execute ActionScript

Rasterize

Rasterize

Blit

Future?

CPU CPU GPU

Execute ActionScript

Rasterize

Rasterize

Composite

Blit

ActionScript
60

Flex

50

40

30

20

10

fps

Android

iOS CPU

iOS GPU

iOS CPU

iOS GPU

AIR 2.6

AIR 2.7

Available today

Hardware Renderer

AIR for iOS and Android renderMode=GPU

Hardware compositing Stage3D

Stage3D
Molehill

/* Some constants for us */ private const FARPLANE:Number = 10000; private const INVFARPLANE:Number = 1/FARPLANE; /* Set up the fragment constant for a cyan fog color (fc0) */ context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, Vector.<Number>([0, INVFARPLANE, INVFARPLANE, 1])); /* Set up vertex shader which will pass colour and depth to the fragment shader */ var vertexShaderAssembler:AGALMiniAssembler = new AGALMiniAssembler(); vertexShaderAssembler.assemble(Context3DProgramType.VERTEX, "m44 vt0, va0, vc0 \n"+ //transform vertex x,y,z "mov op, vt0 \n"+ //output vertex x,y,z "mov v0, vt0.z \n"+ //move vertex z (depth) to fragment shader "mov v1, va1" //move vertex r,g,b to fragment shader ); /* Set up a fragment shader */ var fragmentShaderAssembler:AGALMiniAssembler= new AGALMiniAssembler(); fragmentShaderAssembler.assemble(Context3DProgramType.FRAGMENT, "mul ft0, fc0, v0 \n"+ //multiply fog r,g,b by vertex z (depth) "add ft1, ft0, v1 \n"+ //add final fog r,g,b to vertex r,g,b "mov oc, ft1" //output color );

Alternativa3D Away3D Flare3D

Frameworks

Sophie3D Unity Yogurt3D M2D

Away3D

Molehill Demo Reel

Very low-level API Direct access to GPU Amazing performance Optimized for mobile 3D and 2D frameworks Available on Labs today
labs.adobe.com Alex Karpovitch, Alternativa Find out more: Saturday, 9:15am10:30 Room A

Stage3D
Molehill

Faster garbage collector Faster ActionScript Concurrency StageVideo readed video pipeline Hardware renderer Stage3D Molehill