| 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 <memory> | 7 #include <memory> |
| 8 #include "bindings/modules/v8/WebGLAny.h" | 8 #include "bindings/modules/v8/WebGLAny.h" |
| 9 #include "core/frame/ImageBitmap.h" | 9 #include "core/frame/ImageBitmap.h" |
| 10 #include "core/html/HTMLCanvasElement.h" | 10 #include "core/html/HTMLCanvasElement.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 } | 446 } |
| 447 break; | 447 break; |
| 448 case GL_TEXTURE_2D_ARRAY: | 448 case GL_TEXTURE_2D_ARRAY: |
| 449 if (layer > max_array_texture_layers_ - 1) { | 449 if (layer > max_array_texture_layers_ - 1) { |
| 450 SynthesizeGLError(GL_INVALID_VALUE, function_name, | 450 SynthesizeGLError(GL_INVALID_VALUE, function_name, |
| 451 "layer out of range"); | 451 "layer out of range"); |
| 452 return false; | 452 return false; |
| 453 } | 453 } |
| 454 break; | 454 break; |
| 455 default: | 455 default: |
| 456 ASSERT_NOT_REACHED(); | 456 NOTREACHED(); |
| 457 return false; | 457 return false; |
| 458 } | 458 } |
| 459 return true; | 459 return true; |
| 460 } | 460 } |
| 461 | 461 |
| 462 void WebGL2RenderingContextBase::framebufferTextureLayer(GLenum target, | 462 void WebGL2RenderingContextBase::framebufferTextureLayer(GLenum target, |
| 463 GLenum attachment, | 463 GLenum attachment, |
| 464 WebGLTexture* texture, | 464 WebGLTexture* texture, |
| 465 GLint level, | 465 GLint level, |
| 466 GLint layer) { | 466 GLint layer) { |
| (...skipping 4051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4518 case kIntType: { | 4518 case kIntType: { |
| 4519 return WebGLAny(script_state, result); | 4519 return WebGLAny(script_state, result); |
| 4520 } | 4520 } |
| 4521 case kBoolType: { | 4521 case kBoolType: { |
| 4522 Vector<bool> bool_result(size); | 4522 Vector<bool> bool_result(size); |
| 4523 for (size_t i = 0; i < size; ++i) | 4523 for (size_t i = 0; i < size; ++i) |
| 4524 bool_result[i] = static_cast<bool>(result[i]); | 4524 bool_result[i] = static_cast<bool>(result[i]); |
| 4525 return WebGLAny(script_state, bool_result); | 4525 return WebGLAny(script_state, bool_result); |
| 4526 } | 4526 } |
| 4527 default: | 4527 default: |
| 4528 ASSERT_NOT_REACHED(); | 4528 NOTREACHED(); |
| 4529 return ScriptValue::CreateNull(script_state); | 4529 return ScriptValue::CreateNull(script_state); |
| 4530 } | 4530 } |
| 4531 } | 4531 } |
| 4532 | 4532 |
| 4533 GLuint WebGL2RenderingContextBase::getUniformBlockIndex( | 4533 GLuint WebGL2RenderingContextBase::getUniformBlockIndex( |
| 4534 WebGLProgram* program, | 4534 WebGLProgram* program, |
| 4535 const String& uniform_block_name) { | 4535 const String& uniform_block_name) { |
| 4536 if (isContextLost() || !ValidateWebGLObject("getUniformBlockIndex", program)) | 4536 if (isContextLost() || !ValidateWebGLObject("getUniformBlockIndex", program)) |
| 4537 return 0; | 4537 return 0; |
| 4538 if (!ValidateString("getUniformBlockIndex", uniform_block_name)) | 4538 if (!ValidateString("getUniformBlockIndex", uniform_block_name)) |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5091 case GL_PIXEL_UNPACK_BUFFER: | 5091 case GL_PIXEL_UNPACK_BUFFER: |
| 5092 bound_pixel_unpack_buffer_ = buffer; | 5092 bound_pixel_unpack_buffer_ = buffer; |
| 5093 break; | 5093 break; |
| 5094 case GL_TRANSFORM_FEEDBACK_BUFFER: | 5094 case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 5095 bound_transform_feedback_buffer_ = buffer; | 5095 bound_transform_feedback_buffer_ = buffer; |
| 5096 break; | 5096 break; |
| 5097 case GL_UNIFORM_BUFFER: | 5097 case GL_UNIFORM_BUFFER: |
| 5098 bound_uniform_buffer_ = buffer; | 5098 bound_uniform_buffer_ = buffer; |
| 5099 break; | 5099 break; |
| 5100 default: | 5100 default: |
| 5101 ASSERT_NOT_REACHED(); | 5101 NOTREACHED(); |
| 5102 break; | 5102 break; |
| 5103 } | 5103 } |
| 5104 | 5104 |
| 5105 if (buffer && !buffer->GetInitialTarget()) | 5105 if (buffer && !buffer->GetInitialTarget()) |
| 5106 buffer->SetInitialTarget(target); | 5106 buffer->SetInitialTarget(target); |
| 5107 return true; | 5107 return true; |
| 5108 } | 5108 } |
| 5109 | 5109 |
| 5110 bool WebGL2RenderingContextBase::ValidateBufferBaseTarget( | 5110 bool WebGL2RenderingContextBase::ValidateBufferBaseTarget( |
| 5111 const char* function_name, | 5111 const char* function_name, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5161 index == max_bound_uniform_buffer_index_) { | 5161 index == max_bound_uniform_buffer_index_) { |
| 5162 size_t i = max_bound_uniform_buffer_index_ - 1; | 5162 size_t i = max_bound_uniform_buffer_index_ - 1; |
| 5163 for (; i > 0; --i) { | 5163 for (; i > 0; --i) { |
| 5164 if (bound_indexed_uniform_buffers_[i].Get()) | 5164 if (bound_indexed_uniform_buffers_[i].Get()) |
| 5165 break; | 5165 break; |
| 5166 } | 5166 } |
| 5167 max_bound_uniform_buffer_index_ = i; | 5167 max_bound_uniform_buffer_index_ = i; |
| 5168 } | 5168 } |
| 5169 break; | 5169 break; |
| 5170 default: | 5170 default: |
| 5171 ASSERT_NOT_REACHED(); | 5171 NOTREACHED(); |
| 5172 break; | 5172 break; |
| 5173 } | 5173 } |
| 5174 | 5174 |
| 5175 if (buffer && !buffer->GetInitialTarget()) | 5175 if (buffer && !buffer->GetInitialTarget()) |
| 5176 buffer->SetInitialTarget(target); | 5176 buffer->SetInitialTarget(target); |
| 5177 return true; | 5177 return true; |
| 5178 } | 5178 } |
| 5179 | 5179 |
| 5180 bool WebGL2RenderingContextBase::ValidateFramebufferTarget(GLenum target) { | 5180 bool WebGL2RenderingContextBase::ValidateFramebufferTarget(GLenum target) { |
| 5181 switch (target) { | 5181 switch (target) { |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5765 | 5765 |
| 5766 void WebGL2RenderingContextBase:: | 5766 void WebGL2RenderingContextBase:: |
| 5767 DrawingBufferClientRestorePixelUnpackBufferBinding() { | 5767 DrawingBufferClientRestorePixelUnpackBufferBinding() { |
| 5768 if (!ContextGL()) | 5768 if (!ContextGL()) |
| 5769 return; | 5769 return; |
| 5770 ContextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, | 5770 ContextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, |
| 5771 ObjectOrZero(bound_pixel_unpack_buffer_.Get())); | 5771 ObjectOrZero(bound_pixel_unpack_buffer_.Get())); |
| 5772 } | 5772 } |
| 5773 | 5773 |
| 5774 } // namespace blink | 5774 } // namespace blink |
| OLD | NEW |