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

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

Issue 2322943002: Generate INVALID_OPERATION error when attempting to bind a deleted object (Closed)
Patch Set: Solve merge conflict Created 4 years, 3 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 | « third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 if (buffer && !buffer->getInitialTarget()) 1513 if (buffer && !buffer->getInitialTarget())
1514 buffer->setInitialTarget(target); 1514 buffer->setInitialTarget(target);
1515 return true; 1515 return true;
1516 } 1516 }
1517 1517
1518 void WebGLRenderingContextBase::bindBuffer(GLenum target, WebGLBuffer* buffer) 1518 void WebGLRenderingContextBase::bindBuffer(GLenum target, WebGLBuffer* buffer)
1519 { 1519 {
1520 bool deleted; 1520 bool deleted;
1521 if (!checkObjectToBeBound("bindBuffer", buffer, deleted)) 1521 if (!checkObjectToBeBound("bindBuffer", buffer, deleted))
1522 return; 1522 return;
1523 if (deleted) 1523 if (deleted) {
1524 buffer = 0; 1524 synthesizeGLError(GL_INVALID_OPERATION, "bindBuffer", "attempt to bind a deleted buffer");
1525 return;
1526 }
1525 if (!validateAndUpdateBufferBindTarget("bindBuffer", target, buffer)) 1527 if (!validateAndUpdateBufferBindTarget("bindBuffer", target, buffer))
1526 return; 1528 return;
1527 1529
1528 if (target == GL_PIXEL_UNPACK_BUFFER) { 1530 if (target == GL_PIXEL_UNPACK_BUFFER) {
1529 drawingBuffer()->setPixelUnpackBufferBinding(objectOrZero(buffer)); 1531 drawingBuffer()->setPixelUnpackBufferBinding(objectOrZero(buffer));
1530 } 1532 }
1531 contextGL()->BindBuffer(target, objectOrZero(buffer)); 1533 contextGL()->BindBuffer(target, objectOrZero(buffer));
1532 } 1534 }
1533 1535
1534 void WebGLRenderingContextBase::bindFramebuffer(GLenum target, WebGLFramebuffer* buffer) 1536 void WebGLRenderingContextBase::bindFramebuffer(GLenum target, WebGLFramebuffer* buffer)
1535 { 1537 {
1536 bool deleted; 1538 bool deleted;
1537 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted)) 1539 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted))
1538 return; 1540 return;
1539 1541 if (deleted) {
1540 if (deleted) 1542 synthesizeGLError(GL_INVALID_OPERATION, "bindFramebuffer", "attempt to b ind a deleted framebuffer");
1541 buffer = 0; 1543 return;
1544 }
1542 1545
1543 if (target != GL_FRAMEBUFFER) { 1546 if (target != GL_FRAMEBUFFER) {
1544 synthesizeGLError(GL_INVALID_ENUM, "bindFramebuffer", "invalid target"); 1547 synthesizeGLError(GL_INVALID_ENUM, "bindFramebuffer", "invalid target");
1545 return; 1548 return;
1546 } 1549 }
1547 1550
1548 setFramebuffer(target, buffer); 1551 setFramebuffer(target, buffer);
1549 } 1552 }
1550 1553
1551 void WebGLRenderingContextBase::bindRenderbuffer(GLenum target, WebGLRenderbuffe r* renderBuffer) 1554 void WebGLRenderingContextBase::bindRenderbuffer(GLenum target, WebGLRenderbuffe r* renderBuffer)
1552 { 1555 {
1553 bool deleted; 1556 bool deleted;
1554 if (!checkObjectToBeBound("bindRenderbuffer", renderBuffer, deleted)) 1557 if (!checkObjectToBeBound("bindRenderbuffer", renderBuffer, deleted))
1555 return; 1558 return;
1556 if (deleted) 1559 if (deleted) {
1557 renderBuffer = 0; 1560 synthesizeGLError(GL_INVALID_OPERATION, "bindRenderbuffer", "attempt to bind a deleted renderbuffer");
1561 return;
1562 }
1558 if (target != GL_RENDERBUFFER) { 1563 if (target != GL_RENDERBUFFER) {
1559 synthesizeGLError(GL_INVALID_ENUM, "bindRenderbuffer", "invalid target") ; 1564 synthesizeGLError(GL_INVALID_ENUM, "bindRenderbuffer", "invalid target") ;
1560 return; 1565 return;
1561 } 1566 }
1562 m_renderbufferBinding = renderBuffer; 1567 m_renderbufferBinding = renderBuffer;
1563 contextGL()->BindRenderbuffer(target, objectOrZero(renderBuffer)); 1568 contextGL()->BindRenderbuffer(target, objectOrZero(renderBuffer));
1564 1569
1565 drawingBuffer()->setRenderbufferBinding(objectOrZero(renderBuffer)); 1570 drawingBuffer()->setRenderbufferBinding(objectOrZero(renderBuffer));
1566 1571
1567 if (renderBuffer) 1572 if (renderBuffer)
1568 renderBuffer->setHasEverBeenBound(); 1573 renderBuffer->setHasEverBeenBound();
1569 } 1574 }
1570 1575
1571 void WebGLRenderingContextBase::bindTexture(GLenum target, WebGLTexture* texture ) 1576 void WebGLRenderingContextBase::bindTexture(GLenum target, WebGLTexture* texture )
1572 { 1577 {
1573 bool deleted; 1578 bool deleted;
1574 if (!checkObjectToBeBound("bindTexture", texture, deleted)) 1579 if (!checkObjectToBeBound("bindTexture", texture, deleted))
1575 return; 1580 return;
1576 if (deleted) 1581 if (deleted) {
1577 texture = 0; 1582 synthesizeGLError(GL_INVALID_OPERATION, "bindTexture", "attempt to bind a deleted texture");
1583 return;
1584 }
1578 if (texture && texture->getTarget() && texture->getTarget() != target) { 1585 if (texture && texture->getTarget() && texture->getTarget() != target) {
1579 synthesizeGLError(GL_INVALID_OPERATION, "bindTexture", "textures can not be used with multiple targets"); 1586 synthesizeGLError(GL_INVALID_OPERATION, "bindTexture", "textures can not be used with multiple targets");
1580 return; 1587 return;
1581 } 1588 }
1582 1589
1583 if (target == GL_TEXTURE_2D) { 1590 if (target == GL_TEXTURE_2D) {
1584 m_textureUnits[m_activeTextureUnit].m_texture2DBinding = texture; 1591 m_textureUnits[m_activeTextureUnit].m_texture2DBinding = texture;
1585 1592
1586 if (!m_activeTextureUnit) 1593 if (!m_activeTextureUnit)
1587 drawingBuffer()->setTexture2DBinding(objectOrZero(texture)); 1594 drawingBuffer()->setTexture2DBinding(objectOrZero(texture));
(...skipping 4859 matching lines...) Expand 10 before | Expand all | Expand 10 after
6447 6454
6448 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs creenCanvas& result) const 6455 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs creenCanvas& result) const
6449 { 6456 {
6450 if (canvas()) 6457 if (canvas())
6451 result.setHTMLCanvasElement(canvas()); 6458 result.setHTMLCanvasElement(canvas());
6452 else 6459 else
6453 result.setOffscreenCanvas(getOffscreenCanvas()); 6460 result.setOffscreenCanvas(getOffscreenCanvas());
6454 } 6461 }
6455 6462
6456 } // namespace blink 6463 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698