| 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 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 { | 2130 { |
| 2131 if (!validateDrawElements("drawElements", type, offset)) | 2131 if (!validateDrawElements("drawElements", type, offset)) |
| 2132 return; | 2132 return; |
| 2133 | 2133 |
| 2134 if (transformFeedbackActive() && !transformFeedbackPaused()) { | 2134 if (transformFeedbackActive() && !transformFeedbackPaused()) { |
| 2135 synthesizeGLError(GL_INVALID_OPERATION, "drawElements", "transform feedb
ack is active and not paused"); | 2135 synthesizeGLError(GL_INVALID_OPERATION, "drawElements", "transform feedb
ack is active and not paused"); |
| 2136 return; | 2136 return; |
| 2137 } | 2137 } |
| 2138 | 2138 |
| 2139 clearIfComposited(); | 2139 clearIfComposited(); |
| 2140 webContext()->drawElements(mode, count, type, static_cast<GLintptr>(offset))
; | 2140 contextGL()->DrawElements(mode, count, type, reinterpret_cast<void*>(static_
cast<intptr_t>(offset))); |
| 2141 markContextChanged(CanvasChanged); | 2141 markContextChanged(CanvasChanged); |
| 2142 } | 2142 } |
| 2143 | 2143 |
| 2144 void WebGLRenderingContextBase::drawArraysInstancedANGLE(GLenum mode, GLint firs
t, GLsizei count, GLsizei primcount) | 2144 void WebGLRenderingContextBase::drawArraysInstancedANGLE(GLenum mode, GLint firs
t, GLsizei count, GLsizei primcount) |
| 2145 { | 2145 { |
| 2146 if (!validateDrawArrays("drawArraysInstancedANGLE")) | 2146 if (!validateDrawArrays("drawArraysInstancedANGLE")) |
| 2147 return; | 2147 return; |
| 2148 | 2148 |
| 2149 clearIfComposited(); | 2149 clearIfComposited(); |
| 2150 contextGL()->DrawArraysInstancedANGLE(mode, first, count, primcount); | 2150 contextGL()->DrawArraysInstancedANGLE(mode, first, count, primcount); |
| (...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3292 default: | 3292 default: |
| 3293 synthesizeGLError(GL_INVALID_ENUM, "getVertexAttrib", "invalid parameter
name"); | 3293 synthesizeGLError(GL_INVALID_ENUM, "getVertexAttrib", "invalid parameter
name"); |
| 3294 return ScriptValue::createNull(scriptState); | 3294 return ScriptValue::createNull(scriptState); |
| 3295 } | 3295 } |
| 3296 } | 3296 } |
| 3297 | 3297 |
| 3298 long long WebGLRenderingContextBase::getVertexAttribOffset(GLuint index, GLenum
pname) | 3298 long long WebGLRenderingContextBase::getVertexAttribOffset(GLuint index, GLenum
pname) |
| 3299 { | 3299 { |
| 3300 if (isContextLost()) | 3300 if (isContextLost()) |
| 3301 return 0; | 3301 return 0; |
| 3302 GLintptr result = webContext()->getVertexAttribOffset(index, pname); | 3302 GLvoid* result = nullptr; |
| 3303 return static_cast<long long>(result); | 3303 // NOTE: If pname is ever a value that returns more then 1 element |
| 3304 // this will corrupt memory. |
| 3305 contextGL()->GetVertexAttribPointerv(index, pname, &result); |
| 3306 return static_cast<long long>(reinterpret_cast<intptr_t>(result)); |
| 3304 } | 3307 } |
| 3305 | 3308 |
| 3306 void WebGLRenderingContextBase::hint(GLenum target, GLenum mode) | 3309 void WebGLRenderingContextBase::hint(GLenum target, GLenum mode) |
| 3307 { | 3310 { |
| 3308 if (isContextLost()) | 3311 if (isContextLost()) |
| 3309 return; | 3312 return; |
| 3310 bool isValid = false; | 3313 bool isValid = false; |
| 3311 switch (target) { | 3314 switch (target) { |
| 3312 case GL_GENERATE_MIPMAP_HINT: | 3315 case GL_GENERATE_MIPMAP_HINT: |
| 3313 isValid = true; | 3316 isValid = true; |
| (...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4950 return; | 4953 return; |
| 4951 } | 4954 } |
| 4952 if (!validateValueFitNonNegInt32("vertexAttribPointer", "offset", offset)) | 4955 if (!validateValueFitNonNegInt32("vertexAttribPointer", "offset", offset)) |
| 4953 return; | 4956 return; |
| 4954 if (!m_boundArrayBuffer) { | 4957 if (!m_boundArrayBuffer) { |
| 4955 synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribPointer", "no bound
ARRAY_BUFFER"); | 4958 synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribPointer", "no bound
ARRAY_BUFFER"); |
| 4956 return; | 4959 return; |
| 4957 } | 4960 } |
| 4958 | 4961 |
| 4959 m_boundVertexArrayObject->setArrayBufferForAttrib(index, m_boundArrayBuffer.
get()); | 4962 m_boundVertexArrayObject->setArrayBufferForAttrib(index, m_boundArrayBuffer.
get()); |
| 4960 webContext()->vertexAttribPointer(index, size, type, normalized, stride, sta
tic_cast<GLintptr>(offset)); | 4963 contextGL()->VertexAttribPointer(index, size, type, normalized, stride, rein
terpret_cast<void*>(static_cast<intptr_t>(offset))); |
| 4961 maybePreserveDefaultVAOObjectWrapper(scriptState); | 4964 maybePreserveDefaultVAOObjectWrapper(scriptState); |
| 4962 preserveObjectWrapper(scriptState, m_boundVertexArrayObject, "arraybuffer",
index, m_boundArrayBuffer); | 4965 preserveObjectWrapper(scriptState, m_boundVertexArrayObject, "arraybuffer",
index, m_boundArrayBuffer); |
| 4963 } | 4966 } |
| 4964 | 4967 |
| 4965 void WebGLRenderingContextBase::vertexAttribDivisorANGLE(GLuint index, GLuint di
visor) | 4968 void WebGLRenderingContextBase::vertexAttribDivisorANGLE(GLuint index, GLuint di
visor) |
| 4966 { | 4969 { |
| 4967 if (isContextLost()) | 4970 if (isContextLost()) |
| 4968 return; | 4971 return; |
| 4969 | 4972 |
| 4970 if (index >= m_maxVertexAttribs) { | 4973 if (index >= m_maxVertexAttribs) { |
| (...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6296 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6299 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6297 } | 6300 } |
| 6298 | 6301 |
| 6299 void WebGLRenderingContextBase::restoreUnpackParameters() | 6302 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6300 { | 6303 { |
| 6301 if (m_unpackAlignment != 1) | 6304 if (m_unpackAlignment != 1) |
| 6302 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6305 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6303 } | 6306 } |
| 6304 | 6307 |
| 6305 } // namespace blink | 6308 } // namespace blink |
| OLD | NEW |