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

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

Issue 12717013: Add reference-counting for mailbox textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add optional 'pool' reference while textures are in mailbox Created 7 years, 8 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 | Annotate | Revision Log
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 9974 matching lines...) Expand 10 before | Expand all | Expand 10 after
9985 LOCAL_SET_GL_ERROR( 9985 LOCAL_SET_GL_ERROR(
9986 GL_INVALID_OPERATION, 9986 GL_INVALID_OPERATION,
9987 "glProduceTextureCHROMIUM", "invalid texture"); 9987 "glProduceTextureCHROMIUM", "invalid texture");
9988 return; 9988 return;
9989 } 9989 }
9990 9990
9991 if (!group_->mailbox_manager()->ProduceTexture( 9991 if (!group_->mailbox_manager()->ProduceTexture(
9992 target, 9992 target,
9993 *reinterpret_cast<const MailboxName*>(mailbox), 9993 *reinterpret_cast<const MailboxName*>(mailbox),
9994 definition, 9994 definition,
9995 texture_manager())) { 9995 MailboxManager::TexturePoolNone)) {
9996 bool success = texture_manager()->Restore( 9996 bool success = texture_manager()->Restore(
9997 "glProductTextureCHROMIUM", this, texture, definition); 9997 "glProductTextureCHROMIUM", this, texture, definition);
9998 DCHECK(success); 9998 DCHECK(success);
9999 LOCAL_SET_GL_ERROR( 9999 LOCAL_SET_GL_ERROR(
10000 GL_INVALID_OPERATION, 10000 GL_INVALID_OPERATION,
10001 "glProduceTextureCHROMIUM", "invalid mailbox name"); 10001 "glProduceTextureCHROMIUM", "invalid mailbox name");
10002 return; 10002 return;
10003 } 10003 }
10004 10004
10005 glBindTexture(texture->target(), texture->service_id()); 10005 glBindTexture(texture->target(), texture->service_id());
10006 } 10006 }
10007 10007
10008 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, 10008 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
10009 const GLbyte* mailbox) { 10009 const GLbyte* mailbox) {
10010 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM", 10010 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM",
10011 "context", GetLogPrefix(), 10011 "context", GetLogPrefix(),
10012 "mailbox[0]", static_cast<unsigned char>(mailbox[0])); 10012 "mailbox[0]", static_cast<unsigned char>(mailbox[0]));
10013 10013
10014 Texture* texture = GetTextureInfoForTarget(target); 10014 Texture* texture = GetTextureInfoForTarget(target);
10015 if (!texture) { 10015 if (!texture) {
10016 LOCAL_SET_GL_ERROR( 10016 LOCAL_SET_GL_ERROR(
10017 GL_INVALID_OPERATION, 10017 GL_INVALID_OPERATION,
10018 "glConsumeTextureCHROMIUM", "unknown texture for target"); 10018 "glConsumeTextureCHROMIUM", "unknown texture for target");
10019 return; 10019 return;
10020 } 10020 }
10021 10021
10022 scoped_ptr<TextureDefinition> definition( 10022 TextureDefinition* definition(
10023 group_->mailbox_manager()->ConsumeTexture( 10023 group_->mailbox_manager()->ConsumeTexture(
10024 target, 10024 target,
10025 *reinterpret_cast<const MailboxName*>(mailbox))); 10025 *reinterpret_cast<const MailboxName*>(mailbox)));
10026 if (!definition.get()) { 10026 if (!definition) {
10027 LOCAL_SET_GL_ERROR( 10027 LOCAL_SET_GL_ERROR(
10028 GL_INVALID_OPERATION, 10028 GL_INVALID_OPERATION,
10029 "glConsumeTextureCHROMIUM", "invalid mailbox name"); 10029 "glConsumeTextureCHROMIUM", "invalid mailbox name");
10030 return; 10030 return;
10031 } 10031 }
10032 10032
10033 if (!texture_manager()->Restore( 10033 if (!texture_manager()->Restore(
10034 "glConsumeTextureCHROMIUM", this, texture, definition.release())) { 10034 "glConsumeTextureCHROMIUM", this, texture, definition)) {
10035 LOCAL_SET_GL_ERROR( 10035 LOCAL_SET_GL_ERROR(
10036 GL_INVALID_OPERATION, 10036 GL_INVALID_OPERATION,
10037 "glConsumeTextureCHROMIUM", "invalid texture"); 10037 "glConsumeTextureCHROMIUM", "invalid texture");
10038 return; 10038 return;
10039 } 10039 }
10040 } 10040 }
10041 10041
10042 void GLES2DecoderImpl::DoInsertEventMarkerEXT( 10042 void GLES2DecoderImpl::DoInsertEventMarkerEXT(
10043 GLsizei length, const GLchar* marker) { 10043 GLsizei length, const GLchar* marker) {
10044 if (!marker) { 10044 if (!marker) {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
10466 return error::kNoError; 10466 return error::kNoError;
10467 } 10467 }
10468 10468
10469 // Include the auto-generated part of this file. We split this because it means 10469 // Include the auto-generated part of this file. We split this because it means
10470 // we can easily edit the non-auto generated parts right here in this file 10470 // we can easily edit the non-auto generated parts right here in this file
10471 // instead of having to edit some template or the code generator. 10471 // instead of having to edit some template or the code generator.
10472 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10472 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10473 10473
10474 } // namespace gles2 10474 } // namespace gles2
10475 } // namespace gpu 10475 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_group.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698