OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 2664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 active_texture_unit_ = texture_index; | 2675 active_texture_unit_ = texture_index; |
2676 glActiveTexture(texture_unit); | 2676 glActiveTexture(texture_unit); |
2677 } | 2677 } |
2678 | 2678 |
2679 void GLES2DecoderImpl::DoBindBuffer(GLenum target, GLuint client_id) { | 2679 void GLES2DecoderImpl::DoBindBuffer(GLenum target, GLuint client_id) { |
2680 BufferManager::BufferInfo* info = NULL; | 2680 BufferManager::BufferInfo* info = NULL; |
2681 GLuint service_id = 0; | 2681 GLuint service_id = 0; |
2682 if (client_id != 0) { | 2682 if (client_id != 0) { |
2683 info = GetBufferInfo(client_id); | 2683 info = GetBufferInfo(client_id); |
2684 if (!info) { | 2684 if (!info) { |
| 2685 if (!group_->bind_generates_resource()) { |
| 2686 SetGLError(GL_INVALID_VALUE, |
| 2687 "glBindBuffer: id not generated by glGenBuffers"); |
| 2688 return; |
| 2689 } |
| 2690 |
2685 // It's a new id so make a buffer info for it. | 2691 // It's a new id so make a buffer info for it. |
2686 glGenBuffersARB(1, &service_id); | 2692 glGenBuffersARB(1, &service_id); |
2687 CreateBufferInfo(client_id, service_id); | 2693 CreateBufferInfo(client_id, service_id); |
2688 info = GetBufferInfo(client_id); | 2694 info = GetBufferInfo(client_id); |
2689 IdAllocatorInterface* id_allocator = | 2695 IdAllocatorInterface* id_allocator = |
2690 group_->GetIdAllocator(id_namespaces::kBuffers); | 2696 group_->GetIdAllocator(id_namespaces::kBuffers); |
2691 id_allocator->MarkAsUsed(client_id); | 2697 id_allocator->MarkAsUsed(client_id); |
2692 } | 2698 } |
2693 } | 2699 } |
2694 if (info) { | 2700 if (info) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2754 state_dirty_ = false; | 2760 state_dirty_ = false; |
2755 } | 2761 } |
2756 } | 2762 } |
2757 | 2763 |
2758 void GLES2DecoderImpl::DoBindFramebuffer(GLenum target, GLuint client_id) { | 2764 void GLES2DecoderImpl::DoBindFramebuffer(GLenum target, GLuint client_id) { |
2759 FramebufferManager::FramebufferInfo* info = NULL; | 2765 FramebufferManager::FramebufferInfo* info = NULL; |
2760 GLuint service_id = 0; | 2766 GLuint service_id = 0; |
2761 if (client_id != 0) { | 2767 if (client_id != 0) { |
2762 info = GetFramebufferInfo(client_id); | 2768 info = GetFramebufferInfo(client_id); |
2763 if (!info) { | 2769 if (!info) { |
| 2770 if (!group_->bind_generates_resource()) { |
| 2771 SetGLError(GL_INVALID_VALUE, |
| 2772 "glBindFramebuffer: id not generated by glGenFramebuffers"); |
| 2773 return; |
| 2774 } |
| 2775 |
2764 // It's a new id so make a framebuffer info for it. | 2776 // It's a new id so make a framebuffer info for it. |
2765 glGenFramebuffersEXT(1, &service_id); | 2777 glGenFramebuffersEXT(1, &service_id); |
2766 CreateFramebufferInfo(client_id, service_id); | 2778 CreateFramebufferInfo(client_id, service_id); |
2767 info = GetFramebufferInfo(client_id); | 2779 info = GetFramebufferInfo(client_id); |
2768 IdAllocatorInterface* id_allocator = | 2780 IdAllocatorInterface* id_allocator = |
2769 group_->GetIdAllocator(id_namespaces::kFramebuffers); | 2781 group_->GetIdAllocator(id_namespaces::kFramebuffers); |
2770 id_allocator->MarkAsUsed(client_id); | 2782 id_allocator->MarkAsUsed(client_id); |
2771 } else { | 2783 } else { |
2772 service_id = info->service_id(); | 2784 service_id = info->service_id(); |
2773 } | 2785 } |
(...skipping 19 matching lines...) Expand all Loading... |
2793 | 2805 |
2794 glBindFramebufferEXT(target, service_id); | 2806 glBindFramebufferEXT(target, service_id); |
2795 } | 2807 } |
2796 | 2808 |
2797 void GLES2DecoderImpl::DoBindRenderbuffer(GLenum target, GLuint client_id) { | 2809 void GLES2DecoderImpl::DoBindRenderbuffer(GLenum target, GLuint client_id) { |
2798 RenderbufferManager::RenderbufferInfo* info = NULL; | 2810 RenderbufferManager::RenderbufferInfo* info = NULL; |
2799 GLuint service_id = 0; | 2811 GLuint service_id = 0; |
2800 if (client_id != 0) { | 2812 if (client_id != 0) { |
2801 info = GetRenderbufferInfo(client_id); | 2813 info = GetRenderbufferInfo(client_id); |
2802 if (!info) { | 2814 if (!info) { |
| 2815 if (!group_->bind_generates_resource()) { |
| 2816 SetGLError( |
| 2817 GL_INVALID_VALUE, |
| 2818 "glBindRenderbuffer: id not generated by glGenRenderbuffers"); |
| 2819 return; |
| 2820 } |
| 2821 |
2803 // It's a new id so make a renderbuffer info for it. | 2822 // It's a new id so make a renderbuffer info for it. |
2804 glGenRenderbuffersEXT(1, &service_id); | 2823 glGenRenderbuffersEXT(1, &service_id); |
2805 CreateRenderbufferInfo(client_id, service_id); | 2824 CreateRenderbufferInfo(client_id, service_id); |
2806 info = GetRenderbufferInfo(client_id); | 2825 info = GetRenderbufferInfo(client_id); |
2807 IdAllocatorInterface* id_allocator = | 2826 IdAllocatorInterface* id_allocator = |
2808 group_->GetIdAllocator(id_namespaces::kRenderbuffers); | 2827 group_->GetIdAllocator(id_namespaces::kRenderbuffers); |
2809 id_allocator->MarkAsUsed(client_id); | 2828 id_allocator->MarkAsUsed(client_id); |
2810 } else { | 2829 } else { |
2811 service_id = info->service_id(); | 2830 service_id = info->service_id(); |
2812 } | 2831 } |
2813 info->MarkAsValid(); | 2832 info->MarkAsValid(); |
2814 } | 2833 } |
2815 bound_renderbuffer_ = info; | 2834 bound_renderbuffer_ = info; |
2816 glBindRenderbufferEXT(target, service_id); | 2835 glBindRenderbufferEXT(target, service_id); |
2817 } | 2836 } |
2818 | 2837 |
2819 void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) { | 2838 void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) { |
2820 TextureManager::TextureInfo* info = NULL; | 2839 TextureManager::TextureInfo* info = NULL; |
2821 GLuint service_id = 0; | 2840 GLuint service_id = 0; |
2822 if (client_id != 0) { | 2841 if (client_id != 0) { |
2823 info = GetTextureInfo(client_id); | 2842 info = GetTextureInfo(client_id); |
2824 if (!info) { | 2843 if (!info) { |
| 2844 if (!group_->bind_generates_resource()) { |
| 2845 SetGLError(GL_INVALID_VALUE, |
| 2846 "glBindTexture: id not generated by glGenTextures"); |
| 2847 return; |
| 2848 } |
| 2849 |
2825 // It's a new id so make a texture info for it. | 2850 // It's a new id so make a texture info for it. |
2826 glGenTextures(1, &service_id); | 2851 glGenTextures(1, &service_id); |
2827 CreateTextureInfo(client_id, service_id); | 2852 CreateTextureInfo(client_id, service_id); |
2828 info = GetTextureInfo(client_id); | 2853 info = GetTextureInfo(client_id); |
2829 IdAllocatorInterface* id_allocator = | 2854 IdAllocatorInterface* id_allocator = |
2830 group_->GetIdAllocator(id_namespaces::kTextures); | 2855 group_->GetIdAllocator(id_namespaces::kTextures); |
2831 id_allocator->MarkAsUsed(client_id); | 2856 id_allocator->MarkAsUsed(client_id); |
2832 } | 2857 } |
2833 } else { | 2858 } else { |
2834 info = texture_manager()->GetDefaultTextureInfo(target); | 2859 info = texture_manager()->GetDefaultTextureInfo(target); |
(...skipping 3953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6788 return false; | 6813 return false; |
6789 } | 6814 } |
6790 | 6815 |
6791 // Include the auto-generated part of this file. We split this because it means | 6816 // Include the auto-generated part of this file. We split this because it means |
6792 // we can easily edit the non-auto generated parts right here in this file | 6817 // we can easily edit the non-auto generated parts right here in this file |
6793 // instead of having to edit some template or the code generator. | 6818 // instead of having to edit some template or the code generator. |
6794 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 6819 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
6795 | 6820 |
6796 } // namespace gles2 | 6821 } // namespace gles2 |
6797 } // namespace gpu | 6822 } // namespace gpu |
OLD | NEW |