| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #include "modules/webgl/WebGLLoseContext.h" | 79 #include "modules/webgl/WebGLLoseContext.h" |
| 80 #include "modules/webgl/WebGLProgram.h" | 80 #include "modules/webgl/WebGLProgram.h" |
| 81 #include "modules/webgl/WebGLRenderbuffer.h" | 81 #include "modules/webgl/WebGLRenderbuffer.h" |
| 82 #include "modules/webgl/WebGLShader.h" | 82 #include "modules/webgl/WebGLShader.h" |
| 83 #include "modules/webgl/WebGLShaderPrecisionFormat.h" | 83 #include "modules/webgl/WebGLShaderPrecisionFormat.h" |
| 84 #include "modules/webgl/WebGLTexture.h" | 84 #include "modules/webgl/WebGLTexture.h" |
| 85 #include "modules/webgl/WebGLUniformLocation.h" | 85 #include "modules/webgl/WebGLUniformLocation.h" |
| 86 #include "modules/webgl/WebGLVertexArrayObject.h" | 86 #include "modules/webgl/WebGLVertexArrayObject.h" |
| 87 #include "modules/webgl/WebGLVertexArrayObjectOES.h" | 87 #include "modules/webgl/WebGLVertexArrayObjectOES.h" |
| 88 #include "platform/CheckedInt.h" | 88 #include "platform/CheckedInt.h" |
| 89 #include "platform/NotImplemented.h" | |
| 90 #include "platform/RuntimeEnabledFeatures.h" | 89 #include "platform/RuntimeEnabledFeatures.h" |
| 91 #include "platform/geometry/IntSize.h" | 90 #include "platform/geometry/IntSize.h" |
| 92 #include "platform/graphics/GraphicsContext.h" | 91 #include "platform/graphics/GraphicsContext.h" |
| 93 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 92 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| 94 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" | 93 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" |
| 95 #include "platform/graphics/gpu/DrawingBuffer.h" | 94 #include "platform/graphics/gpu/DrawingBuffer.h" |
| 96 #include "public/platform/Platform.h" | 95 #include "public/platform/Platform.h" |
| 97 #include "public/platform/WebGraphicsContext3D.h" | 96 #include "public/platform/WebGraphicsContext3D.h" |
| 98 #include "public/platform/WebGraphicsContext3DProvider.h" | 97 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 99 #include "wtf/ArrayBufferContents.h" | 98 #include "wtf/ArrayBufferContents.h" |
| (...skipping 3108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3208 contextGL()->GetUniformiv(objectOrZero(program), location, v
alue); | 3207 contextGL()->GetUniformiv(objectOrZero(program), location, v
alue); |
| 3209 if (length > 1) { | 3208 if (length > 1) { |
| 3210 bool boolValue[16] = {0}; | 3209 bool boolValue[16] = {0}; |
| 3211 for (unsigned j = 0; j < length; j++) | 3210 for (unsigned j = 0; j < length; j++) |
| 3212 boolValue[j] = static_cast<bool>(value[j]); | 3211 boolValue[j] = static_cast<bool>(value[j]); |
| 3213 return WebGLAny(scriptState, boolValue, length); | 3212 return WebGLAny(scriptState, boolValue, length); |
| 3214 } | 3213 } |
| 3215 return WebGLAny(scriptState, static_cast<bool>(value[0])); | 3214 return WebGLAny(scriptState, static_cast<bool>(value[0])); |
| 3216 } | 3215 } |
| 3217 default: | 3216 default: |
| 3218 notImplemented(); | 3217 NOTIMPLEMENTED(); |
| 3219 } | 3218 } |
| 3220 } | 3219 } |
| 3221 } | 3220 } |
| 3222 } | 3221 } |
| 3223 // If we get here, something went wrong in our unfortunately complex logic a
bove | 3222 // If we get here, something went wrong in our unfortunately complex logic a
bove |
| 3224 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error"); | 3223 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error"); |
| 3225 return ScriptValue::createNull(scriptState); | 3224 return ScriptValue::createNull(scriptState); |
| 3226 } | 3225 } |
| 3227 | 3226 |
| 3228 WebGLUniformLocation* WebGLRenderingContextBase::getUniformLocation(WebGLProgram
* program, const String& name) | 3227 WebGLUniformLocation* WebGLRenderingContextBase::getUniformLocation(WebGLProgram
* program, const String& name) |
| (...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5170 { | 5169 { |
| 5171 GLboolean value = 0; | 5170 GLboolean value = 0; |
| 5172 if (!isContextLost()) | 5171 if (!isContextLost()) |
| 5173 contextGL()->GetBooleanv(pname, &value); | 5172 contextGL()->GetBooleanv(pname, &value); |
| 5174 return WebGLAny(scriptState, static_cast<bool>(value)); | 5173 return WebGLAny(scriptState, static_cast<bool>(value)); |
| 5175 } | 5174 } |
| 5176 | 5175 |
| 5177 ScriptValue WebGLRenderingContextBase::getBooleanArrayParameter(ScriptState* scr
iptState, GLenum pname) | 5176 ScriptValue WebGLRenderingContextBase::getBooleanArrayParameter(ScriptState* scr
iptState, GLenum pname) |
| 5178 { | 5177 { |
| 5179 if (pname != GL_COLOR_WRITEMASK) { | 5178 if (pname != GL_COLOR_WRITEMASK) { |
| 5180 notImplemented(); | 5179 NOTIMPLEMENTED(); |
| 5181 return WebGLAny(scriptState, 0, 0); | 5180 return WebGLAny(scriptState, 0, 0); |
| 5182 } | 5181 } |
| 5183 GLboolean value[4] = {0}; | 5182 GLboolean value[4] = {0}; |
| 5184 if (!isContextLost()) | 5183 if (!isContextLost()) |
| 5185 contextGL()->GetBooleanv(pname, value); | 5184 contextGL()->GetBooleanv(pname, value); |
| 5186 bool boolValue[4]; | 5185 bool boolValue[4]; |
| 5187 for (int ii = 0; ii < 4; ++ii) | 5186 for (int ii = 0; ii < 4; ++ii) |
| 5188 boolValue[ii] = static_cast<bool>(value[ii]); | 5187 boolValue[ii] = static_cast<bool>(value[ii]); |
| 5189 return WebGLAny(scriptState, boolValue, 4); | 5188 return WebGLAny(scriptState, boolValue, 4); |
| 5190 } | 5189 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5231 case GL_ALIASED_POINT_SIZE_RANGE: | 5230 case GL_ALIASED_POINT_SIZE_RANGE: |
| 5232 case GL_ALIASED_LINE_WIDTH_RANGE: | 5231 case GL_ALIASED_LINE_WIDTH_RANGE: |
| 5233 case GL_DEPTH_RANGE: | 5232 case GL_DEPTH_RANGE: |
| 5234 length = 2; | 5233 length = 2; |
| 5235 break; | 5234 break; |
| 5236 case GL_BLEND_COLOR: | 5235 case GL_BLEND_COLOR: |
| 5237 case GL_COLOR_CLEAR_VALUE: | 5236 case GL_COLOR_CLEAR_VALUE: |
| 5238 length = 4; | 5237 length = 4; |
| 5239 break; | 5238 break; |
| 5240 default: | 5239 default: |
| 5241 notImplemented(); | 5240 NOTIMPLEMENTED(); |
| 5242 } | 5241 } |
| 5243 return WebGLAny(scriptState, DOMFloat32Array::create(value, length)); | 5242 return WebGLAny(scriptState, DOMFloat32Array::create(value, length)); |
| 5244 } | 5243 } |
| 5245 | 5244 |
| 5246 ScriptValue WebGLRenderingContextBase::getWebGLIntArrayParameter(ScriptState* sc
riptState, GLenum pname) | 5245 ScriptValue WebGLRenderingContextBase::getWebGLIntArrayParameter(ScriptState* sc
riptState, GLenum pname) |
| 5247 { | 5246 { |
| 5248 GLint value[4] = {0}; | 5247 GLint value[4] = {0}; |
| 5249 if (!isContextLost()) | 5248 if (!isContextLost()) |
| 5250 contextGL()->GetIntegerv(pname, value); | 5249 contextGL()->GetIntegerv(pname, value); |
| 5251 unsigned length = 0; | 5250 unsigned length = 0; |
| 5252 switch (pname) { | 5251 switch (pname) { |
| 5253 case GL_MAX_VIEWPORT_DIMS: | 5252 case GL_MAX_VIEWPORT_DIMS: |
| 5254 length = 2; | 5253 length = 2; |
| 5255 break; | 5254 break; |
| 5256 case GL_SCISSOR_BOX: | 5255 case GL_SCISSOR_BOX: |
| 5257 case GL_VIEWPORT: | 5256 case GL_VIEWPORT: |
| 5258 length = 4; | 5257 length = 4; |
| 5259 break; | 5258 break; |
| 5260 default: | 5259 default: |
| 5261 notImplemented(); | 5260 NOTIMPLEMENTED(); |
| 5262 } | 5261 } |
| 5263 return WebGLAny(scriptState, DOMInt32Array::create(value, length)); | 5262 return WebGLAny(scriptState, DOMInt32Array::create(value, length)); |
| 5264 } | 5263 } |
| 5265 | 5264 |
| 5266 WebGLTexture* WebGLRenderingContextBase::validateTexture2DBinding(const char* fu
nctionName, GLenum target) | 5265 WebGLTexture* WebGLRenderingContextBase::validateTexture2DBinding(const char* fu
nctionName, GLenum target) |
| 5267 { | 5266 { |
| 5268 WebGLTexture* tex = nullptr; | 5267 WebGLTexture* tex = nullptr; |
| 5269 switch (target) { | 5268 switch (target) { |
| 5270 case GL_TEXTURE_2D: | 5269 case GL_TEXTURE_2D: |
| 5271 tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get(); | 5270 tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get(); |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6334 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6333 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6335 } | 6334 } |
| 6336 | 6335 |
| 6337 void WebGLRenderingContextBase::restoreUnpackParameters() | 6336 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6338 { | 6337 { |
| 6339 if (m_unpackAlignment != 1) | 6338 if (m_unpackAlignment != 1) |
| 6340 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6339 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6341 } | 6340 } |
| 6342 | 6341 |
| 6343 } // namespace blink | 6342 } // namespace blink |
| OLD | NEW |