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 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 int WebGLRenderingContextBase::drawingBufferWidth() const | 1405 int WebGLRenderingContextBase::drawingBufferWidth() const |
1406 { | 1406 { |
1407 return isContextLost() ? 0 : drawingBuffer()->size().width(); | 1407 return isContextLost() ? 0 : drawingBuffer()->size().width(); |
1408 } | 1408 } |
1409 | 1409 |
1410 int WebGLRenderingContextBase::drawingBufferHeight() const | 1410 int WebGLRenderingContextBase::drawingBufferHeight() const |
1411 { | 1411 { |
1412 return isContextLost() ? 0 : drawingBuffer()->size().height(); | 1412 return isContextLost() ? 0 : drawingBuffer()->size().height(); |
1413 } | 1413 } |
1414 | 1414 |
1415 unsigned WebGLRenderingContextBase::sizeInBytes(GLenum type) | 1415 unsigned WebGLRenderingContextBase::sizeInBytes(GLenum type, bool isIntegerAPI)
const |
1416 { | 1416 { |
1417 switch (type) { | 1417 switch (type) { |
1418 case GL_BYTE: | 1418 case GL_BYTE: |
1419 return sizeof(GLbyte); | 1419 return sizeof(GLbyte); |
1420 case GL_UNSIGNED_BYTE: | 1420 case GL_UNSIGNED_BYTE: |
1421 return sizeof(GLubyte); | 1421 return sizeof(GLubyte); |
1422 case GL_SHORT: | 1422 case GL_SHORT: |
1423 return sizeof(GLshort); | 1423 return sizeof(GLshort); |
1424 case GL_UNSIGNED_SHORT: | 1424 case GL_UNSIGNED_SHORT: |
1425 return sizeof(GLushort); | 1425 return sizeof(GLushort); |
(...skipping 3738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5164 if (stride < 0 || stride > 255) { | 5164 if (stride < 0 || stride > 255) { |
5165 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribPointer", "bad stride")
; | 5165 synthesizeGLError(GL_INVALID_VALUE, "vertexAttribPointer", "bad stride")
; |
5166 return; | 5166 return; |
5167 } | 5167 } |
5168 if (!validateValueFitNonNegInt32("vertexAttribPointer", "offset", offset)) | 5168 if (!validateValueFitNonNegInt32("vertexAttribPointer", "offset", offset)) |
5169 return; | 5169 return; |
5170 if (!m_boundArrayBuffer) { | 5170 if (!m_boundArrayBuffer) { |
5171 synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribPointer", "no bound
ARRAY_BUFFER"); | 5171 synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribPointer", "no bound
ARRAY_BUFFER"); |
5172 return; | 5172 return; |
5173 } | 5173 } |
5174 unsigned typeSize = sizeInBytes(type); | 5174 unsigned typeSize = sizeInBytes(type, false); |
5175 ASSERT((typeSize & (typeSize - 1)) == 0); // Ensure that the value is POT. | 5175 ASSERT((typeSize & (typeSize - 1)) == 0); // Ensure that the value is POT. |
5176 if ((stride & (typeSize - 1)) || (static_cast<GLintptr>(offset) & (typeSize
- 1))) { | 5176 if ((stride & (typeSize - 1)) || (static_cast<GLintptr>(offset) & (typeSize
- 1))) { |
5177 synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribPointer", "stride o
r offset not valid for type"); | 5177 synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribPointer", "stride o
r offset not valid for type"); |
5178 return; | 5178 return; |
5179 } | 5179 } |
5180 GLsizei bytesPerElement = size * typeSize; | 5180 GLsizei bytesPerElement = size * typeSize; |
5181 | 5181 |
5182 m_boundVertexArrayObject->setVertexAttribState(index, bytesPerElement, size,
type, normalized, stride, static_cast<GLintptr>(offset), m_boundArrayBuffer); | 5182 m_boundVertexArrayObject->setVertexAttribState(index, bytesPerElement, size,
type, normalized, stride, static_cast<GLintptr>(offset), m_boundArrayBuffer); |
5183 webContext()->vertexAttribPointer(index, size, type, normalized, stride, sta
tic_cast<GLintptr>(offset)); | 5183 webContext()->vertexAttribPointer(index, size, type, normalized, stride, sta
tic_cast<GLintptr>(offset)); |
5184 maybePreserveDefaultVAOObjectWrapper(scriptState); | 5184 maybePreserveDefaultVAOObjectWrapper(scriptState); |
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7061 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); | 7061 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); |
7062 } | 7062 } |
7063 | 7063 |
7064 void WebGLRenderingContextBase::restoreUnpackParameters() | 7064 void WebGLRenderingContextBase::restoreUnpackParameters() |
7065 { | 7065 { |
7066 if (m_unpackAlignment != 1) | 7066 if (m_unpackAlignment != 1) |
7067 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 7067 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
7068 } | 7068 } |
7069 | 7069 |
7070 } // namespace blink | 7070 } // namespace blink |
OLD | NEW |