Can someone explain the different between Pixel Bender in Flash and Pixel Shader(HLSL) in Silverlight in terms of programming flexibility and run-time performance?
I do not know about programmability, but as for run-time performance, pixelbender is great. Currently Silverlight 3 does not let you do this processing in the background, but with PixelBender, you can. This is good because the UI is not affected as much when using computationally intense filters.
This forum has some good pro's and con's for Silverlight 3: Pros and Cons. I know this topic is old, but I'm adding to it since it seemed a little incomplete.
I don't really know about the Silverlight shaders but I can talk about PixelBender.
A pixelbender shader takes bitmap data and evaluates each 32-bit pixel (actually each chunk of 4 floats) one at a time and performs calculations on it. The input to the shader is one or more images and optional parameters and the output is always a single image. The calculation happens in parallel across all the pixels in the image and is 'stateless' between pixels, meaning that you cannot store values while evaluating one pixel and use them in another. In fact, in terms of the pixel evaluation, the function is designed to operate on an infinitely large image and is therefore ignorant to the size and shape of the image.
The functionality available to Flash Player for shaders is a subset of the entire pixelbender language. It excludes such language features as reusable library functions and region functions.
The pixel bender shader can run on the GPU in a separate thread from the Flash Player essentially allowing threaded processes in Flash. In practice, this is only useful for large-batch number crunching given the statelessness and limited functionality of pixelbender. A bytearray of numbers can be passed to the shader disguised as bitmapdata and run asynchronously (or synchronously) using a ShaderJob.
Syntax-wise, both HLSL and PBJ are C-like and based on GLSL. My guess is that HLSL probably has better performance and more features given Microsoft's experience with graphic's hardware. However, the differences between Flash and Silverlight go far beyond their shaders and I think Flash excels beyond Silverlight in almost every area so it comes down to which platform better meets needs.
© 2022 - 2024 — McMap. All rights reserved.