| 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 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 } | 2407 } |
| 2408 } | 2408 } |
| 2409 | 2409 |
| 2410 void WebGL2RenderingContextBase::bindBufferBase(GLenum target, GLuint index, Web
GLBuffer* buffer) | 2410 void WebGL2RenderingContextBase::bindBufferBase(GLenum target, GLuint index, Web
GLBuffer* buffer) |
| 2411 { | 2411 { |
| 2412 if (isContextLost()) | 2412 if (isContextLost()) |
| 2413 return; | 2413 return; |
| 2414 bool deleted; | 2414 bool deleted; |
| 2415 if (!checkObjectToBeBound("bindBufferBase", buffer, deleted)) | 2415 if (!checkObjectToBeBound("bindBufferBase", buffer, deleted)) |
| 2416 return; | 2416 return; |
| 2417 if (deleted) | 2417 if (deleted) { |
| 2418 buffer = 0; | 2418 synthesizeGLError(GL_INVALID_OPERATION, "bindBufferBase", "attempt to bi
nd a deleted buffer"); |
| 2419 return; |
| 2420 } |
| 2419 if (!validateAndUpdateBufferBindBaseTarget("bindBufferBase", target, index,
buffer)) | 2421 if (!validateAndUpdateBufferBindBaseTarget("bindBufferBase", target, index,
buffer)) |
| 2420 return; | 2422 return; |
| 2421 | 2423 |
| 2422 contextGL()->BindBufferBase(target, index, objectOrZero(buffer)); | 2424 contextGL()->BindBufferBase(target, index, objectOrZero(buffer)); |
| 2423 } | 2425 } |
| 2424 | 2426 |
| 2425 void WebGL2RenderingContextBase::bindBufferRange(GLenum target, GLuint index, We
bGLBuffer* buffer, long long offset, long long size) | 2427 void WebGL2RenderingContextBase::bindBufferRange(GLenum target, GLuint index, We
bGLBuffer* buffer, long long offset, long long size) |
| 2426 { | 2428 { |
| 2427 if (isContextLost()) | 2429 if (isContextLost()) |
| 2428 return; | 2430 return; |
| 2429 bool deleted; | 2431 bool deleted; |
| 2430 if (!checkObjectToBeBound("bindBufferRange", buffer, deleted)) | 2432 if (!checkObjectToBeBound("bindBufferRange", buffer, deleted)) |
| 2431 return; | 2433 return; |
| 2432 if (deleted) | 2434 if (deleted) { |
| 2433 buffer = 0; | 2435 synthesizeGLError(GL_INVALID_OPERATION, "bindBufferRange", "attempt to b
ind a deleted buffer"); |
| 2436 return; |
| 2437 } |
| 2434 if (!validateValueFitNonNegInt32("bindBufferRange", "offset", offset) | 2438 if (!validateValueFitNonNegInt32("bindBufferRange", "offset", offset) |
| 2435 || !validateValueFitNonNegInt32("bindBufferRange", "size", size)) { | 2439 || !validateValueFitNonNegInt32("bindBufferRange", "size", size)) { |
| 2436 return; | 2440 return; |
| 2437 } | 2441 } |
| 2438 | 2442 |
| 2439 if (!validateAndUpdateBufferBindBaseTarget("bindBufferRange", target, index,
buffer)) | 2443 if (!validateAndUpdateBufferBindBaseTarget("bindBufferRange", target, index,
buffer)) |
| 2440 return; | 2444 return; |
| 2441 | 2445 |
| 2442 contextGL()->BindBufferRange(target, index, objectOrZero(buffer), static_cas
t<GLintptr>(offset), static_cast<GLsizeiptr>(size)); | 2446 contextGL()->BindBufferRange(target, index, objectOrZero(buffer), static_cas
t<GLintptr>(offset), static_cast<GLsizeiptr>(size)); |
| 2443 } | 2447 } |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2724 setBoundVertexArrayObject(nullptr); | 2728 setBoundVertexArrayObject(nullptr); |
| 2725 } | 2729 } |
| 2726 } | 2730 } |
| 2727 | 2731 |
| 2728 void WebGL2RenderingContextBase::bindFramebuffer(GLenum target, WebGLFramebuffer
* buffer) | 2732 void WebGL2RenderingContextBase::bindFramebuffer(GLenum target, WebGLFramebuffer
* buffer) |
| 2729 { | 2733 { |
| 2730 bool deleted; | 2734 bool deleted; |
| 2731 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted)) | 2735 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted)) |
| 2732 return; | 2736 return; |
| 2733 | 2737 |
| 2734 if (deleted) | 2738 if (deleted) { |
| 2735 buffer = 0; | 2739 synthesizeGLError(GL_INVALID_OPERATION, "bindFramebuffer", "attempt to b
ind a deleted framebuffer"); |
| 2740 return; |
| 2741 } |
| 2736 | 2742 |
| 2737 switch (target) { | 2743 switch (target) { |
| 2738 case GL_DRAW_FRAMEBUFFER: | 2744 case GL_DRAW_FRAMEBUFFER: |
| 2739 break; | 2745 break; |
| 2740 case GL_FRAMEBUFFER: | 2746 case GL_FRAMEBUFFER: |
| 2741 case GL_READ_FRAMEBUFFER: | 2747 case GL_READ_FRAMEBUFFER: |
| 2742 m_readFramebufferBinding = buffer; | 2748 m_readFramebufferBinding = buffer; |
| 2743 break; | 2749 break; |
| 2744 default: | 2750 default: |
| 2745 synthesizeGLError(GL_INVALID_ENUM, "bindFramebuffer", "invalid target"); | 2751 synthesizeGLError(GL_INVALID_ENUM, "bindFramebuffer", "invalid target"); |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3644 params.skipPixels = m_unpackSkipPixels; | 3650 params.skipPixels = m_unpackSkipPixels; |
| 3645 params.skipRows = m_unpackSkipRows; | 3651 params.skipRows = m_unpackSkipRows; |
| 3646 if (dimension == Tex3D) { | 3652 if (dimension == Tex3D) { |
| 3647 params.imageHeight = m_unpackImageHeight; | 3653 params.imageHeight = m_unpackImageHeight; |
| 3648 params.skipImages = m_unpackSkipImages; | 3654 params.skipImages = m_unpackSkipImages; |
| 3649 } | 3655 } |
| 3650 return params; | 3656 return params; |
| 3651 } | 3657 } |
| 3652 | 3658 |
| 3653 } // namespace blink | 3659 } // namespace blink |
| OLD | NEW |