| 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 "core/html/canvas/WebGL2RenderingContextBase.h" | 6 #include "core/html/canvas/WebGL2RenderingContextBase.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/WebGLAny.h" | 8 #include "bindings/core/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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return; | 84 return; |
| 85 | 85 |
| 86 webContext()->copyBufferSubData(readTarget, writeTarget, readOffset, writeOf
fset, size); | 86 webContext()->copyBufferSubData(readTarget, writeTarget, readOffset, writeOf
fset, size); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void WebGL2RenderingContextBase::getBufferSubData(GLenum target, GLintptr offset
, DOMArrayBuffer* returnedData) | 89 void WebGL2RenderingContextBase::getBufferSubData(GLenum target, GLintptr offset
, DOMArrayBuffer* returnedData) |
| 90 { | 90 { |
| 91 if (isContextLost()) | 91 if (isContextLost()) |
| 92 return; | 92 return; |
| 93 | 93 |
| 94 notImplemented(); | 94 void* mappedData = webContext()->mapBufferRange(target, offset, returnedData
->byteLength(), GL_MAP_READ_BIT); |
| 95 |
| 96 if (!mappedData) |
| 97 return; |
| 98 |
| 99 memcpy(returnedData->data(), mappedData, returnedData->byteLength()); |
| 100 |
| 101 webContext()->unmapBuffer(target); |
| 95 } | 102 } |
| 96 | 103 |
| 97 void WebGL2RenderingContextBase::blitFramebuffer(GLint srcX0, GLint srcY0, GLint
srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfi
eld mask, GLenum filter) | 104 void WebGL2RenderingContextBase::blitFramebuffer(GLint srcX0, GLint srcY0, GLint
srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfi
eld mask, GLenum filter) |
| 98 { | 105 { |
| 99 if (isContextLost()) | 106 if (isContextLost()) |
| 100 return; | 107 return; |
| 101 | 108 |
| 102 webContext()->blitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dst
Y0, dstX1, dstY1, mask, filter); | 109 webContext()->blitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dst
Y0, dstX1, dstY1, mask, filter); |
| 103 } | 110 } |
| 104 | 111 |
| (...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 return 0; | 1269 return 0; |
| 1263 | 1270 |
| 1264 return webContext()->isTransformFeedback(feedback->object()); | 1271 return webContext()->isTransformFeedback(feedback->object()); |
| 1265 } | 1272 } |
| 1266 | 1273 |
| 1267 void WebGL2RenderingContextBase::bindTransformFeedback(GLenum target, WebGLTrans
formFeedback* feedback) | 1274 void WebGL2RenderingContextBase::bindTransformFeedback(GLenum target, WebGLTrans
formFeedback* feedback) |
| 1268 { | 1275 { |
| 1269 bool deleted; | 1276 bool deleted; |
| 1270 if (!checkObjectToBeBound("bindTransformFeedback", feedback, deleted)) | 1277 if (!checkObjectToBeBound("bindTransformFeedback", feedback, deleted)) |
| 1271 return; | 1278 return; |
| 1272 if (deleted) | 1279 if (deleted) { |
| 1273 feedback = 0; | 1280 synthesizeGLError(GL_INVALID_OPERATION, "bindTransformFeedback", "attemp
ted to bind a deleted transform feedback object"); |
| 1281 return; |
| 1282 } |
| 1274 | 1283 |
| 1275 if (target != GL_TRANSFORM_FEEDBACK) { | 1284 if (target != GL_TRANSFORM_FEEDBACK) { |
| 1276 synthesizeGLError(GL_INVALID_ENUM, "bindTransformFeedback", "target must
be TRANSFORM_FEEDBACK"); | 1285 synthesizeGLError(GL_INVALID_ENUM, "bindTransformFeedback", "target must
be TRANSFORM_FEEDBACK"); |
| 1277 return; | 1286 return; |
| 1278 } | 1287 } |
| 1279 | 1288 |
| 1280 m_transformFeedbackBinding = feedback; | 1289 m_transformFeedbackBinding = feedback; |
| 1281 | 1290 |
| 1282 webContext()->bindTransformFeedback(target, objectOrZero(feedback)); | 1291 webContext()->bindTransformFeedback(target, objectOrZero(feedback)); |
| 1283 if (feedback) | 1292 if (feedback) |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 m_boundPixelUnpackBuffer = nullptr; | 2085 m_boundPixelUnpackBuffer = nullptr; |
| 2077 if (m_boundTransformFeedbackBuffer == buffer) | 2086 if (m_boundTransformFeedbackBuffer == buffer) |
| 2078 m_boundTransformFeedbackBuffer = nullptr; | 2087 m_boundTransformFeedbackBuffer = nullptr; |
| 2079 if (m_boundUniformBuffer == buffer) | 2088 if (m_boundUniformBuffer == buffer) |
| 2080 m_boundUniformBuffer = nullptr; | 2089 m_boundUniformBuffer = nullptr; |
| 2081 | 2090 |
| 2082 WebGLRenderingContextBase::removeBoundBuffer(buffer); | 2091 WebGLRenderingContextBase::removeBoundBuffer(buffer); |
| 2083 } | 2092 } |
| 2084 | 2093 |
| 2085 } // namespace blink | 2094 } // namespace blink |
| OLD | NEW |