Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 14456004: GPU client side changes for GpuMemoryBuffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@glapi
Patch Set: Implement DeleteImageBuffersHelper and remove unused GetNativeBufferForGpuMemoryBuffer Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 bool GenBuffersHelper(GLsizei n, const GLuint* client_ids); 698 bool GenBuffersHelper(GLsizei n, const GLuint* client_ids);
699 void DeleteBuffersHelper(GLsizei n, const GLuint* client_ids); 699 void DeleteBuffersHelper(GLsizei n, const GLuint* client_ids);
700 bool GenFramebuffersHelper(GLsizei n, const GLuint* client_ids); 700 bool GenFramebuffersHelper(GLsizei n, const GLuint* client_ids);
701 void DeleteFramebuffersHelper(GLsizei n, const GLuint* client_ids); 701 void DeleteFramebuffersHelper(GLsizei n, const GLuint* client_ids);
702 bool GenRenderbuffersHelper(GLsizei n, const GLuint* client_ids); 702 bool GenRenderbuffersHelper(GLsizei n, const GLuint* client_ids);
703 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* client_ids); 703 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* client_ids);
704 bool GenQueriesEXTHelper(GLsizei n, const GLuint* client_ids); 704 bool GenQueriesEXTHelper(GLsizei n, const GLuint* client_ids);
705 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* client_ids); 705 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* client_ids);
706 bool GenVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); 706 bool GenVertexArraysOESHelper(GLsizei n, const GLuint* client_ids);
707 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); 707 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* client_ids);
708 bool GenImageBuffersHelper(GLsizei n, const GLuint* client_ids);
709 void DeleteImageBuffersHelper(GLsizei n, const GLuint* client_ids);
708 710
709 // Workarounds 711 // Workarounds
710 void OnFboChanged() const; 712 void OnFboChanged() const;
711 void OnUseFramebuffer() const; 713 void OnUseFramebuffer() const;
712 714
713 // TODO(gman): Cache these pointers? 715 // TODO(gman): Cache these pointers?
714 BufferManager* buffer_manager() { 716 BufferManager* buffer_manager() {
715 return group_->buffer_manager(); 717 return group_->buffer_manager();
716 } 718 }
717 719
(...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 } 2692 }
2691 } 2693 }
2692 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); 2694 scoped_ptr<GLuint[]> service_ids(new GLuint[n]);
2693 glGenTextures(n, service_ids.get()); 2695 glGenTextures(n, service_ids.get());
2694 for (GLsizei ii = 0; ii < n; ++ii) { 2696 for (GLsizei ii = 0; ii < n; ++ii) {
2695 CreateTexture(client_ids[ii], service_ids[ii]); 2697 CreateTexture(client_ids[ii], service_ids[ii]);
2696 } 2698 }
2697 return true; 2699 return true;
2698 } 2700 }
2699 2701
2702 bool GLES2DecoderImpl::GenImageBuffersHelper(GLsizei n,
2703 const GLuint* client_ids) {
2704 for (GLsizei ii = 0; ii < n; ++ii) {
2705 if (image_manager()->LookupImage(client_ids[ii])) {
2706 return false;
2707 }
2708 }
2709
2710 // Image already inserted into the ImageManager within GpuMemoryBufferFactory.
2711 return true;
2712 }
2713
2700 void GLES2DecoderImpl::DeleteBuffersHelper( 2714 void GLES2DecoderImpl::DeleteBuffersHelper(
2701 GLsizei n, const GLuint* client_ids) { 2715 GLsizei n, const GLuint* client_ids) {
2702 for (GLsizei ii = 0; ii < n; ++ii) { 2716 for (GLsizei ii = 0; ii < n; ++ii) {
2703 Buffer* buffer = GetBuffer(client_ids[ii]); 2717 Buffer* buffer = GetBuffer(client_ids[ii]);
2704 if (buffer && !buffer->IsDeleted()) { 2718 if (buffer && !buffer->IsDeleted()) {
2705 state_.vertex_attrib_manager->Unbind(buffer); 2719 state_.vertex_attrib_manager->Unbind(buffer);
2706 if (state_.bound_array_buffer == buffer) { 2720 if (state_.bound_array_buffer == buffer) {
2707 state_.bound_array_buffer = NULL; 2721 state_.bound_array_buffer = NULL;
2708 } 2722 }
2709 RemoveBuffer(client_ids[ii]); 2723 RemoveBuffer(client_ids[ii]);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 #if defined(OS_MACOSX) 2822 #if defined(OS_MACOSX)
2809 if (texture->target() == GL_TEXTURE_RECTANGLE_ARB) { 2823 if (texture->target() == GL_TEXTURE_RECTANGLE_ARB) {
2810 ReleaseIOSurfaceForTexture(service_id); 2824 ReleaseIOSurfaceForTexture(service_id);
2811 } 2825 }
2812 #endif 2826 #endif
2813 RemoveTexture(client_ids[ii]); 2827 RemoveTexture(client_ids[ii]);
2814 } 2828 }
2815 } 2829 }
2816 } 2830 }
2817 2831
2832 void GLES2DecoderImpl::DeleteImageBuffersHelper(
2833 GLsizei n, const GLuint* client_ids) {
2834 for (GLsizei ii = 0; ii < n; ++ii) {
2835 image_manager()->RemoveImage(client_ids[ii]);
2836 }
2837 }
2838
2818 // } // anonymous namespace 2839 // } // anonymous namespace
2819 2840
2820 bool GLES2DecoderImpl::MakeCurrent() { 2841 bool GLES2DecoderImpl::MakeCurrent() {
2821 if (!context_.get() || !context_->MakeCurrent(surface_.get())) 2842 if (!context_.get() || !context_->MakeCurrent(surface_.get()))
2822 return false; 2843 return false;
2823 2844
2824 if (WasContextLost()) { 2845 if (WasContextLost()) {
2825 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent."; 2846 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent.";
2826 2847
2827 // Some D3D drivers cannot recover from device lost in the GPU process 2848 // Some D3D drivers cannot recover from device lost in the GPU process
(...skipping 7584 matching lines...) Expand 10 before | Expand all | Expand 10 after
10412 return error::kNoError; 10433 return error::kNoError;
10413 } 10434 }
10414 10435
10415 // Include the auto-generated part of this file. We split this because it means 10436 // Include the auto-generated part of this file. We split this because it means
10416 // we can easily edit the non-auto generated parts right here in this file 10437 // we can easily edit the non-auto generated parts right here in this file
10417 // instead of having to edit some template or the code generator. 10438 // instead of having to edit some template or the code generator.
10418 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10439 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10419 10440
10420 } // namespace gles2 10441 } // namespace gles2
10421 } // namespace gpu 10442 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698