带有__declspec(align('16'))的形式参数将不会对齐 [英] Formal parameter with __declspec(align('16')) won't be aligned
本文介绍了带有__declspec(align('16'))的形式参数将不会对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试设置着色器制服的功能,但是当我尝试对其进行编译时,出现此错误:
I am trying to make function for setting shader uniforms, but when I try to compile it I get this error :
错误2错误C2719:值":具有的形式参数 __declspec(align('16'))将不会对齐
Error 2 error C2719: 'value': formal parameter with __declspec(align('16')) won't be aligned
这是功能代码:
void Shader::setUniform(std::string name, const glm::mat4 value){
GLint uniform = glGetUniformLocation(m_program, name.c_str());
glUniformMatrix4fv(uniform, 1, GL_FALSE, (GLfloat*)&value);
}
我正在使用Visual Studio 2013.
I am using Visual studio 2013.
推荐答案
来自 Microsoft的文档有关该错误的信息:
From Microsoft's documentation on that error:
align __ declspec 修饰符是函数参数上不允许.
The align __declspec modifier is not permitted on function parameters.
不要复制参数到未对齐的位置.将常量引用传递给现有的对齐数据.
Don't copy the parameter to an unaligned location. Pass a constant reference to the existing, aligned data.
void Shader::setUniform(const std::string &name, const glm::mat4 & value)
// ^^^^^ ^
这篇关于带有__declspec(align('16'))的形式参数将不会对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文