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

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: Address piman's comments 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/mailbox_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 Texture* texture =
4795 static_cast<Texture*>(group_->mailbox_manager()->ConsumeTexture(mailbox));
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 Texture* texture =
16058 static_cast<Texture*>(group_->mailbox_manager()->ConsumeTexture(mailbox));
16055 if (!texture) { 16059 if (!texture) {
16056 LOCAL_SET_GL_ERROR( 16060 LOCAL_SET_GL_ERROR(
16057 GL_INVALID_OPERATION, 16061 GL_INVALID_OPERATION,
16058 "glConsumeTextureCHROMIUM", "invalid mailbox name"); 16062 "glConsumeTextureCHROMIUM", "invalid mailbox name");
16059 return; 16063 return;
16060 } 16064 }
16061 if (texture->target() != target) { 16065 if (texture->target() != target) {
16062 LOCAL_SET_GL_ERROR( 16066 LOCAL_SET_GL_ERROR(
16063 GL_INVALID_OPERATION, 16067 GL_INVALID_OPERATION,
16064 "glConsumeTextureCHROMIUM", "invalid target"); 16068 "glConsumeTextureCHROMIUM", "invalid target");
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
16104 16108
16105 TextureRef* texture_ref = GetTexture(client_id); 16109 TextureRef* texture_ref = GetTexture(client_id);
16106 if (texture_ref) { 16110 if (texture_ref) {
16107 // No need to call EnsureTextureForClientId here, the client_id already has 16111 // No need to call EnsureTextureForClientId here, the client_id already has
16108 // an associated texture. 16112 // an associated texture.
16109 LOCAL_SET_GL_ERROR( 16113 LOCAL_SET_GL_ERROR(
16110 GL_INVALID_OPERATION, 16114 GL_INVALID_OPERATION,
16111 "glCreateAndConsumeTextureCHROMIUM", "client id already in use"); 16115 "glCreateAndConsumeTextureCHROMIUM", "client id already in use");
16112 return; 16116 return;
16113 } 16117 }
16114 Texture* texture = group_->mailbox_manager()->ConsumeTexture(mailbox); 16118 Texture* texture =
16119 static_cast<Texture*>(group_->mailbox_manager()->ConsumeTexture(mailbox));
16115 if (!texture) { 16120 if (!texture) {
16116 EnsureTextureForClientId(target, client_id); 16121 EnsureTextureForClientId(target, client_id);
16117 LOCAL_SET_GL_ERROR( 16122 LOCAL_SET_GL_ERROR(
16118 GL_INVALID_OPERATION, 16123 GL_INVALID_OPERATION,
16119 "glCreateAndConsumeTextureCHROMIUM", "invalid mailbox name"); 16124 "glCreateAndConsumeTextureCHROMIUM", "invalid mailbox name");
16120 return; 16125 return;
16121 } 16126 }
16122 16127
16123 if (texture->target() != target) { 16128 if (texture->target() != target) {
16124 EnsureTextureForClientId(target, client_id); 16129 EnsureTextureForClientId(target, client_id);
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after
17929 } 17934 }
17930 17935
17931 // Include the auto-generated part of this file. We split this because it means 17936 // 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 17937 // 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. 17938 // instead of having to edit some template or the code generator.
17934 #include "base/macros.h" 17939 #include "base/macros.h"
17935 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17940 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17936 17941
17937 } // namespace gles2 17942 } // namespace gles2
17938 } // namespace gpu 17943 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/mailbox_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698