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 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 scoped_array<GLchar> log(new GLchar[log_length]); | 1247 scoped_array<GLchar> log(new GLchar[log_length]); |
1248 GLsizei returned_log_length; | 1248 GLsizei returned_log_length; |
1249 glGetShaderSource(shader, log_length, &returned_log_length, log.get()); | 1249 glGetShaderSource(shader, log_length, &returned_log_length, log.get()); |
1250 DCHECK(log_length == returned_log_length + 1); | 1250 DCHECK(log_length == returned_log_length + 1); |
1251 WebString res = WebString::fromUTF8(log.get(), returned_log_length); | 1251 WebString res = WebString::fromUTF8(log.get(), returned_log_length); |
1252 return res; | 1252 return res; |
1253 } | 1253 } |
1254 | 1254 |
1255 WebString WebGraphicsContext3DInProcessImpl::getString(WGC3Denum name) { | 1255 WebString WebGraphicsContext3DInProcessImpl::getString(WGC3Denum name) { |
1256 makeContextCurrent(); | 1256 makeContextCurrent(); |
1257 std::string result(reinterpret_cast<const char*>(glGetString(name))); | 1257 std::string result; |
1258 if (name == GL_EXTENSIONS) { | 1258 if (name == GL_EXTENSIONS) { |
| 1259 result = gl_context_->GetExtensions(); |
1259 if (!is_gles2_) { | 1260 if (!is_gles2_) { |
1260 std::vector<std::string> split; | 1261 std::vector<std::string> split; |
1261 base::SplitString(result, ' ', &split); | 1262 base::SplitString(result, ' ', &split); |
1262 if (std::find(split.begin(), split.end(), "GL_EXT_bgra") != split.end()) { | 1263 if (std::find(split.begin(), split.end(), "GL_EXT_bgra") != split.end()) { |
1263 // If we support GL_EXT_bgra, pretend we support a couple of GLES2 | 1264 // If we support GL_EXT_bgra, pretend we support a couple of GLES2 |
1264 // extension that are a subset of it. | 1265 // extension that are a subset of it. |
1265 result += " GL_EXT_texture_format_BGRA8888 GL_EXT_read_format_bgra"; | 1266 result += " GL_EXT_texture_format_BGRA8888 GL_EXT_read_format_bgra"; |
1266 } | 1267 } |
1267 } | 1268 } |
| 1269 } else { |
| 1270 result = reinterpret_cast<const char*>(glGetString(name)); |
1268 } | 1271 } |
1269 return WebString::fromUTF8(result.c_str()); | 1272 return WebString::fromUTF8(result.c_str()); |
1270 } | 1273 } |
1271 | 1274 |
1272 DELEGATE_TO_GL_3(getTexParameterfv, GetTexParameterfv, | 1275 DELEGATE_TO_GL_3(getTexParameterfv, GetTexParameterfv, |
1273 WGC3Denum, WGC3Denum, WGC3Dfloat*) | 1276 WGC3Denum, WGC3Denum, WGC3Dfloat*) |
1274 | 1277 |
1275 DELEGATE_TO_GL_3(getTexParameteriv, GetTexParameteriv, | 1278 DELEGATE_TO_GL_3(getTexParameteriv, GetTexParameteriv, |
1276 WGC3Denum, WGC3Denum, WGC3Dint*) | 1279 WGC3Denum, WGC3Denum, WGC3Dint*) |
1277 | 1280 |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 if (length > 1) { | 1698 if (length > 1) { |
1696 entry->translated_source.reset(new char[length]); | 1699 entry->translated_source.reset(new char[length]); |
1697 ShGetObjectCode(compiler, entry->translated_source.get()); | 1700 ShGetObjectCode(compiler, entry->translated_source.get()); |
1698 } | 1701 } |
1699 entry->is_valid = true; | 1702 entry->is_valid = true; |
1700 return true; | 1703 return true; |
1701 } | 1704 } |
1702 | 1705 |
1703 } // namespace gpu | 1706 } // namespace gpu |
1704 } // namespace webkit | 1707 } // namespace webkit |
OLD | NEW |