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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 1808933002: Remove framebufferRenderbuffer and framebufferTexture* from WGC3D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wgc3d-unused
Patch Set: framebufferRenderbuffer: rebase Created 4 years, 9 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 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 { 668 {
669 if (m_antiAliasingMode == MSAAExplicitResolve) { 669 if (m_antiAliasingMode == MSAAExplicitResolve) {
670 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); 670 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
671 671
672 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_multisampleColorBuffer); 672 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_multisampleColorBuffer);
673 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sam pleCount, m_colorBuffer.parameters.internalRenderbufferFormat, size.width(), siz e.height()); 673 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sam pleCount, m_colorBuffer.parameters.internalRenderbufferFormat, size.width(), siz e.height());
674 674
675 if (m_context->getError() == GL_OUT_OF_MEMORY) 675 if (m_context->getError() == GL_OUT_OF_MEMORY)
676 return false; 676 return false;
677 677
678 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer); 678 m_gl->FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_R ENDERBUFFER, m_multisampleColorBuffer);
679 resizeDepthStencil(size); 679 resizeDepthStencil(size);
680 if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_ COMPLETE) 680 if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_ COMPLETE)
681 return false; 681 return false;
682 } 682 }
683 683
684 return true; 684 return true;
685 } 685 }
686 686
687 void DrawingBuffer::resizeDepthStencil(const IntSize& size) 687 void DrawingBuffer::resizeDepthStencil(const IntSize& size)
688 { 688 {
689 if (!m_requestedAttributes.depth && !m_requestedAttributes.stencil) 689 if (!m_requestedAttributes.depth && !m_requestedAttributes.stencil)
690 return; 690 return;
691 691
692 if (!m_depthStencilBuffer) 692 if (!m_depthStencilBuffer)
693 m_depthStencilBuffer = m_context->createRenderbuffer(); 693 m_depthStencilBuffer = m_context->createRenderbuffer();
694 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer); 694 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer);
695 if (m_antiAliasingMode == MSAAImplicitResolve) 695 if (m_antiAliasingMode == MSAAImplicitResolve)
696 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_sampleCo unt, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); 696 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_sampleCo unt, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
697 else if (m_antiAliasingMode == MSAAExplicitResolve) 697 else if (m_antiAliasingMode == MSAAExplicitResolve)
698 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sam pleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); 698 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sam pleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
699 else 699 else
700 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); 700 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
701 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHME NT, GL_RENDERBUFFER, m_depthStencilBuffer); 701 m_gl->FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, G L_RENDERBUFFER, m_depthStencilBuffer);
702 m_context->bindRenderbuffer(GL_RENDERBUFFER, 0); 702 m_context->bindRenderbuffer(GL_RENDERBUFFER, 0);
703 } 703 }
704 704
705 705
706 706
707 void DrawingBuffer::clearFramebuffers(GLbitfield clearMask) 707 void DrawingBuffer::clearFramebuffers(GLbitfield clearMask)
708 { 708 {
709 // We will clear the multisample FBO, but we also need to clear the non-mult isampled buffer. 709 // We will clear the multisample FBO, but we also need to clear the non-mult isampled buffer.
710 if (m_multisampleFBO) { 710 if (m_multisampleFBO) {
711 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); 711 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 dataSize *= height; 873 dataSize *= height;
874 if (dataSize.hasOverflowed()) 874 if (dataSize.hasOverflowed())
875 return false; 875 return false;
876 876
877 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :NotShared, WTF::ArrayBufferContents::DontInitialize); 877 WTF::ArrayBufferContents pixels(width * height, 4, WTF::ArrayBufferContents: :NotShared, WTF::ArrayBufferContents::DontInitialize);
878 878
879 GLint fbo = 0; 879 GLint fbo = 0;
880 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) { 880 if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) {
881 fbo = m_context->createFramebuffer(); 881 fbo = m_context->createFramebuffer();
882 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo); 882 m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo);
883 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_ frontColorBuffer.texInfo.parameters.target, m_frontColorBuffer.texInfo.textureId , 0); 883 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_front ColorBuffer.texInfo.parameters.target, m_frontColorBuffer.texInfo.textureId, 0);
884 } else { 884 } else {
885 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer()); 885 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer());
886 } 886 }
887 887
888 readBackFramebuffer(static_cast<unsigned char*>(pixels.data()), width, heigh t, ReadbackRGBA, WebGLImageConversion::AlphaDoNothing); 888 readBackFramebuffer(static_cast<unsigned char*>(pixels.data()), width, heigh t, ReadbackRGBA, WebGLImageConversion::AlphaDoNothing);
889 flipVertically(static_cast<uint8_t*>(pixels.data()), width, height); 889 flipVertically(static_cast<uint8_t*>(pixels.data()), width, height);
890 890
891 if (fbo) { 891 if (fbo) {
892 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_ frontColorBuffer.texInfo.parameters.target, 0, 0); 892 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_front ColorBuffer.texInfo.parameters.target, 0, 0);
893 m_context->deleteFramebuffer(fbo); 893 m_context->deleteFramebuffer(fbo);
894 } 894 }
895 895
896 restoreFramebufferBindings(); 896 restoreFramebufferBindings();
897 897
898 pixels.transfer(contents); 898 pixels.transfer(contents);
899 return true; 899 return true;
900 } 900 }
901 901
902 void DrawingBuffer::readBackFramebuffer(unsigned char* pixels, int width, int he ight, ReadbackOrder readbackOrder, WebGLImageConversion::AlphaOp op) 902 void DrawingBuffer::readBackFramebuffer(unsigned char* pixels, int width, int he ight, ReadbackOrder readbackOrder, WebGLImageConversion::AlphaOp op)
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 1030
1031 void DrawingBuffer::attachColorBufferToCurrentFBO() 1031 void DrawingBuffer::attachColorBufferToCurrentFBO()
1032 { 1032 {
1033 WGC3Denum target = m_colorBuffer.parameters.target; 1033 WGC3Denum target = m_colorBuffer.parameters.target;
1034 1034
1035 m_context->bindTexture(target, m_colorBuffer.textureId); 1035 m_context->bindTexture(target, m_colorBuffer.textureId);
1036 1036
1037 if (m_antiAliasingMode == MSAAImplicitResolve) 1037 if (m_antiAliasingMode == MSAAImplicitResolve)
1038 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); 1038 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, target, m_colorBuffer.textureId, 0, m_sampleCount);
1039 else 1039 else
1040 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, ta rget, m_colorBuffer.textureId, 0); 1040 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, m_colorBuffer.textureId, 0);
1041 1041
1042 m_context->bindTexture(GL_TEXTURE_2D, m_texture2DBinding); 1042 m_context->bindTexture(GL_TEXTURE_2D, m_texture2DBinding);
1043 } 1043 }
1044 1044
1045 } // namespace blink 1045 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698