Pixel Bender(Flash 中)和 Pixel Shaders(Silverlight 中)之间的比较

发布于 2024-08-04 19:18:05 字数 93 浏览 9 评论 0原文

有人可以解释一下 Flash 中的 Pixel Bender 和 Silverlight 中的 Pixel Shader(HLSL) 在编程灵活性和运行时性能方面的区别吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初熏 2024-08-11 19:18:05

我不知道可编程性,但就运行时性能而言,pixelbender 很棒。目前 Silverlight 3 不允许您在后台执行此处理,但使用 PixelBender,您可以。这很好,因为使用计算密集型过滤器时 UI 不会受到太大影响。

该论坛对 Silverlight 3 有一些好的优点和缺点:
优点和缺点
我知道这个主题很旧,但我添加了它,因为它看起来有点不完整。

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.

暗喜 2024-08-11 19:18:05

我不太了解 Silverlight 着色器,但我可以谈谈 PixelBender。

Pixelbender 着色器获取位图数据并一次评估每个 32 位像素(实际上是 4 个浮点数的每个块)并对其执行计算。着色器的输入是一个或多个图像和可选参数,输出始终是单个图像。该计算在图像中的所有像素上并行进行,并且在像素之间是“无状态”的,这意味着您无法在评估一个像素时存储值并在另一个像素中使用它们。事实上,就像素评估而言,该函数被设计为在无限大的图像上运行,因此不知道图像的大小和形状。

Flash Player 可用于着色器的功能是整个 Pixelbender 语言的子集。它排除了诸如可重用库函数和区域函数之类的语言功能。

像素弯曲器着色器可以在 GPU 上以独立于 Flash Player 的线程运行,本质上允许 Flash 中的线程处理。在实践中,考虑到 Pixelbender 的无状态性和有限的功能,这仅对大批量数字处理有用。数字的字节数组可以传递给伪装成位图数据的着色器,并使用 ShaderJob 异步(或同步)运行。

在语法方面,HLSL 和 PBJ 都是类似 C 的并且基于 GLSL。我的猜测是,鉴于 Microsoft 在图形硬件方面的经验,HLSL 可能具有更好的性能和更多功能。然而,Flash 和 Silverlight 之间的差异远远超出了它们的着色器,我认为 Flash 几乎在每个领域都优于 Silverlight,因此这取决于哪个平台更能满足需求。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文