Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exact parts of CSS3 are GPU accelerated?

Tags:

html

css

gpu

I've been reading several references like "X is GPU accelerated" and "Y is not GPU accelarated", but I can't find a full list. What exact parts of CSS3 are GPU accelerated?

like image 523
user967722 Avatar asked Aug 27 '12 19:08

user967722


People also ask

What can be GPU accelerated?

GPU-accelerated computing is the employment of a graphics processing unit (GPU) along with a computer processing unit (CPU) in order to facilitate the playback of the average timeline in realtime at high quality. You can playback GPU accelerated effects and transitions in real time without rendering them.

Does CSS use GPU?

Ever wondered how some CSS animations run so smoothly in the browser? CSS animations, transforms and transitions are not automatically GPU accelerated, and instead execute from the browser's slower software rendering engine.

What is GPU accelerated encoding?

Mercury Playback Engine (GPU Accelerated) is a renderer used to process GPU-accelerated effects and enhances playback. Hardware-accelerated Encoding is used to accelerate the encoding performance while exporting the timeline in H. 264/MPEG2 and MPEG4 Codecs.

Can CSS animations be hardware-accelerated?

The only CSS property transitions which can be hardware-accelerated are those which occur in the compositing stage of the rendering process.


2 Answers

Right, this is an interesting topic, and it does really depend on the browser + graphics card. I've been meaning to do some research on this for a while, so here's a quick summary.

Webkit (Safari, Chrome, iOS, Android)

In Webkit, AnimationBase.cpp used to specify it, but it seems to have moved! Doh! Well, anyway, if you search the code for ACCELERATED_COMPOSITING, you'll find it.

Specifically, if something matches one of these, then it can be accelerated (at least in Chromium):

  • Layer has 3D or perspective transform CSS properties
  • Layer is used by element using accelerated video decoding
  • Layer is used by a element with a 3D context or accelerated 2D context
  • Layer is used for a composited plugin
  • Layer uses a CSS animation for its opacity or uses an animated webkit transform
  • Layer uses accelerated CSS filters
  • Layer has a descendant that is a compositing layer
  • Layer has a sibling with a lower z-index which has a compositing layer (in other words the layer is rendered on top of a composited layer)

Source


Gecko (Firefox)

In Gecko, https://wiki.mozilla.org/Platform/GFX/HardwareAcceleration explains their plan/implementation, much like IE, on XP the options are more limited, but every other OS gets some acceleration if the graphics card is supported properly. Firefox 4 (I think!) added acceleration for text, canvas and transforms.


Trident (IE)

IE10 seems to have pretty much everything HW accelerated. http://blogs.msdn.com/b/ie/archive/2011/04/26/understanding-differences-in-hardware-acceleration-through-paintball.aspx

It is pretty quick, so I don't really doubt their claim!

like image 81
Rich Bradshaw Avatar answered Nov 01 '22 11:11

Rich Bradshaw


There is no CSS3 specification that discusses anything about GPU acceleration. Instead, it is up to each browser maker or the company that implements the browser on specific hardware to decide which parts of CSS3 they will use the GPU for. And, this can easily change from one device to the next.

For example, as of about a year ago (I don't have more current info), 3d transformations were GPU accelerated on an iPhone3, but not 2d tranformations. But, I would expect that that info could be completely different for the iPhone3s or iPhone4 or future iPhone5.

like image 31
jfriend00 Avatar answered Nov 01 '22 13:11

jfriend00