ATI 显卡上 GLSL 着色器的顶点统一组件的实际数量是多少?
我正在为配备 AMD Radeon HD 6970M 2048 MB 显卡的 iMac 编写 GLSL 顶点着色器:
GL_MAX_VERTEX_ATTRIBS: 16
GL_MAX_VERTEX_UNIFORM_COMPONENTS: 4096
GL_VERSION: 2.1 ATI-7.12.9
GL_SHADING_LANGUAGE_VERSION: 1.20
在我的着色器中,我希望拥有大量统一的 mat4:
uniform mat4 T[65]
但如果我尝试拥有其中 65 个着色器(秘密地) )切换到 Apple 软件渲染器模式。如果我改用 64:
uniform mat4 T[64]
一切都很好。
似乎是超过制服最大数量的问题。但正如我上面所写,我得到 GL_MAX_VERTEX_UNIFORM_COMPONENTS 的 4096,因此 4096/(4*4) = 256 而不是 64...
ATI/AMD 注意:ATI 最大组件值是错误的。它们是组件的实际数量除以 4。
但是读到这里我会想,如果我查询 GL_MAX_VERTEX_UNIFORM_COMPONENTS 并得到 4096,我实际上有 16,384 个。情况似乎是 GL_MAX_VERTEX_UNIFORM_COMPONENTS 返回组件的实际数量乘以 4。这将得到 1024/(4*4) = 64。
有人能证实这一点吗?
编辑: 我的着色器很简单:
#version 120
// 65 goes into software render mode
#define MAX_T 64
attribute vec4 indices;
uniform mat4 T[MAX_T];
void main()
{
gl_Position = T[int(indices[0])]*gl_Vertex;
}
I'm writing a GLSL vertex shader for an iMac with a AMD Radeon HD 6970M 2048 MB graphics card:
GL_MAX_VERTEX_ATTRIBS: 16
GL_MAX_VERTEX_UNIFORM_COMPONENTS: 4096
GL_VERSION: 2.1 ATI-7.12.9
GL_SHADING_LANGUAGE_VERSION: 1.20
In my shader I would like to have a large array of uniform mat4s:
uniform mat4 T[65]
but if I try to have 65 of these my shader (secretly) switches to Apple Software Renderer mode. If I instead use 64:
uniform mat4 T[64]
everything is fine.
Seems to be a problem with exceeding the maximum number of uniforms. But as I wrote above I'm getting 4096 for GL_MAX_VERTEX_UNIFORM_COMPONENTS so 4096/(4*4) = 256 not 64...
OpenGL.org wiki says
ATI/AMD note: The ATI max component values are wrong. They are the actual number of components divided by 4.
But reading this I would think that if I query GL_MAX_VERTEX_UNIFORM_COMPONENTS and get 4096 that I actually have 16,384. What seems to be the case is that GL_MAX_VERTEX_UNIFORM_COMPONENTS returns the actual number of components multiplied by 4. This would then give 1024/(4*4) = 64.
Can anyone confirm this?
Edit:
My shader is simply:
#version 120
// 65 goes into software render mode
#define MAX_T 64
attribute vec4 indices;
uniform mat4 T[MAX_T];
void main()
{
gl_Position = T[int(indices[0])]*gl_Vertex;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
到目前为止,您是对的,您需要将 4096 除以 4,而不是相乘。维基条目
is的措辞很糟糕。You're right isofar, that you need to divide the 4096 by 4 not multiply. The wiki entry
iswas worded badly.