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

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

Issue 2315313003: Add a base class of Texture for interfacing with the mailbox manager. (Closed)
Patch Set: Created 4 years, 3 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 <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 4773 matching lines...) Expand 10 before | Expand all | Expand 10 after
4784 // that. 4784 // that.
4785 SavedBackTexture save; 4785 SavedBackTexture save;
4786 save.back_texture.swap(offscreen_saved_color_texture_); 4786 save.back_texture.swap(offscreen_saved_color_texture_);
4787 save.in_use = true; 4787 save.in_use = true;
4788 saved_back_textures_.push_back(std::move(save)); 4788 saved_back_textures_.push_back(std::move(save));
4789 4789
4790 CreateBackTexture(); 4790 CreateBackTexture();
4791 } 4791 }
4792 4792
4793 void GLES2DecoderImpl::ReturnFrontBuffer(const Mailbox& mailbox, bool is_lost) { 4793 void GLES2DecoderImpl::ReturnFrontBuffer(const Mailbox& mailbox, bool is_lost) {
4794 Texture* texture = mailbox_manager()->ConsumeTexture(mailbox); 4794 TextureBase* texture_base = mailbox_manager()->ConsumeTexture(mailbox);
4795 Texture* texture = texture_base ? texture_base->AsTexture() : nullptr;
4796
4795 for (auto it = saved_back_textures_.begin(); it != saved_back_textures_.end(); 4797 for (auto it = saved_back_textures_.begin(); it != saved_back_textures_.end();
4796 ++it) { 4798 ++it) {
4797 if (texture != it->back_texture->texture_ref()->texture()) 4799 if (texture != it->back_texture->texture_ref()->texture())
4798 continue; 4800 continue;
4799 4801
4800 if (is_lost || it->back_texture->size() != offscreen_size_) { 4802 if (is_lost || it->back_texture->size() != offscreen_size_) {
4801 it->back_texture->Invalidate(); 4803 it->back_texture->Invalidate();
4802 saved_back_textures_.erase(it); 4804 saved_back_textures_.erase(it);
4803 return; 4805 return;
4804 } 4806 }
(...skipping 11239 matching lines...) Expand 10 before | Expand all | Expand 10 after
16044 "unknown texture for target"); 16046 "unknown texture for target");
16045 return; 16047 return;
16046 } 16048 }
16047 GLuint client_id = texture_ref->client_id(); 16049 GLuint client_id = texture_ref->client_id();
16048 if (!client_id) { 16050 if (!client_id) {
16049 LOCAL_SET_GL_ERROR( 16051 LOCAL_SET_GL_ERROR(
16050 GL_INVALID_OPERATION, 16052 GL_INVALID_OPERATION,
16051 "glConsumeTextureCHROMIUM", "unknown texture for target"); 16053 "glConsumeTextureCHROMIUM", "unknown texture for target");
16052 return; 16054 return;
16053 } 16055 }
16054 Texture* texture = group_->mailbox_manager()->ConsumeTexture(mailbox); 16056
16057 TextureBase* texture_base =
16058 group_->mailbox_manager()->ConsumeTexture(mailbox);
16059 Texture* texture = texture_base ? texture_base->AsTexture() : nullptr;
16055 if (!texture) { 16060 if (!texture) {
16056 LOCAL_SET_GL_ERROR( 16061 LOCAL_SET_GL_ERROR(
16057 GL_INVALID_OPERATION, 16062 GL_INVALID_OPERATION,
16058 "glConsumeTextureCHROMIUM", "invalid mailbox name"); 16063 "glConsumeTextureCHROMIUM", "invalid mailbox name");
16059 return; 16064 return;
16060 } 16065 }
16061 if (texture->target() != target) { 16066 if (texture->target() != target) {
16062 LOCAL_SET_GL_ERROR( 16067 LOCAL_SET_GL_ERROR(
16063 GL_INVALID_OPERATION, 16068 GL_INVALID_OPERATION,
16064 "glConsumeTextureCHROMIUM", "invalid target"); 16069 "glConsumeTextureCHROMIUM", "invalid target");
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
16104 16109
16105 TextureRef* texture_ref = GetTexture(client_id); 16110 TextureRef* texture_ref = GetTexture(client_id);
16106 if (texture_ref) { 16111 if (texture_ref) {
16107 // No need to call EnsureTextureForClientId here, the client_id already has 16112 // No need to call EnsureTextureForClientId here, the client_id already has
16108 // an associated texture. 16113 // an associated texture.
16109 LOCAL_SET_GL_ERROR( 16114 LOCAL_SET_GL_ERROR(
16110 GL_INVALID_OPERATION, 16115 GL_INVALID_OPERATION,
16111 "glCreateAndConsumeTextureCHROMIUM", "client id already in use"); 16116 "glCreateAndConsumeTextureCHROMIUM", "client id already in use");
16112 return; 16117 return;
16113 } 16118 }
16114 Texture* texture = group_->mailbox_manager()->ConsumeTexture(mailbox); 16119 TextureBase* texture_base =
16120 group_->mailbox_manager()->ConsumeTexture(mailbox);
16121 Texture* texture = texture_base ? texture_base->AsTexture() : nullptr;
16115 if (!texture) { 16122 if (!texture) {
16116 EnsureTextureForClientId(target, client_id); 16123 EnsureTextureForClientId(target, client_id);
16117 LOCAL_SET_GL_ERROR( 16124 LOCAL_SET_GL_ERROR(
16118 GL_INVALID_OPERATION, 16125 GL_INVALID_OPERATION,
16119 "glCreateAndConsumeTextureCHROMIUM", "invalid mailbox name"); 16126 "glCreateAndConsumeTextureCHROMIUM", "invalid mailbox name");
16120 return; 16127 return;
16121 } 16128 }
16122 16129
16123 if (texture->target() != target) { 16130 if (texture->target() != target) {
16124 EnsureTextureForClientId(target, client_id); 16131 EnsureTextureForClientId(target, client_id);
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after
17929 } 17936 }
17930 17937
17931 // Include the auto-generated part of this file. We split this because it means 17938 // Include the auto-generated part of this file. We split this because it means
17932 // we can easily edit the non-auto generated parts right here in this file 17939 // we can easily edit the non-auto generated parts right here in this file
17933 // instead of having to edit some template or the code generator. 17940 // instead of having to edit some template or the code generator.
17934 #include "base/macros.h" 17941 #include "base/macros.h"
17935 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17942 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17936 17943
17937 } // namespace gles2 17944 } // namespace gles2
17938 } // namespace gpu 17945 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/mailbox_manager.h » ('j') | gpu/command_buffer/service/mailbox_manager_sync.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698