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

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

Issue 2535173002: Prevent implicit framebuffer clear from clobbering alpha in emulated RGB (Closed)
Patch Set: remove unnecessary std::list Created 4 years 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/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "core/frame/ImageBitmap.h" 9 #include "core/frame/ImageBitmap.h"
10 #include "core/html/HTMLCanvasElement.h" 10 #include "core/html/HTMLCanvasElement.h"
(...skipping 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 GLsizei instanceCount) { 2569 GLsizei instanceCount) {
2570 if (!validateDrawArrays("drawArraysInstanced")) 2570 if (!validateDrawArrays("drawArraysInstanced"))
2571 return; 2571 return;
2572 2572
2573 if (!m_boundVertexArrayObject->isAllEnabledAttribBufferBound()) { 2573 if (!m_boundVertexArrayObject->isAllEnabledAttribBufferBound()) {
2574 synthesizeGLError(GL_INVALID_OPERATION, "drawArraysInstanced", 2574 synthesizeGLError(GL_INVALID_OPERATION, "drawArraysInstanced",
2575 "no buffer is bound to enabled attribute"); 2575 "no buffer is bound to enabled attribute");
2576 return; 2576 return;
2577 } 2577 }
2578 2578
2579 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, 2579 ScopedRGBEmulationColorMask emulationColorMask(this, m_colorMask,
2580 m_drawingBuffer.get()); 2580 m_drawingBuffer.get());
2581 clearIfComposited(); 2581 clearIfComposited();
2582 contextGL()->DrawArraysInstancedANGLE(mode, first, count, instanceCount); 2582 contextGL()->DrawArraysInstancedANGLE(mode, first, count, instanceCount);
2583 markContextChanged(CanvasChanged); 2583 markContextChanged(CanvasChanged);
2584 } 2584 }
2585 2585
2586 void WebGL2RenderingContextBase::drawElementsInstanced(GLenum mode, 2586 void WebGL2RenderingContextBase::drawElementsInstanced(GLenum mode,
2587 GLsizei count, 2587 GLsizei count,
2588 GLenum type, 2588 GLenum type,
2589 long long offset, 2589 long long offset,
2590 GLsizei instanceCount) { 2590 GLsizei instanceCount) {
2591 if (!validateDrawElements("drawElementsInstanced", type, offset)) 2591 if (!validateDrawElements("drawElementsInstanced", type, offset))
2592 return; 2592 return;
2593 2593
2594 if (!m_boundVertexArrayObject->isAllEnabledAttribBufferBound()) { 2594 if (!m_boundVertexArrayObject->isAllEnabledAttribBufferBound()) {
2595 synthesizeGLError(GL_INVALID_OPERATION, "drawElementsInstanced", 2595 synthesizeGLError(GL_INVALID_OPERATION, "drawElementsInstanced",
2596 "no buffer is bound to enabled attribute"); 2596 "no buffer is bound to enabled attribute");
2597 return; 2597 return;
2598 } 2598 }
2599 2599
2600 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, 2600 ScopedRGBEmulationColorMask emulationColorMask(this, m_colorMask,
2601 m_drawingBuffer.get()); 2601 m_drawingBuffer.get());
2602 clearIfComposited(); 2602 clearIfComposited();
2603 contextGL()->DrawElementsInstancedANGLE( 2603 contextGL()->DrawElementsInstancedANGLE(
2604 mode, count, type, reinterpret_cast<void*>(static_cast<intptr_t>(offset)), 2604 mode, count, type, reinterpret_cast<void*>(static_cast<intptr_t>(offset)),
2605 instanceCount); 2605 instanceCount);
2606 markContextChanged(CanvasChanged); 2606 markContextChanged(CanvasChanged);
2607 } 2607 }
2608 2608
2609 void WebGL2RenderingContextBase::drawRangeElements(GLenum mode, 2609 void WebGL2RenderingContextBase::drawRangeElements(GLenum mode,
2610 GLuint start, 2610 GLuint start,
2611 GLuint end, 2611 GLuint end,
2612 GLsizei count, 2612 GLsizei count,
2613 GLenum type, 2613 GLenum type,
2614 long long offset) { 2614 long long offset) {
2615 if (!validateDrawElements("drawRangeElements", type, offset)) 2615 if (!validateDrawElements("drawRangeElements", type, offset))
2616 return; 2616 return;
2617 2617
2618 if (!m_boundVertexArrayObject->isAllEnabledAttribBufferBound()) { 2618 if (!m_boundVertexArrayObject->isAllEnabledAttribBufferBound()) {
2619 synthesizeGLError(GL_INVALID_OPERATION, "drawRangeElements", 2619 synthesizeGLError(GL_INVALID_OPERATION, "drawRangeElements",
2620 "no buffer is bound to enabled attribute"); 2620 "no buffer is bound to enabled attribute");
2621 return; 2621 return;
2622 } 2622 }
2623 2623
2624 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, 2624 ScopedRGBEmulationColorMask emulationColorMask(this, m_colorMask,
2625 m_drawingBuffer.get()); 2625 m_drawingBuffer.get());
2626 clearIfComposited(); 2626 clearIfComposited();
2627 contextGL()->DrawRangeElements( 2627 contextGL()->DrawRangeElements(
2628 mode, start, end, count, type, 2628 mode, start, end, count, type,
2629 reinterpret_cast<void*>(static_cast<intptr_t>(offset))); 2629 reinterpret_cast<void*>(static_cast<intptr_t>(offset)));
2630 markContextChanged(CanvasChanged); 2630 markContextChanged(CanvasChanged);
2631 } 2631 }
2632 2632
2633 void WebGL2RenderingContextBase::drawBuffers(const Vector<GLenum>& buffers) { 2633 void WebGL2RenderingContextBase::drawBuffers(const Vector<GLenum>& buffers) {
2634 if (isContextLost()) 2634 if (isContextLost())
2635 return; 2635 return;
2636 2636
2637 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, 2637 ScopedRGBEmulationColorMask emulationColorMask(this, m_colorMask,
2638 m_drawingBuffer.get()); 2638 m_drawingBuffer.get());
2639 GLsizei n = buffers.size(); 2639 GLsizei n = buffers.size();
2640 const GLenum* bufs = buffers.data(); 2640 const GLenum* bufs = buffers.data();
2641 for (GLsizei i = 0; i < n; ++i) { 2641 for (GLsizei i = 0; i < n; ++i) {
2642 switch (bufs[i]) { 2642 switch (bufs[i]) {
2643 case GL_NONE: 2643 case GL_NONE:
2644 case GL_BACK: 2644 case GL_BACK:
2645 case GL_COLOR_ATTACHMENT0: 2645 case GL_COLOR_ATTACHMENT0:
2646 break; 2646 break;
2647 default: 2647 default:
(...skipping 2317 matching lines...) Expand 10 before | Expand all | Expand 10 after
4965 4965
4966 void WebGL2RenderingContextBase:: 4966 void WebGL2RenderingContextBase::
4967 DrawingBufferClientRestorePixelUnpackBufferBinding() { 4967 DrawingBufferClientRestorePixelUnpackBufferBinding() {
4968 if (!contextGL()) 4968 if (!contextGL())
4969 return; 4969 return;
4970 contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 4970 contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER,
4971 objectOrZero(m_boundPixelUnpackBuffer.get())); 4971 objectOrZero(m_boundPixelUnpackBuffer.get()));
4972 } 4972 }
4973 4973
4974 } // namespace blink 4974 } // namespace blink
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/pixel_test_pages.py ('k') | third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698