Moved State::initializeExtensionProcs() nearer top of source file to make the position consistent with change in position in master, making it easier to diff between them.
This commit is contained in:
parent
b37b635a7c
commit
f449bd3730
@ -152,6 +152,96 @@ State::~State()
|
||||
//_vertexAttribArrayList.clear();
|
||||
}
|
||||
|
||||
void State::initializeExtensionProcs()
|
||||
{
|
||||
if (_extensionProcsInitialized) return;
|
||||
|
||||
const char* vendor = (const char*) glGetString( GL_VENDOR );
|
||||
if (vendor)
|
||||
{
|
||||
std::string str_vendor(vendor);
|
||||
std::replace(str_vendor.begin(), str_vendor.end(), ' ', '_');
|
||||
OSG_INFO<<"GL_VENDOR = ["<<str_vendor<<"]"<<std::endl;
|
||||
_defineMap.map[str_vendor].defineVec.push_back(osg::StateSet::DefinePair("1",osg::StateAttribute::ON));
|
||||
_defineMap.map[str_vendor].changed = true;
|
||||
_defineMap.changed = true;
|
||||
}
|
||||
|
||||
_glExtensions = new GLExtensions(_contextID);
|
||||
GLExtensions::Set(_contextID, _glExtensions.get());
|
||||
|
||||
setGLExtensionFuncPtr(_glClientActiveTexture,"glClientActiveTexture","glClientActiveTextureARB");
|
||||
setGLExtensionFuncPtr(_glActiveTexture, "glActiveTexture","glActiveTextureARB");
|
||||
setGLExtensionFuncPtr(_glFogCoordPointer, "glFogCoordPointer","glFogCoordPointerEXT");
|
||||
setGLExtensionFuncPtr(_glSecondaryColorPointer, "glSecondaryColorPointer","glSecondaryColorPointerEXT");
|
||||
setGLExtensionFuncPtr(_glVertexAttribPointer, "glVertexAttribPointer","glVertexAttribPointerARB");
|
||||
setGLExtensionFuncPtr(_glVertexAttribIPointer, "glVertexAttribIPointer");
|
||||
setGLExtensionFuncPtr(_glVertexAttribLPointer, "glVertexAttribLPointer","glVertexAttribPointerARB");
|
||||
setGLExtensionFuncPtr(_glEnableVertexAttribArray, "glEnableVertexAttribArray","glEnableVertexAttribArrayARB");
|
||||
setGLExtensionFuncPtr(_glMultiTexCoord4f, "glMultiTexCoord4f","glMultiTexCoord4fARB");
|
||||
setGLExtensionFuncPtr(_glVertexAttrib4f, "glVertexAttrib4f");
|
||||
setGLExtensionFuncPtr(_glVertexAttrib4fv, "glVertexAttrib4fv");
|
||||
setGLExtensionFuncPtr(_glDisableVertexAttribArray, "glDisableVertexAttribArray","glDisableVertexAttribArrayARB");
|
||||
setGLExtensionFuncPtr(_glBindBuffer, "glBindBuffer","glBindBufferARB");
|
||||
|
||||
setGLExtensionFuncPtr(_glDrawArraysInstanced, "glDrawArraysInstanced","glDrawArraysInstancedARB","glDrawArraysInstancedEXT");
|
||||
setGLExtensionFuncPtr(_glDrawElementsInstanced, "glDrawElementsInstanced","glDrawElementsInstancedARB","glDrawElementsInstancedEXT");
|
||||
|
||||
if (osg::getGLVersionNumber() >= 2.0 || osg::isGLExtensionSupported(_contextID, "GL_ARB_vertex_shader") || OSG_GLES2_FEATURES || OSG_GL3_FEATURES)
|
||||
{
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,&_glMaxTextureUnits);
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glGetIntegerv(GL_MAX_TEXTURE_COORDS, &_glMaxTextureCoords);
|
||||
#else
|
||||
_glMaxTextureCoords = _glMaxTextureUnits;
|
||||
#endif
|
||||
}
|
||||
else if ( osg::getGLVersionNumber() >= 1.3 ||
|
||||
osg::isGLExtensionSupported(_contextID,"GL_ARB_multitexture") ||
|
||||
osg::isGLExtensionSupported(_contextID,"GL_EXT_multitexture") ||
|
||||
OSG_GLES1_FEATURES)
|
||||
{
|
||||
GLint maxTextureUnits = 0;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS,&maxTextureUnits);
|
||||
_glMaxTextureUnits = maxTextureUnits;
|
||||
_glMaxTextureCoords = maxTextureUnits;
|
||||
}
|
||||
else
|
||||
{
|
||||
_glMaxTextureUnits = 1;
|
||||
_glMaxTextureCoords = 1;
|
||||
}
|
||||
|
||||
if (_glExtensions->isARBTimerQuerySupported)
|
||||
{
|
||||
const GLubyte* renderer = glGetString(GL_RENDERER);
|
||||
std::string rendererString = renderer ? (const char*)renderer : "";
|
||||
if (rendererString.find("Radeon")!=std::string::npos || rendererString.find("RADEON")!=std::string::npos || rendererString.find("FirePro")!=std::string::npos)
|
||||
{
|
||||
// AMD/ATI drivers are producing an invalid enumerate error on the
|
||||
// glGetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS_ARB, &bits);
|
||||
// call so work around it by assuming 64 bits for counter.
|
||||
setTimestampBits(64);
|
||||
//setTimestampBits(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint bits = 0;
|
||||
_glExtensions->glGetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS_ARB, &bits);
|
||||
setTimestampBits(bits);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_extensionProcsInitialized = true;
|
||||
|
||||
if (_graphicsCostEstimator.valid())
|
||||
{
|
||||
RenderInfo renderInfo(this,0);
|
||||
_graphicsCostEstimator->calibrate(renderInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void State::releaseGLObjects()
|
||||
{
|
||||
// release any GL objects held by the shader composer
|
||||
@ -959,96 +1049,6 @@ void State::setInterleavedArrays( GLenum format, GLsizei stride, const GLvoid* p
|
||||
dirtyAllVertexArrays();
|
||||
}
|
||||
|
||||
void State::initializeExtensionProcs()
|
||||
{
|
||||
if (_extensionProcsInitialized) return;
|
||||
|
||||
const char* vendor = (const char*) glGetString( GL_VENDOR );
|
||||
if (vendor)
|
||||
{
|
||||
std::string str_vendor(vendor);
|
||||
std::replace(str_vendor.begin(), str_vendor.end(), ' ', '_');
|
||||
OSG_INFO<<"GL_VENDOR = ["<<str_vendor<<"]"<<std::endl;
|
||||
_defineMap.map[str_vendor].defineVec.push_back(osg::StateSet::DefinePair("1",osg::StateAttribute::ON));
|
||||
_defineMap.map[str_vendor].changed = true;
|
||||
_defineMap.changed = true;
|
||||
}
|
||||
|
||||
_glExtensions = new GLExtensions(_contextID);
|
||||
GLExtensions::Set(_contextID, _glExtensions.get());
|
||||
|
||||
setGLExtensionFuncPtr(_glClientActiveTexture,"glClientActiveTexture","glClientActiveTextureARB");
|
||||
setGLExtensionFuncPtr(_glActiveTexture, "glActiveTexture","glActiveTextureARB");
|
||||
setGLExtensionFuncPtr(_glFogCoordPointer, "glFogCoordPointer","glFogCoordPointerEXT");
|
||||
setGLExtensionFuncPtr(_glSecondaryColorPointer, "glSecondaryColorPointer","glSecondaryColorPointerEXT");
|
||||
setGLExtensionFuncPtr(_glVertexAttribPointer, "glVertexAttribPointer","glVertexAttribPointerARB");
|
||||
setGLExtensionFuncPtr(_glVertexAttribIPointer, "glVertexAttribIPointer");
|
||||
setGLExtensionFuncPtr(_glVertexAttribLPointer, "glVertexAttribLPointer","glVertexAttribPointerARB");
|
||||
setGLExtensionFuncPtr(_glEnableVertexAttribArray, "glEnableVertexAttribArray","glEnableVertexAttribArrayARB");
|
||||
setGLExtensionFuncPtr(_glMultiTexCoord4f, "glMultiTexCoord4f","glMultiTexCoord4fARB");
|
||||
setGLExtensionFuncPtr(_glVertexAttrib4f, "glVertexAttrib4f");
|
||||
setGLExtensionFuncPtr(_glVertexAttrib4fv, "glVertexAttrib4fv");
|
||||
setGLExtensionFuncPtr(_glDisableVertexAttribArray, "glDisableVertexAttribArray","glDisableVertexAttribArrayARB");
|
||||
setGLExtensionFuncPtr(_glBindBuffer, "glBindBuffer","glBindBufferARB");
|
||||
|
||||
setGLExtensionFuncPtr(_glDrawArraysInstanced, "glDrawArraysInstanced","glDrawArraysInstancedARB","glDrawArraysInstancedEXT");
|
||||
setGLExtensionFuncPtr(_glDrawElementsInstanced, "glDrawElementsInstanced","glDrawElementsInstancedARB","glDrawElementsInstancedEXT");
|
||||
|
||||
if (osg::getGLVersionNumber() >= 2.0 || osg::isGLExtensionSupported(_contextID, "GL_ARB_vertex_shader") || OSG_GLES2_FEATURES || OSG_GL3_FEATURES)
|
||||
{
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,&_glMaxTextureUnits);
|
||||
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
glGetIntegerv(GL_MAX_TEXTURE_COORDS, &_glMaxTextureCoords);
|
||||
#else
|
||||
_glMaxTextureCoords = _glMaxTextureUnits;
|
||||
#endif
|
||||
}
|
||||
else if ( osg::getGLVersionNumber() >= 1.3 ||
|
||||
osg::isGLExtensionSupported(_contextID,"GL_ARB_multitexture") ||
|
||||
osg::isGLExtensionSupported(_contextID,"GL_EXT_multitexture") ||
|
||||
OSG_GLES1_FEATURES)
|
||||
{
|
||||
GLint maxTextureUnits = 0;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS,&maxTextureUnits);
|
||||
_glMaxTextureUnits = maxTextureUnits;
|
||||
_glMaxTextureCoords = maxTextureUnits;
|
||||
}
|
||||
else
|
||||
{
|
||||
_glMaxTextureUnits = 1;
|
||||
_glMaxTextureCoords = 1;
|
||||
}
|
||||
|
||||
if (_glExtensions->isARBTimerQuerySupported)
|
||||
{
|
||||
const GLubyte* renderer = glGetString(GL_RENDERER);
|
||||
std::string rendererString = renderer ? (const char*)renderer : "";
|
||||
if (rendererString.find("Radeon")!=std::string::npos || rendererString.find("RADEON")!=std::string::npos || rendererString.find("FirePro")!=std::string::npos)
|
||||
{
|
||||
// AMD/ATI drivers are producing an invalid enumerate error on the
|
||||
// glGetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS_ARB, &bits);
|
||||
// call so work around it by assuming 64 bits for counter.
|
||||
setTimestampBits(64);
|
||||
//setTimestampBits(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint bits = 0;
|
||||
_glExtensions->glGetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS_ARB, &bits);
|
||||
setTimestampBits(bits);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_extensionProcsInitialized = true;
|
||||
|
||||
if (_graphicsCostEstimator.valid())
|
||||
{
|
||||
RenderInfo renderInfo(this,0);
|
||||
_graphicsCostEstimator->calibrate(renderInfo);
|
||||
}
|
||||
}
|
||||
|
||||
bool State::setClientActiveTextureUnit( unsigned int unit )
|
||||
{
|
||||
if (unit!=_currentClientActiveTextureUnit)
|
||||
|
Loading…
Reference in New Issue
Block a user