| 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/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
| 10 #include <GLES2/gl2extchromium.h> | 10 #include <GLES2/gl2extchromium.h> |
| (...skipping 2677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2688 this, target, buffer_id, &GLES2Implementation::BindBufferStub); | 2688 this, target, buffer_id, &GLES2Implementation::BindBufferStub); |
| 2689 } | 2689 } |
| 2690 } | 2690 } |
| 2691 | 2691 |
| 2692 void GLES2Implementation::BindBufferStub(GLenum target, GLuint buffer) { | 2692 void GLES2Implementation::BindBufferStub(GLenum target, GLuint buffer) { |
| 2693 helper_->BindBuffer(target, buffer); | 2693 helper_->BindBuffer(target, buffer); |
| 2694 if (share_group_->bind_generates_resource()) | 2694 if (share_group_->bind_generates_resource()) |
| 2695 helper_->CommandBufferHelper::Flush(); | 2695 helper_->CommandBufferHelper::Flush(); |
| 2696 } | 2696 } |
| 2697 | 2697 |
| 2698 void GLES2Implementation::BindBufferBaseHelper( |
| 2699 GLenum target, GLuint index, GLuint buffer_id) { |
| 2700 // TODO(zmo): See note #1 above. |
| 2701 // TODO(zmo): There's a bug here. If the target or index is invalid the ID |
| 2702 // will not be used even though it's marked it as used here. |
| 2703 GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind( |
| 2704 this, target, index, buffer_id, &GLES2Implementation::BindBufferBaseStub); |
| 2705 } |
| 2706 |
| 2707 void GLES2Implementation::BindBufferBaseStub( |
| 2708 GLenum target, GLuint index, GLuint buffer) { |
| 2709 helper_->BindBufferBase(target, index, buffer); |
| 2710 if (share_group_->bind_generates_resource()) |
| 2711 helper_->CommandBufferHelper::Flush(); |
| 2712 } |
| 2713 |
| 2714 void GLES2Implementation::BindBufferRangeHelper( |
| 2715 GLenum target, GLuint index, GLuint buffer_id, |
| 2716 GLintptr offset, GLsizeiptr size) { |
| 2717 // TODO(zmo): See note #1 above. |
| 2718 // TODO(zmo): There's a bug here. If an arguments is invalid the ID will not |
| 2719 // be used even though it's marked it as used here. |
| 2720 GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind( |
| 2721 this, target, index, buffer_id, offset, size, |
| 2722 &GLES2Implementation::BindBufferRangeStub); |
| 2723 } |
| 2724 |
| 2725 void GLES2Implementation::BindBufferRangeStub( |
| 2726 GLenum target, GLuint index, GLuint buffer, |
| 2727 GLintptr offset, GLsizeiptr size) { |
| 2728 // TODO(zmo): uncomment the below call once the helper function is added. |
| 2729 // helper_->BindBufferRange(target, index, buffer, offset, size); |
| 2730 if (share_group_->bind_generates_resource()) |
| 2731 helper_->CommandBufferHelper::Flush(); |
| 2732 } |
| 2733 |
| 2698 void GLES2Implementation::BindFramebufferHelper( | 2734 void GLES2Implementation::BindFramebufferHelper( |
| 2699 GLenum target, GLuint framebuffer) { | 2735 GLenum target, GLuint framebuffer) { |
| 2700 // TODO(gman): See note #1 above. | 2736 // TODO(gman): See note #1 above. |
| 2701 bool changed = false; | 2737 bool changed = false; |
| 2702 switch (target) { | 2738 switch (target) { |
| 2703 case GL_FRAMEBUFFER: | 2739 case GL_FRAMEBUFFER: |
| 2704 if (bound_framebuffer_ != framebuffer || | 2740 if (bound_framebuffer_ != framebuffer || |
| 2705 bound_read_framebuffer_ != framebuffer) { | 2741 bound_read_framebuffer_ != framebuffer) { |
| 2706 bound_framebuffer_ = framebuffer; | 2742 bound_framebuffer_ = framebuffer; |
| 2707 bound_read_framebuffer_ = framebuffer; | 2743 bound_read_framebuffer_ = framebuffer; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2770 } | 2806 } |
| 2771 } | 2807 } |
| 2772 | 2808 |
| 2773 void GLES2Implementation::BindRenderbufferStub(GLenum target, | 2809 void GLES2Implementation::BindRenderbufferStub(GLenum target, |
| 2774 GLuint renderbuffer) { | 2810 GLuint renderbuffer) { |
| 2775 helper_->BindRenderbuffer(target, renderbuffer); | 2811 helper_->BindRenderbuffer(target, renderbuffer); |
| 2776 if (share_group_->bind_generates_resource()) | 2812 if (share_group_->bind_generates_resource()) |
| 2777 helper_->CommandBufferHelper::Flush(); | 2813 helper_->CommandBufferHelper::Flush(); |
| 2778 } | 2814 } |
| 2779 | 2815 |
| 2816 void GLES2Implementation::BindSamplerHelper(GLuint unit, |
| 2817 GLuint sampler) { |
| 2818 helper_->BindSampler(unit, sampler); |
| 2819 } |
| 2820 |
| 2780 void GLES2Implementation::BindTextureHelper(GLenum target, GLuint texture) { | 2821 void GLES2Implementation::BindTextureHelper(GLenum target, GLuint texture) { |
| 2781 // TODO(gman): See note #1 above. | 2822 // TODO(gman): See note #1 above. |
| 2782 // TODO(gman): Change this to false once we figure out why it's failing | 2823 // TODO(gman): Change this to false once we figure out why it's failing |
| 2783 // on daisy. | 2824 // on daisy. |
| 2784 bool changed = true; | 2825 bool changed = true; |
| 2785 TextureUnit& unit = texture_units_[active_texture_unit_]; | 2826 TextureUnit& unit = texture_units_[active_texture_unit_]; |
| 2786 switch (target) { | 2827 switch (target) { |
| 2787 case GL_TEXTURE_2D: | 2828 case GL_TEXTURE_2D: |
| 2788 if (unit.bound_texture_2d != texture) { | 2829 if (unit.bound_texture_2d != texture) { |
| 2789 unit.bound_texture_2d = texture; | 2830 unit.bound_texture_2d = texture; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2813 this, target, texture, &GLES2Implementation::BindTextureStub); | 2854 this, target, texture, &GLES2Implementation::BindTextureStub); |
| 2814 } | 2855 } |
| 2815 } | 2856 } |
| 2816 | 2857 |
| 2817 void GLES2Implementation::BindTextureStub(GLenum target, GLuint texture) { | 2858 void GLES2Implementation::BindTextureStub(GLenum target, GLuint texture) { |
| 2818 helper_->BindTexture(target, texture); | 2859 helper_->BindTexture(target, texture); |
| 2819 if (share_group_->bind_generates_resource()) | 2860 if (share_group_->bind_generates_resource()) |
| 2820 helper_->CommandBufferHelper::Flush(); | 2861 helper_->CommandBufferHelper::Flush(); |
| 2821 } | 2862 } |
| 2822 | 2863 |
| 2864 void GLES2Implementation::BindTransformFeedbackHelper( |
| 2865 GLenum target, GLuint transformfeedback) { |
| 2866 helper_->BindTransformFeedback(target, transformfeedback); |
| 2867 } |
| 2868 |
| 2823 void GLES2Implementation::BindVertexArrayOESHelper(GLuint array) { | 2869 void GLES2Implementation::BindVertexArrayOESHelper(GLuint array) { |
| 2824 // TODO(gman): See note #1 above. | 2870 // TODO(gman): See note #1 above. |
| 2825 bool changed = false; | 2871 bool changed = false; |
| 2826 if (vertex_array_object_manager_->BindVertexArray(array, &changed)) { | 2872 if (vertex_array_object_manager_->BindVertexArray(array, &changed)) { |
| 2827 if (changed) { | 2873 if (changed) { |
| 2828 // Unlike other BindXXXHelpers we don't call MarkAsUsedForBind | 2874 // Unlike other BindXXXHelpers we don't call MarkAsUsedForBind |
| 2829 // because unlike other resources VertexArrayObject ids must | 2875 // because unlike other resources VertexArrayObject ids must |
| 2830 // be generated by GenVertexArrays. A random id to Bind will not | 2876 // be generated by GenVertexArrays. A random id to Bind will not |
| 2831 // generate a new object. | 2877 // generate a new object. |
| 2832 helper_->BindVertexArrayOES(array); | 2878 helper_->BindVertexArrayOES(array); |
| (...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4356 return false; | 4402 return false; |
| 4357 } | 4403 } |
| 4358 | 4404 |
| 4359 // Include the auto-generated part of this file. We split this because it means | 4405 // Include the auto-generated part of this file. We split this because it means |
| 4360 // we can easily edit the non-auto generated parts right here in this file | 4406 // we can easily edit the non-auto generated parts right here in this file |
| 4361 // instead of having to edit some template or the code generator. | 4407 // instead of having to edit some template or the code generator. |
| 4362 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 4408 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 4363 | 4409 |
| 4364 } // namespace gles2 | 4410 } // namespace gles2 |
| 4365 } // namespace gpu | 4411 } // namespace gpu |
| OLD | NEW |