| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
| 6 | 6 |
| 7 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" | 7 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" |
| 8 | 8 |
| 9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 | 10 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 385 |
| 386 DELEGATE_TO_GL_5(framebufferTexture2D, FramebufferTexture2D, | 386 DELEGATE_TO_GL_5(framebufferTexture2D, FramebufferTexture2D, |
| 387 unsigned long, unsigned long, unsigned long, WebGLId, long) | 387 unsigned long, unsigned long, unsigned long, WebGLId, long) |
| 388 | 388 |
| 389 DELEGATE_TO_GL_1(frontFace, FrontFace, unsigned long) | 389 DELEGATE_TO_GL_1(frontFace, FrontFace, unsigned long) |
| 390 | 390 |
| 391 DELEGATE_TO_GL_1(generateMipmap, GenerateMipmap, unsigned long) | 391 DELEGATE_TO_GL_1(generateMipmap, GenerateMipmap, unsigned long) |
| 392 | 392 |
| 393 bool WebGraphicsContext3DCommandBufferImpl::getActiveAttrib( | 393 bool WebGraphicsContext3DCommandBufferImpl::getActiveAttrib( |
| 394 WebGLId program, unsigned long index, ActiveInfo& info) { | 394 WebGLId program, unsigned long index, ActiveInfo& info) { |
| 395 makeContextCurrent(); |
| 395 if (!program) { | 396 if (!program) { |
| 396 synthesizeGLError(GL_INVALID_VALUE); | 397 synthesizeGLError(GL_INVALID_VALUE); |
| 397 return false; | 398 return false; |
| 398 } | 399 } |
| 399 GLint max_name_length = -1; | 400 GLint max_name_length = -1; |
| 400 glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_name_length); | 401 glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_name_length); |
| 401 if (max_name_length < 0) | 402 if (max_name_length < 0) |
| 402 return false; | 403 return false; |
| 403 scoped_array<GLchar> name(new GLchar[max_name_length]); | 404 scoped_array<GLchar> name(new GLchar[max_name_length]); |
| 404 if (!name.get()) { | 405 if (!name.get()) { |
| 405 synthesizeGLError(GL_OUT_OF_MEMORY); | 406 synthesizeGLError(GL_OUT_OF_MEMORY); |
| 406 return false; | 407 return false; |
| 407 } | 408 } |
| 408 GLsizei length = 0; | 409 GLsizei length = 0; |
| 409 GLint size = -1; | 410 GLint size = -1; |
| 410 GLenum type = 0; | 411 GLenum type = 0; |
| 411 glGetActiveAttrib(program, index, max_name_length, | 412 glGetActiveAttrib(program, index, max_name_length, |
| 412 &length, &size, &type, name.get()); | 413 &length, &size, &type, name.get()); |
| 413 if (size < 0) { | 414 if (size < 0) { |
| 414 return false; | 415 return false; |
| 415 } | 416 } |
| 416 info.name = WebKit::WebString::fromUTF8(name.get(), length); | 417 info.name = WebKit::WebString::fromUTF8(name.get(), length); |
| 417 info.type = type; | 418 info.type = type; |
| 418 info.size = size; | 419 info.size = size; |
| 419 return true; | 420 return true; |
| 420 } | 421 } |
| 421 | 422 |
| 422 bool WebGraphicsContext3DCommandBufferImpl::getActiveUniform( | 423 bool WebGraphicsContext3DCommandBufferImpl::getActiveUniform( |
| 423 WebGLId program, unsigned long index, ActiveInfo& info) { | 424 WebGLId program, unsigned long index, ActiveInfo& info) { |
| 425 makeContextCurrent(); |
| 424 GLint max_name_length = -1; | 426 GLint max_name_length = -1; |
| 425 glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_name_length); | 427 glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_name_length); |
| 426 if (max_name_length < 0) | 428 if (max_name_length < 0) |
| 427 return false; | 429 return false; |
| 428 scoped_array<GLchar> name(new GLchar[max_name_length]); | 430 scoped_array<GLchar> name(new GLchar[max_name_length]); |
| 429 if (!name.get()) { | 431 if (!name.get()) { |
| 430 synthesizeGLError(GL_OUT_OF_MEMORY); | 432 synthesizeGLError(GL_OUT_OF_MEMORY); |
| 431 return false; | 433 return false; |
| 432 } | 434 } |
| 433 GLsizei length = 0; | 435 GLsizei length = 0; |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 glDeleteShader(shader); | 796 glDeleteShader(shader); |
| 795 } | 797 } |
| 796 | 798 |
| 797 void WebGraphicsContext3DCommandBufferImpl::deleteTexture(unsigned texture) { | 799 void WebGraphicsContext3DCommandBufferImpl::deleteTexture(unsigned texture) { |
| 798 makeContextCurrent(); | 800 makeContextCurrent(); |
| 799 glDeleteTextures(1, &texture); | 801 glDeleteTextures(1, &texture); |
| 800 } | 802 } |
| 801 | 803 |
| 802 #endif // defined(ENABLE_GPU) | 804 #endif // defined(ENABLE_GPU) |
| 803 | 805 |
| OLD | NEW |