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

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

Issue 13543007: GLImage support for Android zero-copy pixel buffers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/PixelBuffer/GpuMemoryBuffer/ 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
« no previous file with comments | « no previous file | ui/gfx/native_widget_types.h » ('j') | ui/gl/gl_image.h » ('J')
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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 10131 matching lines...) Expand 10 before | Expand all | Expand 10 after
10142 } 10142 }
10143 10143
10144 gfx::GLImage* gl_image = image_manager()->LookupImage(image_id); 10144 gfx::GLImage* gl_image = image_manager()->LookupImage(image_id);
10145 if (!gl_image) { 10145 if (!gl_image) {
10146 LOCAL_SET_GL_ERROR( 10146 LOCAL_SET_GL_ERROR(
10147 GL_INVALID_OPERATION, 10147 GL_INVALID_OPERATION,
10148 "glBindTexImage2DCHROMIUM", "no image found with the given ID"); 10148 "glBindTexImage2DCHROMIUM", "no image found with the given ID");
10149 return; 10149 return;
10150 } 10150 }
10151 10151
10152 if (!gl_image->BindTexImage()) { 10152 {
10153 LOCAL_SET_GL_ERROR( 10153 ScopedGLErrorSuppressor suppressor(
10154 GL_INVALID_OPERATION, 10154 "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM", this);
10155 "glBindTexImage2DCHROMIUM", "fail to bind image with the given ID"); 10155 if (!gl_image->BindTexImage()) {
10156 return; 10156 LOCAL_SET_GL_ERROR(
10157 GL_INVALID_OPERATION,
10158 "glBindTexImage2DCHROMIUM", "fail to bind image with the given ID");
10159 return;
10160 }
10157 } 10161 }
10158 10162
10159 gfx::Size size = gl_image->GetSize(); 10163 gfx::Size size = gl_image->GetSize();
10160 texture_manager()->SetLevelInfo( 10164 texture_manager()->SetLevelInfo(
10161 texture, target, 0, GL_RGBA, size.width(), size.height(), 1, 0, 10165 texture, target, 0, GL_RGBA, size.width(), size.height(), 1, 0,
10162 GL_RGBA, GL_UNSIGNED_BYTE, true); 10166 GL_RGBA, GL_UNSIGNED_BYTE, true);
10163 texture_manager()->SetLevelImage(texture, target, 0, gl_image); 10167 texture_manager()->SetLevelImage(texture, target, 0, gl_image);
10164 } 10168 }
10165 10169
10166 void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM( 10170 void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM(
(...skipping 22 matching lines...) Expand all
10189 LOCAL_SET_GL_ERROR( 10193 LOCAL_SET_GL_ERROR(
10190 GL_INVALID_OPERATION, 10194 GL_INVALID_OPERATION,
10191 "glReleaseTexImage2DCHROMIUM", "no image found with the given ID"); 10195 "glReleaseTexImage2DCHROMIUM", "no image found with the given ID");
10192 return; 10196 return;
10193 } 10197 }
10194 10198
10195 // Do nothing when image is not currently bound. 10199 // Do nothing when image is not currently bound.
10196 if (texture->GetLevelImage(target, 0) != gl_image) 10200 if (texture->GetLevelImage(target, 0) != gl_image)
10197 return; 10201 return;
10198 10202
10199 gl_image->ReleaseTexImage(); 10203 {
10204 ScopedGLErrorSuppressor suppressor(
10205 "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM", this);
10206 gl_image->ReleaseTexImage();
10207 }
10200 10208
10201 texture_manager()->SetLevelInfo( 10209 texture_manager()->SetLevelInfo(
10202 texture, target, 0, GL_RGBA, 0, 0, 1, 0, 10210 texture, target, 0, GL_RGBA, 0, 0, 1, 0,
10203 GL_RGBA, GL_UNSIGNED_BYTE, false); 10211 GL_RGBA, GL_UNSIGNED_BYTE, false);
10204 } 10212 }
10205 10213
10206 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( 10214 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM(
10207 uint32 immediate_data_size, const cmds::TraceBeginCHROMIUM& c) { 10215 uint32 immediate_data_size, const cmds::TraceBeginCHROMIUM& c) {
10208 Bucket* bucket = GetBucket(c.bucket_id); 10216 Bucket* bucket = GetBucket(c.bucket_id);
10209 if (!bucket || bucket->size() == 0) { 10217 if (!bucket || bucket->size() == 0) {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
10525 return error::kNoError; 10533 return error::kNoError;
10526 } 10534 }
10527 10535
10528 // Include the auto-generated part of this file. We split this because it means 10536 // Include the auto-generated part of this file. We split this because it means
10529 // we can easily edit the non-auto generated parts right here in this file 10537 // we can easily edit the non-auto generated parts right here in this file
10530 // instead of having to edit some template or the code generator. 10538 // instead of having to edit some template or the code generator.
10531 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10539 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10532 10540
10533 } // namespace gles2 10541 } // namespace gles2
10534 } // namespace gpu 10542 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/native_widget_types.h » ('j') | ui/gl/gl_image.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698