In addition to basic if-then-else statements, it is possible to write for, while, and do-while loops. In OpenGL ES 2.0, very strict rules governed the usage of loops. Essentially, only loops that could be unrolled by the compiler were supported. These restrictions no longer exist in OpenGL ES 3.0. The GPU hardware is expected to provide support for looping and flow control; thus loops are fully supported.

That is not to say that loops don't come with some performance implications. On most GPU architectures, vertices or fragments are executed in parallel in batches. The GPU typically requires that all fragments or vertices in a batch evaluate all branches (or loop iterations) of flow control statements. If vertices or fragments in a batch execute different paths, then, usually all of the other vertices/fragments in a batch will need to execute that path as well. The size of a batch is GPU dependent and will often require profiling to determine the performance implications of the use of flow control on a particular architecture. However, a good rule of thumb is to try to limit the use of divergent flow control or loop iterations across vertices/fragments

OpenGL ES Shading Language中应尽量避免使用循环的更多相关文章

  1. OpenGL ES Shader语言中的函数不支持递归

    An example function definition is given here for a simple function that computes basic diffuse light ...

  2. OpenGL ES 3D空间中自定义显示空间

    在Android中,我们所熟知的是在ES管线中,其在图元装配时,会进行图元组装与图元分配,这样就回剪裁出来视景体中的物体.但是如果我想在3D场景中规定一个区域,凡是在这个区域中的物体就能显示出来,非这 ...

  3. OpenGL ES SL 3.0规范中以前的attribute改成了in varying改成了out

           OpenGL ES和OpenGL的图标 关于“OpenGL ES SL 3.0规范中以前的attribute改成了in varying改成了out”这个问题,做一阐述: 1.关键字的小修 ...

  4. 在Android中使用OpenGL ES进行开发第(一)节:概念先行

    一.前期基础是知识储备笔者计划写三篇文章来详细分析OpenGL ES基础的同时也是入门关键的三个点: ①OpenGL ES是什么?与OpenGL的关系是什么?——概念部分 ②使用OpenGL ES绘制 ...

  5. Mali GPU OpenGL ES 应用性能优化--基本方法

    1. 经常使用优化工具 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvTXlBcnJvdw==/font/5a6L5L2T/fontsize/400/fil ...

  6. OpenGL ES crash notes 01 - Nice to meet you

    这篇笔记完全参照<OpenGL.ES.3.0.Programming.Guide.2nd.Edition>,摘出部分内容只为学习参考. 为什么要用英文:无论是D3D的SDK还是OES的Sp ...

  7. 梳理 Opengl ES 3.0 (二)剖析一个GLSL程序

    OpenGL ES shading language 3.0 也被称作 GLSL,是个 C风格的编程语言. Opengl ES 3.0内部有两种可编程处理单元,即Vertex processor和Fr ...

  8. 详解 OpenGL ES 2.x 渲染流程

    khronos官方对OpenGL ES的描述如下: OpenGL ES is a royalty-free, cross-platform API for rendering advanced 2D ...

  9. 一文详解 OpenGL ES 3.x 渲染管线

    OpenGL ES 构建的三维空间,其中的三维实体由许多的三角形拼接构成.如下图左侧所示的三维实体圆锥,其由许多三角形按照一定规律拼接构成.而组成圆锥的每一个三角形,其任意一个顶点由三维空间中 x.y ...

随机推荐

  1. 微信小程序开发需要注意的29个坑

    1.小程序名称可以由中文.数字.英文.长度在3-20个字符之间,一个中文字等于2个字符. 2.小程序名称不得与公众平台已有的订阅号.服务号重复.如提示重名,请更换名称进行设置. 3.小程序名称在帐号信 ...

  2. 在eclipse中查看Android源码

    声明:高手跳过此文章 当我们在eclipse中开发android程序的时候.往往须要看源码(可能是出于好奇,可能是读源码习惯),那么怎样查看Android源码呢? 比方以下这样的情况 图1 如果我们想 ...

  3. lodoop打印控件详解

    注意:使用此打印控件需要引入(在我上传的Demo中都有): install_lodop32.exe install_lodop64.exe LodopFuncs.js jquery-1.10.0.mi ...

  4. hdu1465(放错信 错排公式)

    Problem Description 大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了! 做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱容易 ...

  5. SQLPrompt_7.2.2.273〖含注册机〗(支持低版本和最高版本SQL2016+VS2015)

    SQLPrompt_7.4.1.564[含注册机](支持低版本和最高版本SQL2016+VS2015) http://download.csdn.net/detail/wozengcong/97601 ...

  6. 蜻蜓FM涉嫌诈骗投资人和广告主源代码剖析

    引用自:https://github.com/cryfish2015/QingTingCheat 本文主要内容,引用自知乎的这篇文章:如何评价蜻蜓 FM 伪造用户活跃度等数据 感谢“左莫”.“任正”等 ...

  7. C#编程(五十四)----------Lookup类和有序字典

    原文链接: http://blog.csdn.net/shanyongxu/article/details/47071607 Lookup类 Dictionary<Tkey,TValue> ...

  8. C#编程(二十四)----------修饰符

    修饰符 修饰符即应用于类型或成员的关键字.修饰符可以指定方法的可见性,如public或private,还可以指定一项的本质,如刚发的vritual或abstract. 可见性的修饰符 修饰符 应用于 ...

  9. 下载java生成PDF

    /** * 下载打印PDF * @param request * @param response * @throws ServletException * @throws IOException * ...

  10. localhost,127.0.0.1 和 本机IP 三者的区别

    localhost.127.0.0.1和本机IP的区别如下: 1.首先 localhost 是一个域名,在过去它指向 127.0.0.1 这个IP地址.在操作系统支持 ipv6 后,它同时还指向ipv ...