简体   繁体   English

iOS OpenGL ES 2.0着色器的限制

[英]iOS OpenGL ES 2.0 Shader's limits

Are some limits of shader's size or variable's number in fragment shader? 片段着色器中着色器的大小或变量数有一些限制吗?

I've fragment shader, which returns empty image after some threshold size of code. 我有片段着色器,它在一些阈值的代码大小之后返回空图像。 I think, that problem is in limit of shader's size or number of variables. 我认为,问题在于着色器的大小或变量数的限制。

I check my shader program after compilation - all is ok. 编译后我检查着色器程序-一切正常。

Apple said: 苹果说:

OpenGL ES limits the number of each variable type you can use in a vertex or fragment shader. OpenGL ES限制了可在顶点或片段着色器中使用的每种变量类型的数量。 The OpenGL ES specification doesn't require implementations to provide a software fallback when these limits are exceeded; 超过这些限制时,OpenGL ES规范不需要实现提供软件后备; instead, the shader simply fails to compile or link. 相反,着色器根本无法编译或链接。

Khronos said: 赫罗诺斯说:

2 Length of Shader Executable This is defined by the conformance tests. 2可执行着色器的长度这是由一致性测试定义的。 3 Usage of Temporary Variables The maximum number of variables is defined by the conformance tests. 3临时变量的使用变量的最大数量由一致性测试定义。

But I can't find value of this limits. 但是我找不到这个限制的价值。

UPDATE: 更新:

Sometimes application is interrupted on glFlush or glDrawArrays with EXC_BAD_ACCESS , if image is big. 如果图像很大,有时应用程序会使用EXC_BAD_ACCESSglFlushglDrawArrays上中断。

SOLVED 解决了

Problem was in too long loop and from whence in long calculation time. 问题出在太长的循环中,并且由此导致计算时间过长。 Shader is no big, but very complexity. 着色器并不大,但是非常复杂。

UPDATE 更新

Same problem: GPUImage Kuwahara filter on iPhone 4S 相同的问题: iPhone 4S上的GPUImage Kuwahara过滤器

If you are checking the results of your shader compilations and linking (like instructed in Listing 10-1 in Apple's best practices .) and there are no errors, something else causes your empty image. 如果您正在检查着色器编译和链接的结果(如Apple最佳实践中的清单10-1所示 ),并且没有错误,则其他原因会导致图像空白。

If you are not checking the log, you should start checking :) 如果您不检查日志,则应开始检查:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM