| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 *params = | 829 *params = |
| 830 texture_units_[active_texture_unit_].bound_texture_external_oes; | 830 texture_units_[active_texture_unit_].bound_texture_external_oes; |
| 831 return true; | 831 return true; |
| 832 case GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM: | 832 case GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM: |
| 833 *params = bound_pixel_pack_transfer_buffer_id_; | 833 *params = bound_pixel_pack_transfer_buffer_id_; |
| 834 return true; | 834 return true; |
| 835 case GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM: | 835 case GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM: |
| 836 *params = bound_pixel_unpack_transfer_buffer_id_; | 836 *params = bound_pixel_unpack_transfer_buffer_id_; |
| 837 return true; | 837 return true; |
| 838 case GL_READ_FRAMEBUFFER_BINDING: | 838 case GL_READ_FRAMEBUFFER_BINDING: |
| 839 if (IsChromiumFramebufferMultisampleAvailable()) { | 839 if (capabilities_.major_version >= 3 || |
| 840 IsChromiumFramebufferMultisampleAvailable()) { |
| 840 *params = bound_read_framebuffer_; | 841 *params = bound_read_framebuffer_; |
| 841 return true; | 842 return true; |
| 842 } | 843 } |
| 843 break; | 844 break; |
| 844 case GL_TIMESTAMP_EXT: | 845 case GL_TIMESTAMP_EXT: |
| 845 // We convert all GPU timestamps to CPU time. | 846 // We convert all GPU timestamps to CPU time. |
| 846 *params = base::saturated_cast<GLint>( | 847 *params = base::saturated_cast<GLint>( |
| 847 (base::TimeTicks::Now() - base::TimeTicks()).InMicroseconds() | 848 (base::TimeTicks::Now() - base::TimeTicks()).InMicroseconds() |
| 848 * base::Time::kNanosecondsPerMicrosecond); | 849 * base::Time::kNanosecondsPerMicrosecond); |
| 849 return true; | 850 return true; |
| (...skipping 3502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4352 switch (target) { | 4353 switch (target) { |
| 4353 case GL_FRAMEBUFFER: | 4354 case GL_FRAMEBUFFER: |
| 4354 if (bound_framebuffer_ != framebuffer || | 4355 if (bound_framebuffer_ != framebuffer || |
| 4355 bound_read_framebuffer_ != framebuffer) { | 4356 bound_read_framebuffer_ != framebuffer) { |
| 4356 bound_framebuffer_ = framebuffer; | 4357 bound_framebuffer_ = framebuffer; |
| 4357 bound_read_framebuffer_ = framebuffer; | 4358 bound_read_framebuffer_ = framebuffer; |
| 4358 changed = true; | 4359 changed = true; |
| 4359 } | 4360 } |
| 4360 break; | 4361 break; |
| 4361 case GL_READ_FRAMEBUFFER: | 4362 case GL_READ_FRAMEBUFFER: |
| 4362 if (!IsChromiumFramebufferMultisampleAvailable()) { | 4363 DCHECK(capabilities_.major_version >= 3 || |
| 4363 SetGLErrorInvalidEnum("glBindFramebuffer", target, "target"); | 4364 IsChromiumFramebufferMultisampleAvailable()); |
| 4364 return; | |
| 4365 } | |
| 4366 if (bound_read_framebuffer_ != framebuffer) { | 4365 if (bound_read_framebuffer_ != framebuffer) { |
| 4367 bound_read_framebuffer_ = framebuffer; | 4366 bound_read_framebuffer_ = framebuffer; |
| 4368 changed = true; | 4367 changed = true; |
| 4369 } | 4368 } |
| 4370 break; | 4369 break; |
| 4371 case GL_DRAW_FRAMEBUFFER: | 4370 case GL_DRAW_FRAMEBUFFER: |
| 4372 if (!IsChromiumFramebufferMultisampleAvailable()) { | 4371 DCHECK(capabilities_.major_version >= 3 || |
| 4373 SetGLErrorInvalidEnum("glBindFramebuffer", target, "target"); | 4372 IsChromiumFramebufferMultisampleAvailable()); |
| 4374 return; | |
| 4375 } | |
| 4376 if (bound_framebuffer_ != framebuffer) { | 4373 if (bound_framebuffer_ != framebuffer) { |
| 4377 bound_framebuffer_ = framebuffer; | 4374 bound_framebuffer_ = framebuffer; |
| 4378 changed = true; | 4375 changed = true; |
| 4379 } | 4376 } |
| 4380 break; | 4377 break; |
| 4381 default: | 4378 default: |
| 4382 SetGLErrorInvalidEnum("glBindFramebuffer", target, "target"); | 4379 SetGLErrorInvalidEnum("glBindFramebuffer", target, "target"); |
| 4383 return; | 4380 return; |
| 4384 } | 4381 } |
| 4385 | 4382 |
| (...skipping 2679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7065 CheckGLError(); | 7062 CheckGLError(); |
| 7066 } | 7063 } |
| 7067 | 7064 |
| 7068 // Include the auto-generated part of this file. We split this because it means | 7065 // Include the auto-generated part of this file. We split this because it means |
| 7069 // we can easily edit the non-auto generated parts right here in this file | 7066 // we can easily edit the non-auto generated parts right here in this file |
| 7070 // instead of having to edit some template or the code generator. | 7067 // instead of having to edit some template or the code generator. |
| 7071 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 7068 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 7072 | 7069 |
| 7073 } // namespace gles2 | 7070 } // namespace gles2 |
| 7074 } // namespace gpu | 7071 } // namespace gpu |
| OLD | NEW |