diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-24 19:32:50 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-24 19:32:50 +0000 |
commit | abd3ee31ea51b47264986e4f5a3109582fbef97d (patch) | |
tree | 6780c5aad3a11d7e4472dba9373c7d40d756f075 /chrome | |
parent | 826fa729e3763314e75a8391af8b7ca50f3aa573 (diff) | |
download | chromium_src-abd3ee31ea51b47264986e4f5a3109582fbef97d.zip chromium_src-abd3ee31ea51b47264986e4f5a3109582fbef97d.tar.gz chromium_src-abd3ee31ea51b47264986e4f5a3109582fbef97d.tar.bz2 |
Initialize destinations variables before calling GL functions
because if the context is lost those variables will
be uninitialized.
TEST=ran chrome, conformance tests, unit tests and hand edited gles2_demo to test
BUG=none
Review URL: http://codereview.chromium.org/5305005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/gpu/gpu_info_collector_mac.mm | 8 | ||||
-rw-r--r-- | chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/chrome/gpu/gpu_info_collector_mac.mm b/chrome/gpu/gpu_info_collector_mac.mm index 9da958c..24c809d 100644 --- a/chrome/gpu/gpu_info_collector_mac.mm +++ b/chrome/gpu/gpu_info_collector_mac.mm @@ -81,13 +81,15 @@ static int GetShaderNumericVersion(int gl_major_version) { int shader_version = 0; if (gl_major_version == 1) { - char *gl_extensions_string = (char*)glGetString(GL_EXTENSIONS); - if (strstr(gl_extensions_string, "GL_ARB_shading_language_100")) { + const char *gl_extensions_string = (const char*)glGetString(GL_EXTENSIONS); + if (gl_extensions_string && + strstr(gl_extensions_string, "GL_ARB_shading_language_100")) { gl_hlsl_major = 1; gl_hlsl_minor = 0; } } else if (gl_major_version > 1) { - char *glsl_version_string = (char*)glGetString(GL_SHADING_LANGUAGE_VERSION); + const char *glsl_version_string = + (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); if (glsl_version_string) sscanf(glsl_version_string, "%u.%u", &gl_hlsl_major, &gl_hlsl_minor); } diff --git a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc index af89470..17d0e22 100644 --- a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc +++ b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc @@ -693,7 +693,7 @@ WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getProgramInfoLog( scoped_array<GLchar> log(new GLchar[logLength]); if (!log.get()) return WebKit::WebString(); - GLsizei returnedLogLength; + GLsizei returnedLogLength = 0; glGetProgramInfoLog(program, logLength, &returnedLogLength, log.get()); DCHECK_EQ(logLength, returnedLogLength + 1); WebKit::WebString res = @@ -716,7 +716,7 @@ WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getShaderInfoLog( scoped_array<GLchar> log(new GLchar[logLength]); if (!log.get()) return WebKit::WebString(); - GLsizei returnedLogLength; + GLsizei returnedLogLength = 0; glGetShaderInfoLog(shader, logLength, &returnedLogLength, log.get()); DCHECK_EQ(logLength, returnedLogLength + 1); WebKit::WebString res = @@ -734,7 +734,7 @@ WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getShaderSource( scoped_array<GLchar> log(new GLchar[logLength]); if (!log.get()) return WebKit::WebString(); - GLsizei returnedLogLength; + GLsizei returnedLogLength = 0; glGetShaderSource(shader, logLength, &returnedLogLength, log.get()); DCHECK_EQ(logLength, returnedLogLength + 1); WebKit::WebString res = |