- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
来自OpenGL ES spec第 2.10.4 节(着色器变量:可变变量):
The number of interpolators available for processing varying variables is given by the implementation-dependent constant
MAX_VARYING_VECTORS
.This value represents the number of four-element floating-point vectors that can be interpolated; varying variables declared as matrices or arrays will consume multiple interpolators.
When a program is linked, any varying variable written by a vertex shader, or read by a fragment shader, will count against this limit.
A program whose shaders access more than
MAX_VARYING_VECTORS
worth of varying variables may fail to link
在我机器上的 Chrome 中,gl.getParameter(gl.MAX_VARYING_VECTORS)
返回 15
,这意味着我可以使用 15 个 vec4
变量着色器。
我已经通过一些测试验证了这一点。 15 vec4
变量工作正常,但是当尝试使用 16 时,程序无法链接,并且 gl.getProgramInfoLog()
返回“变量超过最大寄存器限制”
.
但是可以使用多少种 vec3
、vec2
或 float
类型的变量?
OpenGL ES 规范似乎暗示了这一点,但没有明确说明:
any varying variable ... will count against this limit.
A program whose shaders access more than
MAX_VARYING_VECTORS
worth of varying variables may fail to link
我有两个猜测:
float
的最大数量由以下公式给出:MAX_VARYING_VECTORS * 4
vec4
向量 4 float
)MAX_VARYING_VECTORS
为 8
,则可以安全地使用以下各项,而不会导致任何链接错误:
vec4
变化vec3
变化vec2
变化 float
变化vec4
、3 vec3
、3 vec2
和 5 float
变化vec4
长度可变的数组 8
vec3
长度可变的数组 10
vec2
长度可变的数组 16
float
长度不同的数组 32
vec4
/vec3
/vec2
/float
变量或数组的任何其他组合,其使用最大值32 个 float
因此,如果我的 MAX_VARYING_VECTORS
值为 15
,我想我最多可以使用 60 个 float
。我的测试似乎证实了这一点。例如,30 个vec2
变量在我的机器上工作正常,但 31 个会导致“变量超出最大寄存器限制”
链接错误。
所以我的问题是:
MAX_VARYING_VECTORS
为 8
,那么使用 16 个 vec2
变量是否安全?这能保证始终有效吗?最佳答案
来自 WebGL 规范
6.24 Packing Restrictions for Uniforms and Varyings
The OpenGL ES Shading Language, Version 1.00 [GLES20GLSL], Appendix A, Section 7 "Counting of Varyings and Uniforms" defines a conservative algorithm for computing the storage required for all of the uniform and varying variables in a shader. The GLSL ES specification requires that if the packing algorithm defined in Appendix A succeeds, then the shader must succeed compilation on the target platform. The WebGL API further requires that if the packing algorithm fails either for the uniform variables of a shader or for the varying variables of a program, compilation or linking must fail.
所以,是的,如果您阅读了算法,如果 MAX_VARYING_VECTORS
为 8,则可以使用 16 个 vec2
。但是您不能使用 10 个 vec3。您只能使用 8 个 vec3
还有数组限制。例如,如果 MAX_VARYING_VECTORS
为 8,则 float
数组不能大于 8,vec2
数组也不能大于 8。
关于opengl-es - WebGL 着色器 : maximum number of varying variables,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26682631/
考虑一下,我们在具有整数弧容量的有向网络中有一个非整数最大流。 是否有算法可以将这个流量转化为整数最大流量? 它的运行时间是多少? 这不是作业问题。 最佳答案 如果您正在寻找具有积分弧容量的最大 s-
我有一个可以接受 byte[] 的 WCF 服务。我正在使用 HttpClient 创建客户端并收到以下错误。我在网上看到你必须在服务器和客户端上设置 readerQuotas,但是如何在 HttpC
我有一个如下所示的数据框: df = pd.DataFrame({'A':[100,300,500,600], 'B':[100,200,300,400],
我开始使用 cocoapi评估使用 Object Detection API 训练的模型。在阅读了解释平均精度 (mAP) 和召回率的各种来源后,我对 cocoapi 中使用的“最大检测”参数感到困惑
这个问题已经有答案了: 已关闭10 年前。 Possible Duplicate: Size-limited queue that holds last N elements in Java Java
您好,我需要帮助制作以下算法: 假设一个二维空间域,具有 xmax、xmin、ymin、ymax,空间中有“n~10,000”个点。 浏览点位置列表。 当框中的点数达到最大数量(假设为 10 个)时,
我在 Android 应用程序中有一个类,它包含一个字节数组作为纹理的数据源。我使用帧缓冲区将一些东西渲染到该纹理上,然后在屏幕上渲染该纹理。这非常有效。 但是,我只能使用 151 个纹理来执行此操作
系统调用中可以传递多少个参数?我检查了内核文件 /asm/unistd.h,没有看到包含超过 4 个参数的系统调用。 最佳答案 这取决于您使用的架构。对于 i386,系统调用号旁边最多有 6 个参数。
题目地址:https://leetcode-cn.com/problems/maximum-average-subtree/ 题目描述 Given the root of a binary tre
题目地址:https://leetcode.com/problems/sliding-window-maximum/ 题目描述 Given an array nums, there is a sl
题目地址:https://leetcode-cn.com/problems/maximum-distance-in-arrays/ 题目描述 Given m arrays, and each ar
题目地址:https://leetcode.com/problems/maximum-average-subarray-i/description/open in new window 题目描述
题目地址:https://leetcode.com/problems/third-maximum-number/description/ 题目描述 Given a non-empty array
我有一个很难重现的错误。另外,有人告诉我写日志文件是一种安全责任。所以我想在异常中尽可能多地捕捉。 我找不到任何说明 C# 异常的最大长度是多少的地方。 我想粘贴一条 XML 消息(1 或 2K),也
是否可以限制 QML 应用的最大 FPS? 我在低端 iten atom 硬件中获得 60FPS 和 30% 的 CPU 使用率使用 win32 Angle 驱动程序(openGL 软件无法使用),我
我已启用 SeriLog(最新版本)自记录功能,并且看到数百条消息说 Maximum destructuring depth reached 不知道这意味着什么以及这是否是我需要担心的问题。 有谁知道
我有一个具有两个属性的模型(我只显示两个,因为只需要这两列) 我的模型 place_id ---------------------- user_id 1 ----------------------
考虑以下情况:要设置一个群集,其中每台计算机都具有32G GB的RAM。和16个CPU核心 如何根据信息(32G GB RAM和16 CPU CORE)确定以下参数 ) yarn.scheduler.
完成如下函数定义: -- maxi x y returns the maximum of x and y 我应该不使用 Haskell 中的“最大”函数来完成这个任务。 maxi :: Int
Haskell 标准库中是否有与 maximum 等效的安全值? *Main Control.Monad.State Data.List> maximum [] *** Exception: Prel
我是一名优秀的程序员,十分优秀!