GL: Fixed initial value of binary shader hash.

This commit is contained in:
bkaradzic 2013-03-23 22:42:16 -07:00
parent def008725c
commit 137700d0a2

View File

@ -2004,13 +2004,25 @@ namespace bgfx
s_renderCtx.flip();
}
GLint glGet(GLenum _pname)
static GLint glGet(GLenum _pname)
{
GLint result;
GL_CHECK(glGetIntegerv(_pname, &result) );
return result;
}
static uint32_t glGetStringHash(GLenum _name)
{
const char* str = (const char*)glGetString(_name);
glGetError(); // ignore error if glGetString returns NULL.
if (NULL != str)
{
return bx::hashMurmur2A(str, strlen(str) );
}
return 0;
}
void Context::rendererInit()
{
s_renderCtx.init();
@ -2056,6 +2068,13 @@ namespace bgfx
BX_TRACE("GLSL version: %s", version);
#endif // BGFX_CONFIG_DEBUG
// Initial binary shader hash depends on driver version.
s_renderCtx.m_hash = ( (BX_PLATFORM_WINDOWS<<1) | BX_ARCH_64BIT)
^ (uint64_t(glGetStringHash(GL_VENDOR ) )<<32)
^ (uint64_t(glGetStringHash(GL_RENDERER) )<<0 )
^ (uint64_t(glGetStringHash(GL_VERSION ) )<<16)
;
const char* extensions = (const char*)glGetString(GL_EXTENSIONS);
glGetError(); // ignore error if glGetString returns NULL.
if (NULL != extensions)