| 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 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2277 ScriptValue WebGLRenderingContextBase::getFramebufferAttachmentParameter(ScriptS
tate* scriptState, GLenum target, GLenum attachment, GLenum pname) | 2277 ScriptValue WebGLRenderingContextBase::getFramebufferAttachmentParameter(ScriptS
tate* scriptState, GLenum target, GLenum attachment, GLenum pname) |
| 2278 { | 2278 { |
| 2279 if (isContextLost() || !validateFramebufferFuncParameters("getFramebufferAtt
achmentParameter", target, attachment)) | 2279 if (isContextLost() || !validateFramebufferFuncParameters("getFramebufferAtt
achmentParameter", target, attachment)) |
| 2280 return ScriptValue::createNull(scriptState); | 2280 return ScriptValue::createNull(scriptState); |
| 2281 | 2281 |
| 2282 if (!m_framebufferBinding || !m_framebufferBinding->object()) { | 2282 if (!m_framebufferBinding || !m_framebufferBinding->object()) { |
| 2283 synthesizeGLError(GL_INVALID_OPERATION, "getFramebufferAttachmentParamet
er", "no framebuffer bound"); | 2283 synthesizeGLError(GL_INVALID_OPERATION, "getFramebufferAttachmentParamet
er", "no framebuffer bound"); |
| 2284 return ScriptValue::createNull(scriptState); | 2284 return ScriptValue::createNull(scriptState); |
| 2285 } | 2285 } |
| 2286 | 2286 |
| 2287 WebGLSharedObject* object = m_framebufferBinding->getAttachmentObject(attach
ment); | 2287 WebGLSharedObject* attachmentObject = m_framebufferBinding->getAttachmentObj
ect(attachment); |
| 2288 if (!object) { | 2288 if (!attachmentObject) { |
| 2289 if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) | 2289 if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) |
| 2290 return WebGLAny(scriptState, GL_NONE); | 2290 return WebGLAny(scriptState, GL_NONE); |
| 2291 // OpenGL ES 2.0 specifies INVALID_ENUM in this case, while desktop GL | 2291 // OpenGL ES 2.0 specifies INVALID_ENUM in this case, while desktop GL |
| 2292 // specifies INVALID_OPERATION. | 2292 // specifies INVALID_OPERATION. |
| 2293 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter",
"invalid parameter name"); | 2293 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter",
"invalid parameter name"); |
| 2294 return ScriptValue::createNull(scriptState); | 2294 return ScriptValue::createNull(scriptState); |
| 2295 } | 2295 } |
| 2296 | 2296 |
| 2297 ASSERT(object->isTexture() || object->isRenderbuffer()); | 2297 ASSERT(attachmentObject->isTexture() || attachmentObject->isRenderbuffer()); |
| 2298 if (object->isTexture()) { | 2298 if (attachmentObject->isTexture()) { |
| 2299 switch (pname) { | 2299 switch (pname) { |
| 2300 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: | 2300 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2301 return WebGLAny(scriptState, GL_TEXTURE); | 2301 return WebGLAny(scriptState, GL_TEXTURE); |
| 2302 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: | 2302 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2303 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(obj
ect)); | 2303 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(att
achmentObject)); |
| 2304 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: | 2304 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2305 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: | 2305 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2306 { | 2306 { |
| 2307 GLint value = 0; | 2307 GLint value = 0; |
| 2308 webContext()->getFramebufferAttachmentParameteriv(target, attach
ment, pname, &value); | 2308 webContext()->getFramebufferAttachmentParameteriv(target, attach
ment, pname, &value); |
| 2309 return WebGLAny(scriptState, value); | 2309 return WebGLAny(scriptState, value); |
| 2310 } | 2310 } |
| 2311 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: | 2311 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: |
| 2312 if (extensionEnabled(EXTsRGBName) || isWebGL2OrHigher()) { | 2312 if (extensionEnabled(EXTsRGBName)) { |
| 2313 GLint value = 0; | 2313 GLint value = 0; |
| 2314 webContext()->getFramebufferAttachmentParameteriv(target, attach
ment, pname, &value); | 2314 webContext()->getFramebufferAttachmentParameteriv(target, attach
ment, pname, &value); |
| 2315 return WebGLAny(scriptState, value); | 2315 return WebGLAny(scriptState, static_cast<unsigned>(value)); |
| 2316 } | 2316 } |
| 2317 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for renderbuffer attachment"); | 2317 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for renderbuffer attachment"); |
| 2318 return ScriptValue::createNull(scriptState); | 2318 return ScriptValue::createNull(scriptState); |
| 2319 default: | 2319 default: |
| 2320 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for texture attachment"); | 2320 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for texture attachment"); |
| 2321 return ScriptValue::createNull(scriptState); | 2321 return ScriptValue::createNull(scriptState); |
| 2322 } | 2322 } |
| 2323 } else { | 2323 } else { |
| 2324 switch (pname) { | 2324 switch (pname) { |
| 2325 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: | 2325 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2326 return WebGLAny(scriptState, GL_RENDERBUFFER); | 2326 return WebGLAny(scriptState, GL_RENDERBUFFER); |
| 2327 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: | 2327 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2328 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(obj
ect)); | 2328 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(att
achmentObject)); |
| 2329 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: | 2329 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: |
| 2330 if (extensionEnabled(EXTsRGBName) || isWebGL2OrHigher()) { | 2330 if (extensionEnabled(EXTsRGBName) || isWebGL2OrHigher()) { |
| 2331 GLint value = 0; | 2331 GLint value = 0; |
| 2332 webContext()->getFramebufferAttachmentParameteriv(target, attach
ment, pname, &value); | 2332 webContext()->getFramebufferAttachmentParameteriv(target, attach
ment, pname, &value); |
| 2333 return WebGLAny(scriptState, value); | 2333 return WebGLAny(scriptState, value); |
| 2334 } | 2334 } |
| 2335 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for renderbuffer attachment"); | 2335 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for renderbuffer attachment"); |
| 2336 return ScriptValue::createNull(scriptState); | 2336 return ScriptValue::createNull(scriptState); |
| 2337 default: | 2337 default: |
| 2338 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for renderbuffer attachment"); | 2338 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for renderbuffer attachment"); |
| (...skipping 3754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6093 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB
uffer() : 0; | 6093 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB
uffer() : 0; |
| 6094 } | 6094 } |
| 6095 #else | 6095 #else |
| 6096 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6096 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 6097 { | 6097 { |
| 6098 return m_drawingBuffer.get(); | 6098 return m_drawingBuffer.get(); |
| 6099 } | 6099 } |
| 6100 #endif | 6100 #endif |
| 6101 | 6101 |
| 6102 } // namespace blink | 6102 } // namespace blink |
| OLD | NEW |