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 ...
随机推荐
- 仿酒仙网的一款jQuery侧栏弹出导航栏特效
仿酒仙网的一款jQuery侧栏弹出导航栏特效 一款常用于商城左侧商品导航的jquery菜单导航特效. 非常不错的一款商品分类特效.大家可以拿去研究研究 . 注意:该特效还支持挨千刀的IE6啊,之强大. ...
- Sublime Text 2 安装与使用SFTP插件
http://wbond.net/sublime_packages/sftp/usage http://www.360doc.com/content/13/0603/15/9437165_290170 ...
- sql 子查询要命名
Date1 from ( select distinct Date1 from TableName where Date1 > '2013-5-1' )A --这里加个A,B,C随便你 或者as ...
- MapReduce shuffle阶段详解
在Mapreduce中,Shuffle过程是Mapreduce的核心,它分布在Mapreduce的map阶段和reduce阶段,共可分为6个详细的阶段: 1).Collect阶段:将MapTask的结 ...
- ASP.NET Core文章汇总
现有Asp.Net Core 文章资料,2016 3-20月汇总如下 ASP.NET Core 1.0 与 .NET Core 1.0 基础概述 http://www.cnblogs.com/Irvi ...
- 浅析python的string.Template
摘自:python参考手册. string模块定义了一种新字符串类型Template,简化了特定的字符串置换操作, Template定义一个类 1.template(s), #s是字符串 s='he ...
- sublimeLinter-jshint 配置
这几天知道sublime3有可以对javascript进行语法检查的文件,折腾了一上午,搞定了. 记录一下步骤: 1.先安装nodejs. 2.npm install jshint -g 3.通过su ...
- 刀哥多线程笔记之gcd-02-block
block 概念 block 是 C 语言的 是一种数据类型,可以当作参数传递 是一组预先准备好的代码,在需要的时候执行 动画 block 回顾 self.demoView.center = CGPo ...
- Python 文件I/O
文件I/O是Python中最重要的技术之一,在Python中对文件进行I/O操作是非常简单的. 1.打开文件 语法: open(name[, mode[, buffering]]) 1.1文件模式 1 ...
- Go defer延迟执行
defer用于延迟执行,可以类比于java或c++中的析构函数. 查看一段示例代码: func Contents(filename string) (string, error) { //打开文件 f ...