Safe m_vendorName and m_rendererName initialization.

This commit is contained in:
vng 2012-03-02 03:02:10 +03:00 committed by Alex Zolotarev
parent 616f89894b
commit 12053af5be
2 changed files with 18 additions and 4 deletions

View file

@ -355,9 +355,7 @@ namespace yg
}
ResourceManager::Params::Params()
: m_vendorName(reinterpret_cast<char const*>(glGetString(GL_VENDOR))),
m_rendererName(reinterpret_cast<char const *>(glGetString(GL_RENDERER))),
m_rtFormat(yg::Data8Bpp),
: m_rtFormat(yg::Data8Bpp),
m_texFormat(yg::Data4Bpp),
m_texRtFormat(yg::Data4Bpp),
m_useSingleThreadedOGL(false),
@ -374,6 +372,23 @@ namespace yg
m_styleCacheTexturesParams("styleCacheTexture"),
m_guiThreadTexturesParams("guiThreadTexture")
{
char const * s = reinterpret_cast<char const*>(glGetString(GL_VENDOR));
if (s)
m_vendorName = s;
else
{
OGLCHECKAFTER;
LOG(LWARNING, ("Can't get vendor name from OpenGL"));
}
s = reinterpret_cast<char const *>(glGetString(GL_RENDERER));
if (s)
m_rendererName = s;
else
{
OGLCHECKAFTER;
LOG(LWARNING, ("Can't get renderer name from OpenGL"));
}
}
bool ResourceManager::Params::isGPU(char const * vendorName, char const * rendererName) const

View file

@ -284,7 +284,6 @@ namespace yg
ResourceManager(Params const & p);
void initGlyphCaches(GlyphCacheParams const & p);
void selectTexRTFormat();
void initStoragePool(StoragePoolParams const & p, scoped_ptr<TStoragePool> & pool);