Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp

Issue 2389363002: Move special DEPTH_STENCIL attachment logic from command buffers to WebGL1 (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 if (!validateTexFuncLevel("framebufferTextureLayer", textarget, level)) 456 if (!validateTexFuncLevel("framebufferTextureLayer", textarget, level))
457 return; 457 return;
458 } 458 }
459 459
460 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target); 460 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target);
461 if (!framebufferBinding || !framebufferBinding->object()) { 461 if (!framebufferBinding || !framebufferBinding->object()) {
462 synthesizeGLError(GL_INVALID_OPERATION, "framebufferTextureLayer", 462 synthesizeGLError(GL_INVALID_OPERATION, "framebufferTextureLayer",
463 "no framebuffer bound"); 463 "no framebuffer bound");
464 return; 464 return;
465 } 465 }
466 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { 466 framebufferBinding->setAttachmentForBoundFramebuffer(
467 contextGL()->FramebufferTextureLayer(target, GL_DEPTH_ATTACHMENT, 467 target, attachment, textarget, texture, level, layer);
468 objectOrZero(texture), level, layer);
469 contextGL()->FramebufferTextureLayer(target, GL_STENCIL_ATTACHMENT,
470 objectOrZero(texture), level, layer);
471 } else {
472 contextGL()->FramebufferTextureLayer(target, attachment,
473 objectOrZero(texture), level, layer);
474 }
475 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
476 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMENT +
477 // STENCIL_ATTACHMENT. We divide it here so in WebGLFramebuffer, we don't
478 // have to handle DEPTH_STENCIL_ATTACHMENT in WebGL 2.
479 framebufferBinding->setAttachmentForBoundFramebuffer(
480 target, GL_DEPTH_ATTACHMENT, textarget, texture, level, layer);
481 framebufferBinding->setAttachmentForBoundFramebuffer(
482 target, GL_STENCIL_ATTACHMENT, textarget, texture, level, layer);
483 } else {
484 framebufferBinding->setAttachmentForBoundFramebuffer(
485 target, attachment, textarget, texture, level, layer);
486 }
487 applyStencilTest(); 468 applyStencilTest();
488 } 469 }
489 470
490 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter( 471 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(
491 ScriptState* scriptState, 472 ScriptState* scriptState,
492 GLenum target, 473 GLenum target,
493 GLenum internalformat, 474 GLenum internalformat,
494 GLenum pname) { 475 GLenum pname) {
495 if (isContextLost()) 476 if (isContextLost())
496 return ScriptValue::createNull(scriptState); 477 return ScriptValue::createNull(scriptState);
(...skipping 3997 matching lines...) Expand 10 before | Expand all | Expand 10 after
4494 params.skipPixels = m_unpackSkipPixels; 4475 params.skipPixels = m_unpackSkipPixels;
4495 params.skipRows = m_unpackSkipRows; 4476 params.skipRows = m_unpackSkipRows;
4496 if (dimension == Tex3D) { 4477 if (dimension == Tex3D) {
4497 params.imageHeight = m_unpackImageHeight; 4478 params.imageHeight = m_unpackImageHeight;
4498 params.skipImages = m_unpackSkipImages; 4479 params.skipImages = m_unpackSkipImages;
4499 } 4480 }
4500 return params; 4481 return params;
4501 } 4482 }
4502 4483
4503 } // namespace blink 4484 } // namespace blink
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager_unittest.cc ('k') | third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698