| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 | 1323 |
| 1324 DELEGATE_TO_GL_2(sampleCoverage, SampleCoverage, WGC3Dclampf, WGC3Dboolean) | 1324 DELEGATE_TO_GL_2(sampleCoverage, SampleCoverage, WGC3Dclampf, WGC3Dboolean) |
| 1325 | 1325 |
| 1326 DELEGATE_TO_GL_4(scissor, Scissor, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei) | 1326 DELEGATE_TO_GL_4(scissor, Scissor, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei) |
| 1327 | 1327 |
| 1328 void WebGraphicsContext3DInProcessImpl::texImage2D( | 1328 void WebGraphicsContext3DInProcessImpl::texImage2D( |
| 1329 WGC3Denum target, WGC3Dint level, WGC3Denum internalFormat, | 1329 WGC3Denum target, WGC3Dint level, WGC3Denum internalFormat, |
| 1330 WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, | 1330 WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, |
| 1331 WGC3Denum format, WGC3Denum type, const void* pixels) { | 1331 WGC3Denum format, WGC3Denum type, const void* pixels) { |
| 1332 makeContextCurrent(); | 1332 makeContextCurrent(); |
| 1333 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
| 1334 if (format == GL_BGRA_EXT && internalFormat == GL_BGRA_EXT) { |
| 1335 internalFormat = GL_RGBA; |
| 1336 } else if (type == GL_FLOAT) { |
| 1337 if (format == GL_RGBA) { |
| 1338 internalFormat = GL_RGBA32F_ARB; |
| 1339 } else if (format == GL_RGB) { |
| 1340 internalFormat = GL_RGB32F_ARB; |
| 1341 } |
| 1342 } |
| 1343 } |
| 1333 glTexImage2D(target, level, internalFormat, | 1344 glTexImage2D(target, level, internalFormat, |
| 1334 width, height, border, format, type, pixels); | 1345 width, height, border, format, type, pixels); |
| 1335 } | 1346 } |
| 1336 | 1347 |
| 1337 void WebGraphicsContext3DInProcessImpl::shaderSource( | 1348 void WebGraphicsContext3DInProcessImpl::shaderSource( |
| 1338 WebGLId shader, const WGC3Dchar* source) { | 1349 WebGLId shader, const WGC3Dchar* source) { |
| 1339 makeContextCurrent(); | 1350 makeContextCurrent(); |
| 1340 GLint length = source ? strlen(source) : 0; | 1351 GLint length = source ? strlen(source) : 0; |
| 1341 ShaderSourceMap::iterator result = shader_source_map_.find(shader); | 1352 ShaderSourceMap::iterator result = shader_source_map_.find(shader); |
| 1342 if (result != shader_source_map_.end()) { | 1353 if (result != shader_source_map_.end()) { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 if (length > 1) { | 1641 if (length > 1) { |
| 1631 entry->translated_source.reset(new char[length]); | 1642 entry->translated_source.reset(new char[length]); |
| 1632 ShGetObjectCode(compiler, entry->translated_source.get()); | 1643 ShGetObjectCode(compiler, entry->translated_source.get()); |
| 1633 } | 1644 } |
| 1634 entry->is_valid = true; | 1645 entry->is_valid = true; |
| 1635 return true; | 1646 return true; |
| 1636 } | 1647 } |
| 1637 | 1648 |
| 1638 } // namespace gpu | 1649 } // namespace gpu |
| 1639 } // namespace webkit | 1650 } // namespace webkit |
| OLD | NEW |