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 "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 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 } | 1520 } |
1521 | 1521 |
1522 contextGL()->VertexAttribDivisorANGLE(index, divisor); | 1522 contextGL()->VertexAttribDivisorANGLE(index, divisor); |
1523 } | 1523 } |
1524 | 1524 |
1525 void WebGL2RenderingContextBase::drawArraysInstanced(GLenum mode, GLint first, G
Lsizei count, GLsizei instanceCount) | 1525 void WebGL2RenderingContextBase::drawArraysInstanced(GLenum mode, GLint first, G
Lsizei count, GLsizei instanceCount) |
1526 { | 1526 { |
1527 if (!validateDrawArrays("drawArraysInstanced")) | 1527 if (!validateDrawArrays("drawArraysInstanced")) |
1528 return; | 1528 return; |
1529 | 1529 |
| 1530 if (!m_boundVertexArrayObject->isAllEnabledAttribBufferBound()) { |
| 1531 synthesizeGLError(GL_INVALID_OPERATION, "drawArraysInstanced", "no buffe
r is bound to enabled attribute"); |
| 1532 return; |
| 1533 } |
| 1534 |
1530 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, m_d
rawingBuffer.get()); | 1535 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, m_d
rawingBuffer.get()); |
1531 clearIfComposited(); | 1536 clearIfComposited(); |
1532 contextGL()->DrawArraysInstancedANGLE(mode, first, count, instanceCount); | 1537 contextGL()->DrawArraysInstancedANGLE(mode, first, count, instanceCount); |
1533 markContextChanged(CanvasChanged); | 1538 markContextChanged(CanvasChanged); |
1534 } | 1539 } |
1535 | 1540 |
1536 void WebGL2RenderingContextBase::drawElementsInstanced(GLenum mode, GLsizei coun
t, GLenum type, long long offset, GLsizei instanceCount) | 1541 void WebGL2RenderingContextBase::drawElementsInstanced(GLenum mode, GLsizei coun
t, GLenum type, long long offset, GLsizei instanceCount) |
1537 { | 1542 { |
1538 if (!validateDrawElements("drawElementsInstanced", type, offset)) | 1543 if (!validateDrawElements("drawElementsInstanced", type, offset)) |
1539 return; | 1544 return; |
1540 | 1545 |
| 1546 if (!m_boundVertexArrayObject->isAllEnabledAttribBufferBound()) { |
| 1547 synthesizeGLError(GL_INVALID_OPERATION, "drawElementsInstanced", "no buf
fer is bound to enabled attribute"); |
| 1548 return; |
| 1549 } |
| 1550 |
1541 if (transformFeedbackActive() && !transformFeedbackPaused()) { | 1551 if (transformFeedbackActive() && !transformFeedbackPaused()) { |
1542 synthesizeGLError(GL_INVALID_OPERATION, "drawElementsInstanced", "transf
orm feedback is active and not paused"); | 1552 synthesizeGLError(GL_INVALID_OPERATION, "drawElementsInstanced", "transf
orm feedback is active and not paused"); |
1543 return; | 1553 return; |
1544 } | 1554 } |
1545 | 1555 |
1546 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, m_d
rawingBuffer.get()); | 1556 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, m_d
rawingBuffer.get()); |
1547 clearIfComposited(); | 1557 clearIfComposited(); |
1548 contextGL()->DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<
void*>(static_cast<intptr_t>(offset)), instanceCount); | 1558 contextGL()->DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<
void*>(static_cast<intptr_t>(offset)), instanceCount); |
1549 markContextChanged(CanvasChanged); | 1559 markContextChanged(CanvasChanged); |
1550 } | 1560 } |
1551 | 1561 |
1552 void WebGL2RenderingContextBase::drawRangeElements(GLenum mode, GLuint start, GL
uint end, GLsizei count, GLenum type, long long offset) | 1562 void WebGL2RenderingContextBase::drawRangeElements(GLenum mode, GLuint start, GL
uint end, GLsizei count, GLenum type, long long offset) |
1553 { | 1563 { |
1554 if (!validateDrawElements("drawRangeElements", type, offset)) | 1564 if (!validateDrawElements("drawRangeElements", type, offset)) |
1555 return; | 1565 return; |
1556 | 1566 |
| 1567 if (!m_boundVertexArrayObject->isAllEnabledAttribBufferBound()) { |
| 1568 synthesizeGLError(GL_INVALID_OPERATION, "drawRangeElements", "no buffer
is bound to enabled attribute"); |
| 1569 return; |
| 1570 } |
| 1571 |
1557 if (transformFeedbackActive() && !transformFeedbackPaused()) { | 1572 if (transformFeedbackActive() && !transformFeedbackPaused()) { |
1558 synthesizeGLError(GL_INVALID_OPERATION, "drawRangeElements", "transform
feedback is active and not paused"); | 1573 synthesizeGLError(GL_INVALID_OPERATION, "drawRangeElements", "transform
feedback is active and not paused"); |
1559 return; | 1574 return; |
1560 } | 1575 } |
1561 | 1576 |
1562 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, m_d
rawingBuffer.get()); | 1577 ScopedRGBEmulationColorMask emulationColorMask(contextGL(), m_colorMask, m_d
rawingBuffer.get()); |
1563 clearIfComposited(); | 1578 clearIfComposited(); |
1564 contextGL()->DrawRangeElements(mode, start, end, count, type, reinterpret_ca
st<void*>(static_cast<intptr_t>(offset))); | 1579 contextGL()->DrawRangeElements(mode, start, end, count, type, reinterpret_ca
st<void*>(static_cast<intptr_t>(offset))); |
1565 markContextChanged(CanvasChanged); | 1580 markContextChanged(CanvasChanged); |
1566 } | 1581 } |
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3603 params.skipPixels = m_unpackSkipPixels; | 3618 params.skipPixels = m_unpackSkipPixels; |
3604 params.skipRows = m_unpackSkipRows; | 3619 params.skipRows = m_unpackSkipRows; |
3605 if (dimension == Tex3D) { | 3620 if (dimension == Tex3D) { |
3606 params.imageHeight = m_unpackImageHeight; | 3621 params.imageHeight = m_unpackImageHeight; |
3607 params.skipImages = m_unpackSkipImages; | 3622 params.skipImages = m_unpackSkipImages; |
3608 } | 3623 } |
3609 return params; | 3624 return params; |
3610 } | 3625 } |
3611 | 3626 |
3612 } // namespace blink | 3627 } // namespace blink |
OLD | NEW |