pixel bender in flash - CPU v. GPU?
Copy link to clipboard
Copied
i'm trying to figure out how much processing power a pixel bender filter with dynamic values (modified via flash) requires from my computer. i understand pixel bender should run on GPU and my video card (NVIDIA GeForce GT 120 on a mac) is supported.
looking at this flash video implementation http://www.brooksandrus.com/blog/2009/01/19/pixel-bender-effects-video-killer-runtime-effects/ i get really high CPU usage on the mac activity monitor as soon as i apply the filter. i tried using google chrome's task manager and resources seem to be drawn as badly. i tried several implementations of other filters myself, and no one had minimal CPU usage.
could anyone shed a light here? is pixel bender in flash supposed to suck so much CPU power while it's meant to be using GPU (if it's not using it already)? or maybe a 'better' way to check what's happening? funny thing is that on my tests even if CPU usage was high, the effect was still going fairly smoothly.
many thanks
Copy link to clipboard
Copied
Somewhat disappointingly Pixelbender still does not (as far as I know) execute on the GPU, when running in Flash. Which is really quite strange when you consider that Flash can do GPU 3D animation. For some reason a 2D shader remains in the too hard basket.
But reading the marketing on Pixelbender I'm not surprised you would assume Flash ran it on the GPU. It's not until you've invested time in it that you discover it doesn't. You naturally think that Flash + Pixelbender = GPU. And nobody tells you otherwise so it's easy to jump to that conclusion. You go back over what you've read and see how they've done it. Clever use of words.
That said there are some slight benefits over Actionscript, to do with threading and background processing. Will be awesome when Flash eventually can run Pixelbender scripts on the GPU.
In Photoshop, however, Pixelbender does run on the GPU.
Carl
Copy link to clipboard
Copied
As a 2-facit reminder, please remember a GPU is not a CPU. They are designed for different purposes. GPU is specialized, CPU is general. While in the future filters may be coded to somehow use the GPUs shaders to accomplish things, testing first is the best solution. I wouldn't expect PixelBender to instantly update to 100% GPU usage. In fact, I'd never assume anything until tested.
Copy link to clipboard
Copied
By definition a GPU shader is a shader that runs on the GPU. Or to put it another way, a GPU shader that doesn't run on a GPU is not a GPU shader.
The design of the PixelBender language is one that is obviously designed for compilation into GPU instructions. It is based on OpenGL shader language (etc). It's not based on this language because somehow it was felt this language would be a good language in which to bend pixels. It's a lot easier to bend pixels in Actionscript, or Java, or C. That said there is some slight performance improvement going through PixelBender. The same constraints that make it easier to compile Pixelbender to GPU instructions also help it to be compiled more efficiently for the CPU. That's certainly a plus.
Carl
Copy link to clipboard
Copied
PBs are compiled into kernels. The vast majority of what FP10+ does with the GPU is simply upload and release from it to use it for rendering. That is, until Stage3D emerged.
Pixel Bender 3D is the step toward actually really using the GPU and with Stage3D you can finally issue those GPU instructions that the standard Pixel Bender 2D cannot. Here's an article on why PB2D is still so heavily used which in a word is Adobe's requirement that software rendering works so Flash Player will work on all systems (note: it's old bit I feel it's still a valid synopsis):
http://www.kaourantin.net/2008/05/adobe-pixel-bender-in-flash-player-10.html
dns r5~ At the bottom of that article it does touch on the Mac performance differences (e.g. PPC runs 10x slower and kills CPU).
Copy link to clipboard
Copied
Why would you design a kernal language for writing kernals that can't be exectuted? Well there are very good reasons. The best reason is to future proof it, ie. so that when you can actually execute kernals you will have a language that won't need to be redesigned. The next best reason is that kernals also run well on the CPU. From script to compilation to execution there is very little overhead. To put it another way the langauge constraints force the writer to write their ideas in a way that can be easily compiled and executed with the least amount of overhead. And that won't require rewriting if and when GPU rendering becomes possible.
To put it yet another way, in Photoshop, you can compile and execute PixelBender scripts on the GPU - because the forethought in designing a language such as the PixelBender language, makes that possible.
Or to put it yet another way, the "problem" is not PixelBender as such but Flash. Flash has been slowly porting bits and pieces of it's underlying rendering software for execution on the GPU. It's a slow process because you do not wnat to introduce anything that breaks the multi-platfrom paradigm.
Flash can only use, or it philosophically decides it will only use, CPU Rendering only. It has nothing to do with the language. The language is way ahead of Flash in this regard. It's just Flash that needs to catch up.
My two cents.
C
Copy link to clipboard
Copied
I'm sorry you're not happy Pixel Bender is using the GPU as best it can but I just wanted to relay the real information to you.
Adobe wants the player to be available to everyone. Not just people with amazing machines. Perhaps the only software on the market today with the coconuts to continue to support the ultra-legacy is Flash Runtime. Yes, that costs some of us some performance. But with optimal coding techniques this is a non-issue with Stage3D.
At least you see the future isn't unplanned, Pixel Bender 3D exists.
Copy link to clipboard
Copied
Real information?
1. It is not Pixel Bender that does or does not use the GPU. It is Flash. Flash does not use the GPU. Whereas Photoshop does. Pixel Bender remains the same in both cases.
2. I'm not diagreeing with the Flash paradigm - which is why I put the word "problem" in quotes. The Flash philosophy is a good one with which I aggree. It is the misleading marketing I sometime disagree with.
3. Pixelbender3D isn't some sort of new version of Pixelbender. Pixelbender3D is designed for a different purpose, for writing shaders for use in a 3D context.
4. Indeed neither Pixel Bender nor PixelBender 3D needs to change in any way. They are already quite perfect. The future is already well planned. Its just the backend that needs catching up to the implicit plan.
C
Copy link to clipboard
Copied
1, Pixel Bender 2D uploads to GPU, Pixel Bender 3D does utilize the GPU.
2, Never seen marketing for Pixel Bender itself, let alone for Pixel Blender for Flash, nor misunderstood it was agnostic to the application utilizing it (to whatever extend it could, docs make it clear what those are)
3, The GPU is all about processing SIMD/vectors so, obviously yes, Pixel Bender 3D is for the GPU
4, It takes time to move huge frameworks into huge directions in a way that pleases all developers. I'll take the snotty route. If you can do it better, rather than complaining, by all means do so..
Copy link to clipboard
Copied
PixelBender 2D uploads to GPU? Or was that a typo?
Marketing
You want to find out the "real" deal on PixelBender
Type PixelBender into Google:
Go to first link:
http://www.adobe.com/devnet/pixelbender.html
Go to release notes:
http://www.adobe.com/devnet/pixelbender/articles/releasenotes.html
Scroll down to:
Supported graphics cards
The following table lists the graphics cards supported by the Pixel Bender Toolkit. The Pixel Bender Toolkit supports filter execution on the GPU, the CPU, and within Flash Player. For correct GPU processing, check the NVIDIA or ATI website for the latest graphics card drivers.
Big focus on graphics cards. But note the clever wording:
The Pixel Bender Toolkit supports filter execution on the GPU, the CPU, and within Flash Player
What is clever here is how they speak what is true and you couldn't really accuse them of saying anything that wasn't true. But what is happening here is in what they don't say. Where is the line that might read:
Note. In Flash, Pixelbender filters execute on the CPU.
The counter-argument is that why should they say that? And they would be entirely justified. If I'm selling a car, why do I have to say it's not a horse. But then my car doesn't look like a horse.
Regarding moving frameworks I said exactly the same thing. Where really in agreement on most points. But many people (myself when I first used PixelBender years ago) thought wow - GPU processing in Flash. Everything suggested that is what it was - until I read a single line in the docs that sank all my enthusiasm. But that said, and I say it again, for all that Pixelbender is still entirely useful in Flash . it does things you can't do directly in Actionscript. So it's defintiely a plus.
In other words I'm not complaining about Pixelbender. On the contrary I'm supporting it. What I'm complaing about is the marketing. To put it another way - whay are there so many posts about pixelBender not running on the GPU? Why do people assume ti does run ont he GPU. Where do they get that idea in the first place? Where? The marketing. It's as simple as that.
Heres some more:
http://www.adobe.com/devnet/flash/articles/pixel_bender_basics.html
Reading this you would get the distinct impression that Pixelbender in Flash ran on the GPU. It doesn't actually say that anywhere but the use of terms such "kernal" and "fragment shader languages" and "GLSL" kind of frame it as if it was for targeting the GPU. And when you look at the language and it's philosophy it all suggests GPU. The idea of a kernal is that it does the same thing on all pixels of the image, at the same time. But you can't actually do that on a CPU. So the language would seem rather pointless if it wasn't for targeting GPUs. However it s not actually pointless because, as I've ssuggested a couple of times, a kernal script does in fact also work quite well for a CPU as well.
Carl
Copy link to clipboard
Copied
I think that horse (or car) is definitely beaten to death. We're on the same page. The CPU is responsible for the work, explaining the OPs issue/confusion on why they see exactly that.
There is info out there that explains why Adobe does this in software (so 99% of the install base supports it). That's a pretty good reason. Now, I would agree that it would be nice if it was done on the GPU. With Stage3D, Adobe is clearly pointed toward the GPU for the gigafloppiness bliss.
While I wish it'd use the GPU to full potential now, I have no reason to believe Pixel Bender 3D won't solve the issue and turn it into "Use GPU if you can, fall back to software otherwise" in the future. Can't say I've desired to use the toolkit in any more projects than I can count on one hand. Just hang on a little bit

Copy link to clipboard
Copied
Pixel Bender just tricked me making me all that happy and down after all.
GPU functions in the debugging environment of the desktop application of FlashBuilder, and it does not function in a release environment.
OMG...
Thank you for the temporary and short-lived happiness.
I hope it will be handled properly for the better in near future.
Copy link to clipboard
Copied
From what I understand pixel bender support has been removed from flash 11.7 onwards or some one from adobe can correct me if I am wrong.

