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

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 ASSERT(extensionsUtil->supportsExtension("GL_OES_packed_depth_stencil"));
106 extensionsUtil->ensureExtensionEnabled("GL_OES_packed_depth_stencil");
105 bool multisampleSupported = (extensionsUtil->supportsExtension("GL_CHROMIUM_ framebuffer_multisample") 107 bool multisampleSupported = (extensionsUtil->supportsExtension("GL_CHROMIUM_ framebuffer_multisample")
106 || extensionsUtil->supportsExtension("GL_EXT_multisampled_render_to_text ure")) 108 || extensionsUtil->supportsExtension("GL_EXT_multisampled_render_to_text ure"))
107 && extensionsUtil->supportsExtension("GL_OES_rgb8_rgba8"); 109 && extensionsUtil->supportsExtension("GL_OES_rgb8_rgba8");
108 if (multisampleSupported) { 110 if (multisampleSupported) {
109 extensionsUtil->ensureExtensionEnabled("GL_OES_rgb8_rgba8"); 111 extensionsUtil->ensureExtensionEnabled("GL_OES_rgb8_rgba8");
110 if (extensionsUtil->supportsExtension("GL_CHROMIUM_framebuffer_multisamp le")) 112 if (extensionsUtil->supportsExtension("GL_CHROMIUM_framebuffer_multisamp le"))
111 extensionsUtil->ensureExtensionEnabled("GL_CHROMIUM_framebuffer_mult isample"); 113 extensionsUtil->ensureExtensionEnabled("GL_CHROMIUM_framebuffer_mult isample");
112 else 114 else
113 extensionsUtil->ensureExtensionEnabled("GL_EXT_multisampled_render_t o_texture"); 115 extensionsUtil->ensureExtensionEnabled("GL_EXT_multisampled_render_t o_texture");
114 } 116 }
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"); 117 bool discardFramebufferSupported = extensionsUtil->supportsExtension("GL_EXT _discard_framebuffer");
119 if (discardFramebufferSupported) 118 if (discardFramebufferSupported)
120 extensionsUtil->ensureExtensionEnabled("GL_EXT_discard_framebuffer"); 119 extensionsUtil->ensureExtensionEnabled("GL_EXT_discard_framebuffer");
121 120
122 RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(std::move(c ontext), extensionsUtil.release(), multisampleSupported, packedDepthStencilSuppo rted, discardFramebufferSupported, preserve, requestedAttributes)); 121 RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(std::move(c ontext), extensionsUtil.release(), multisampleSupported, true, discardFramebuffe rSupported, preserve, requestedAttributes));
123 if (!drawingBuffer->initialize(size)) { 122 if (!drawingBuffer->initialize(size)) {
124 drawingBuffer->beginDestruction(); 123 drawingBuffer->beginDestruction();
125 return PassRefPtr<DrawingBuffer>(); 124 return PassRefPtr<DrawingBuffer>();
126 } 125 }
127 return drawingBuffer.release(); 126 return drawingBuffer.release();
128 } 127 }
129 128
130 void DrawingBuffer::forceNextDrawingBufferCreationToFail() 129 void DrawingBuffer::forceNextDrawingBufferCreationToFail()
131 { 130 {
132 shouldFailDrawingBufferCreationForTesting = true; 131 shouldFailDrawingBufferCreationForTesting = true;
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 if (m_packedDepthStencilExtensionSupported) { 700 if (m_packedDepthStencilExtensionSupported) {
702 if (!m_depthStencilBuffer) 701 if (!m_depthStencilBuffer)
703 m_depthStencilBuffer = m_context->createRenderbuffer(); 702 m_depthStencilBuffer = m_context->createRenderbuffer();
704 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer); 703 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer);
705 if (m_antiAliasingMode == MSAAImplicitResolve) 704 if (m_antiAliasingMode == MSAAImplicitResolve)
706 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_samp leCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); 705 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_samp leCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
707 else if (m_antiAliasingMode == MSAAExplicitResolve) 706 else if (m_antiAliasingMode == MSAAExplicitResolve)
708 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m _sampleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); 707 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m _sampleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
709 else 708 else
710 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_ OES, size.width(), size.height()); 709 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); 710 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 { 711 } else {
714 if (m_requestedAttributes.depth) { 712 if (m_requestedAttributes.depth) {
715 if (!m_depthBuffer) 713 if (!m_depthBuffer)
716 m_depthBuffer = m_context->createRenderbuffer(); 714 m_depthBuffer = m_context->createRenderbuffer();
717 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer); 715 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer);
718 if (m_antiAliasingMode == MSAAImplicitResolve) 716 if (m_antiAliasingMode == MSAAImplicitResolve)
719 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_ sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height()); 717 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_ sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height());
720 else if (m_antiAliasingMode == MSAAExplicitResolve) 718 else if (m_antiAliasingMode == MSAAExplicitResolve)
721 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFE R, m_sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height()); 719 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFE R, m_sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height());
722 else 720 else
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 1066
1069 if (m_antiAliasingMode == MSAAImplicitResolve) 1067 if (m_antiAliasingMode == MSAAImplicitResolve)
1070 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); 1068 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, target, m_colorBuffer.textureId, 0, m_sampleCount);
1071 else 1069 else
1072 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, ta rget, m_colorBuffer.textureId, 0); 1070 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, ta rget, m_colorBuffer.textureId, 0);
1073 1071
1074 m_context->bindTexture(GL_TEXTURE_2D, m_texture2DBinding); 1072 m_context->bindTexture(GL_TEXTURE_2D, m_texture2DBinding);
1075 } 1073 }
1076 1074
1077 } // namespace blink 1075 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698