diff options
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 10 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index c9fd9ff..0d6ba07 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -107,10 +107,18 @@ static void GetShaderPrecisionFormatImpl(GLenum shader_type, break; } - if (gfx::g_driver_gl.fn.glGetShaderPrecisionFormatFn) { + // TODO(kbr): fix this to not require testing for the mock. Tests + // should be able to change what GetGLImplementation returns in + // order to test all code paths. + if (gfx::GetGLImplementation() == gfx::kGLImplementationMockGL || + (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(shader_type, precision_type, range, precision); } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc index 0745c91..8d86800 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc @@ -1372,7 +1372,6 @@ TEST_F(GLES2DecoderWithShaderTest, GetShaderPrecisionFormatSucceeds) { typedef GetShaderPrecisionFormat::Result Result; Result* result = static_cast<Result*>(shared_memory_address_); result->success = 0; - // NOTE: GL might not be called. There is no Desktop OpenGL equivalent. const GLint range[2] = { 62, 62 }; const GLint precision = 16; EXPECT_CALL(*gl_,GetShaderPrecisionFormat(_, _, _, _)) |