| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "modules/webgl/WebGL2RenderingContextBase.h" | 5 #include "modules/webgl/WebGL2RenderingContextBase.h" |
| 6 | 6 |
| 7 #include "bindings/modules/v8/WebGLAny.h" | 7 #include "bindings/modules/v8/WebGLAny.h" |
| 8 #include "core/frame/ImageBitmap.h" | 8 #include "core/frame/ImageBitmap.h" |
| 9 #include "core/html/HTMLCanvasElement.h" | 9 #include "core/html/HTMLCanvasElement.h" |
| 10 #include "core/html/HTMLImageElement.h" | 10 #include "core/html/HTMLImageElement.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 contextGL()->FramebufferTextureLayer(target, GL_DEPTH_ATTACHMENT, object
OrZero(texture), level, layer); | 314 contextGL()->FramebufferTextureLayer(target, GL_DEPTH_ATTACHMENT, object
OrZero(texture), level, layer); |
| 315 contextGL()->FramebufferTextureLayer(target, GL_STENCIL_ATTACHMENT, obje
ctOrZero(texture), level, layer); | 315 contextGL()->FramebufferTextureLayer(target, GL_STENCIL_ATTACHMENT, obje
ctOrZero(texture), level, layer); |
| 316 } else { | 316 } else { |
| 317 contextGL()->FramebufferTextureLayer(target, attachment, objectOrZero(te
xture), level, layer); | 317 contextGL()->FramebufferTextureLayer(target, attachment, objectOrZero(te
xture), level, layer); |
| 318 } | 318 } |
| 319 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { | 319 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| 320 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN
T + STENCIL_ATTACHMENT. | 320 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN
T + STENCIL_ATTACHMENT. |
| 321 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP
TH_STENCIL_ATTACHMENT in WebGL 2. | 321 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP
TH_STENCIL_ATTACHMENT in WebGL 2. |
| 322 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT
TACHMENT, textarget, texture, level, layer); | 322 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT
TACHMENT, textarget, texture, level, layer); |
| 323 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_
ATTACHMENT, textarget, texture, level, layer); | 323 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_
ATTACHMENT, textarget, texture, level, layer); |
| 324 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_
DEPTH_ATTACHMENT, texture); | 324 preserveObjectWrapper(scriptState, framebufferBinding, V8HiddenValue::we
bglAttachments(scriptState->isolate()), framebufferBinding->getPersistentCache()
, GL_DEPTH_ATTACHMENT, texture); |
| 325 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_
STENCIL_ATTACHMENT, texture); | 325 preserveObjectWrapper(scriptState, framebufferBinding, V8HiddenValue::we
bglAttachments(scriptState->isolate()), framebufferBinding->getPersistentCache()
, GL_STENCIL_ATTACHMENT, texture); |
| 326 } else { | 326 } else { |
| 327 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment,
textarget, texture, level, layer); | 327 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment,
textarget, texture, level, layer); |
| 328 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", att
achment, texture); | 328 preserveObjectWrapper(scriptState, framebufferBinding, V8HiddenValue::we
bglAttachments(scriptState->isolate()), framebufferBinding->getPersistentCache()
, attachment, texture); |
| 329 } | 329 } |
| 330 applyStencilTest(); | 330 applyStencilTest(); |
| 331 } | 331 } |
| 332 | 332 |
| 333 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState*
scriptState, GLenum target, GLenum internalformat, GLenum pname) | 333 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState*
scriptState, GLenum target, GLenum internalformat, GLenum pname) |
| 334 { | 334 { |
| 335 if (isContextLost()) | 335 if (isContextLost()) |
| 336 return ScriptValue::createNull(scriptState); | 336 return ScriptValue::createNull(scriptState); |
| 337 | 337 |
| 338 if (target != GL_RENDERBUFFER) { | 338 if (target != GL_RENDERBUFFER) { |
| (...skipping 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2710 case GL_FRAMEBUFFER: | 2710 case GL_FRAMEBUFFER: |
| 2711 case GL_READ_FRAMEBUFFER: | 2711 case GL_READ_FRAMEBUFFER: |
| 2712 m_readFramebufferBinding = buffer; | 2712 m_readFramebufferBinding = buffer; |
| 2713 break; | 2713 break; |
| 2714 default: | 2714 default: |
| 2715 synthesizeGLError(GL_INVALID_ENUM, "bindFramebuffer", "invalid target"); | 2715 synthesizeGLError(GL_INVALID_ENUM, "bindFramebuffer", "invalid target"); |
| 2716 return; | 2716 return; |
| 2717 } | 2717 } |
| 2718 | 2718 |
| 2719 setFramebuffer(target, buffer); | 2719 setFramebuffer(target, buffer); |
| 2720 if (scriptState) | 2720 if (scriptState) { |
| 2721 preserveObjectWrapper(scriptState, this, "framebuffer", 0, buffer); | 2721 preserveObjectWrapper(scriptState, this, V8HiddenValue::webglMisc(script
State->isolate()), &m_miscWrappers, static_cast<uint32_t>(PreservedFramebuffer),
buffer); |
| 2722 } |
| 2722 } | 2723 } |
| 2723 | 2724 |
| 2724 void WebGL2RenderingContextBase::deleteFramebuffer(WebGLFramebuffer* framebuffer
) | 2725 void WebGL2RenderingContextBase::deleteFramebuffer(WebGLFramebuffer* framebuffer
) |
| 2725 { | 2726 { |
| 2726 if (!deleteObject(framebuffer)) | 2727 if (!deleteObject(framebuffer)) |
| 2727 return; | 2728 return; |
| 2728 GLenum target = 0; | 2729 GLenum target = 0; |
| 2729 if (framebuffer == m_framebufferBinding) { | 2730 if (framebuffer == m_framebufferBinding) { |
| 2730 if (framebuffer == m_readFramebufferBinding) { | 2731 if (framebuffer == m_readFramebufferBinding) { |
| 2731 target = GL_FRAMEBUFFER; | 2732 target = GL_FRAMEBUFFER; |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3582 params.skipPixels = m_unpackSkipPixels; | 3583 params.skipPixels = m_unpackSkipPixels; |
| 3583 params.skipRows = m_unpackSkipRows; | 3584 params.skipRows = m_unpackSkipRows; |
| 3584 if (dimension == Tex3D) { | 3585 if (dimension == Tex3D) { |
| 3585 params.imageHeight = m_unpackImageHeight; | 3586 params.imageHeight = m_unpackImageHeight; |
| 3586 params.skipImages = m_unpackSkipImages; | 3587 params.skipImages = m_unpackSkipImages; |
| 3587 } | 3588 } |
| 3588 return params; | 3589 return params; |
| 3589 } | 3590 } |
| 3590 | 3591 |
| 3591 } // namespace blink | 3592 } // namespace blink |
| OLD | NEW |