OLD | NEW |
---|---|
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 "config.h" | 5 #include "config.h" |
6 #include "modules/webgl/WebGL2RenderingContextBase.h" | 6 #include "modules/webgl/WebGL2RenderingContextBase.h" |
7 | 7 |
8 #include "bindings/modules/v8/WebGLAny.h" | 8 #include "bindings/modules/v8/WebGLAny.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 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1586 { | 1586 { |
1587 if (isContextLost()) | 1587 if (isContextLost()) |
1588 return nullptr; | 1588 return nullptr; |
1589 WebGLQuery* o = WebGLQuery::create(this); | 1589 WebGLQuery* o = WebGLQuery::create(this); |
1590 addSharedObject(o); | 1590 addSharedObject(o); |
1591 return o; | 1591 return o; |
1592 } | 1592 } |
1593 | 1593 |
1594 void WebGL2RenderingContextBase::deleteQuery(WebGLQuery* query) | 1594 void WebGL2RenderingContextBase::deleteQuery(WebGLQuery* query) |
1595 { | 1595 { |
1596 if (!query) { | |
1597 synthesizeGLError(GL_INVALID_OPERATION, "deleteQuery", "query object is null"); | |
Zhenyao Mo
2015/11/25 18:16:33
You should follow the same pattern from other dele
| |
1598 return; | |
1599 } | |
1600 | |
1596 if (m_currentBooleanOcclusionQuery == query) { | 1601 if (m_currentBooleanOcclusionQuery == query) { |
1597 webContext()->endQueryEXT(m_currentBooleanOcclusionQuery->getTarget()); | 1602 webContext()->endQueryEXT(m_currentBooleanOcclusionQuery->getTarget()); |
1598 m_currentBooleanOcclusionQuery = nullptr; | 1603 m_currentBooleanOcclusionQuery = nullptr; |
1599 } | 1604 } |
1600 | 1605 |
1601 if (m_currentTransformFeedbackPrimitivesWrittenQuery == query) { | 1606 if (m_currentTransformFeedbackPrimitivesWrittenQuery == query) { |
1602 webContext()->endQueryEXT(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); | 1607 webContext()->endQueryEXT(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); |
1603 m_currentTransformFeedbackPrimitivesWrittenQuery = nullptr; | 1608 m_currentTransformFeedbackPrimitivesWrittenQuery = nullptr; |
1604 } | 1609 } |
1605 | 1610 |
1606 deleteObject(query); | 1611 deleteObject(query); |
1607 } | 1612 } |
1608 | 1613 |
1609 GLboolean WebGL2RenderingContextBase::isQuery(WebGLQuery* query) | 1614 GLboolean WebGL2RenderingContextBase::isQuery(WebGLQuery* query) |
1610 { | 1615 { |
1611 if (isContextLost() || !query) | 1616 if (isContextLost() || !query) |
1612 return 0; | 1617 return 0; |
1613 | 1618 |
1614 return webContext()->isQueryEXT(query->object()); | 1619 return webContext()->isQueryEXT(query->object()); |
1615 } | 1620 } |
1616 | 1621 |
1617 void WebGL2RenderingContextBase::beginQuery(GLenum target, WebGLQuery* query) | 1622 void WebGL2RenderingContextBase::beginQuery(GLenum target, WebGLQuery* query) |
1618 { | 1623 { |
1619 bool deleted; | 1624 bool deleted; |
1625 if (!query) { | |
1626 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "query object is n ull"); | |
1627 return; | |
1628 } | |
1629 | |
1620 if (!checkObjectToBeBound("beginQuery", query, deleted)) | 1630 if (!checkObjectToBeBound("beginQuery", query, deleted)) |
1621 return; | 1631 return; |
1622 if (deleted) { | 1632 if (deleted) { |
1623 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "attempted to begi n a deleted query object"); | 1633 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "attempted to begi n a deleted query object"); |
1624 return; | 1634 return; |
1625 } | 1635 } |
1626 | 1636 |
1627 if (query->getTarget() && query->getTarget() != target) { | 1637 if (query->getTarget() && query->getTarget() != target) { |
1628 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "query type does n ot match target"); | 1638 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "query type does n ot match target"); |
1629 return; | 1639 return; |
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3211 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() | 3221 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() |
3212 { | 3222 { |
3213 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) | 3223 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) |
3214 return m_readFramebufferBinding->colorBufferFormat(); | 3224 return m_readFramebufferBinding->colorBufferFormat(); |
3215 if (m_requestedAttributes.alpha()) | 3225 if (m_requestedAttributes.alpha()) |
3216 return GL_RGBA; | 3226 return GL_RGBA; |
3217 return GL_RGB; | 3227 return GL_RGB; |
3218 } | 3228 } |
3219 | 3229 |
3220 } // namespace blink | 3230 } // namespace blink |
OLD | NEW |