Commit cc14f104 by Geoff Lang

Use a static function instead of a static initializer for defaultBlockInfo.

BUG=angle:640 Change-Id: I5fe568c9a2b492a5bd8a42142762229c5f992c7e Reviewed-on: https://chromium-review.googlesource.com/198248Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 8a7bed8c
...@@ -67,7 +67,10 @@ BlockMemberInfo::BlockMemberInfo(int offset, int arrayStride, int matrixStride, ...@@ -67,7 +67,10 @@ BlockMemberInfo::BlockMemberInfo(int offset, int arrayStride, int matrixStride,
{ {
} }
const BlockMemberInfo BlockMemberInfo::defaultBlockInfo(-1, -1, -1, false); BlockMemberInfo BlockMemberInfo::getDefaultBlockInfo()
{
return BlockMemberInfo(-1, -1, -1, false);
}
InterfaceBlock::InterfaceBlock(const char *name, unsigned int arraySize, unsigned int registerIndex) InterfaceBlock::InterfaceBlock(const char *name, unsigned int arraySize, unsigned int registerIndex)
: name(name), : name(name),
......
...@@ -95,7 +95,7 @@ struct BlockMemberInfo ...@@ -95,7 +95,7 @@ struct BlockMemberInfo
int matrixStride; int matrixStride;
bool isRowMajorMatrix; bool isRowMajorMatrix;
static const BlockMemberInfo defaultBlockInfo; static BlockMemberInfo getDefaultBlockInfo();
}; };
typedef std::vector<BlockMemberInfo> BlockMemberInfoArray; typedef std::vector<BlockMemberInfo> BlockMemberInfoArray;
......
...@@ -1564,9 +1564,9 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin ...@@ -1564,9 +1564,9 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin
// special case for gl_DepthRange, the only built-in uniform (also a struct) // special case for gl_DepthRange, the only built-in uniform (also a struct)
if (vertexShader->usesDepthRange() || fragmentShader->usesDepthRange()) if (vertexShader->usesDepthRange() || fragmentShader->usesDepthRange())
{ {
mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.near", 0, -1, gl::BlockMemberInfo::defaultBlockInfo)); mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.near", 0, -1, gl::BlockMemberInfo::getDefaultBlockInfo()));
mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.far", 0, -1, gl::BlockMemberInfo::defaultBlockInfo)); mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.far", 0, -1, gl::BlockMemberInfo::getDefaultBlockInfo()));
mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.diff", 0, -1, gl::BlockMemberInfo::defaultBlockInfo)); mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.diff", 0, -1, gl::BlockMemberInfo::getDefaultBlockInfo()));
} }
if (!linkUniformBlocks(infoLog, vertexShader->getInterfaceBlocks(), fragmentShader->getInterfaceBlocks())) if (!linkUniformBlocks(infoLog, vertexShader->getInterfaceBlocks(), fragmentShader->getInterfaceBlocks()))
...@@ -2012,7 +2012,7 @@ bool ProgramBinary::defineUniform(GLenum shader, const gl::Uniform &constant, In ...@@ -2012,7 +2012,7 @@ bool ProgramBinary::defineUniform(GLenum shader, const gl::Uniform &constant, In
} }
else else
{ {
uniform = new LinkedUniform(constant.type, constant.precision, constant.name, constant.arraySize, -1, gl::BlockMemberInfo::defaultBlockInfo); uniform = new LinkedUniform(constant.type, constant.precision, constant.name, constant.arraySize, -1, gl::BlockMemberInfo::getDefaultBlockInfo());
uniform->registerElement = constant.elementIndex; uniform->registerElement = constant.elementIndex;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment