ATI图形卡上GLSL着色器的顶点统一组件的实际数量是多少? [英] What is the actual number of vertex uniform components for GLSL shader on ATI graphics card?
问题描述
我正在为配备AMD Radeon HD 6970M 2048 MB显卡的iMac编写GLSL顶点着色器:
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
在我的着色器中,我想要一大堆均匀的mat4s:
In my shader I would like to have a large array of uniform mat4s:
uniform mat4 T[65]
但是,如果我尝试将其中的65个着色器(秘密地)切换到Apple Software Renderer模式.如果我改用64:
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]
一切都很好.
超出制服的最大数量似乎是一个问题.但是正如我上面写的那样,GL_MAX_VERTEX_UNIFORM_COMPONENTS的值为4096,所以4096/(4 * 4)= 256而不是64 ...
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...
ATI/AMD注意:ATI max组件值错误.它们是组件的实际数量除以4.
ATI/AMD note: The ATI max component values are wrong. They are the actual number of components divided by 4.
但是阅读此书,我会认为,如果我查询GL_MAX_VERTEX_UNIFORM_COMPONENTS并获得4096,则我实际上有16,384.似乎是这样的情况:GL_MAX_VERTEX_UNIFORM_COMPONENTS返回组件的实际数量乘以4.这将得出1024/(4 * 4)= 64.
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.
任何人都可以确认吗?
我的着色器很简单:
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;
}
推荐答案
您是正确的等距点,您需要将4096除以4而不是相乘. Wiki条目是的措词不正确.
You're right isofar, that you need to divide the 4096 by 4 not multiply. The wiki entry is was worded badly.
这篇关于ATI图形卡上GLSL着色器的顶点统一组件的实际数量是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!