From 1e037e1f5c48ea5e9aeecb7c82a8351dbb399aa2 Mon Sep 17 00:00:00 2001 From: "zmo@google.com" Date: Mon, 17 Oct 2011 23:53:13 +0000 Subject: Last straw for translated_shader_source extension. While hooking up with webkit side of this extension, I realized something is missing. So this CL is the fix. BUG=95531 TEST=tested with the webkit side CL Review URL: http://codereview.chromium.org/8294002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105969 0039d316-1c4b-4281-b951-d872f2087c98 --- ...hicscontext3d_in_process_command_buffer_impl.cc | 24 ++++++++++++++++++++++ ...phicscontext3d_in_process_command_buffer_impl.h | 2 ++ 2 files changed, 26 insertions(+) (limited to 'webkit') diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc index ec03290..7ff9951 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc @@ -1308,6 +1308,30 @@ WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: GLsizei returnedLogLength = 0; gl_->GetShaderSource( shader, logLength, &returnedLogLength, log.get()); + if (!returnedLogLength) + return WebKit::WebString(); + DCHECK_EQ(logLength, returnedLogLength + 1); + WebKit::WebString res = + WebKit::WebString::fromUTF8(log.get(), returnedLogLength); + return res; +} + +WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: + getTranslatedShaderSourceANGLE(WebGLId shader) { + ClearContext(); + GLint logLength = 0; + gl_->GetShaderiv( + shader, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &logLength); + if (!logLength) + return WebKit::WebString(); + scoped_array log(new GLchar[logLength]); + if (!log.get()) + return WebKit::WebString(); + GLsizei returnedLogLength = 0; + gl_->GetTranslatedShaderSourceANGLE( + shader, logLength, &returnedLogLength, log.get()); + if (!returnedLogLength) + return WebKit::WebString(); DCHECK_EQ(logLength, returnedLogLength + 1); WebKit::WebString res = WebKit::WebString::fromUTF8(log.get(), returnedLogLength); diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h index ae162e7..f4ee402 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h +++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h @@ -421,6 +421,8 @@ class WebGraphicsContext3DInProcessCommandBufferImpl WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height); + virtual WebKit::WebString getTranslatedShaderSourceANGLE(WebGLId shader); + virtual WebGLId createCompositorTexture(WGC3Dsizei width, WGC3Dsizei height); virtual void deleteCompositorTexture(WebGLId parent_texture); virtual void copyTextureToCompositor(WebGLId texture, -- cgit v1.1