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

Side by Side 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, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" 5 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 *value = entry->source.get() ? strlen(entry->source.get()) : 0; 1240 *value = entry->source.get() ? strlen(entry->source.get()) : 0;
1241 if (*value) 1241 if (*value)
1242 (*value)++; 1242 (*value)++;
1243 return; 1243 return;
1244 } 1244 }
1245 } 1245 }
1246 1246
1247 glGetShaderiv(shader, pname, value); 1247 glGetShaderiv(shader, pname, value);
1248 } 1248 }
1249 1249
1250 DELEGATE_TO_GL_4(getShaderPrecisionFormat, GetShaderPrecisionFormat, 1250 void WebGraphicsContext3DInProcessImpl::getShaderPrecisionFormat(
1251 WGC3Denum, WGC3Denum, WGC3Dint*, WGC3Dint*) 1251 WGC3Denum shadertype, WGC3Denum precisiontype,
1252 WGC3Dint* range, WGC3Dint* precision) {
1253 switch (precisiontype) {
1254 case GL_LOW_INT:
1255 case GL_MEDIUM_INT:
1256 case GL_HIGH_INT:
1257 // These values are for a 32-bit twos-complement integer format.
1258 range[0] = 31;
1259 range[1] = 30;
1260 *precision = 0;
1261 break;
1262 case GL_LOW_FLOAT:
1263 case GL_MEDIUM_FLOAT:
1264 case GL_HIGH_FLOAT:
1265 // These values are for an IEEE single-precision floating-point format.
1266 range[0] = 127;
1267 range[1] = 127;
1268 *precision = 23;
1269 break;
1270 default:
1271 NOTREACHED();
1272 break;
1273 }
1274
1275 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 &&
1276 gfx::g_driver_gl.fn.glGetShaderPrecisionFormatFn) {
1277 // This function is sometimes defined even though it's really just
1278 // a stub, so we need to set range and precision as if it weren't
1279 // defined before calling it.
1280 // On Mac OS with some GPUs, calling this generates a
1281 // GL_INVALID_OPERATION error. Avoid calling it on non-GLES2
1282 // platforms.
1283 glGetShaderPrecisionFormat(shadertype, precisiontype,
1284 range, precision);
1285 }
1286 }
1252 1287
1253 WebString WebGraphicsContext3DInProcessImpl::getShaderInfoLog(WebGLId shader) { 1288 WebString WebGraphicsContext3DInProcessImpl::getShaderInfoLog(WebGLId shader) {
1254 makeContextCurrent(); 1289 makeContextCurrent();
1255 1290
1256 ShaderSourceMap::iterator result = shader_source_map_.find(shader); 1291 ShaderSourceMap::iterator result = shader_source_map_.find(shader);
1257 if (result != shader_source_map_.end()) { 1292 if (result != shader_source_map_.end()) {
1258 ShaderSourceEntry* entry = result->second; 1293 ShaderSourceEntry* entry = result->second;
1259 DCHECK(entry); 1294 DCHECK(entry);
1260 if (!entry->is_valid) { 1295 if (!entry->is_valid) {
1261 if (!entry->log.get()) 1296 if (!entry->log.get())
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 if (length > 1) { 1849 if (length > 1) {
1815 entry->translated_source.reset(new char[length]); 1850 entry->translated_source.reset(new char[length]);
1816 ShGetObjectCode(compiler, entry->translated_source.get()); 1851 ShGetObjectCode(compiler, entry->translated_source.get());
1817 } 1852 }
1818 entry->is_valid = true; 1853 entry->is_valid = true;
1819 return true; 1854 return true;
1820 } 1855 }
1821 1856
1822 } // namespace gpu 1857 } // namespace gpu
1823 } // namespace webkit 1858 } // namespace webkit
OLDNEW
« 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