| OLD | NEW |
| 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 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 state.enabled = false; | 1786 state.enabled = false; |
| 1787 | 1787 |
| 1788 // If the disabled index is the current maximum, trace backwards to find the
new max enabled attrib index | 1788 // If the disabled index is the current maximum, trace backwards to find the
new max enabled attrib index |
| 1789 if (m_onePlusMaxEnabledAttribIndex == index + 1) { | 1789 if (m_onePlusMaxEnabledAttribIndex == index + 1) { |
| 1790 findNewMaxEnabledAttribIndex(); | 1790 findNewMaxEnabledAttribIndex(); |
| 1791 } | 1791 } |
| 1792 | 1792 |
| 1793 m_context->disableVertexAttribArray(index); | 1793 m_context->disableVertexAttribArray(index); |
| 1794 } | 1794 } |
| 1795 | 1795 |
| 1796 bool WebGLRenderingContext::validateRenderingState() | 1796 bool WebGLRenderingContext::validateRenderingState(const char* functionName) |
| 1797 { | 1797 { |
| 1798 if (!m_currentProgram) | 1798 if (!m_currentProgram) { |
| 1799 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no valid shader p
rogram in use"); |
| 1799 return false; | 1800 return false; |
| 1801 } |
| 1800 | 1802 |
| 1801 // Look in each enabled vertex attrib and check if they've been bound to a b
uffer. | 1803 // Look in each enabled vertex attrib and check if they've been bound to a b
uffer. |
| 1802 for (unsigned i = 0; i < m_onePlusMaxEnabledAttribIndex; ++i) { | 1804 for (unsigned i = 0; i < m_onePlusMaxEnabledAttribIndex; ++i) { |
| 1803 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVerte
xArrayObject->getVertexAttribState(i); | 1805 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVerte
xArrayObject->getVertexAttribState(i); |
| 1804 if (state.enabled | 1806 if (state.enabled |
| 1805 && (!state.bufferBinding || !state.bufferBinding->object())) | 1807 && (!state.bufferBinding || !state.bufferBinding->object())) { |
| 1808 synthesizeGLError(GL_INVALID_OPERATION, functionName, String::format
("attribute %d is enabled but has no buffer bound", i).utf8().data()); |
| 1806 return false; | 1809 return false; |
| 1810 } |
| 1807 } | 1811 } |
| 1808 | 1812 |
| 1809 return true; | 1813 return true; |
| 1810 } | 1814 } |
| 1811 | 1815 |
| 1812 bool WebGLRenderingContext::validateWebGLObject(const char* functionName, WebGLO
bject* object) | 1816 bool WebGLRenderingContext::validateWebGLObject(const char* functionName, WebGLO
bject* object) |
| 1813 { | 1817 { |
| 1814 if (!object || !object->object()) { | 1818 if (!object || !object->object()) { |
| 1815 synthesizeGLError(GL_INVALID_VALUE, functionName, "no object or object d
eleted"); | 1819 synthesizeGLError(GL_INVALID_VALUE, functionName, "no object or object d
eleted"); |
| 1816 return false; | 1820 return false; |
| (...skipping 3395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5212 if (first < 0 || count < 0) { | 5216 if (first < 0 || count < 0) { |
| 5213 synthesizeGLError(GL_INVALID_VALUE, functionName, "first or count < 0"); | 5217 synthesizeGLError(GL_INVALID_VALUE, functionName, "first or count < 0"); |
| 5214 return false; | 5218 return false; |
| 5215 } | 5219 } |
| 5216 | 5220 |
| 5217 if (!count) { | 5221 if (!count) { |
| 5218 markContextChanged(); | 5222 markContextChanged(); |
| 5219 return false; | 5223 return false; |
| 5220 } | 5224 } |
| 5221 | 5225 |
| 5222 if (!validateRenderingState()) { | 5226 if (!validateRenderingState(functionName)) { |
| 5223 synthesizeGLError(GL_INVALID_OPERATION, functionName, "attribs not setup
correctly"); | |
| 5224 return false; | 5227 return false; |
| 5225 } | 5228 } |
| 5226 | 5229 |
| 5227 const char* reason = "framebuffer incomplete"; | 5230 const char* reason = "framebuffer incomplete"; |
| 5228 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3
D(), &reason)) { | 5231 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3
D(), &reason)) { |
| 5229 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, functionName, reason
); | 5232 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, functionName, reason
); |
| 5230 return false; | 5233 return false; |
| 5231 } | 5234 } |
| 5232 | 5235 |
| 5233 return true; | 5236 return true; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 5263 if (!count) { | 5266 if (!count) { |
| 5264 markContextChanged(); | 5267 markContextChanged(); |
| 5265 return false; | 5268 return false; |
| 5266 } | 5269 } |
| 5267 | 5270 |
| 5268 if (!m_boundVertexArrayObject->boundElementArrayBuffer()) { | 5271 if (!m_boundVertexArrayObject->boundElementArrayBuffer()) { |
| 5269 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no ELEMENT_ARRAY_
BUFFER bound"); | 5272 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no ELEMENT_ARRAY_
BUFFER bound"); |
| 5270 return false; | 5273 return false; |
| 5271 } | 5274 } |
| 5272 | 5275 |
| 5273 if (!validateRenderingState()) { | 5276 if (!validateRenderingState(functionName)) { |
| 5274 synthesizeGLError(GL_INVALID_OPERATION, functionName, "attribs not setup
correctly"); | |
| 5275 return false; | 5277 return false; |
| 5276 } | 5278 } |
| 5277 | 5279 |
| 5278 const char* reason = "framebuffer incomplete"; | 5280 const char* reason = "framebuffer incomplete"; |
| 5279 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3
D(), &reason)) { | 5281 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3
D(), &reason)) { |
| 5280 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, functionName, reason
); | 5282 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, functionName, reason
); |
| 5281 return false; | 5283 return false; |
| 5282 } | 5284 } |
| 5283 | 5285 |
| 5284 return true; | 5286 return true; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5639 if (m_textureUnits[i].m_texture2DBinding | 5641 if (m_textureUnits[i].m_texture2DBinding |
| 5640 || m_textureUnits[i].m_textureCubeMapBinding) { | 5642 || m_textureUnits[i].m_textureCubeMapBinding) { |
| 5641 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5643 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
| 5642 return; | 5644 return; |
| 5643 } | 5645 } |
| 5644 } | 5646 } |
| 5645 m_onePlusMaxNonDefaultTextureUnit = 0; | 5647 m_onePlusMaxNonDefaultTextureUnit = 0; |
| 5646 } | 5648 } |
| 5647 | 5649 |
| 5648 } // namespace WebCore | 5650 } // namespace WebCore |
| OLD | NEW |