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

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

Issue 1673113002: Move WebGL1 attachment image type / attachment point matching check to command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (shouldFailDrawingBufferCreationForTesting) { 95 if (shouldFailDrawingBufferCreationForTesting) {
96 shouldFailDrawingBufferCreationForTesting = false; 96 shouldFailDrawingBufferCreationForTesting = false;
97 return nullptr; 97 return nullptr;
98 } 98 }
99 99
100 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g et()); 100 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g et());
101 if (!extensionsUtil->isValid()) { 101 if (!extensionsUtil->isValid()) {
102 // This might be the first time we notice that the WebGraphicsContext3D is lost. 102 // This might be the first time we notice that the WebGraphicsContext3D is lost.
103 return nullptr; 103 return nullptr;
104 } 104 }
105 bool packedDepthStencilSupported = extensionsUtil->supportsExtension("GL_OES _packed_depth_stencil");
106 if (!packedDepthStencilSupported) {
107 return nullptr;
108 }
109 extensionsUtil->ensureExtensionEnabled("GL_OES_packed_depth_stencil");
Ken Russell (switch to Gerrit) 2016/02/08 21:39:45 I wonder whether these checks could be replaced wi
Zhenyao Mo 2016/02/09 17:21:23 Done.
105 bool multisampleSupported = (extensionsUtil->supportsExtension("GL_CHROMIUM_ framebuffer_multisample") 110 bool multisampleSupported = (extensionsUtil->supportsExtension("GL_CHROMIUM_ framebuffer_multisample")
106 || extensionsUtil->supportsExtension("GL_EXT_multisampled_render_to_text ure")) 111 || extensionsUtil->supportsExtension("GL_EXT_multisampled_render_to_text ure"))
107 && extensionsUtil->supportsExtension("GL_OES_rgb8_rgba8"); 112 && extensionsUtil->supportsExtension("GL_OES_rgb8_rgba8");
108 if (multisampleSupported) { 113 if (multisampleSupported) {
109 extensionsUtil->ensureExtensionEnabled("GL_OES_rgb8_rgba8"); 114 extensionsUtil->ensureExtensionEnabled("GL_OES_rgb8_rgba8");
110 if (extensionsUtil->supportsExtension("GL_CHROMIUM_framebuffer_multisamp le")) 115 if (extensionsUtil->supportsExtension("GL_CHROMIUM_framebuffer_multisamp le"))
111 extensionsUtil->ensureExtensionEnabled("GL_CHROMIUM_framebuffer_mult isample"); 116 extensionsUtil->ensureExtensionEnabled("GL_CHROMIUM_framebuffer_mult isample");
112 else 117 else
113 extensionsUtil->ensureExtensionEnabled("GL_EXT_multisampled_render_t o_texture"); 118 extensionsUtil->ensureExtensionEnabled("GL_EXT_multisampled_render_t o_texture");
114 } 119 }
115 bool packedDepthStencilSupported = extensionsUtil->supportsExtension("GL_OES _packed_depth_stencil");
116 if (packedDepthStencilSupported)
117 extensionsUtil->ensureExtensionEnabled("GL_OES_packed_depth_stencil");
118 bool discardFramebufferSupported = extensionsUtil->supportsExtension("GL_EXT _discard_framebuffer"); 120 bool discardFramebufferSupported = extensionsUtil->supportsExtension("GL_EXT _discard_framebuffer");
119 if (discardFramebufferSupported) 121 if (discardFramebufferSupported)
120 extensionsUtil->ensureExtensionEnabled("GL_EXT_discard_framebuffer"); 122 extensionsUtil->ensureExtensionEnabled("GL_EXT_discard_framebuffer");
121 123
122 RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(std::move(c ontext), extensionsUtil.release(), multisampleSupported, packedDepthStencilSuppo rted, discardFramebufferSupported, preserve, requestedAttributes)); 124 RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(std::move(c ontext), extensionsUtil.release(), multisampleSupported, packedDepthStencilSuppo rted, discardFramebufferSupported, preserve, requestedAttributes));
123 if (!drawingBuffer->initialize(size)) { 125 if (!drawingBuffer->initialize(size)) {
124 drawingBuffer->beginDestruction(); 126 drawingBuffer->beginDestruction();
125 return PassRefPtr<DrawingBuffer>(); 127 return PassRefPtr<DrawingBuffer>();
126 } 128 }
127 return drawingBuffer.release(); 129 return drawingBuffer.release();
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 if (m_packedDepthStencilExtensionSupported) { 703 if (m_packedDepthStencilExtensionSupported) {
702 if (!m_depthStencilBuffer) 704 if (!m_depthStencilBuffer)
703 m_depthStencilBuffer = m_context->createRenderbuffer(); 705 m_depthStencilBuffer = m_context->createRenderbuffer();
704 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer); 706 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer);
705 if (m_antiAliasingMode == MSAAImplicitResolve) 707 if (m_antiAliasingMode == MSAAImplicitResolve)
706 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_samp leCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); 708 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_samp leCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
707 else if (m_antiAliasingMode == MSAAExplicitResolve) 709 else if (m_antiAliasingMode == MSAAExplicitResolve)
708 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m _sampleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); 710 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m _sampleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
709 else 711 else
710 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_ OES, size.width(), size.height()); 712 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_ OES, size.width(), size.height());
711 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT , GL_RENDERBUFFER, m_depthStencilBuffer); 713 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTA CHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
712 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
713 } else { 714 } else {
714 if (m_requestedAttributes.depth) { 715 if (m_requestedAttributes.depth) {
715 if (!m_depthBuffer) 716 if (!m_depthBuffer)
716 m_depthBuffer = m_context->createRenderbuffer(); 717 m_depthBuffer = m_context->createRenderbuffer();
717 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer); 718 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer);
718 if (m_antiAliasingMode == MSAAImplicitResolve) 719 if (m_antiAliasingMode == MSAAImplicitResolve)
719 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_ sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height()); 720 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_ sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height());
720 else if (m_antiAliasingMode == MSAAExplicitResolve) 721 else if (m_antiAliasingMode == MSAAExplicitResolve)
721 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFE R, m_sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height()); 722 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFE R, m_sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height());
722 else 723 else
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 1069
1069 if (m_antiAliasingMode == MSAAImplicitResolve) 1070 if (m_antiAliasingMode == MSAAImplicitResolve)
1070 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); 1071 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, target, m_colorBuffer.textureId, 0, m_sampleCount);
1071 else 1072 else
1072 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, ta rget, m_colorBuffer.textureId, 0); 1073 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, ta rget, m_colorBuffer.textureId, 0);
1073 1074
1074 m_context->bindTexture(GL_TEXTURE_2D, m_texture2DBinding); 1075 m_context->bindTexture(GL_TEXTURE_2D, m_texture2DBinding);
1075 } 1076 }
1076 1077
1077 } // namespace blink 1078 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698