зеркало из https://github.com/mozilla/gecko-dev.git
Bug 664066 - Initialize GL values - r=karlt
This patch initializes by zero the GL max values before we query them, just in case a buggy OpenGL implementation's glGetIntegerv function would fail to set them. This patch also manually sets the initial values of mPixelStorePackAlignment and mPixelStoreUnpackAlignment as per the spec, rather than querying them from the GL.
This commit is contained in:
Родитель
9884944aa7
Коммит
4d67b80afe
|
@ -148,6 +148,22 @@ WebGLContext::WebGLContext()
|
|||
mScissorTestEnabled = 0;
|
||||
mDitherEnabled = 1;
|
||||
mBackbufferClearingStatus = BackbufferClearingStatus::NotClearedSinceLastPresented;
|
||||
|
||||
// initialize some GL values: we're going to get them from the GL and use them as the sizes of arrays,
|
||||
// so in case glGetIntegerv leaves them uninitialized because of a GL bug, we would have very weird crashes.
|
||||
mGLMaxVertexAttribs = 0;
|
||||
mGLMaxTextureUnits = 0;
|
||||
mGLMaxTextureSize = 0;
|
||||
mGLMaxCubeMapTextureSize = 0;
|
||||
mGLMaxTextureImageUnits = 0;
|
||||
mGLMaxVertexTextureImageUnits = 0;
|
||||
mGLMaxVaryingVectors = 0;
|
||||
mGLMaxFragmentUniformVectors = 0;
|
||||
mGLMaxVertexUniformVectors = 0;
|
||||
|
||||
// See OpenGL ES 2.0.25 spec, 6.2 State Tables, table 6.13
|
||||
mPixelStorePackAlignment = 4;
|
||||
mPixelStoreUnpackAlignment = 4;
|
||||
}
|
||||
|
||||
WebGLContext::~WebGLContext()
|
||||
|
|
|
@ -571,12 +571,6 @@ WebGLContext::InitAndValidateGL()
|
|||
}
|
||||
}
|
||||
|
||||
GLint i;
|
||||
gl->fGetIntegerv(LOCAL_GL_PACK_ALIGNMENT, &i);
|
||||
mPixelStorePackAlignment = i;
|
||||
gl->fGetIntegerv(LOCAL_GL_UNPACK_ALIGNMENT, &i);
|
||||
mPixelStoreUnpackAlignment = i;
|
||||
|
||||
// Check the shader validator pref
|
||||
nsCOMPtr<nsIPrefBranch> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(prefService != nsnull, NS_ERROR_FAILURE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче