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

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: Created 7 years, 9 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 9950 matching lines...) Expand 10 before | Expand all | Expand 10 after
9961 if (!definition) { 9961 if (!definition) {
9962 LOCAL_SET_GL_ERROR( 9962 LOCAL_SET_GL_ERROR(
9963 GL_INVALID_OPERATION, 9963 GL_INVALID_OPERATION,
9964 "glProduceTextureCHROMIUM", "invalid texture"); 9964 "glProduceTextureCHROMIUM", "invalid texture");
9965 return; 9965 return;
9966 } 9966 }
9967 9967
9968 if (!group_->mailbox_manager()->ProduceTexture( 9968 if (!group_->mailbox_manager()->ProduceTexture(
9969 target, 9969 target,
9970 *reinterpret_cast<const MailboxName*>(mailbox), 9970 *reinterpret_cast<const MailboxName*>(mailbox),
9971 definition, 9971 definition)) {
9972 texture_manager())) {
9973 bool success = texture_manager()->Restore( 9972 bool success = texture_manager()->Restore(
9974 "glProductTextureCHROMIUM", this, texture, definition); 9973 "glProductTextureCHROMIUM", this, texture, definition);
9975 DCHECK(success); 9974 DCHECK(success);
9976 LOCAL_SET_GL_ERROR( 9975 LOCAL_SET_GL_ERROR(
9977 GL_INVALID_OPERATION, 9976 GL_INVALID_OPERATION,
9978 "glProduceTextureCHROMIUM", "invalid mailbox name"); 9977 "glProduceTextureCHROMIUM", "invalid mailbox name");
9979 return; 9978 return;
9980 } 9979 }
9981
9982 glBindTexture(texture->target(), texture->service_id());
9983 } 9980 }
9984 9981
9985 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, 9982 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
9986 const GLbyte* mailbox) { 9983 const GLbyte* mailbox) {
9987 Texture* texture = GetTextureInfoForTarget(target); 9984 Texture* texture = GetTextureInfoForTarget(target);
9988 if (!texture) { 9985 if (!texture) {
9989 LOCAL_SET_GL_ERROR( 9986 LOCAL_SET_GL_ERROR(
9990 GL_INVALID_OPERATION, 9987 GL_INVALID_OPERATION,
9991 "glConsumeTextureCHROMIUM", "unknown texture for target"); 9988 "glConsumeTextureCHROMIUM", "unknown texture for target");
9992 return; 9989 return;
9993 } 9990 }
9994 9991
9995 scoped_ptr<TextureDefinition> definition( 9992 scoped_refptr<TextureDefinition> definition(
9996 group_->mailbox_manager()->ConsumeTexture( 9993 group_->mailbox_manager()->ConsumeTexture(
9997 target, 9994 target,
9998 *reinterpret_cast<const MailboxName*>(mailbox))); 9995 *reinterpret_cast<const MailboxName*>(mailbox)));
9999 if (!definition.get()) { 9996 if (!definition.get()) {
10000 LOCAL_SET_GL_ERROR( 9997 LOCAL_SET_GL_ERROR(
10001 GL_INVALID_OPERATION, 9998 GL_INVALID_OPERATION,
10002 "glConsumeTextureCHROMIUM", "invalid mailbox name"); 9999 "glConsumeTextureCHROMIUM", "invalid mailbox name");
10003 return; 10000 return;
10004 } 10001 }
10005 10002
10006 if (!texture_manager()->Restore( 10003 if (!texture_manager()->Restore(
10007 "glConsumeTextureCHROMIUM", this, texture, definition.release())) { 10004 "glConsumeTextureCHROMIUM", this, texture, definition)) {
10008 LOCAL_SET_GL_ERROR( 10005 LOCAL_SET_GL_ERROR(
10009 GL_INVALID_OPERATION, 10006 GL_INVALID_OPERATION,
10010 "glConsumeTextureCHROMIUM", "invalid texture"); 10007 "glConsumeTextureCHROMIUM", "invalid texture");
10011 return; 10008 return;
10012 } 10009 }
10013 } 10010 }
10014 10011
10015 void GLES2DecoderImpl::DoInsertEventMarkerEXT( 10012 void GLES2DecoderImpl::DoInsertEventMarkerEXT(
10016 GLsizei length, const GLchar* marker) { 10013 GLsizei length, const GLchar* marker) {
10017 if (!marker) { 10014 if (!marker) {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
10439 return error::kNoError; 10436 return error::kNoError;
10440 } 10437 }
10441 10438
10442 // Include the auto-generated part of this file. We split this because it means 10439 // Include the auto-generated part of this file. We split this because it means
10443 // we can easily edit the non-auto generated parts right here in this file 10440 // we can easily edit the non-auto generated parts right here in this file
10444 // instead of having to edit some template or the code generator. 10441 // instead of having to edit some template or the code generator.
10445 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10442 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10446 10443
10447 } // namespace gles2 10444 } // namespace gles2
10448 } // namespace gpu 10445 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698