WARNING: Calls to any function that may require a gradient calculation inside a conditional block may return undefined results
GLES2.0:
Some device will give a warning on compling shaders(yet the compling will succeed), and the rendering result is incorrect with blink & artifacts.
the problems is gradient calculation(interpolation) relies on the neighbor pixels,
if the neighbor pixels are not in the same conditional branch, the gradient will be invalid and result may be undifed.
I guess it is an un-defined behavior, so some devices/drivers works good, some don't.
//like this
if( test )
color = texture2D(sampler,UV);
else
color = vec4(,,,);
One workaround is use mix() or step() instead of conditional test.
color = mix(vec4(,,,), texture2D(...), testVal);
When using conditional branch, the texture sampling may be not actually executed, which will increase graphics performance.
One draw back on using mix/step is that the sampling is always performed, then interpolated/multiplied.
udpate:
Actually to many conditonal test & branch blocks(even without texture sampling in it) in fragment shader will case rendering halt, no response, and even system restart.
this result is based on testing on Galaxy S4 (PowerVR SGX544), compared to testing on iPad Air(PowerVR G6430, no such problems).
maybe it's only a driver issue, since both graphics chips are PowerVR family.
WARNING: Calls to any function that may require a gradient calculation inside a conditional block may return undefined results的更多相关文章
- linux系统下,警告:warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration] 和 warning: the `gets' function is dangerous and should not be used. 的由来和解决方法。
字符数组 的英文名字是 char [] gets()函数的基本用法为:char *gets(char *s); 该函数的参数是一个字符数组,该函数的返回值也是一个字符数组. linux下的代码如下: ...
- vs的【warning C4996:'fopen': This function or variable may be unsafe】解决方案
编译警告:warning C4996 与 Security Enhancements in the CRT 将过去的工程用VS2005打开的时候.你有可能会遇到一大堆的警告:warning C4996 ...
- warning: control reaches end of non-void function 和 warning: implicit declaration of function 'rsgClearColor' is invalid in C99
用gcc编译一个程序的时候出现这样的警告: warning: control reaches end of non-void function 它的意思是:控制到达非void函数的结尾.就是说你的一些 ...
- warning C4996: 'fopen': This function or variable may be unsafe.(_CRT_SECURE_NO_WARNINGS)
在 windows 平台下的 visual studio IDE,使用 fopen 等 CRT 函数(C runtime library(part of the C standard library) ...
- “warning C4996: 'fopen': This function or variable may be unsafe”和“LINK : fatal error LNK1104”的解决办法
程序有时编译出现警告C4996,报错: warning C4996: 'fopen': This function or variable may be unsafe. Consider using ...
- warning: implicit declaration of function 'getMyfilename' [-Wimplicit-function-declaration]|
我在main后面定义了getMyfilename()函数,然后就报出这个warning. 在main前声明一下就好了.
- warning C4996: 'sprintf': This function or variable may be unsafe
选项Project | Configuration Properties | C/C++ | Preprocessor | Preprocessor Defin ...
- warning C4996: 'strcpy': This function or variable may be unsafe.
mkdir 写成 _mkdir strcpy 写成为 strcpy_s 或是在项目处右击-->属性-->C/C++-->预处理器-->在预处理器定义后添加";_CR ...
- Unresolved function or method require()
1. 这是在JavaScript配置中没有node.js,去设置中配置就行了,方法如下: setting -> Languages&Frameworks -> Javascript ...
随机推荐
- Delphi 7 里没有加载的控件
在原来版本如D5.D6中使用的控件如Quickrep,FastNet等,在D7中仍然是保留的.只是Delphi没有将他们默认的安装到组件面版中来.这些控件包全部保存在Delphi目录的bin下,文件扩 ...
- 17.python自定义函数
什么是函数,函数说白了就是将一系列代码封装起来,实现代码的重用. 什么是代码重用? 假设我有这样的需求: 但是我还是觉得太麻烦了,每次想吃饭的时候都要重复这样的步骤.此时,我希望有这样的机器:
- <bootstrap>bs2和3的区别</bootstrap>
实验室的list网站开始动工了,准备打算用bootstrap作布局. 大前天去本部停了长html5峰会大连站的讲演,着急往回赶,很多感兴趣的东西都没有听到,但是还是了解了一些html5的新特性 电脑端 ...
- Swing基础
Swing基础 JFrame JPanel 绘图:paint 监听事件: ActionListener KeyListener Listener和Adapter 计时器:Timer Time ...
- ASP.NET内置对象之Request传递请求对象
Request对象是HttpRequest类的一个实例,Request对象用于读取客户端在Web请求期间发送的HTTP值.Request对象常用的属性如下所示. q QueryString: ...
- VS中制作安装文件
第一步先来建一个最简单的Windows窗体应用程序,并为项目命名为WinFormTest,解决方案为WinFormSetup 第二步在窗体Form中添加一个按钮并在按钮事件中添加代码,只做测试因此简单 ...
- JavaScript高级程序设计之基本包装类型
为便于操作基本类型值,ECMAScript提供了3个特殊的引用类型:Boolean, Number 和 String // 字符串怎么会有方法呢 var str1 = "some text& ...
- ASP.NET MVC4 View层_Razor操作Html元素
1 常用 Html 标签 1.1 Label Html 语法 :<label for="UserName">用户名</label> Razor语法:@Htm ...
- bootstrap-fileinput 图片上传
bootstrap-fileinput 源文件 在网上下载 CSS: <link href="../../static/Bootstrap/css/plugins/bootstrap- ...
- P1230: [Usaco2008 Nov]lites 开关灯
嗯嗯,这是一道线段树的题,询问区间内亮着的灯的个数,我们可以把区间修改的线段树改一下,原本的求和改成若有奇数次更改则取反(总长度-亮着的灯个数),而判断是否奇数次只要数组加一个delta的值,upda ...