Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1358)

Unified Diff: webkit/gpu/webgraphicscontext3d_in_process_impl.cc

Issue 13111002: gpu: Fix in-process implementation of glGetShaderPrecisionFormat (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: copy workaround instead of sharing Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/gpu/webgraphicscontext3d_in_process_impl.cc
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc
index 72bd440b5412f4e1e7cfea0a0e5efb715de73508..a810c1c873793f87436c6e7400ed80d77f51dc77 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc
+++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc
@@ -1247,8 +1247,43 @@ void WebGraphicsContext3DInProcessImpl::getShaderiv(
glGetShaderiv(shader, pname, value);
}
-DELEGATE_TO_GL_4(getShaderPrecisionFormat, GetShaderPrecisionFormat,
- WGC3Denum, WGC3Denum, WGC3Dint*, WGC3Dint*)
+void WebGraphicsContext3DInProcessImpl::getShaderPrecisionFormat(
+ WGC3Denum shadertype, WGC3Denum precisiontype,
+ WGC3Dint* range, WGC3Dint* precision) {
+ switch (precisiontype) {
+ case GL_LOW_INT:
+ case GL_MEDIUM_INT:
+ case GL_HIGH_INT:
+ // These values are for a 32-bit twos-complement integer format.
+ range[0] = 31;
+ range[1] = 30;
+ *precision = 0;
+ break;
+ case GL_LOW_FLOAT:
+ case GL_MEDIUM_FLOAT:
+ case GL_HIGH_FLOAT:
+ // These values are for an IEEE single-precision floating-point format.
+ range[0] = 127;
+ range[1] = 127;
+ *precision = 23;
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+
+ if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 &&
+ gfx::g_driver_gl.fn.glGetShaderPrecisionFormatFn) {
+ // This function is sometimes defined even though it's really just
+ // a stub, so we need to set range and precision as if it weren't
+ // defined before calling it.
+ // On Mac OS with some GPUs, calling this generates a
+ // GL_INVALID_OPERATION error. Avoid calling it on non-GLES2
+ // platforms.
+ glGetShaderPrecisionFormat(shadertype, precisiontype,
+ range, precision);
+ }
+}
WebString WebGraphicsContext3DInProcessImpl::getShaderInfoLog(WebGLId shader) {
makeContextCurrent();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698