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/html/HTMLCanvasElement.h" | 8 #include "core/html/HTMLCanvasElement.h" |
9 #include "core/html/HTMLImageElement.h" | 9 #include "core/html/HTMLImageElement.h" |
10 #include "core/html/HTMLVideoElement.h" | 10 #include "core/html/HTMLVideoElement.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 return; | 301 return; |
302 if (!validateTexFuncLevel("framebufferTextureLayer", textarget, level)) | 302 if (!validateTexFuncLevel("framebufferTextureLayer", textarget, level)) |
303 return; | 303 return; |
304 } | 304 } |
305 | 305 |
306 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target); | 306 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target); |
307 if (!framebufferBinding || !framebufferBinding->object()) { | 307 if (!framebufferBinding || !framebufferBinding->object()) { |
308 synthesizeGLError(GL_INVALID_OPERATION, "framebufferTextureLayer", "no f
ramebuffer bound"); | 308 synthesizeGLError(GL_INVALID_OPERATION, "framebufferTextureLayer", "no f
ramebuffer bound"); |
309 return; | 309 return; |
310 } | 310 } |
311 webContext()->framebufferTextureLayer(target, attachment, objectOrZero(textu
re), level, layer); | 311 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
312 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment, tex
target, texture, level, layer); | 312 webContext()->framebufferTextureLayer(target, GL_DEPTH_ATTACHMENT, objec
tOrZero(texture), level, layer); |
| 313 webContext()->framebufferTextureLayer(target, GL_STENCIL_ATTACHMENT, obj
ectOrZero(texture), level, layer); |
| 314 } else { |
| 315 webContext()->framebufferTextureLayer(target, attachment, objectOrZero(t
exture), level, layer); |
| 316 } |
| 317 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| 318 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN
T + STENCIL_ATTACHMENT. |
| 319 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP
TH_STENCIL_ATTACHMENT in WebGL 2. |
| 320 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT
TACHMENT, textarget, texture, level, layer); |
| 321 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_
ATTACHMENT, textarget, texture, level, layer); |
| 322 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_
DEPTH_ATTACHMENT, texture); |
| 323 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_
STENCIL_ATTACHMENT, texture); |
| 324 } else { |
| 325 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment,
textarget, texture, level, layer); |
| 326 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", att
achment, texture); |
| 327 } |
313 applyStencilTest(); | 328 applyStencilTest(); |
314 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", attachm
ent, texture); | |
315 } | 329 } |
316 | 330 |
317 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState*
scriptState, GLenum target, GLenum internalformat, GLenum pname) | 331 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState*
scriptState, GLenum target, GLenum internalformat, GLenum pname) |
318 { | 332 { |
319 if (isContextLost()) | 333 if (isContextLost()) |
320 return ScriptValue::createNull(scriptState); | 334 return ScriptValue::createNull(scriptState); |
321 | 335 |
322 if (target != GL_RENDERBUFFER) { | 336 if (target != GL_RENDERBUFFER) { |
323 synthesizeGLError(GL_INVALID_ENUM, "getInternalformatParameter", "invali
d target"); | 337 synthesizeGLError(GL_INVALID_ENUM, "getInternalformatParameter", "invali
d target"); |
324 return ScriptValue::createNull(scriptState); | 338 return ScriptValue::createNull(scriptState); |
(...skipping 3134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3459 params.alignment = m_unpackAlignment; | 3473 params.alignment = m_unpackAlignment; |
3460 params.rowLength = m_unpackRowLength; | 3474 params.rowLength = m_unpackRowLength; |
3461 params.imageHeight = m_unpackImageHeight; | 3475 params.imageHeight = m_unpackImageHeight; |
3462 params.skipPixels = m_unpackSkipPixels; | 3476 params.skipPixels = m_unpackSkipPixels; |
3463 params.skipRows = m_unpackSkipRows; | 3477 params.skipRows = m_unpackSkipRows; |
3464 params.skipImages = m_unpackSkipImages; | 3478 params.skipImages = m_unpackSkipImages; |
3465 return params; | 3479 return params; |
3466 } | 3480 } |
3467 | 3481 |
3468 } // namespace blink | 3482 } // namespace blink |
OLD | NEW |