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

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

Issue 2402603002: State management cleanup (Closed)
Patch Set: Make state dirtying explosive Created 4 years, 2 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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 std::move(drawingBuffer()->transferToStaticBitmapImage()), 707 std::move(drawingBuffer()->transferToStaticBitmapImage()),
708 drawingBuffer()->contextProvider()->isSoftwareRendering()); 708 drawingBuffer()->contextProvider()->isSoftwareRendering());
709 } 709 }
710 710
711 PassRefPtr<Image> WebGLRenderingContextBase::getImage( 711 PassRefPtr<Image> WebGLRenderingContextBase::getImage(
712 AccelerationHint hint, 712 AccelerationHint hint,
713 SnapshotReason reason) const { 713 SnapshotReason reason) const {
714 if (!drawingBuffer()) 714 if (!drawingBuffer())
715 return nullptr; 715 return nullptr;
716 716
717 drawingBuffer()->commit(); 717 drawingBuffer()->resolveAndBindForReadAndDraw();
718 IntSize size = clampedCanvasSize(); 718 IntSize size = clampedCanvasSize();
719 OpacityMode opacityMode = 719 OpacityMode opacityMode =
720 creationAttributes().hasAlpha() ? NonOpaque : Opaque; 720 creationAttributes().hasAlpha() ? NonOpaque : Opaque;
721 std::unique_ptr<AcceleratedImageBufferSurface> surface = 721 std::unique_ptr<AcceleratedImageBufferSurface> surface =
722 wrapUnique(new AcceleratedImageBufferSurface(size, opacityMode)); 722 wrapUnique(new AcceleratedImageBufferSurface(size, opacityMode));
723 if (!surface->isValid()) 723 if (!surface->isValid())
724 return nullptr; 724 return nullptr;
725 std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(std::move(surface)); 725 std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(std::move(surface));
726 if (!buffer->copyRenderingResultsFromDrawingBuffer(drawingBuffer(), 726 if (!buffer->copyRenderingResultsFromDrawingBuffer(drawingBuffer(),
727 BackBuffer)) { 727 BackBuffer)) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 : DrawingBuffer::Discard; 1046 : DrawingBuffer::Discard;
1047 DrawingBuffer::WebGLVersion webGLVersion = DrawingBuffer::WebGL1; 1047 DrawingBuffer::WebGLVersion webGLVersion = DrawingBuffer::WebGL1;
1048 if (version() == 1) { 1048 if (version() == 1) {
1049 webGLVersion = DrawingBuffer::WebGL1; 1049 webGLVersion = DrawingBuffer::WebGL1;
1050 } else if (version() == 2) { 1050 } else if (version() == 2) {
1051 webGLVersion = DrawingBuffer::WebGL2; 1051 webGLVersion = DrawingBuffer::WebGL2;
1052 } else { 1052 } else {
1053 NOTREACHED(); 1053 NOTREACHED();
1054 } 1054 }
1055 return DrawingBuffer::create( 1055 return DrawingBuffer::create(
1056 std::move(contextProvider), clampedCanvasSize(), premultipliedAlpha, 1056 std::move(contextProvider), this, clampedCanvasSize(), premultipliedAlpha,
1057 wantAlphaChannel, wantDepthBuffer, wantStencilBuffer, wantAntialiasing, 1057 wantAlphaChannel, wantDepthBuffer, wantStencilBuffer, wantAntialiasing,
1058 preserve, webGLVersion, chromiumImageUsage); 1058 preserve, webGLVersion, chromiumImageUsage);
1059 } 1059 }
1060 1060
1061 void WebGLRenderingContextBase::initializeNewContext() { 1061 void WebGLRenderingContextBase::initializeNewContext() {
1062 ASSERT(!isContextLost()); 1062 ASSERT(!isContextLost());
1063 ASSERT(drawingBuffer()); 1063 ASSERT(drawingBuffer());
1064 1064
1065 m_markedCanvasDirty = false; 1065 m_markedCanvasDirty = false;
1066 m_activeTextureUnit = 0; 1066 m_activeTextureUnit = 0;
(...skipping 10 matching lines...) Expand all
1077 m_stencilEnabled = false; 1077 m_stencilEnabled = false;
1078 m_stencilMask = 0xFFFFFFFF; 1078 m_stencilMask = 0xFFFFFFFF;
1079 m_stencilMaskBack = 0xFFFFFFFF; 1079 m_stencilMaskBack = 0xFFFFFFFF;
1080 m_stencilFuncRef = 0; 1080 m_stencilFuncRef = 0;
1081 m_stencilFuncRefBack = 0; 1081 m_stencilFuncRefBack = 0;
1082 m_stencilFuncMask = 0xFFFFFFFF; 1082 m_stencilFuncMask = 0xFFFFFFFF;
1083 m_stencilFuncMaskBack = 0xFFFFFFFF; 1083 m_stencilFuncMaskBack = 0xFFFFFFFF;
1084 m_numGLErrorsToConsoleAllowed = maxGLErrorsAllowedToConsole; 1084 m_numGLErrorsToConsoleAllowed = maxGLErrorsAllowedToConsole;
1085 1085
1086 m_clearColor[0] = m_clearColor[1] = m_clearColor[2] = m_clearColor[3] = 0; 1086 m_clearColor[0] = m_clearColor[1] = m_clearColor[2] = m_clearColor[3] = 0;
1087 drawingBuffer()->setClearColor(m_clearColor);
1088 m_scissorEnabled = false; 1087 m_scissorEnabled = false;
1089 m_clearDepth = 1; 1088 m_clearDepth = 1;
1090 m_clearStencil = 0; 1089 m_clearStencil = 0;
1091 m_colorMask[0] = m_colorMask[1] = m_colorMask[2] = m_colorMask[3] = true; 1090 m_colorMask[0] = m_colorMask[1] = m_colorMask[2] = m_colorMask[3] = true;
1092 drawingBuffer()->setColorMask(m_colorMask);
1093 1091
1094 GLint numCombinedTextureImageUnits = 0; 1092 GLint numCombinedTextureImageUnits = 0;
1095 contextGL()->GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, 1093 contextGL()->GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
1096 &numCombinedTextureImageUnits); 1094 &numCombinedTextureImageUnits);
1097 m_textureUnits.clear(); 1095 m_textureUnits.clear();
1098 m_textureUnits.resize(numCombinedTextureImageUnits); 1096 m_textureUnits.resize(numCombinedTextureImageUnits);
1099 1097
1100 GLint numVertexAttribs = 0; 1098 GLint numVertexAttribs = 0;
1101 contextGL()->GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numVertexAttribs); 1099 contextGL()->GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numVertexAttribs);
1102 m_maxVertexAttribs = numVertexAttribs; 1100 m_maxVertexAttribs = numVertexAttribs;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 else 1366 else
1369 contextGL()->ClearStencil(0); 1367 contextGL()->ClearStencil(0);
1370 clearMask |= GL_STENCIL_BUFFER_BIT; 1368 clearMask |= GL_STENCIL_BUFFER_BIT;
1371 contextGL()->StencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); 1369 contextGL()->StencilMaskSeparate(GL_FRONT, 0xFFFFFFFF);
1372 } 1370 }
1373 1371
1374 contextGL()->ColorMask( 1372 contextGL()->ColorMask(
1375 true, true, true, 1373 true, true, true,
1376 !drawingBuffer()->defaultBufferRequiresAlphaChannelToBePreserved()); 1374 !drawingBuffer()->defaultBufferRequiresAlphaChannelToBePreserved());
1377 drawingBuffer()->clearFramebuffers(clearMask); 1375 drawingBuffer()->clearFramebuffers(clearMask);
1378
1379 restoreStateAfterClear();
1380 drawingBuffer()->restoreFramebufferBindings();
1381 drawingBuffer()->setBufferClearNeeded(false); 1376 drawingBuffer()->setBufferClearNeeded(false);
1382 1377
1383 return combinedClear ? CombinedClear : JustClear; 1378 return combinedClear ? CombinedClear : JustClear;
1384 } 1379 }
1385 1380
1386 void WebGLRenderingContextBase::restoreScissorEnabled() { 1381 void WebGLRenderingContextBase::restoreScissorEnabled() {
1387 if (isContextLost()) 1382 if (isContextLost())
1388 return; 1383 return;
1389 1384
1390 if (m_scissorEnabled) { 1385 if (m_scissorEnabled) {
(...skipping 12 matching lines...) Expand all
1403 } 1398 }
1404 1399
1405 void WebGLRenderingContextBase::restoreClearColor() { 1400 void WebGLRenderingContextBase::restoreClearColor() {
1406 if (isContextLost()) 1401 if (isContextLost())
1407 return; 1402 return;
1408 1403
1409 contextGL()->ClearColor(m_clearColor[0], m_clearColor[1], m_clearColor[2], 1404 contextGL()->ClearColor(m_clearColor[0], m_clearColor[1], m_clearColor[2],
1410 m_clearColor[3]); 1405 m_clearColor[3]);
1411 } 1406 }
1412 1407
1413 void WebGLRenderingContextBase::restoreClearDepthf() {
1414 if (isContextLost())
1415 return;
1416
1417 contextGL()->ClearDepthf(m_clearDepth);
1418 }
1419
1420 void WebGLRenderingContextBase::restoreClearStencil() {
1421 if (isContextLost())
1422 return;
1423
1424 contextGL()->ClearStencil(m_clearStencil);
1425 }
1426
1427 void WebGLRenderingContextBase::restoreStencilMaskSeparate() {
1428 if (isContextLost())
1429 return;
1430
1431 contextGL()->StencilMaskSeparate(GL_FRONT, m_stencilMask);
1432 }
1433
1434 void WebGLRenderingContextBase::restoreColorMask() { 1408 void WebGLRenderingContextBase::restoreColorMask() {
1435 if (isContextLost()) 1409 if (isContextLost())
1436 return; 1410 return;
1437 1411
1438 contextGL()->ColorMask(m_colorMask[0], m_colorMask[1], m_colorMask[2], 1412 contextGL()->ColorMask(m_colorMask[0], m_colorMask[1], m_colorMask[2],
1439 m_colorMask[3]); 1413 m_colorMask[3]);
1440 } 1414 }
1441 1415
1442 void WebGLRenderingContextBase::restoreDepthMask() {
1443 if (isContextLost())
1444 return;
1445
1446 contextGL()->DepthMask(m_depthMask);
1447 }
1448
1449 void WebGLRenderingContextBase::restoreStateAfterClear() {
1450 // Restore clear-related state items back to what the context had set.
1451 restoreScissorEnabled();
1452 restoreClearColor();
1453 restoreColorMask();
1454 restoreClearDepthf();
1455 restoreClearStencil();
1456 restoreStencilMaskSeparate();
1457 restoreDepthMask();
1458 }
1459 1416
1460 void WebGLRenderingContextBase::markLayerComposited() { 1417 void WebGLRenderingContextBase::markLayerComposited() {
1461 if (!isContextLost()) 1418 if (!isContextLost())
1462 drawingBuffer()->setBufferClearNeeded(true); 1419 drawingBuffer()->setBufferClearNeeded(true);
1463 } 1420 }
1464 1421
1465 void WebGLRenderingContextBase::setIsHidden(bool hidden) { 1422 void WebGLRenderingContextBase::setIsHidden(bool hidden) {
1466 m_isHidden = hidden; 1423 m_isHidden = hidden;
1467 if (drawingBuffer()) 1424 if (drawingBuffer())
1468 drawingBuffer()->setIsHidden(hidden); 1425 drawingBuffer()->setIsHidden(hidden);
(...skipping 16 matching lines...) Expand all
1485 1442
1486 canvas()->clearCopiedImage(); 1443 canvas()->clearCopiedImage();
1487 m_markedCanvasDirty = false; 1444 m_markedCanvasDirty = false;
1488 1445
1489 if (!canvas()->buffer()) 1446 if (!canvas()->buffer())
1490 return false; 1447 return false;
1491 1448
1492 ScopedTexture2DRestorer restorer(this); 1449 ScopedTexture2DRestorer restorer(this);
1493 ScopedFramebufferRestorer fboRestorer(this); 1450 ScopedFramebufferRestorer fboRestorer(this);
1494 1451
1495 drawingBuffer()->commit(); 1452 drawingBuffer()->resolveAndBindForReadAndDraw();
1496 if (!canvas()->buffer()->copyRenderingResultsFromDrawingBuffer( 1453 if (!canvas()->buffer()->copyRenderingResultsFromDrawingBuffer(
1497 drawingBuffer(), sourceBuffer)) { 1454 drawingBuffer(), sourceBuffer)) {
1498 // Currently, copyRenderingResultsFromDrawingBuffer is expected to always 1455 // Currently, copyRenderingResultsFromDrawingBuffer is expected to always
1499 // succeed because cases where canvas()-buffer() is not accelerated are 1456 // succeed because cases where canvas()-buffer() is not accelerated are
1500 // handle before reaching this point. If that assumption ever stops holding 1457 // handle before reaching this point. If that assumption ever stops holding
1501 // true, we may need to implement a fallback right here. 1458 // true, we may need to implement a fallback right here.
1502 ASSERT_NOT_REACHED(); 1459 ASSERT_NOT_REACHED();
1503 return false; 1460 return false;
1504 } 1461 }
1505 1462
1506 return true; 1463 return true;
1507 } 1464 }
1508 1465
1509 ImageData* WebGLRenderingContextBase::paintRenderingResultsToImageData( 1466 ImageData* WebGLRenderingContextBase::paintRenderingResultsToImageData(
1510 SourceDrawingBuffer sourceBuffer) { 1467 SourceDrawingBuffer sourceBuffer) {
1511 if (isContextLost()) 1468 if (isContextLost())
1512 return nullptr; 1469 return nullptr;
1513 if (creationAttributes().premultipliedAlpha()) 1470 if (creationAttributes().premultipliedAlpha())
1514 return nullptr; 1471 return nullptr;
1515 1472
1516 clearIfComposited(); 1473 clearIfComposited();
1517 drawingBuffer()->commit(); 1474 drawingBuffer()->resolveAndBindForReadAndDraw();
1518 ScopedFramebufferRestorer restorer(this); 1475 ScopedFramebufferRestorer restorer(this);
1519 int width, height; 1476 int width, height;
1520 WTF::ArrayBufferContents contents; 1477 WTF::ArrayBufferContents contents;
1521 if (!drawingBuffer()->paintRenderingResultsToImageData( 1478 if (!drawingBuffer()->paintRenderingResultsToImageData(
1522 width, height, sourceBuffer, contents)) 1479 width, height, sourceBuffer, contents))
1523 return nullptr; 1480 return nullptr;
1524 DOMArrayBuffer* imageDataPixels = DOMArrayBuffer::create(contents); 1481 DOMArrayBuffer* imageDataPixels = DOMArrayBuffer::create(contents);
1525 1482
1526 return ImageData::create( 1483 return ImageData::create(
1527 IntSize(width, height), 1484 IntSize(width, height),
(...skipping 27 matching lines...) Expand all
1555 // If we've exceeded the area limit scale the buffer down, preserving 1512 // If we've exceeded the area limit scale the buffer down, preserving
1556 // ascpect ratio, until it fits. 1513 // ascpect ratio, until it fits.
1557 float scaleFactor = 1514 float scaleFactor =
1558 sqrtf(static_cast<float>(maxArea) / static_cast<float>(currentArea)); 1515 sqrtf(static_cast<float>(maxArea) / static_cast<float>(currentArea));
1559 width = std::max(1, static_cast<int>(width * scaleFactor)); 1516 width = std::max(1, static_cast<int>(width * scaleFactor));
1560 height = std::max(1, static_cast<int>(height * scaleFactor)); 1517 height = std::max(1, static_cast<int>(height * scaleFactor));
1561 } 1518 }
1562 1519
1563 // We don't have to mark the canvas as dirty, since the newly created image 1520 // We don't have to mark the canvas as dirty, since the newly created image
1564 // buffer will also start off clear (and this matches what reshape will do). 1521 // buffer will also start off clear (and this matches what reshape will do).
1565 drawingBuffer()->reset(IntSize(width, height)); 1522 drawingBuffer()->resize(IntSize(width, height));
1566 restoreStateAfterClear();
1567
1568 contextGL()->BindTexture(
1569 GL_TEXTURE_2D,
1570 objectOrZero(
1571 m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get()));
1572 contextGL()->BindRenderbuffer(GL_RENDERBUFFER,
1573 objectOrZero(m_renderbufferBinding.get()));
1574 drawingBuffer()->restoreFramebufferBindings();
1575 drawingBuffer()->restorePixelUnpackBufferBindings();
1576 } 1523 }
1577 1524
1578 int WebGLRenderingContextBase::drawingBufferWidth() const { 1525 int WebGLRenderingContextBase::drawingBufferWidth() const {
1579 return isContextLost() ? 0 : drawingBuffer()->size().width(); 1526 return isContextLost() ? 0 : drawingBuffer()->size().width();
1580 } 1527 }
1581 1528
1582 int WebGLRenderingContextBase::drawingBufferHeight() const { 1529 int WebGLRenderingContextBase::drawingBufferHeight() const {
1583 return isContextLost() ? 0 : drawingBuffer()->size().height(); 1530 return isContextLost() ? 0 : drawingBuffer()->size().height();
1584 } 1531 }
1585 1532
1586 void WebGLRenderingContextBase::activeTexture(GLenum texture) { 1533 void WebGLRenderingContextBase::activeTexture(GLenum texture) {
1587 if (isContextLost()) 1534 if (isContextLost())
1588 return; 1535 return;
1589 if (texture - GL_TEXTURE0 >= m_textureUnits.size()) { 1536 if (texture - GL_TEXTURE0 >= m_textureUnits.size()) {
1590 synthesizeGLError(GL_INVALID_ENUM, "activeTexture", 1537 synthesizeGLError(GL_INVALID_ENUM, "activeTexture",
1591 "texture unit out of range"); 1538 "texture unit out of range");
1592 return; 1539 return;
1593 } 1540 }
1594 m_activeTextureUnit = texture - GL_TEXTURE0; 1541 m_activeTextureUnit = texture - GL_TEXTURE0;
1595 contextGL()->ActiveTexture(texture); 1542 contextGL()->ActiveTexture(texture);
1596
1597 drawingBuffer()->setActiveTextureUnit(texture);
1598 } 1543 }
1599 1544
1600 void WebGLRenderingContextBase::attachShader(WebGLProgram* program, 1545 void WebGLRenderingContextBase::attachShader(WebGLProgram* program,
1601 WebGLShader* shader) { 1546 WebGLShader* shader) {
1602 if (isContextLost() || !validateWebGLObject("attachShader", program) || 1547 if (isContextLost() || !validateWebGLObject("attachShader", program) ||
1603 !validateWebGLObject("attachShader", shader)) 1548 !validateWebGLObject("attachShader", shader))
1604 return; 1549 return;
1605 if (!program->attachShader(shader)) { 1550 if (!program->attachShader(shader)) {
1606 synthesizeGLError(GL_INVALID_OPERATION, "attachShader", 1551 synthesizeGLError(GL_INVALID_OPERATION, "attachShader",
1607 "shader attachment already has shader"); 1552 "shader attachment already has shader");
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 bool deleted; 1624 bool deleted;
1680 if (!checkObjectToBeBound("bindBuffer", buffer, deleted)) 1625 if (!checkObjectToBeBound("bindBuffer", buffer, deleted))
1681 return; 1626 return;
1682 if (deleted) { 1627 if (deleted) {
1683 synthesizeGLError(GL_INVALID_OPERATION, "bindBuffer", 1628 synthesizeGLError(GL_INVALID_OPERATION, "bindBuffer",
1684 "attempt to bind a deleted buffer"); 1629 "attempt to bind a deleted buffer");
1685 return; 1630 return;
1686 } 1631 }
1687 if (!validateAndUpdateBufferBindTarget("bindBuffer", target, buffer)) 1632 if (!validateAndUpdateBufferBindTarget("bindBuffer", target, buffer))
1688 return; 1633 return;
1689
1690 if (target == GL_PIXEL_UNPACK_BUFFER) {
1691 drawingBuffer()->setPixelUnpackBufferBinding(objectOrZero(buffer));
1692 }
1693 contextGL()->BindBuffer(target, objectOrZero(buffer)); 1634 contextGL()->BindBuffer(target, objectOrZero(buffer));
1694 } 1635 }
1695 1636
1696 void WebGLRenderingContextBase::bindFramebuffer(GLenum target, 1637 void WebGLRenderingContextBase::bindFramebuffer(GLenum target,
1697 WebGLFramebuffer* buffer) { 1638 WebGLFramebuffer* buffer) {
1698 bool deleted; 1639 bool deleted;
1699 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted)) 1640 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted))
1700 return; 1641 return;
1701 if (deleted) { 1642 if (deleted) {
1702 synthesizeGLError(GL_INVALID_OPERATION, "bindFramebuffer", 1643 synthesizeGLError(GL_INVALID_OPERATION, "bindFramebuffer",
(...skipping 19 matching lines...) Expand all
1722 synthesizeGLError(GL_INVALID_OPERATION, "bindRenderbuffer", 1663 synthesizeGLError(GL_INVALID_OPERATION, "bindRenderbuffer",
1723 "attempt to bind a deleted renderbuffer"); 1664 "attempt to bind a deleted renderbuffer");
1724 return; 1665 return;
1725 } 1666 }
1726 if (target != GL_RENDERBUFFER) { 1667 if (target != GL_RENDERBUFFER) {
1727 synthesizeGLError(GL_INVALID_ENUM, "bindRenderbuffer", "invalid target"); 1668 synthesizeGLError(GL_INVALID_ENUM, "bindRenderbuffer", "invalid target");
1728 return; 1669 return;
1729 } 1670 }
1730 m_renderbufferBinding = renderBuffer; 1671 m_renderbufferBinding = renderBuffer;
1731 contextGL()->BindRenderbuffer(target, objectOrZero(renderBuffer)); 1672 contextGL()->BindRenderbuffer(target, objectOrZero(renderBuffer));
1732
1733 drawingBuffer()->setRenderbufferBinding(objectOrZero(renderBuffer));
1734
1735 if (renderBuffer) 1673 if (renderBuffer)
1736 renderBuffer->setHasEverBeenBound(); 1674 renderBuffer->setHasEverBeenBound();
1737 } 1675 }
1738 1676
1739 void WebGLRenderingContextBase::bindTexture(GLenum target, 1677 void WebGLRenderingContextBase::bindTexture(GLenum target,
1740 WebGLTexture* texture) { 1678 WebGLTexture* texture) {
1741 bool deleted; 1679 bool deleted;
1742 if (!checkObjectToBeBound("bindTexture", texture, deleted)) 1680 if (!checkObjectToBeBound("bindTexture", texture, deleted))
1743 return; 1681 return;
1744 if (deleted) { 1682 if (deleted) {
1745 synthesizeGLError(GL_INVALID_OPERATION, "bindTexture", 1683 synthesizeGLError(GL_INVALID_OPERATION, "bindTexture",
1746 "attempt to bind a deleted texture"); 1684 "attempt to bind a deleted texture");
1747 return; 1685 return;
1748 } 1686 }
1749 if (texture && texture->getTarget() && texture->getTarget() != target) { 1687 if (texture && texture->getTarget() && texture->getTarget() != target) {
1750 synthesizeGLError(GL_INVALID_OPERATION, "bindTexture", 1688 synthesizeGLError(GL_INVALID_OPERATION, "bindTexture",
1751 "textures can not be used with multiple targets"); 1689 "textures can not be used with multiple targets");
1752 return; 1690 return;
1753 } 1691 }
1754 1692
1755 if (target == GL_TEXTURE_2D) { 1693 if (target == GL_TEXTURE_2D) {
1756 m_textureUnits[m_activeTextureUnit].m_texture2DBinding = texture; 1694 m_textureUnits[m_activeTextureUnit].m_texture2DBinding = texture;
1757
1758 if (!m_activeTextureUnit)
1759 drawingBuffer()->setTexture2DBinding(objectOrZero(texture));
1760 } else if (target == GL_TEXTURE_CUBE_MAP) { 1695 } else if (target == GL_TEXTURE_CUBE_MAP) {
1761 m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding = texture; 1696 m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding = texture;
1762 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_2D_ARRAY) { 1697 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_2D_ARRAY) {
1763 m_textureUnits[m_activeTextureUnit].m_texture2DArrayBinding = texture; 1698 m_textureUnits[m_activeTextureUnit].m_texture2DArrayBinding = texture;
1764 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_3D) { 1699 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_3D) {
1765 m_textureUnits[m_activeTextureUnit].m_texture3DBinding = texture; 1700 m_textureUnits[m_activeTextureUnit].m_texture3DBinding = texture;
1766 } else { 1701 } else {
1767 synthesizeGLError(GL_INVALID_ENUM, "bindTexture", "invalid target"); 1702 synthesizeGLError(GL_INVALID_ENUM, "bindTexture", "invalid target");
1768 return; 1703 return;
1769 } 1704 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 if (std::isnan(g)) 1946 if (std::isnan(g))
2012 g = 0; 1947 g = 0;
2013 if (std::isnan(b)) 1948 if (std::isnan(b))
2014 b = 0; 1949 b = 0;
2015 if (std::isnan(a)) 1950 if (std::isnan(a))
2016 a = 1; 1951 a = 1;
2017 m_clearColor[0] = r; 1952 m_clearColor[0] = r;
2018 m_clearColor[1] = g; 1953 m_clearColor[1] = g;
2019 m_clearColor[2] = b; 1954 m_clearColor[2] = b;
2020 m_clearColor[3] = a; 1955 m_clearColor[3] = a;
2021 drawingBuffer()->setClearColor(m_clearColor);
2022 contextGL()->ClearColor(r, g, b, a); 1956 contextGL()->ClearColor(r, g, b, a);
2023 } 1957 }
2024 1958
2025 void WebGLRenderingContextBase::clearDepth(GLfloat depth) { 1959 void WebGLRenderingContextBase::clearDepth(GLfloat depth) {
2026 if (isContextLost()) 1960 if (isContextLost())
2027 return; 1961 return;
2028 m_clearDepth = depth; 1962 m_clearDepth = depth;
2029 contextGL()->ClearDepthf(depth); 1963 contextGL()->ClearDepthf(depth);
2030 } 1964 }
2031 1965
2032 void WebGLRenderingContextBase::clearStencil(GLint s) { 1966 void WebGLRenderingContextBase::clearStencil(GLint s) {
2033 if (isContextLost()) 1967 if (isContextLost())
2034 return; 1968 return;
2035 m_clearStencil = s; 1969 m_clearStencil = s;
2036 contextGL()->ClearStencil(s); 1970 contextGL()->ClearStencil(s);
2037 } 1971 }
2038 1972
2039 void WebGLRenderingContextBase::colorMask(GLboolean red, 1973 void WebGLRenderingContextBase::colorMask(GLboolean red,
2040 GLboolean green, 1974 GLboolean green,
2041 GLboolean blue, 1975 GLboolean blue,
2042 GLboolean alpha) { 1976 GLboolean alpha) {
2043 if (isContextLost()) 1977 if (isContextLost())
2044 return; 1978 return;
2045 m_colorMask[0] = red; 1979 m_colorMask[0] = red;
2046 m_colorMask[1] = green; 1980 m_colorMask[1] = green;
2047 m_colorMask[2] = blue; 1981 m_colorMask[2] = blue;
2048 m_colorMask[3] = alpha; 1982 m_colorMask[3] = alpha;
2049 drawingBuffer()->setColorMask(m_colorMask);
2050 contextGL()->ColorMask(red, green, blue, alpha); 1983 contextGL()->ColorMask(red, green, blue, alpha);
2051 } 1984 }
2052 1985
2053 void WebGLRenderingContextBase::compileShader(WebGLShader* shader) { 1986 void WebGLRenderingContextBase::compileShader(WebGLShader* shader) {
2054 if (isContextLost() || !validateWebGLObject("compileShader", shader)) 1987 if (isContextLost() || !validateWebGLObject("compileShader", shader))
2055 return; 1988 return;
2056 contextGL()->CompileShader(objectOrZero(shader)); 1989 contextGL()->CompileShader(objectOrZero(shader));
2057 } 1990 }
2058 1991
2059 void WebGLRenderingContextBase::compressedTexImage2D(GLenum target, 1992 void WebGLRenderingContextBase::compressedTexImage2D(GLenum target,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 } 2183 }
2251 if (object->hasObject()) { 2184 if (object->hasObject()) {
2252 // We need to pass in context here because we want 2185 // We need to pass in context here because we want
2253 // things in this context unbound. 2186 // things in this context unbound.
2254 object->deleteObject(contextGL()); 2187 object->deleteObject(contextGL());
2255 } 2188 }
2256 return true; 2189 return true;
2257 } 2190 }
2258 2191
2259 void WebGLRenderingContextBase::deleteBuffer(WebGLBuffer* buffer) { 2192 void WebGLRenderingContextBase::deleteBuffer(WebGLBuffer* buffer) {
2260 GLuint bufferName = objectOrZero(buffer);
2261 if (!deleteObject(buffer)) 2193 if (!deleteObject(buffer))
2262 return; 2194 return;
2263 drawingBuffer()->notifyBufferDeleted(bufferName);
2264 removeBoundBuffer(buffer); 2195 removeBoundBuffer(buffer);
2265 } 2196 }
2266 2197
2267 void WebGLRenderingContextBase::deleteFramebuffer( 2198 void WebGLRenderingContextBase::deleteFramebuffer(
2268 WebGLFramebuffer* framebuffer) { 2199 WebGLFramebuffer* framebuffer) {
2269 if (!deleteObject(framebuffer)) 2200 if (!deleteObject(framebuffer))
2270 return; 2201 return;
2271 if (framebuffer == m_framebufferBinding) { 2202 if (framebuffer == m_framebufferBinding) {
2272 m_framebufferBinding = nullptr; 2203 m_framebufferBinding = nullptr;
2273 drawingBuffer()->setFramebufferBinding(GL_FRAMEBUFFER, 0);
2274 // Have to call drawingBuffer()->bind() here to bind back to internal fbo. 2204 // Have to call drawingBuffer()->bind() here to bind back to internal fbo.
2275 drawingBuffer()->bind(GL_FRAMEBUFFER); 2205 drawingBuffer()->bind(GL_FRAMEBUFFER);
2276 } 2206 }
2277 } 2207 }
2278 2208
2279 void WebGLRenderingContextBase::deleteProgram(WebGLProgram* program) { 2209 void WebGLRenderingContextBase::deleteProgram(WebGLProgram* program) {
2280 deleteObject(program); 2210 deleteObject(program);
2281 // We don't reset m_currentProgram to 0 here because the deletion of the 2211 // We don't reset m_currentProgram to 0 here because the deletion of the
2282 // current program is delayed. 2212 // current program is delayed.
2283 } 2213 }
2284 2214
2285 void WebGLRenderingContextBase::deleteRenderbuffer( 2215 void WebGLRenderingContextBase::deleteRenderbuffer(
2286 WebGLRenderbuffer* renderbuffer) { 2216 WebGLRenderbuffer* renderbuffer) {
2287 if (!deleteObject(renderbuffer)) 2217 if (!deleteObject(renderbuffer))
2288 return; 2218 return;
2289 if (renderbuffer == m_renderbufferBinding) { 2219 if (renderbuffer == m_renderbufferBinding) {
2290 m_renderbufferBinding = nullptr; 2220 m_renderbufferBinding = nullptr;
2291 drawingBuffer()->setRenderbufferBinding(0);
2292 } 2221 }
2293 if (m_framebufferBinding) 2222 if (m_framebufferBinding)
2294 m_framebufferBinding->removeAttachmentFromBoundFramebuffer(GL_FRAMEBUFFER, 2223 m_framebufferBinding->removeAttachmentFromBoundFramebuffer(GL_FRAMEBUFFER,
2295 renderbuffer); 2224 renderbuffer);
2296 if (getFramebufferBinding(GL_READ_FRAMEBUFFER)) 2225 if (getFramebufferBinding(GL_READ_FRAMEBUFFER))
2297 getFramebufferBinding(GL_READ_FRAMEBUFFER) 2226 getFramebufferBinding(GL_READ_FRAMEBUFFER)
2298 ->removeAttachmentFromBoundFramebuffer(GL_READ_FRAMEBUFFER, 2227 ->removeAttachmentFromBoundFramebuffer(GL_READ_FRAMEBUFFER,
2299 renderbuffer); 2228 renderbuffer);
2300 } 2229 }
2301 2230
2302 void WebGLRenderingContextBase::deleteShader(WebGLShader* shader) { 2231 void WebGLRenderingContextBase::deleteShader(WebGLShader* shader) {
2303 deleteObject(shader); 2232 deleteObject(shader);
2304 } 2233 }
2305 2234
2306 void WebGLRenderingContextBase::deleteTexture(WebGLTexture* texture) { 2235 void WebGLRenderingContextBase::deleteTexture(WebGLTexture* texture) {
2307 if (!deleteObject(texture)) 2236 if (!deleteObject(texture))
2308 return; 2237 return;
2309 2238
2310 int maxBoundTextureIndex = -1; 2239 int maxBoundTextureIndex = -1;
2311 for (size_t i = 0; i < m_onePlusMaxNonDefaultTextureUnit; ++i) { 2240 for (size_t i = 0; i < m_onePlusMaxNonDefaultTextureUnit; ++i) {
2312 if (texture == m_textureUnits[i].m_texture2DBinding) { 2241 if (texture == m_textureUnits[i].m_texture2DBinding) {
2313 m_textureUnits[i].m_texture2DBinding = nullptr; 2242 m_textureUnits[i].m_texture2DBinding = nullptr;
2314 maxBoundTextureIndex = i; 2243 maxBoundTextureIndex = i;
2315 if (!i)
2316 drawingBuffer()->setTexture2DBinding(0);
2317 } 2244 }
2318 if (texture == m_textureUnits[i].m_textureCubeMapBinding) { 2245 if (texture == m_textureUnits[i].m_textureCubeMapBinding) {
2319 m_textureUnits[i].m_textureCubeMapBinding = nullptr; 2246 m_textureUnits[i].m_textureCubeMapBinding = nullptr;
2320 maxBoundTextureIndex = i; 2247 maxBoundTextureIndex = i;
2321 } 2248 }
2322 if (isWebGL2OrHigher()) { 2249 if (isWebGL2OrHigher()) {
2323 if (texture == m_textureUnits[i].m_texture3DBinding) { 2250 if (texture == m_textureUnits[i].m_texture3DBinding) {
2324 m_textureUnits[i].m_texture3DBinding = nullptr; 2251 m_textureUnits[i].m_texture3DBinding = nullptr;
2325 maxBoundTextureIndex = i; 2252 maxBoundTextureIndex = i;
2326 } 2253 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 } 2311 }
2385 2312
2386 void WebGLRenderingContextBase::disable(GLenum cap) { 2313 void WebGLRenderingContextBase::disable(GLenum cap) {
2387 if (isContextLost() || !validateCapability("disable", cap)) 2314 if (isContextLost() || !validateCapability("disable", cap))
2388 return; 2315 return;
2389 if (cap == GL_STENCIL_TEST) { 2316 if (cap == GL_STENCIL_TEST) {
2390 m_stencilEnabled = false; 2317 m_stencilEnabled = false;
2391 applyStencilTest(); 2318 applyStencilTest();
2392 return; 2319 return;
2393 } 2320 }
2394 if (cap == GL_SCISSOR_TEST) { 2321 if (cap == GL_SCISSOR_TEST)
2395 m_scissorEnabled = false; 2322 m_scissorEnabled = false;
2396 drawingBuffer()->setScissorEnabled(m_scissorEnabled);
2397 }
2398 contextGL()->Disable(cap); 2323 contextGL()->Disable(cap);
2399 } 2324 }
2400 2325
2401 void WebGLRenderingContextBase::disableVertexAttribArray(GLuint index) { 2326 void WebGLRenderingContextBase::disableVertexAttribArray(GLuint index) {
2402 if (isContextLost()) 2327 if (isContextLost())
2403 return; 2328 return;
2404 if (index >= m_maxVertexAttribs) { 2329 if (index >= m_maxVertexAttribs) {
2405 synthesizeGLError(GL_INVALID_VALUE, "disableVertexAttribArray", 2330 synthesizeGLError(GL_INVALID_VALUE, "disableVertexAttribArray",
2406 "index out of range"); 2331 "index out of range");
2407 return; 2332 return;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 } 2448 }
2524 2449
2525 void WebGLRenderingContextBase::enable(GLenum cap) { 2450 void WebGLRenderingContextBase::enable(GLenum cap) {
2526 if (isContextLost() || !validateCapability("enable", cap)) 2451 if (isContextLost() || !validateCapability("enable", cap))
2527 return; 2452 return;
2528 if (cap == GL_STENCIL_TEST) { 2453 if (cap == GL_STENCIL_TEST) {
2529 m_stencilEnabled = true; 2454 m_stencilEnabled = true;
2530 applyStencilTest(); 2455 applyStencilTest();
2531 return; 2456 return;
2532 } 2457 }
2533 if (cap == GL_SCISSOR_TEST) { 2458 if (cap == GL_SCISSOR_TEST)
2534 m_scissorEnabled = true; 2459 m_scissorEnabled = true;
2535 drawingBuffer()->setScissorEnabled(m_scissorEnabled);
2536 }
2537 contextGL()->Enable(cap); 2460 contextGL()->Enable(cap);
2538 } 2461 }
2539 2462
2540 void WebGLRenderingContextBase::enableVertexAttribArray(GLuint index) { 2463 void WebGLRenderingContextBase::enableVertexAttribArray(GLuint index) {
2541 if (isContextLost()) 2464 if (isContextLost())
2542 return; 2465 return;
2543 if (index >= m_maxVertexAttribs) { 2466 if (index >= m_maxVertexAttribs) {
2544 synthesizeGLError(GL_INVALID_VALUE, "enableVertexAttribArray", 2467 synthesizeGLError(GL_INVALID_VALUE, "enableVertexAttribArray",
2545 "index out of range"); 2468 "index out of range");
2546 return; 2469 return;
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 GL_INVALID_VALUE, "pixelStorei", 3850 GL_INVALID_VALUE, "pixelStorei",
3928 "invalid parameter for UNPACK_COLORSPACE_CONVERSION_WEBGL"); 3851 "invalid parameter for UNPACK_COLORSPACE_CONVERSION_WEBGL");
3929 return; 3852 return;
3930 } 3853 }
3931 break; 3854 break;
3932 case GL_PACK_ALIGNMENT: 3855 case GL_PACK_ALIGNMENT:
3933 case GL_UNPACK_ALIGNMENT: 3856 case GL_UNPACK_ALIGNMENT:
3934 if (param == 1 || param == 2 || param == 4 || param == 8) { 3857 if (param == 1 || param == 2 || param == 4 || param == 8) {
3935 if (pname == GL_PACK_ALIGNMENT) { 3858 if (pname == GL_PACK_ALIGNMENT) {
3936 m_packAlignment = param; 3859 m_packAlignment = param;
3937 drawingBuffer()->setPackAlignment(param);
3938 } else { // GL_UNPACK_ALIGNMENT: 3860 } else { // GL_UNPACK_ALIGNMENT:
3939 m_unpackAlignment = param; 3861 m_unpackAlignment = param;
3940 } 3862 }
3941 contextGL()->PixelStorei(pname, param); 3863 contextGL()->PixelStorei(pname, param);
3942 } else { 3864 } else {
3943 synthesizeGLError(GL_INVALID_VALUE, "pixelStorei", 3865 synthesizeGLError(GL_INVALID_VALUE, "pixelStorei",
3944 "invalid parameter for alignment"); 3866 "invalid parameter for alignment");
3945 return; 3867 return;
3946 } 3868 }
3947 break; 3869 break;
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after
5946 void WebGLRenderingContextBase::loseContextImpl( 5868 void WebGLRenderingContextBase::loseContextImpl(
5947 WebGLRenderingContextBase::LostContextMode mode, 5869 WebGLRenderingContextBase::LostContextMode mode,
5948 AutoRecoveryMethod autoRecoveryMethod) { 5870 AutoRecoveryMethod autoRecoveryMethod) {
5949 if (isContextLost()) 5871 if (isContextLost())
5950 return; 5872 return;
5951 5873
5952 m_contextLostMode = mode; 5874 m_contextLostMode = mode;
5953 ASSERT(m_contextLostMode != NotLostContext); 5875 ASSERT(m_contextLostMode != NotLostContext);
5954 m_autoRecoveryMethod = autoRecoveryMethod; 5876 m_autoRecoveryMethod = autoRecoveryMethod;
5955 5877
5956 // Make absolutely sure we do not refer to an already-deleted texture or
5957 // framebuffer.
5958 drawingBuffer()->setTexture2DBinding(0);
5959 drawingBuffer()->setFramebufferBinding(GL_FRAMEBUFFER, 0);
5960 drawingBuffer()->setRenderbufferBinding(0);
5961
5962 detachAndRemoveAllObjects(); 5878 detachAndRemoveAllObjects();
5963 5879
5964 // Lose all the extensions. 5880 // Lose all the extensions.
5965 for (size_t i = 0; i < m_extensions.size(); ++i) { 5881 for (size_t i = 0; i < m_extensions.size(); ++i) {
5966 ExtensionTracker* tracker = m_extensions[i]; 5882 ExtensionTracker* tracker = m_extensions[i];
5967 tracker->loseExtension(false); 5883 tracker->loseExtension(false);
5968 } 5884 }
5969 5885
5970 for (size_t i = 0; i < WebGLExtensionNameCount; ++i) 5886 for (size_t i = 0; i < WebGLExtensionNameCount; ++i)
5971 m_extensionEnabled[i] = false; 5887 m_extensionEnabled[i] = false;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
6108 } 6024 }
6109 } 6025 }
6110 6026
6111 void WebGLRenderingContextBase::stop() { 6027 void WebGLRenderingContextBase::stop() {
6112 if (!isContextLost()) { 6028 if (!isContextLost()) {
6113 // Never attempt to restore the context because the page is being torn down. 6029 // Never attempt to restore the context because the page is being torn down.
6114 forceLostContext(SyntheticLostContext, Manual); 6030 forceLostContext(SyntheticLostContext, Manual);
6115 } 6031 }
6116 } 6032 }
6117 6033
6034 void WebGLRenderingContextBase::GetDrawingBufferRestoreState(
6035 DrawingBufferRestoreState* restoreState) {
6036 restoreState->scissorEnabled = m_scissorEnabled;
6037
6038 memcpy(restoreState->clearColor, m_clearColor, sizeof(m_clearColor));
6039 restoreState->clearDepth = m_clearDepth;
6040 restoreState->clearStencil = m_clearStencil;
6041
6042 memcpy(restoreState->colorMask, m_colorMask, sizeof(m_colorMask));
6043 restoreState->depthMask = m_depthMask;
6044 restoreState->stencilMask = m_stencilMask;
6045
6046 restoreState->packAlignment = m_packAlignment;
6047
6048 if (m_activeTextureUnit < m_textureUnits.size()) {
6049 restoreState->activeTexture2DBinding = objectOrZero(
6050 m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get());
6051 }
6052 restoreState->renderbufferBinding = objectOrZero(m_renderbufferBinding.get());
6053 restoreState->drawFramebufferBinding =
6054 objectOrZero(m_framebufferBinding.get());
6055 restoreState->readFramebufferBinding =
6056 objectOrZero(m_framebufferBinding.get());
6057 restoreState->pixelUnpackBufferBinding = 0;
6058 }
6059
6118 ScriptValue WebGLRenderingContextBase::getBooleanParameter( 6060 ScriptValue WebGLRenderingContextBase::getBooleanParameter(
6119 ScriptState* scriptState, 6061 ScriptState* scriptState,
6120 GLenum pname) { 6062 GLenum pname) {
6121 GLboolean value = 0; 6063 GLboolean value = 0;
6122 if (!isContextLost()) 6064 if (!isContextLost())
6123 contextGL()->GetBooleanv(pname, &value); 6065 contextGL()->GetBooleanv(pname, &value);
6124 return WebGLAny(scriptState, static_cast<bool>(value)); 6066 return WebGLAny(scriptState, static_cast<bool>(value));
6125 } 6067 }
6126 6068
6127 ScriptValue WebGLRenderingContextBase::getBooleanArrayParameter( 6069 ScriptValue WebGLRenderingContextBase::getBooleanArrayParameter(
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
7401 7343
7402 void WebGLRenderingContextBase::setFramebuffer(GLenum target, 7344 void WebGLRenderingContextBase::setFramebuffer(GLenum target,
7403 WebGLFramebuffer* buffer) { 7345 WebGLFramebuffer* buffer) {
7404 if (buffer) 7346 if (buffer)
7405 buffer->setHasEverBeenBound(); 7347 buffer->setHasEverBeenBound();
7406 7348
7407 if (target == GL_FRAMEBUFFER || target == GL_DRAW_FRAMEBUFFER) { 7349 if (target == GL_FRAMEBUFFER || target == GL_DRAW_FRAMEBUFFER) {
7408 m_framebufferBinding = buffer; 7350 m_framebufferBinding = buffer;
7409 applyStencilTest(); 7351 applyStencilTest();
7410 } 7352 }
7411 drawingBuffer()->setFramebufferBinding(
7412 target, objectOrZero(getFramebufferBinding(target)));
7413
7414 if (!buffer) { 7353 if (!buffer) {
7415 // Instead of binding fb 0, bind the drawing buffer. 7354 // Instead of binding fb 0, bind the drawing buffer.
7416 drawingBuffer()->bind(target); 7355 drawingBuffer()->bind(target);
7417 } else { 7356 } else {
7418 contextGL()->BindFramebuffer(target, buffer->object()); 7357 contextGL()->BindFramebuffer(target, buffer->object());
7419 } 7358 }
7420 } 7359 }
7421 7360
7422 void WebGLRenderingContextBase::restoreCurrentFramebuffer() { 7361 void WebGLRenderingContextBase::restoreCurrentFramebuffer() {
7423 bindFramebuffer(GL_FRAMEBUFFER, m_framebufferBinding.get()); 7362 bindFramebuffer(GL_FRAMEBUFFER, m_framebufferBinding.get());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
7507 7446
7508 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( 7447 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(
7509 HTMLCanvasElementOrOffscreenCanvas& result) const { 7448 HTMLCanvasElementOrOffscreenCanvas& result) const {
7510 if (canvas()) 7449 if (canvas())
7511 result.setHTMLCanvasElement(canvas()); 7450 result.setHTMLCanvasElement(canvas());
7512 else 7451 else
7513 result.setOffscreenCanvas(getOffscreenCanvas()); 7452 result.setOffscreenCanvas(getOffscreenCanvas());
7514 } 7453 }
7515 7454
7516 } // namespace blink 7455 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698