| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 2684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2695 GLint location = uniformLocation->location(); | 2695 GLint location = uniformLocation->location(); |
| 2696 | 2696 |
| 2697 // FIXME: make this more efficient using WebGLUniformLocation and caching ty
pes in it | 2697 // FIXME: make this more efficient using WebGLUniformLocation and caching ty
pes in it |
| 2698 GLint activeUniforms = 0; | 2698 GLint activeUniforms = 0; |
| 2699 m_context->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORMS, &activeUn
iforms); | 2699 m_context->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORMS, &activeUn
iforms); |
| 2700 for (GLint i = 0; i < activeUniforms; i++) { | 2700 for (GLint i = 0; i < activeUniforms; i++) { |
| 2701 blink::WebGraphicsContext3D::ActiveInfo info; | 2701 blink::WebGraphicsContext3D::ActiveInfo info; |
| 2702 if (!m_context->getActiveUniform(objectOrZero(program), i, info)) | 2702 if (!m_context->getActiveUniform(objectOrZero(program), i, info)) |
| 2703 return WebGLGetInfo(); | 2703 return WebGLGetInfo(); |
| 2704 String name = info.name; | 2704 String name = info.name; |
| 2705 StringBuilder nameBuilder; |
| 2705 // Strip "[0]" from the name if it's an array. | 2706 // Strip "[0]" from the name if it's an array. |
| 2706 if (info.size > 1 && name.endsWith("[0]")) | 2707 if (info.size > 1 && name.endsWith("[0]")) |
| 2707 info.name = name.left(name.length() - 3); | 2708 info.name = name.left(name.length() - 3); |
| 2708 // If it's an array, we need to iterate through each element, appending
"[index]" to the name. | 2709 // If it's an array, we need to iterate through each element, appending
"[index]" to the name. |
| 2709 for (GLint index = 0; index < info.size; ++index) { | 2710 for (GLint index = 0; index < info.size; ++index) { |
| 2710 name = info.name; | 2711 nameBuilder.clear(); |
| 2712 nameBuilder.append(info.name); |
| 2711 if (info.size > 1 && index >= 1) { | 2713 if (info.size > 1 && index >= 1) { |
| 2712 name.append('['); | 2714 nameBuilder.append('['); |
| 2713 name.append(String::number(index)); | 2715 nameBuilder.append(String::number(index)); |
| 2714 name.append(']'); | 2716 nameBuilder.append(']'); |
| 2715 } | 2717 } |
| 2716 // Now need to look this up by name again to find its location | 2718 // Now need to look this up by name again to find its location |
| 2717 GLint loc = m_context->getUniformLocation(objectOrZero(program), nam
e.utf8().data()); | 2719 GLint loc = m_context->getUniformLocation(objectOrZero(program), nam
eBuilder.toString().utf8().data()); |
| 2718 if (loc == location) { | 2720 if (loc == location) { |
| 2719 // Found it. Use the type in the ActiveInfo to determine the ret
urn type. | 2721 // Found it. Use the type in the ActiveInfo to determine the ret
urn type. |
| 2720 GLenum baseType; | 2722 GLenum baseType; |
| 2721 unsigned length; | 2723 unsigned length; |
| 2722 switch (info.type) { | 2724 switch (info.type) { |
| 2723 case GL_BOOL: | 2725 case GL_BOOL: |
| 2724 baseType = GL_BOOL; | 2726 baseType = GL_BOOL; |
| 2725 length = 1; | 2727 length = 1; |
| 2726 break; | 2728 break; |
| 2727 case GL_BOOL_VEC2: | 2729 case GL_BOOL_VEC2: |
| (...skipping 2910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5638 if (m_textureUnits[i].m_texture2DBinding | 5640 if (m_textureUnits[i].m_texture2DBinding |
| 5639 || m_textureUnits[i].m_textureCubeMapBinding) { | 5641 || m_textureUnits[i].m_textureCubeMapBinding) { |
| 5640 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5642 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
| 5641 return; | 5643 return; |
| 5642 } | 5644 } |
| 5643 } | 5645 } |
| 5644 m_onePlusMaxNonDefaultTextureUnit = 0; | 5646 m_onePlusMaxNonDefaultTextureUnit = 0; |
| 5645 } | 5647 } |
| 5646 | 5648 |
| 5647 } // namespace WebCore | 5649 } // namespace WebCore |
| OLD | NEW |