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

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

Issue 2372953002: Move special DEPTH_STENCIL attachment logic from command buffers to WebGL1 (Closed)
Patch Set: add more tests 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 return; 382 return;
383 if (!validateTexFuncLevel("framebufferTextureLayer", textarget, level)) 383 if (!validateTexFuncLevel("framebufferTextureLayer", textarget, level))
384 return; 384 return;
385 } 385 }
386 386
387 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target); 387 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target);
388 if (!framebufferBinding || !framebufferBinding->object()) { 388 if (!framebufferBinding || !framebufferBinding->object()) {
389 synthesizeGLError(GL_INVALID_OPERATION, "framebufferTextureLayer", "no f ramebuffer bound"); 389 synthesizeGLError(GL_INVALID_OPERATION, "framebufferTextureLayer", "no f ramebuffer bound");
390 return; 390 return;
391 } 391 }
392 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { 392 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment, tex target, texture, level, layer);
393 contextGL()->FramebufferTextureLayer(target, GL_DEPTH_ATTACHMENT, object OrZero(texture), level, layer);
394 contextGL()->FramebufferTextureLayer(target, GL_STENCIL_ATTACHMENT, obje ctOrZero(texture), level, layer);
395 } else {
396 contextGL()->FramebufferTextureLayer(target, attachment, objectOrZero(te xture), level, layer);
397 }
398 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
399 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN T + STENCIL_ATTACHMENT.
400 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP TH_STENCIL_ATTACHMENT in WebGL 2.
401 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT TACHMENT, textarget, texture, level, layer);
402 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_ ATTACHMENT, textarget, texture, level, layer);
403 } else {
404 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment, textarget, texture, level, layer);
405 }
406 applyStencilTest(); 393 applyStencilTest();
407 } 394 }
408 395
409 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState* scriptState, GLenum target, GLenum internalformat, GLenum pname) 396 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState* scriptState, GLenum target, GLenum internalformat, GLenum pname)
410 { 397 {
411 if (isContextLost()) 398 if (isContextLost())
412 return ScriptValue::createNull(scriptState); 399 return ScriptValue::createNull(scriptState);
413 400
414 if (target != GL_RENDERBUFFER) { 401 if (target != GL_RENDERBUFFER) {
415 synthesizeGLError(GL_INVALID_ENUM, "getInternalformatParameter", "invali d target"); 402 synthesizeGLError(GL_INVALID_ENUM, "getInternalformatParameter", "invali d target");
(...skipping 3206 matching lines...) Expand 10 before | Expand all | Expand 10 after
3622 params.skipPixels = m_unpackSkipPixels; 3609 params.skipPixels = m_unpackSkipPixels;
3623 params.skipRows = m_unpackSkipRows; 3610 params.skipRows = m_unpackSkipRows;
3624 if (dimension == Tex3D) { 3611 if (dimension == Tex3D) {
3625 params.imageHeight = m_unpackImageHeight; 3612 params.imageHeight = m_unpackImageHeight;
3626 params.skipImages = m_unpackSkipImages; 3613 params.skipImages = m_unpackSkipImages;
3627 } 3614 }
3628 return params; 3615 return params;
3629 } 3616 }
3630 3617
3631 } // namespace blink 3618 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698