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

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

Issue 1856933002: WebGL GL_RGB emulation to support IOSurfaces on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from kbr. Created 4 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 } 1505 }
1506 1506
1507 contextGL()->VertexAttribDivisorANGLE(index, divisor); 1507 contextGL()->VertexAttribDivisorANGLE(index, divisor);
1508 } 1508 }
1509 1509
1510 void WebGL2RenderingContextBase::drawArraysInstanced(GLenum mode, GLint first, G Lsizei count, GLsizei instanceCount) 1510 void WebGL2RenderingContextBase::drawArraysInstanced(GLenum mode, GLint first, G Lsizei count, GLsizei instanceCount)
1511 { 1511 {
1512 if (!validateDrawArrays("drawArraysInstanced")) 1512 if (!validateDrawArrays("drawArraysInstanced"))
1513 return; 1513 return;
1514 1514
1515 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, m_d rawingBuffer.get());
1515 clearIfComposited(); 1516 clearIfComposited();
1516 contextGL()->DrawArraysInstancedANGLE(mode, first, count, instanceCount); 1517 contextGL()->DrawArraysInstancedANGLE(mode, first, count, instanceCount);
1517 markContextChanged(CanvasChanged); 1518 markContextChanged(CanvasChanged);
1518 } 1519 }
1519 1520
1520 void WebGL2RenderingContextBase::drawElementsInstanced(GLenum mode, GLsizei coun t, GLenum type, long long offset, GLsizei instanceCount) 1521 void WebGL2RenderingContextBase::drawElementsInstanced(GLenum mode, GLsizei coun t, GLenum type, long long offset, GLsizei instanceCount)
1521 { 1522 {
1522 if (!validateDrawElements("drawElementsInstanced", type, offset)) 1523 if (!validateDrawElements("drawElementsInstanced", type, offset))
1523 return; 1524 return;
1524 1525
1525 if (transformFeedbackActive() && !transformFeedbackPaused()) { 1526 if (transformFeedbackActive() && !transformFeedbackPaused()) {
1526 synthesizeGLError(GL_INVALID_OPERATION, "drawElementsInstanced", "transf orm feedback is active and not paused"); 1527 synthesizeGLError(GL_INVALID_OPERATION, "drawElementsInstanced", "transf orm feedback is active and not paused");
1527 return; 1528 return;
1528 } 1529 }
1529 1530
1531 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, m_d rawingBuffer.get());
1530 clearIfComposited(); 1532 clearIfComposited();
1531 contextGL()->DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast< void*>(static_cast<intptr_t>(offset)), instanceCount); 1533 contextGL()->DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast< void*>(static_cast<intptr_t>(offset)), instanceCount);
1532 markContextChanged(CanvasChanged); 1534 markContextChanged(CanvasChanged);
1533 } 1535 }
1534 1536
1535 void WebGL2RenderingContextBase::drawRangeElements(GLenum mode, GLuint start, GL uint end, GLsizei count, GLenum type, long long offset) 1537 void WebGL2RenderingContextBase::drawRangeElements(GLenum mode, GLuint start, GL uint end, GLsizei count, GLenum type, long long offset)
1536 { 1538 {
1537 if (!validateDrawElements("drawRangeElements", type, offset)) 1539 if (!validateDrawElements("drawRangeElements", type, offset))
1538 return; 1540 return;
1539 1541
1540 if (transformFeedbackActive() && !transformFeedbackPaused()) { 1542 if (transformFeedbackActive() && !transformFeedbackPaused()) {
1541 synthesizeGLError(GL_INVALID_OPERATION, "drawRangeElements", "transform feedback is active and not paused"); 1543 synthesizeGLError(GL_INVALID_OPERATION, "drawRangeElements", "transform feedback is active and not paused");
1542 return; 1544 return;
1543 } 1545 }
1544 1546
1547 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, m_d rawingBuffer.get());
1545 clearIfComposited(); 1548 clearIfComposited();
1546 contextGL()->DrawRangeElements(mode, start, end, count, type, reinterpret_ca st<void*>(static_cast<intptr_t>(offset))); 1549 contextGL()->DrawRangeElements(mode, start, end, count, type, reinterpret_ca st<void*>(static_cast<intptr_t>(offset)));
1547 markContextChanged(CanvasChanged); 1550 markContextChanged(CanvasChanged);
1548 } 1551 }
1549 1552
1550 void WebGL2RenderingContextBase::drawBuffers(const Vector<GLenum>& buffers) 1553 void WebGL2RenderingContextBase::drawBuffers(const Vector<GLenum>& buffers)
1551 { 1554 {
1552 if (isContextLost()) 1555 if (isContextLost())
1553 return; 1556 return;
1554 1557
1558 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, m_d rawingBuffer.get());
1555 GLsizei n = buffers.size(); 1559 GLsizei n = buffers.size();
1556 const GLenum* bufs = buffers.data(); 1560 const GLenum* bufs = buffers.data();
1557 for (GLsizei i = 0; i < n; ++i) { 1561 for (GLsizei i = 0; i < n; ++i) {
1558 switch (bufs[i]) { 1562 switch (bufs[i]) {
1559 case GL_NONE: 1563 case GL_NONE:
1560 case GL_BACK: 1564 case GL_BACK:
1561 case GL_COLOR_ATTACHMENT0: 1565 case GL_COLOR_ATTACHMENT0:
1562 break; 1566 break;
1563 default: 1567 default:
1564 if (bufs[i] > GL_COLOR_ATTACHMENT0 1568 if (bufs[i] > GL_COLOR_ATTACHMENT0
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after
3577 params.skipPixels = m_unpackSkipPixels; 3581 params.skipPixels = m_unpackSkipPixels;
3578 params.skipRows = m_unpackSkipRows; 3582 params.skipRows = m_unpackSkipRows;
3579 if (dimension == Tex3D) { 3583 if (dimension == Tex3D) {
3580 params.imageHeight = m_unpackImageHeight; 3584 params.imageHeight = m_unpackImageHeight;
3581 params.skipImages = m_unpackSkipImages; 3585 params.skipImages = m_unpackSkipImages;
3582 } 3586 }
3583 return params; 3587 return params;
3584 } 3588 }
3585 3589
3586 } // namespace blink 3590 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698