我的实验表明,TBR架构中渲染顺序对性能影响很大,为什么?

发布于 2024-08-09 22:40:36 字数 156 浏览 6 评论 0原文

TBR 芯片在片段处理之前执行 HSR(隐藏表面去除),因此仅渲染可见像素。此功能无需从前到后对不透明对象进行排序。但我在我的 iPhone 3GS 上做了一个实验。通过比较帧时间,从前到后渲染不透明对象比从后到前渲染要快得多。 为什么会显示这个结果呢?无论以哪种顺序渲染对象,性能都应该非常接近。

TBR chips perform HSR (hidden surface removal) before fragment processing, so only the visible pixels are rendered. This feature results in no necessary sorting opaque objects from front to back. But I have done a experiment on my iPhone 3GS. By comparing the frame time, rendering opaque objects from front to back is much faster than back to front.
Why does it show this result? The performance should be very close when objects are rendered in whichever order.

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

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

发布评论

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

评论(2

围归者 2024-08-16 22:40:36

我相信不执行片段处理的优化是通过使用 Z 缓冲区来确定像素是否可见(如果像素不可见则提前退出管道)来完成的。因此,从后到前渲染将是该优化的最坏情况(不可能进行优化),而从前到后渲染是最好情况(所有最终隐藏的像素都已隐藏)。

I believe that the optimization to not perform fragment processing is done by using the Z-buffer to determine if a pixel is visible or not (and early out the pipeline if the pixel isn't visible). As a result rendering back-to-front will be worst-case for that optimization (no optimization possible) and front-to-back is best-case (all eventually hidden pixels are already hidden).

快乐很简单 2024-08-16 22:40:36

如果为真,则与 Apple 有关该主题的文档

  • 不要浪费 CPU 时间对对象进行从前到后的排序。 OpenGL ES 用于
    iPhone 和 iPod touch 实现了
    基于图块的延迟渲染模型
    这使得这是不必要的。看
    “基于图块的延迟渲染”
    更多信息。
  • 按对象的不透明度对对象进行排序:

    1. 首先绘制不透明对象。
    2. 接下来绘制需要 alpha 测试的对象(或在 OpenGL ES 2.0 中)
      基于应用程序的对象
      要求使用丢弃
      片段着色器。)请注意,这些
      操作会带来性能损失,
      如“避免 Alpha 测试和
      丢弃。”
    3. 最后,绘制 Alpha 混合对象。

以及文档此处

延迟的另一个优点
渲染是它允许 GPU
之前执行隐藏表面去除
片段被处理。像素
不可见的被丢弃而没有
采样纹理或执行
片段处理,显着
减少GPU的计算量
必须执行渲染场景。到
从中获得最大的利益
功能,你应该尝试绘制为
大部分场景包含不透明内容
尽可能并尽量减少使用
混合、阿尔法测试和
丢弃 GLSL 着色器中的指令。
因为硬件执行隐藏
表面去除,没有必要
让您的应用程序对其进行排序
从前到后的几何形状。

If true, that contradicts Apple's documentation on the topic:

  • Do not waste CPU time sorting objects front to back. OpenGL ES for
    iPhone and iPod touch implement a
    tile-based deferred rendering model
    that makes this unnecessary. See
    “Tile-Based Deferred Rendering” for
    more information.
  • Do sort objects by their opacity:

    1. Draw opaque objects first.
    2. Next draw objects that require alpha testing (or in an OpenGL ES 2.0
      based application, objects that
      require the use of discard in the
      fragment shader.) Note that these
      operations have a performance penalty,
      as described in “Avoid Alpha Test and
      Discard.”
    3. Finally, draw alpha-blended objects.

As well as the documentation here:

Another advantage of deferred
rendering is that it allows the GPU to
perform hidden surface removal before
fragments are processed. Pixels that
are not visible are discarded without
sampling textures or performing
fragment processing, significantly
reducing the calculations that the GPU
must perform to render the scene. To
gain the most benefit from this
feature, you should try to draw as
much of the scene with opaque content
as possible and minimize use of
blending, alpha testing, and the
discard instruction in GLSL shaders.
Because the hardware performs hidden
surface removal, it is not necessary
for your application to sort its
geometry from front to back.

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