// Adds a wOpTime and a wElectionId field to a set of gle options static BSONObj buildGLECmdWithOpTime( const BSONObj& gleOptions, const OpTime& opTime, const OID& electionId ) { BSONObjBuilder builder; BSONObjIterator it( gleOptions ); for ( int i = 0; it.more(); ++i ) { BSONElement el = it.next(); // Make sure first element is getLastError : 1 if ( i == 0 ) { StringData elName( el.fieldName() ); if ( !elName.equalCaseInsensitive( "getLastError" ) ) { builder.append( "getLastError", 1 ); } } builder.append( el ); } builder.appendTimestamp( "wOpTime", opTime.asDate() ); builder.appendOID( "wElectionId", const_cast<OID*>(&electionId) ); return builder.obj(); }
void CWebGLProgram::UpdateInfo() { glGetProgramiv(GetGLName(), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, (GLint*)&attribMaxNameLength_); glGetProgramiv(GetGLName(), GL_ACTIVE_UNIFORM_MAX_LENGTH, (GLint*)&uniformMaxNameLength_); glGetProgramiv(GetGLName(), GL_ACTIVE_UNIFORMS, (GLint*)&uniformCount_); glGetProgramiv(GetGLName(), GL_ACTIVE_ATTRIBUTES, (GLint*)&attribCount_); GLint numVertexAttribs; glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numVertexAttribs); attribsInUse_.RemoveAll(); attribsInUse_.SetCount(numVertexAttribs); CAtlStringA nameBuf; nameBuf.Preallocate(attribMaxNameLength_); for (int i = 0; i < attribCount_; ++i) { GLint attrnamelen; GLint attrsize; GLenum attrtype; glGetActiveAttrib(GetGLName(), i, attribMaxNameLength_, &attrnamelen, &attrsize, &attrtype, nameBuf.GetBuffer()); if (attrnamelen > 0) { GLint loc = glGetAttribLocation(GetGLName(), nameBuf.GetBuffer()); attribsInUse_[loc] = true; } } nameBuf.Preallocate(uniformMaxNameLength_); for (int i = 0; i < uniformCount_; ++i) { GLsizei length = 0; GLint size = 0; GLenum type = 0; glGetActiveUniform(GetGLName(), i, uniformMaxNameLength_, &length, &size, &type, nameBuf.GetBuffer()); if (IsArrayName(nameBuf.GetString())) { for (GLint j = 0; j < size; ++j) { CAtlStringA elName(nameBuf.GetString()); if (elName[elName.GetLength()-1] == ']') elName.Delete(elName.GetLength()-3, 3); elName.Format("%s[%u]", elName.GetString(), j); int loc = glGetUniformLocation(GetGLName(), elName.GetString()); if (loc != -1) { uniformInfos_.SetAt(loc, UniformLocationInfo(true, j, size) ); } } } else { int loc = glGetUniformLocation(GetGLName(), nameBuf.GetString()); if (loc != -1) { uniformInfos_.SetAt(loc, UniformLocationInfo(false, -1, 1) ); } } } }