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

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

Issue 12647003: Refactor a bunch of Texture related GPU code (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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 } 704 }
705 705
706 // Creates a Texture for the given texture. 706 // Creates a Texture for the given texture.
707 Texture* CreateTexture( 707 Texture* CreateTexture(
708 GLuint client_id, GLuint service_id) { 708 GLuint client_id, GLuint service_id) {
709 return texture_manager()->CreateTexture(client_id, service_id); 709 return texture_manager()->CreateTexture(client_id, service_id);
710 } 710 }
711 711
712 // Gets the texture info for the given texture. Returns NULL if none exists. 712 // Gets the texture info for the given texture. Returns NULL if none exists.
713 Texture* GetTexture(GLuint client_id) const { 713 Texture* GetTexture(GLuint client_id) const {
714 Texture* info = 714 return texture_manager()->GetTexture(client_id);
715 texture_manager()->GetTexture(client_id);
716 return info;
717 } 715 }
718 716
719 // Deletes the texture info for the given texture. 717 // Deletes the texture info for the given texture.
720 void RemoveTexture(GLuint client_id) { 718 void RemoveTexture(GLuint client_id) {
721 texture_manager()->RemoveTexture(client_id); 719 texture_manager()->RemoveTexture(client_id);
722 } 720 }
723 721
724 // Get the size (in pixels) of the currently bound frame buffer (either FBO 722 // Get the size (in pixels) of the currently bound frame buffer (either FBO
725 // or regular back buffer). 723 // or regular back buffer).
726 gfx::Size GetBoundReadFrameBufferSize(); 724 gfx::Size GetBoundReadFrameBufferSize();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 GLint yoffset, 822 GLint yoffset,
825 GLsizei width, 823 GLsizei width,
826 GLsizei height, 824 GLsizei height,
827 GLenum format, 825 GLenum format,
828 GLenum type, 826 GLenum type,
829 const void * data); 827 const void * data);
830 828
831 // Extra validation for async tex(Sub)Image2D. 829 // Extra validation for async tex(Sub)Image2D.
832 bool ValidateAsyncTransfer( 830 bool ValidateAsyncTransfer(
833 const char* function_name, 831 const char* function_name,
834 Texture* info, 832 Texture* texture,
835 GLenum target, 833 GLenum target,
836 GLint level, 834 GLint level,
837 const void * data); 835 const void * data);
838 836
839 // Wrapper for TexImageIOSurface2DCHROMIUM. 837 // Wrapper for TexImageIOSurface2DCHROMIUM.
840 void DoTexImageIOSurface2DCHROMIUM( 838 void DoTexImageIOSurface2DCHROMIUM(
841 GLenum target, 839 GLenum target,
842 GLsizei width, 840 GLsizei width,
843 GLsizei height, 841 GLsizei height,
844 GLuint io_surface_id, 842 GLuint io_surface_id,
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 1043
1046 // Helper for glShaderSource. 1044 // Helper for glShaderSource.
1047 error::Error ShaderSourceHelper( 1045 error::Error ShaderSourceHelper(
1048 GLuint client_id, const char* data, uint32 data_size); 1046 GLuint client_id, const char* data, uint32 data_size);
1049 1047
1050 // Clear any textures used by the current program. 1048 // Clear any textures used by the current program.
1051 bool ClearUnclearedTextures(); 1049 bool ClearUnclearedTextures();
1052 1050
1053 // Clear any uncleared level in texture. 1051 // Clear any uncleared level in texture.
1054 // Returns false if there was a generated GL error. 1052 // Returns false if there was a generated GL error.
1055 bool ClearTexture(Texture* info); 1053 bool ClearTexture(Texture* texture);
1056 1054
1057 // Clears any uncleared attachments attached to the given frame buffer. 1055 // Clears any uncleared attachments attached to the given frame buffer.
1058 // Returns false if there was a generated GL error. 1056 // Returns false if there was a generated GL error.
1059 void ClearUnclearedAttachments( 1057 void ClearUnclearedAttachments(
1060 GLenum target, Framebuffer* info); 1058 GLenum target, Framebuffer* info);
1061 1059
1062 // overridden from GLES2Decoder 1060 // overridden from GLES2Decoder
1063 virtual bool ClearLevel(unsigned service_id, 1061 virtual bool ClearLevel(unsigned service_id,
1064 unsigned bind_target, 1062 unsigned bind_target,
1065 unsigned target, 1063 unsigned target,
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 if (target == GL_ARRAY_BUFFER) { 1400 if (target == GL_ARRAY_BUFFER) {
1403 return state_.bound_array_buffer; 1401 return state_.bound_array_buffer;
1404 } else { 1402 } else {
1405 return state_.vertex_attrib_manager->element_array_buffer(); 1403 return state_.vertex_attrib_manager->element_array_buffer();
1406 } 1404 }
1407 } 1405 }
1408 1406
1409 // Gets the texture id for a given target. 1407 // Gets the texture id for a given target.
1410 Texture* GetTextureInfoForTarget(GLenum target) { 1408 Texture* GetTextureInfoForTarget(GLenum target) {
1411 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; 1409 TextureUnit& unit = state_.texture_units[state_.active_texture_unit];
1412 Texture* info = NULL; 1410 Texture* texture = NULL;
1413 switch (target) { 1411 switch (target) {
1414 case GL_TEXTURE_2D: 1412 case GL_TEXTURE_2D:
1415 info = unit.bound_texture_2d; 1413 texture = unit.bound_texture_2d;
1416 break; 1414 break;
1417 case GL_TEXTURE_CUBE_MAP: 1415 case GL_TEXTURE_CUBE_MAP:
1418 case GL_TEXTURE_CUBE_MAP_POSITIVE_X: 1416 case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
1419 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: 1417 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
1420 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: 1418 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
1421 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: 1419 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
1422 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: 1420 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
1423 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: 1421 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
1424 info = unit.bound_texture_cube_map; 1422 texture = unit.bound_texture_cube_map;
1425 break; 1423 break;
1426 case GL_TEXTURE_EXTERNAL_OES: 1424 case GL_TEXTURE_EXTERNAL_OES:
1427 info = unit.bound_texture_external_oes; 1425 texture = unit.bound_texture_external_oes;
1428 break; 1426 break;
1429 case GL_TEXTURE_RECTANGLE_ARB: 1427 case GL_TEXTURE_RECTANGLE_ARB:
1430 info = unit.bound_texture_rectangle_arb; 1428 texture = unit.bound_texture_rectangle_arb;
1431 break; 1429 break;
1432 default: 1430 default:
1433 NOTREACHED(); 1431 NOTREACHED();
1434 return NULL; 1432 return NULL;
1435 } 1433 }
1436 return info; 1434 return texture;
1437 } 1435 }
1438 1436
1439 Texture* GetTextureInfoForTargetUnlessDefault( 1437 Texture* GetTextureInfoForTargetUnlessDefault(
1440 GLenum target) { 1438 GLenum target) {
1441 Texture* info = GetTextureInfoForTarget(target); 1439 Texture* texture = GetTextureInfoForTarget(target);
1442 if (!info) 1440 if (!texture)
1443 return NULL; 1441 return NULL;
1444 if (info == texture_manager()->GetDefaultTextureInfo(target)) 1442 if (texture == texture_manager()->GetDefaultTextureInfo(target))
1445 return NULL; 1443 return NULL;
1446 return info; 1444 return texture;
1447 } 1445 }
1448 1446
1449 GLenum GetBindTargetForSamplerType(GLenum type) { 1447 GLenum GetBindTargetForSamplerType(GLenum type) {
1450 DCHECK(type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE || 1448 DCHECK(type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE ||
1451 type == GL_SAMPLER_EXTERNAL_OES || type == GL_SAMPLER_2D_RECT_ARB); 1449 type == GL_SAMPLER_EXTERNAL_OES || type == GL_SAMPLER_2D_RECT_ARB);
1452 switch (type) { 1450 switch (type) {
1453 case GL_SAMPLER_2D: 1451 case GL_SAMPLER_2D:
1454 return GL_TEXTURE_2D; 1452 return GL_TEXTURE_2D;
1455 case GL_SAMPLER_CUBE: 1453 case GL_SAMPLER_CUBE:
1456 return GL_TEXTURE_CUBE_MAP; 1454 return GL_TEXTURE_CUBE_MAP;
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 glGenBuffersARB(1, &attrib_0_buffer_id_); 2254 glGenBuffersARB(1, &attrib_0_buffer_id_);
2257 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); 2255 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_);
2258 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL); 2256 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL);
2259 glBindBuffer(GL_ARRAY_BUFFER, 0); 2257 glBindBuffer(GL_ARRAY_BUFFER, 0);
2260 glGenBuffersARB(1, &fixed_attrib_buffer_id_); 2258 glGenBuffersARB(1, &fixed_attrib_buffer_id_);
2261 2259
2262 state_.texture_units.resize(group_->max_texture_units()); 2260 state_.texture_units.resize(group_->max_texture_units());
2263 for (uint32 tt = 0; tt < state_.texture_units.size(); ++tt) { 2261 for (uint32 tt = 0; tt < state_.texture_units.size(); ++tt) {
2264 glActiveTexture(GL_TEXTURE0 + tt); 2262 glActiveTexture(GL_TEXTURE0 + tt);
2265 // We want the last bind to be 2D. 2263 // We want the last bind to be 2D.
2266 Texture* info; 2264 Texture* texture;
2267 if (features().oes_egl_image_external) { 2265 if (features().oes_egl_image_external) {
2268 info = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_EXTERNAL_OES); 2266 texture = texture_manager()->GetDefaultTextureInfo(
2269 state_.texture_units[tt].bound_texture_external_oes = info; 2267 GL_TEXTURE_EXTERNAL_OES);
2270 glBindTexture(GL_TEXTURE_EXTERNAL_OES, info->service_id()); 2268 state_.texture_units[tt].bound_texture_external_oes = texture;
2269 glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture->service_id());
2271 } 2270 }
2272 if (features().arb_texture_rectangle) { 2271 if (features().arb_texture_rectangle) {
2273 info = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_RECTANGLE_ARB); 2272 texture = texture_manager()->GetDefaultTextureInfo(
2274 state_.texture_units[tt].bound_texture_rectangle_arb = info; 2273 GL_TEXTURE_RECTANGLE_ARB);
2275 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, info->service_id()); 2274 state_.texture_units[tt].bound_texture_rectangle_arb = texture;
2275 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture->service_id());
2276 } 2276 }
2277 info = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP); 2277 texture = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP);
2278 state_.texture_units[tt].bound_texture_cube_map = info; 2278 state_.texture_units[tt].bound_texture_cube_map = texture;
2279 glBindTexture(GL_TEXTURE_CUBE_MAP, info->service_id()); 2279 glBindTexture(GL_TEXTURE_CUBE_MAP, texture->service_id());
2280 info = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D); 2280 texture = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D);
2281 state_.texture_units[tt].bound_texture_2d = info; 2281 state_.texture_units[tt].bound_texture_2d = texture;
2282 glBindTexture(GL_TEXTURE_2D, info->service_id()); 2282 glBindTexture(GL_TEXTURE_2D, texture->service_id());
2283 } 2283 }
2284 glActiveTexture(GL_TEXTURE0); 2284 glActiveTexture(GL_TEXTURE0);
2285 CHECK_GL_ERROR(); 2285 CHECK_GL_ERROR();
2286 2286
2287 ContextCreationAttribParser attrib_parser; 2287 ContextCreationAttribParser attrib_parser;
2288 if (!attrib_parser.Parse(attribs)) 2288 if (!attrib_parser.Parse(attribs))
2289 return false; 2289 return false;
2290 2290
2291 // These are NOT if the back buffer has these proprorties. They are 2291 // These are NOT if the back buffer has these proprorties. They are
2292 // if we want the command buffer to enforce them regardless of what 2292 // if we want the command buffer to enforce them regardless of what
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
2983 0, // level 2983 0, // level
2984 GL_RGBA, 2984 GL_RGBA,
2985 offscreen_size_.width(), 2985 offscreen_size_.width(),
2986 offscreen_size_.height(), 2986 offscreen_size_.height(),
2987 1, // depth 2987 1, // depth
2988 0, // border 2988 0, // border
2989 GL_RGBA, 2989 GL_RGBA,
2990 GL_UNSIGNED_BYTE, 2990 GL_UNSIGNED_BYTE,
2991 true); 2991 true);
2992 parent_texture_manager->SetParameter( 2992 parent_texture_manager->SetParameter(
2993 "UpdateParentTextureInfo",
2994 this,
2993 offscreen_saved_color_texture_info_, 2995 offscreen_saved_color_texture_info_,
2994 GL_TEXTURE_MAG_FILTER, 2996 GL_TEXTURE_MAG_FILTER,
2995 GL_NEAREST); 2997 GL_NEAREST);
2996 parent_texture_manager->SetParameter( 2998 parent_texture_manager->SetParameter(
2999 "UpdateParentTextureInfo",
3000 this,
2997 offscreen_saved_color_texture_info_, 3001 offscreen_saved_color_texture_info_,
2998 GL_TEXTURE_MIN_FILTER, 3002 GL_TEXTURE_MIN_FILTER,
2999 GL_NEAREST); 3003 GL_NEAREST);
3000 parent_texture_manager->SetParameter( 3004 parent_texture_manager->SetParameter(
3005 "UpdateParentTextureInfo",
3006 this,
3001 offscreen_saved_color_texture_info_, 3007 offscreen_saved_color_texture_info_,
3002 GL_TEXTURE_WRAP_S, 3008 GL_TEXTURE_WRAP_S,
3003 GL_CLAMP_TO_EDGE); 3009 GL_CLAMP_TO_EDGE);
3004 parent_texture_manager->SetParameter( 3010 parent_texture_manager->SetParameter(
3011 "UpdateParentTextureInfo",
3012 this,
3005 offscreen_saved_color_texture_info_, 3013 offscreen_saved_color_texture_info_,
3006 GL_TEXTURE_WRAP_T, 3014 GL_TEXTURE_WRAP_T,
3007 GL_CLAMP_TO_EDGE); 3015 GL_CLAMP_TO_EDGE);
3008 } else { 3016 } else {
3009 offscreen_saved_color_texture_info_ = NULL; 3017 offscreen_saved_color_texture_info_ = NULL;
3010 } 3018 }
3011 } 3019 }
3012 3020
3013 void GLES2DecoderImpl::SetResizeCallback( 3021 void GLES2DecoderImpl::SetResizeCallback(
3014 const base::Callback<void(gfx::Size)>& callback) { 3022 const base::Callback<void(gfx::Size)>& callback) {
(...skipping 18 matching lines...) Expand all
3033 return async_pixel_transfer_delegate_.get(); 3041 return async_pixel_transfer_delegate_.get();
3034 } 3042 }
3035 3043
3036 void GLES2DecoderImpl::SetAsyncPixelTransferDelegate( 3044 void GLES2DecoderImpl::SetAsyncPixelTransferDelegate(
3037 gfx::AsyncPixelTransferDelegate* delegate) { 3045 gfx::AsyncPixelTransferDelegate* delegate) {
3038 async_pixel_transfer_delegate_ = make_scoped_ptr(delegate); 3046 async_pixel_transfer_delegate_ = make_scoped_ptr(delegate);
3039 } 3047 }
3040 3048
3041 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, 3049 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id,
3042 uint32* service_texture_id) { 3050 uint32* service_texture_id) {
3043 Texture* texture = 3051 Texture* texture = texture_manager()->GetTexture(client_texture_id);
3044 texture_manager()->GetTexture(client_texture_id);
3045 if (texture) { 3052 if (texture) {
3046 *service_texture_id = texture->service_id(); 3053 *service_texture_id = texture->service_id();
3047 return true; 3054 return true;
3048 } 3055 }
3049 return false; 3056 return false;
3050 } 3057 }
3051 3058
3052 uint32 GLES2DecoderImpl::GetTextureUploadCount() { 3059 uint32 GLES2DecoderImpl::GetTextureUploadCount() {
3053 return texture_upload_count_ + 3060 return texture_upload_count_ +
3054 async_pixel_transfer_delegate_->GetTextureUploadCount(); 3061 async_pixel_transfer_delegate_->GetTextureUploadCount();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3234 // Replace texture info when ID is already in use by parent. 3241 // Replace texture info when ID is already in use by parent.
3235 if (new_parent_impl->texture_manager()->GetTexture( 3242 if (new_parent_impl->texture_manager()->GetTexture(
3236 new_parent_texture_id)) 3243 new_parent_texture_id))
3237 new_parent_impl->texture_manager()->RemoveTexture( 3244 new_parent_impl->texture_manager()->RemoveTexture(
3238 new_parent_texture_id); 3245 new_parent_texture_id);
3239 3246
3240 offscreen_saved_color_texture_info_ = 3247 offscreen_saved_color_texture_info_ =
3241 new_parent_impl->CreateTexture(new_parent_texture_id, service_id); 3248 new_parent_impl->CreateTexture(new_parent_texture_id, service_id);
3242 offscreen_saved_color_texture_info_->SetNotOwned(); 3249 offscreen_saved_color_texture_info_->SetNotOwned();
3243 new_parent_impl->texture_manager()-> 3250 new_parent_impl->texture_manager()->
3244 SetInfoTarget(offscreen_saved_color_texture_info_, GL_TEXTURE_2D); 3251 SetTarget(offscreen_saved_color_texture_info_, GL_TEXTURE_2D);
3245 3252
3246 parent_ = base::AsWeakPtr<GLES2DecoderImpl>(new_parent_impl); 3253 parent_ = base::AsWeakPtr<GLES2DecoderImpl>(new_parent_impl);
3247 3254
3248 UpdateParentTextureInfo(); 3255 UpdateParentTextureInfo();
3249 } else { 3256 } else {
3250 parent_.reset(); 3257 parent_.reset();
3251 offscreen_saved_color_texture_info_ = NULL; 3258 offscreen_saved_color_texture_info_ = NULL;
3252 } 3259 }
3253 3260
3254 return true; 3261 return true;
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
3768 service_id = info->service_id(); 3775 service_id = info->service_id();
3769 } 3776 }
3770 info->MarkAsValid(); 3777 info->MarkAsValid();
3771 } 3778 }
3772 LogClientServiceForInfo(info, client_id, "glBindRenerbuffer"); 3779 LogClientServiceForInfo(info, client_id, "glBindRenerbuffer");
3773 state_.bound_renderbuffer = info; 3780 state_.bound_renderbuffer = info;
3774 glBindRenderbufferEXT(target, service_id); 3781 glBindRenderbufferEXT(target, service_id);
3775 } 3782 }
3776 3783
3777 void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) { 3784 void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) {
3778 Texture* info = NULL; 3785 Texture* texture = NULL;
3779 GLuint service_id = 0; 3786 GLuint service_id = 0;
3780 if (client_id != 0) { 3787 if (client_id != 0) {
3781 info = GetTexture(client_id); 3788 texture = GetTexture(client_id);
3782 if (!info) { 3789 if (!texture) {
3783 if (!group_->bind_generates_resource()) { 3790 if (!group_->bind_generates_resource()) {
3784 LOG(ERROR) << "glBindTexture: id not generated by glGenTextures"; 3791 LOG(ERROR) << "glBindTexture: id not generated by glGenTextures";
3785 current_decoder_error_ = error::kGenericError; 3792 current_decoder_error_ = error::kGenericError;
3786 return; 3793 return;
3787 } 3794 }
3788 3795
3789 // It's a new id so make a texture info for it. 3796 // It's a new id so make a texture texture for it.
3790 glGenTextures(1, &service_id); 3797 glGenTextures(1, &service_id);
3791 DCHECK_NE(0u, service_id); 3798 DCHECK_NE(0u, service_id);
3792 CreateTexture(client_id, service_id); 3799 CreateTexture(client_id, service_id);
3793 info = GetTexture(client_id); 3800 texture = GetTexture(client_id);
3794 IdAllocatorInterface* id_allocator = 3801 IdAllocatorInterface* id_allocator =
3795 group_->GetIdAllocator(id_namespaces::kTextures); 3802 group_->GetIdAllocator(id_namespaces::kTextures);
3796 id_allocator->MarkAsUsed(client_id); 3803 id_allocator->MarkAsUsed(client_id);
3797 } 3804 }
3798 } else { 3805 } else {
3799 info = texture_manager()->GetDefaultTextureInfo(target); 3806 texture = texture_manager()->GetDefaultTextureInfo(target);
3800 } 3807 }
3801 3808
3802 // Check the texture exists 3809 // Check the texture exists
3803 // Check that we are not trying to bind it to a different target. 3810 // Check that we are not trying to bind it to a different target.
3804 if (info->target() != 0 && info->target() != target) { 3811 if (texture->target() != 0 && texture->target() != target) {
3805 SetGLError(GL_INVALID_OPERATION, 3812 SetGLError(GL_INVALID_OPERATION,
3806 "glBindTexture", "texture bound to more than 1 target."); 3813 "glBindTexture", "texture bound to more than 1 target.");
3807 return; 3814 return;
3808 } 3815 }
3809 if (info->IsStreamTexture() && target != GL_TEXTURE_EXTERNAL_OES) { 3816 if (texture->IsStreamTexture() && target != GL_TEXTURE_EXTERNAL_OES) {
3810 SetGLError(GL_INVALID_OPERATION, 3817 SetGLError(GL_INVALID_OPERATION,
3811 "glBindTexture", "illegal target for stream texture."); 3818 "glBindTexture", "illegal target for stream texture.");
3812 return; 3819 return;
3813 } 3820 }
3814 LogClientServiceForInfo(info, client_id, "glBindTexture"); 3821 LogClientServiceForInfo(texture, client_id, "glBindTexture");
3815 if (info->target() == 0) { 3822 if (texture->target() == 0) {
3816 texture_manager()->SetInfoTarget(info, target); 3823 texture_manager()->SetTarget(texture, target);
3817 } 3824 }
3818 glBindTexture(target, info->service_id()); 3825 glBindTexture(target, texture->service_id());
3819 3826
3820 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; 3827 TextureUnit& unit = state_.texture_units[state_.active_texture_unit];
3821 unit.bind_target = target; 3828 unit.bind_target = target;
3822 switch (target) { 3829 switch (target) {
3823 case GL_TEXTURE_2D: 3830 case GL_TEXTURE_2D:
3824 unit.bound_texture_2d = info; 3831 unit.bound_texture_2d = texture;
3825 break; 3832 break;
3826 case GL_TEXTURE_CUBE_MAP: 3833 case GL_TEXTURE_CUBE_MAP:
3827 unit.bound_texture_cube_map = info; 3834 unit.bound_texture_cube_map = texture;
3828 break; 3835 break;
3829 case GL_TEXTURE_EXTERNAL_OES: 3836 case GL_TEXTURE_EXTERNAL_OES:
3830 unit.bound_texture_external_oes = info; 3837 unit.bound_texture_external_oes = texture;
3831 if (info->IsStreamTexture()) { 3838 if (texture->IsStreamTexture()) {
3832 DCHECK(stream_texture_manager_); 3839 DCHECK(stream_texture_manager_);
3833 StreamTexture* stream_tex = 3840 StreamTexture* stream_tex =
3834 stream_texture_manager_->LookupStreamTexture(info->service_id()); 3841 stream_texture_manager_->LookupStreamTexture(texture->service_id());
3835 if (stream_tex) 3842 if (stream_tex)
3836 stream_tex->Update(); 3843 stream_tex->Update();
3837 } 3844 }
3838 break; 3845 break;
3839 case GL_TEXTURE_RECTANGLE_ARB: 3846 case GL_TEXTURE_RECTANGLE_ARB:
3840 unit.bound_texture_rectangle_arb = info; 3847 unit.bound_texture_rectangle_arb = texture;
3841 break; 3848 break;
3842 default: 3849 default:
3843 NOTREACHED(); // Validation should prevent us getting here. 3850 NOTREACHED(); // Validation should prevent us getting here.
3844 break; 3851 break;
3845 } 3852 }
3846 } 3853 }
3847 3854
3848 void GLES2DecoderImpl::DoDisableVertexAttribArray(GLuint index) { 3855 void GLES2DecoderImpl::DoDisableVertexAttribArray(GLuint index) {
3849 if (state_.vertex_attrib_manager->Enable(index, false)) { 3856 if (state_.vertex_attrib_manager->Enable(index, false)) {
3850 if (index != 0 || 3857 if (index != 0 ||
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3907 void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) { 3914 void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) {
3908 if (state_.vertex_attrib_manager->Enable(index, true)) { 3915 if (state_.vertex_attrib_manager->Enable(index, true)) {
3909 glEnableVertexAttribArray(index); 3916 glEnableVertexAttribArray(index);
3910 } else { 3917 } else {
3911 SetGLError(GL_INVALID_VALUE, 3918 SetGLError(GL_INVALID_VALUE,
3912 "glEnableVertexAttribArray", "index out of range"); 3919 "glEnableVertexAttribArray", "index out of range");
3913 } 3920 }
3914 } 3921 }
3915 3922
3916 void GLES2DecoderImpl::DoGenerateMipmap(GLenum target) { 3923 void GLES2DecoderImpl::DoGenerateMipmap(GLenum target) {
3917 Texture* info = GetTextureInfoForTarget(target); 3924 Texture* texture = GetTextureInfoForTarget(target);
3918 if (!info || 3925 if (!texture ||
3919 !texture_manager()->CanGenerateMipmaps(info)) { 3926 !texture_manager()->CanGenerateMipmaps(texture)) {
3920 SetGLError(GL_INVALID_OPERATION, 3927 SetGLError(GL_INVALID_OPERATION,
3921 "glGenerateMipmaps", "Can not generate mips"); 3928 "glGenerateMipmaps", "Can not generate mips");
3922 return; 3929 return;
3923 } 3930 }
3924 3931
3925 if (target == GL_TEXTURE_CUBE_MAP) { 3932 if (target == GL_TEXTURE_CUBE_MAP) {
3926 for (int i = 0; i < 6; ++i) { 3933 for (int i = 0; i < 6; ++i) {
3927 GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i; 3934 GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i;
3928 if (!texture_manager()->ClearTextureLevel(this, info, face, 0)) { 3935 if (!texture_manager()->ClearTextureLevel(this, texture, face, 0)) {
3929 SetGLError(GL_OUT_OF_MEMORY, "glGenerateMipmaps", "dimensions too big"); 3936 SetGLError(GL_OUT_OF_MEMORY, "glGenerateMipmaps", "dimensions too big");
3930 return; 3937 return;
3931 } 3938 }
3932 } 3939 }
3933 } else { 3940 } else {
3934 if (!texture_manager()->ClearTextureLevel(this, info, target, 0)) { 3941 if (!texture_manager()->ClearTextureLevel(this, texture, target, 0)) {
3935 SetGLError(GL_OUT_OF_MEMORY, "glGenerateMipmaps", "dimensions too big"); 3942 SetGLError(GL_OUT_OF_MEMORY, "glGenerateMipmaps", "dimensions too big");
3936 return; 3943 return;
3937 } 3944 }
3938 } 3945 }
3939 3946
3940 CopyRealGLErrorsToWrapper(); 3947 CopyRealGLErrorsToWrapper();
3941 // Workaround for Mac driver bug. In the large scheme of things setting 3948 // Workaround for Mac driver bug. In the large scheme of things setting
3942 // glTexParamter twice for glGenerateMipmap is probably not a lage performance 3949 // glTexParamter twice for glGenerateMipmap is probably not a lage performance
3943 // hit so there's probably no need to make this conditional. The bug appears 3950 // hit so there's probably no need to make this conditional. The bug appears
3944 // to be that if the filtering mode is set to something that doesn't require 3951 // to be that if the filtering mode is set to something that doesn't require
3945 // mipmaps for rendering, or is never set to something other than the default, 3952 // mipmaps for rendering, or is never set to something other than the default,
3946 // then glGenerateMipmap misbehaves. 3953 // then glGenerateMipmap misbehaves.
3947 if (workarounds().set_texture_filter_before_generating_mipmap) { 3954 if (workarounds().set_texture_filter_before_generating_mipmap) {
3948 glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); 3955 glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
3949 } 3956 }
3950 glGenerateMipmapEXT(target); 3957 glGenerateMipmapEXT(target);
3951 if (workarounds().set_texture_filter_before_generating_mipmap) { 3958 if (workarounds().set_texture_filter_before_generating_mipmap) {
3952 glTexParameteri(target, GL_TEXTURE_MIN_FILTER, info->min_filter()); 3959 glTexParameteri(target, GL_TEXTURE_MIN_FILTER, texture->min_filter());
3953 } 3960 }
3954 GLenum error = PeekGLError(); 3961 GLenum error = PeekGLError();
3955 if (error == GL_NO_ERROR) { 3962 if (error == GL_NO_ERROR) {
3956 texture_manager()->MarkMipmapsGenerated(info); 3963 texture_manager()->MarkMipmapsGenerated(texture);
3957 } 3964 }
3958 } 3965 }
3959 3966
3960 bool GLES2DecoderImpl::GetHelper( 3967 bool GLES2DecoderImpl::GetHelper(
3961 GLenum pname, GLint* params, GLsizei* num_written) { 3968 GLenum pname, GLint* params, GLsizei* num_written) {
3962 DCHECK(num_written); 3969 DCHECK(num_written);
3963 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { 3970 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
3964 switch (pname) { 3971 switch (pname) {
3965 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: 3972 case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
3966 *num_written = 1; 3973 *num_written = 1;
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
4794 GLenum target, GLenum attachment, GLenum textarget, 4801 GLenum target, GLenum attachment, GLenum textarget,
4795 GLuint client_texture_id, GLint level) { 4802 GLuint client_texture_id, GLint level) {
4796 Framebuffer* framebuffer_info = 4803 Framebuffer* framebuffer_info =
4797 GetFramebufferInfoForTarget(target); 4804 GetFramebufferInfoForTarget(target);
4798 if (!framebuffer_info) { 4805 if (!framebuffer_info) {
4799 SetGLError(GL_INVALID_OPERATION, 4806 SetGLError(GL_INVALID_OPERATION,
4800 "glFramebufferTexture2D", "no framebuffer bound."); 4807 "glFramebufferTexture2D", "no framebuffer bound.");
4801 return; 4808 return;
4802 } 4809 }
4803 GLuint service_id = 0; 4810 GLuint service_id = 0;
4804 Texture* info = NULL; 4811 Texture* texture = NULL;
4805 if (client_texture_id) { 4812 if (client_texture_id) {
4806 info = GetTexture(client_texture_id); 4813 texture = GetTexture(client_texture_id);
4807 if (!info) { 4814 if (!texture) {
4808 SetGLError(GL_INVALID_OPERATION, 4815 SetGLError(GL_INVALID_OPERATION,
4809 "glFramebufferTexture2D", "unknown texture"); 4816 "glFramebufferTexture2D", "unknown texture");
4810 return; 4817 return;
4811 } 4818 }
4812 service_id = info->service_id(); 4819 service_id = texture->service_id();
4813 } 4820 }
4814 4821
4815 if (!texture_manager()->ValidForTarget(textarget, level, 0, 0, 1)) { 4822 if (!texture_manager()->ValidForTarget(textarget, level, 0, 0, 1)) {
4816 SetGLError(GL_INVALID_VALUE, 4823 SetGLError(GL_INVALID_VALUE,
4817 "glFramebufferTexture2D", "level out of range"); 4824 "glFramebufferTexture2D", "level out of range");
4818 return; 4825 return;
4819 } 4826 }
4820 4827
4821 CopyRealGLErrorsToWrapper(); 4828 CopyRealGLErrorsToWrapper();
4822 glFramebufferTexture2DEXT(target, attachment, textarget, service_id, level); 4829 glFramebufferTexture2DEXT(target, attachment, textarget, service_id, level);
4823 GLenum error = PeekGLError(); 4830 GLenum error = PeekGLError();
4824 if (error == GL_NO_ERROR) { 4831 if (error == GL_NO_ERROR) {
4825 framebuffer_info->AttachTexture(attachment, info, textarget, level); 4832 framebuffer_info->AttachTexture(attachment, texture, textarget, level);
4826 } 4833 }
4827 if (framebuffer_info == state_.bound_draw_framebuffer) { 4834 if (framebuffer_info == state_.bound_draw_framebuffer) {
4828 clear_state_dirty_ = true; 4835 clear_state_dirty_ = true;
4829 } 4836 }
4830 } 4837 }
4831 4838
4832 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv( 4839 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv(
4833 GLenum target, GLenum attachment, GLenum pname, GLint* params) { 4840 GLenum target, GLenum attachment, GLenum pname, GLint* params) {
4834 Framebuffer* framebuffer_info = 4841 Framebuffer* framebuffer_info =
4835 GetFramebufferInfoForTarget(target); 4842 GetFramebufferInfoForTarget(target);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
5038 if (workarounds().use_current_program_after_successful_link) { 5045 if (workarounds().use_current_program_after_successful_link) {
5039 glUseProgram(program->service_id()); 5046 glUseProgram(program->service_id());
5040 } 5047 }
5041 program_manager()->ClearUniforms(program); 5048 program_manager()->ClearUniforms(program);
5042 } 5049 }
5043 } 5050 }
5044 }; 5051 };
5045 5052
5046 void GLES2DecoderImpl::DoTexParameterf( 5053 void GLES2DecoderImpl::DoTexParameterf(
5047 GLenum target, GLenum pname, GLfloat param) { 5054 GLenum target, GLenum pname, GLfloat param) {
5048 Texture* info = GetTextureInfoForTarget(target); 5055 Texture* texture = GetTextureInfoForTarget(target);
5049 if (!info) { 5056 if (!texture) {
5050 SetGLError(GL_INVALID_VALUE, "glTexParameterf", "unknown texture"); 5057 SetGLError(GL_INVALID_VALUE, "glTexParameterf", "unknown texture");
5051 return; 5058 return;
5052 } 5059 }
5053 5060
5054 GLenum error = texture_manager()->SetParameter( 5061 texture_manager()->SetParameter(
5055 info, pname, static_cast<GLint>(param)); 5062 "glTexParameterf", this, texture, pname, static_cast<GLint>(param));
5056 if (error != GL_NO_ERROR) {
5057 SetGLErrorInvalidParam(
5058 error, "glTexParameterf", pname, static_cast<GLint>(param));
5059 return;
5060 }
5061 glTexParameterf(target, pname, param);
5062 } 5063 }
5063 5064
5064 void GLES2DecoderImpl::DoTexParameteri( 5065 void GLES2DecoderImpl::DoTexParameteri(
5065 GLenum target, GLenum pname, GLint param) { 5066 GLenum target, GLenum pname, GLint param) {
5066 Texture* info = GetTextureInfoForTarget(target); 5067 Texture* texture = GetTextureInfoForTarget(target);
5067 if (!info) { 5068 if (!texture) {
5068 SetGLError(GL_INVALID_VALUE, "glTexParameteri", "unknown texture"); 5069 SetGLError(GL_INVALID_VALUE, "glTexParameteri", "unknown texture");
5069 return; 5070 return;
5070 } 5071 }
5071 5072
5072 GLenum error = texture_manager()->SetParameter(info, pname, param); 5073 texture_manager()->SetParameter(
5073 if (error != GL_NO_ERROR) { 5074 "glTexParameteri", this, texture, pname, param);
5074 SetGLErrorInvalidParam(error, "glTexParameteri", pname, param);
5075 return;
5076 }
5077 // Texture tracking pools exist only for the command decoder, so
5078 // do not pass them on to the native GL implementation.
5079 if (pname == GL_TEXTURE_POOL_CHROMIUM) {
5080 return;
5081 }
5082 glTexParameteri(target, pname, param);
5083 } 5075 }
5084 5076
5085 void GLES2DecoderImpl::DoTexParameterfv( 5077 void GLES2DecoderImpl::DoTexParameterfv(
5086 GLenum target, GLenum pname, const GLfloat* params) { 5078 GLenum target, GLenum pname, const GLfloat* params) {
5087 Texture* info = GetTextureInfoForTarget(target); 5079 Texture* texture = GetTextureInfoForTarget(target);
5088 if (!info) { 5080 if (!texture) {
5089 SetGLError(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture"); 5081 SetGLError(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture");
5090 return; 5082 return;
5091 } 5083 }
5092 5084
5093 GLenum error =texture_manager()->SetParameter( 5085 texture_manager()->SetParameter(
5094 info, pname, static_cast<GLint>(params[0])); 5086 "glTexParameterfv", this, texture, pname, static_cast<GLint>(params[0]));
5095 if (error != GL_NO_ERROR) {
5096 SetGLErrorInvalidParam(
5097 error, "glTexParameterfv", pname, static_cast<GLint>(params[0]));
5098 return;
5099 }
5100 glTexParameterfv(target, pname, params);
5101 } 5087 }
5102 5088
5103 void GLES2DecoderImpl::DoTexParameteriv( 5089 void GLES2DecoderImpl::DoTexParameteriv(
5104 GLenum target, GLenum pname, const GLint* params) { 5090 GLenum target, GLenum pname, const GLint* params) {
5105 Texture* info = GetTextureInfoForTarget(target); 5091 Texture* texture = GetTextureInfoForTarget(target);
5106 if (!info) { 5092 if (!texture) {
5107 SetGLError(GL_INVALID_VALUE, "glTexParameteriv", "unknown texture"); 5093 SetGLError(GL_INVALID_VALUE, "glTexParameteriv", "unknown texture");
5108 return; 5094 return;
5109 } 5095 }
5110 5096
5111 GLenum error = texture_manager()->SetParameter(info, pname, *params); 5097 texture_manager()->SetParameter(
5112 if (error != GL_NO_ERROR) { 5098 "glTexParameteriv", this, texture, pname, *params);
5113 SetGLErrorInvalidParam(error, "glTexParameteriv", pname, *params);
5114 return;
5115 }
5116 glTexParameteriv(target, pname, params);
5117 } 5099 }
5118 5100
5119 bool GLES2DecoderImpl::CheckCurrentProgram(const char* function_name) { 5101 bool GLES2DecoderImpl::CheckCurrentProgram(const char* function_name) {
5120 if (!state_.current_program) { 5102 if (!state_.current_program) {
5121 // The program does not exist. 5103 // The program does not exist.
5122 SetGLError(GL_INVALID_OPERATION, function_name, "no program in use"); 5104 SetGLError(GL_INVALID_OPERATION, function_name, "no program in use");
5123 return false; 5105 return false;
5124 } 5106 }
5125 if (!state_.current_program->InUse()) { 5107 if (!state_.current_program->InUse()) {
5126 SetGLError(GL_INVALID_OPERATION, function_name, "program not linked"); 5108 SetGLError(GL_INVALID_OPERATION, function_name, "program not linked");
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
5662 const Program::SamplerIndices& sampler_indices = 5644 const Program::SamplerIndices& sampler_indices =
5663 state_.current_program->sampler_indices(); 5645 state_.current_program->sampler_indices();
5664 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { 5646 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) {
5665 const Program::UniformInfo* uniform_info = 5647 const Program::UniformInfo* uniform_info =
5666 state_.current_program->GetUniformInfo(sampler_indices[ii]); 5648 state_.current_program->GetUniformInfo(sampler_indices[ii]);
5667 DCHECK(uniform_info); 5649 DCHECK(uniform_info);
5668 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { 5650 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) {
5669 GLuint texture_unit_index = uniform_info->texture_units[jj]; 5651 GLuint texture_unit_index = uniform_info->texture_units[jj];
5670 if (texture_unit_index < state_.texture_units.size()) { 5652 if (texture_unit_index < state_.texture_units.size()) {
5671 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; 5653 TextureUnit& texture_unit = state_.texture_units[texture_unit_index];
5672 Texture* texture_info = 5654 Texture* texture =
5673 texture_unit.GetInfoForSamplerType(uniform_info->type); 5655 texture_unit.GetInfoForSamplerType(uniform_info->type);
5674 if (!texture_info || !texture_manager()->CanRender(texture_info)) { 5656 if (!texture || !texture_manager()->CanRender(texture)) {
5675 textures_set = true; 5657 textures_set = true;
5676 glActiveTexture(GL_TEXTURE0 + texture_unit_index); 5658 glActiveTexture(GL_TEXTURE0 + texture_unit_index);
5677 glBindTexture( 5659 glBindTexture(
5678 GetBindTargetForSamplerType(uniform_info->type), 5660 GetBindTargetForSamplerType(uniform_info->type),
5679 texture_manager()->black_texture_id(uniform_info->type)); 5661 texture_manager()->black_texture_id(uniform_info->type));
5680 RenderWarning( 5662 RenderWarning(
5681 std::string("texture bound to texture unit ") + 5663 std::string("texture bound to texture unit ") +
5682 base::IntToString(texture_unit_index) + 5664 base::IntToString(texture_unit_index) +
5683 " is not renderable. It maybe non-power-of-2 and have " 5665 " is not renderable. It maybe non-power-of-2 and have "
5684 " incompatible texture filtering or is not " 5666 " incompatible texture filtering or is not "
(...skipping 11 matching lines...) Expand all
5696 const Program::SamplerIndices& sampler_indices = 5678 const Program::SamplerIndices& sampler_indices =
5697 state_.current_program->sampler_indices(); 5679 state_.current_program->sampler_indices();
5698 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { 5680 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) {
5699 const Program::UniformInfo* uniform_info = 5681 const Program::UniformInfo* uniform_info =
5700 state_.current_program->GetUniformInfo(sampler_indices[ii]); 5682 state_.current_program->GetUniformInfo(sampler_indices[ii]);
5701 DCHECK(uniform_info); 5683 DCHECK(uniform_info);
5702 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { 5684 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) {
5703 GLuint texture_unit_index = uniform_info->texture_units[jj]; 5685 GLuint texture_unit_index = uniform_info->texture_units[jj];
5704 if (texture_unit_index < state_.texture_units.size()) { 5686 if (texture_unit_index < state_.texture_units.size()) {
5705 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; 5687 TextureUnit& texture_unit = state_.texture_units[texture_unit_index];
5706 Texture* texture_info = 5688 Texture* texture = uniform_info->type == GL_SAMPLER_2D ?
5707 uniform_info->type == GL_SAMPLER_2D ? 5689 texture_unit.bound_texture_2d :
5708 texture_unit.bound_texture_2d : 5690 texture_unit.bound_texture_cube_map;
5709 texture_unit.bound_texture_cube_map; 5691 if (!texture || !texture_manager()->CanRender(texture)) {
5710 if (!texture_info || !texture_manager()->CanRender(texture_info)) {
5711 glActiveTexture(GL_TEXTURE0 + texture_unit_index); 5692 glActiveTexture(GL_TEXTURE0 + texture_unit_index);
5712 // Get the texture info that was previously bound here. 5693 // Get the texture info that was previously bound here.
5713 texture_info = texture_unit.bind_target == GL_TEXTURE_2D ? 5694 texture = texture_unit.bind_target == GL_TEXTURE_2D ?
5714 texture_unit.bound_texture_2d : 5695 texture_unit.bound_texture_2d :
5715 texture_unit.bound_texture_cube_map; 5696 texture_unit.bound_texture_cube_map;
5716 glBindTexture(texture_unit.bind_target, 5697 glBindTexture(texture_unit.bind_target,
5717 texture_info ? texture_info->service_id() : 0); 5698 texture ? texture->service_id() : 0);
5718 } 5699 }
5719 } 5700 }
5720 } 5701 }
5721 } 5702 }
5722 // Set the active texture back to whatever the user had it as. 5703 // Set the active texture back to whatever the user had it as.
5723 glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit); 5704 glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit);
5724 } 5705 }
5725 5706
5726 bool GLES2DecoderImpl::ClearUnclearedTextures() { 5707 bool GLES2DecoderImpl::ClearUnclearedTextures() {
5727 // Only check if there are some uncleared textures. 5708 // Only check if there are some uncleared textures.
5728 if (!texture_manager()->HaveUnsafeTextures()) { 5709 if (!texture_manager()->HaveUnsafeTextures()) {
5729 return true; 5710 return true;
5730 } 5711 }
5731 5712
5732 // 1: Check all textures we are about to render with. 5713 // 1: Check all textures we are about to render with.
5733 if (state_.current_program) { 5714 if (state_.current_program) {
5734 const Program::SamplerIndices& sampler_indices = 5715 const Program::SamplerIndices& sampler_indices =
5735 state_.current_program->sampler_indices(); 5716 state_.current_program->sampler_indices();
5736 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { 5717 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) {
5737 const Program::UniformInfo* uniform_info = 5718 const Program::UniformInfo* uniform_info =
5738 state_.current_program->GetUniformInfo(sampler_indices[ii]); 5719 state_.current_program->GetUniformInfo(sampler_indices[ii]);
5739 DCHECK(uniform_info); 5720 DCHECK(uniform_info);
5740 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { 5721 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) {
5741 GLuint texture_unit_index = uniform_info->texture_units[jj]; 5722 GLuint texture_unit_index = uniform_info->texture_units[jj];
5742 if (texture_unit_index < state_.texture_units.size()) { 5723 if (texture_unit_index < state_.texture_units.size()) {
5743 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; 5724 TextureUnit& texture_unit = state_.texture_units[texture_unit_index];
5744 Texture* texture_info = 5725 Texture* texture =
5745 texture_unit.GetInfoForSamplerType(uniform_info->type); 5726 texture_unit.GetInfoForSamplerType(uniform_info->type);
5746 if (texture_info && !texture_info->SafeToRenderFrom()) { 5727 if (texture && !texture->SafeToRenderFrom()) {
5747 if (!texture_manager()->ClearRenderableLevels(this, texture_info)) { 5728 if (!texture_manager()->ClearRenderableLevels(this, texture)) {
5748 return false; 5729 return false;
5749 } 5730 }
5750 } 5731 }
5751 } 5732 }
5752 } 5733 }
5753 } 5734 }
5754 } 5735 }
5755 return true; 5736 return true;
5756 } 5737 }
5757 5738
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after
7319 while (y < height) { 7300 while (y < height) {
7320 GLint h = y + tile_height > height ? height - y : tile_height; 7301 GLint h = y + tile_height > height ? height - y : tile_height;
7321 if (is_texture_immutable || h != height) { 7302 if (is_texture_immutable || h != height) {
7322 glTexSubImage2D(target, level, 0, y, width, h, format, type, zero.get()); 7303 glTexSubImage2D(target, level, 0, y, width, h, format, type, zero.get());
7323 } else { 7304 } else {
7324 WrappedTexImage2D( 7305 WrappedTexImage2D(
7325 target, level, format, width, h, 0, format, type, zero.get()); 7306 target, level, format, width, h, 0, format, type, zero.get());
7326 } 7307 }
7327 y += tile_height; 7308 y += tile_height;
7328 } 7309 }
7329 Texture* info = GetTextureInfoForTarget(bind_target); 7310 Texture* texture = GetTextureInfoForTarget(bind_target);
7330 glBindTexture(bind_target, info ? info->service_id() : 0); 7311 glBindTexture(bind_target, texture ? texture->service_id() : 0);
7331 return true; 7312 return true;
7332 } 7313 }
7333 7314
7334 namespace { 7315 namespace {
7335 7316
7336 const int kS3TCBlockWidth = 4; 7317 const int kS3TCBlockWidth = 4;
7337 const int kS3TCBlockHeight = 4; 7318 const int kS3TCBlockHeight = 4;
7338 const int kS3TCDXT1BlockSize = 8; 7319 const int kS3TCDXT1BlockSize = 8;
7339 const int kS3TCDXT3AndDXT5BlockSize = 16; 7320 const int kS3TCDXT3AndDXT5BlockSize = 16;
7340 const int kETC1BlockWidth = 4; 7321 const int kETC1BlockWidth = 4;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
7492 SetGLErrorInvalidEnum( 7473 SetGLErrorInvalidEnum(
7493 "glCompressedTexImage2D", internal_format, "internal_format"); 7474 "glCompressedTexImage2D", internal_format, "internal_format");
7494 return error::kNoError; 7475 return error::kNoError;
7495 } 7476 }
7496 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || 7477 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) ||
7497 border != 0) { 7478 border != 0) {
7498 SetGLError(GL_INVALID_VALUE, 7479 SetGLError(GL_INVALID_VALUE,
7499 "glCompressedTexImage2D", "dimensions out of range"); 7480 "glCompressedTexImage2D", "dimensions out of range");
7500 return error::kNoError; 7481 return error::kNoError;
7501 } 7482 }
7502 Texture* info = GetTextureInfoForTarget(target); 7483 Texture* texture = GetTextureInfoForTarget(target);
7503 if (!info) { 7484 if (!texture) {
7504 SetGLError(GL_INVALID_VALUE, 7485 SetGLError(GL_INVALID_VALUE,
7505 "glCompressedTexImage2D", "unknown texture target"); 7486 "glCompressedTexImage2D", "unknown texture target");
7506 return error::kNoError; 7487 return error::kNoError;
7507 } 7488 }
7508 if (info->IsImmutable()) { 7489 if (texture->IsImmutable()) {
7509 SetGLError(GL_INVALID_OPERATION, 7490 SetGLError(GL_INVALID_OPERATION,
7510 "glCompressedTexImage2D", "texture is immutable"); 7491 "glCompressedTexImage2D", "texture is immutable");
7511 return error::kNoError; 7492 return error::kNoError;
7512 } 7493 }
7513 7494
7514 if (!ValidateCompressedTexDimensions( 7495 if (!ValidateCompressedTexDimensions(
7515 "glCompressedTexImage2D", level, width, height, internal_format) || 7496 "glCompressedTexImage2D", level, width, height, internal_format) ||
7516 !ValidateCompressedTexFuncData( 7497 !ValidateCompressedTexFuncData(
7517 "glCompressedTexImage2D", width, height, internal_format, image_size)) { 7498 "glCompressedTexImage2D", width, height, internal_format, image_size)) {
7518 return error::kNoError; 7499 return error::kNoError;
7519 } 7500 }
7520 7501
7521 if (!EnsureGPUMemoryAvailable(image_size)) { 7502 if (!EnsureGPUMemoryAvailable(image_size)) {
7522 SetGLError(GL_OUT_OF_MEMORY, "glCompressedTexImage2D", "out of memory"); 7503 SetGLError(GL_OUT_OF_MEMORY, "glCompressedTexImage2D", "out of memory");
7523 return error::kNoError; 7504 return error::kNoError;
7524 } 7505 }
7525 7506
7526 if (info->IsAttachedToFramebuffer()) { 7507 if (texture->IsAttachedToFramebuffer()) {
7527 clear_state_dirty_ = true; 7508 clear_state_dirty_ = true;
7528 // TODO(gman): If textures tracked which framebuffers they were attached to 7509 // TODO(gman): If textures tracked which framebuffers they were attached to
7529 // we could just mark those framebuffers as not complete. 7510 // we could just mark those framebuffers as not complete.
7530 framebuffer_manager()->IncFramebufferStateChangeCount(); 7511 framebuffer_manager()->IncFramebufferStateChangeCount();
7531 } 7512 }
7532 7513
7533 scoped_array<int8> zero; 7514 scoped_array<int8> zero;
7534 if (!data) { 7515 if (!data) {
7535 zero.reset(new int8[image_size]); 7516 zero.reset(new int8[image_size]);
7536 memset(zero.get(), 0, image_size); 7517 memset(zero.get(), 0, image_size);
7537 data = zero.get(); 7518 data = zero.get();
7538 } 7519 }
7539 CopyRealGLErrorsToWrapper(); 7520 CopyRealGLErrorsToWrapper();
7540 glCompressedTexImage2D( 7521 glCompressedTexImage2D(
7541 target, level, internal_format, width, height, border, image_size, data); 7522 target, level, internal_format, width, height, border, image_size, data);
7542 GLenum error = PeekGLError(); 7523 GLenum error = PeekGLError();
7543 if (error == GL_NO_ERROR) { 7524 if (error == GL_NO_ERROR) {
7544 texture_manager()->SetLevelInfo( 7525 texture_manager()->SetLevelInfo(
7545 info, target, level, internal_format, width, height, 1, border, 0, 0, 7526 texture, target, level, internal_format, width, height, 1, border, 0, 0,
7546 true); 7527 true);
7547 } 7528 }
7548 return error::kNoError; 7529 return error::kNoError;
7549 } 7530 }
7550 7531
7551 error::Error GLES2DecoderImpl::HandleCompressedTexImage2D( 7532 error::Error GLES2DecoderImpl::HandleCompressedTexImage2D(
7552 uint32 immediate_data_size, const cmds::CompressedTexImage2D& c) { 7533 uint32 immediate_data_size, const cmds::CompressedTexImage2D& c) {
7553 GLenum target = static_cast<GLenum>(c.target); 7534 GLenum target = static_cast<GLenum>(c.target);
7554 GLint level = static_cast<GLint>(c.level); 7535 GLint level = static_cast<GLint>(c.level);
7555 GLenum internal_format = static_cast<GLenum>(c.internalformat); 7536 GLenum internal_format = static_cast<GLenum>(c.internalformat);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
7721 SetGLError(GL_INVALID_VALUE, function_name, "dimensions out of range"); 7702 SetGLError(GL_INVALID_VALUE, function_name, "dimensions out of range");
7722 return false; 7703 return false;
7723 } 7704 }
7724 if ((GLES2Util::GetChannelsForFormat(format) & 7705 if ((GLES2Util::GetChannelsForFormat(format) &
7725 (GLES2Util::kDepth | GLES2Util::kStencil)) != 0 && pixels) { 7706 (GLES2Util::kDepth | GLES2Util::kStencil)) != 0 && pixels) {
7726 SetGLError( 7707 SetGLError(
7727 GL_INVALID_OPERATION, 7708 GL_INVALID_OPERATION,
7728 function_name, "can not supply data for depth or stencil textures"); 7709 function_name, "can not supply data for depth or stencil textures");
7729 return false; 7710 return false;
7730 } 7711 }
7731 Texture* info = GetTextureInfoForTarget(target); 7712 Texture* texture = GetTextureInfoForTarget(target);
7732 if (!info) { 7713 if (!texture) {
7733 SetGLError(GL_INVALID_OPERATION, 7714 SetGLError(GL_INVALID_OPERATION,
7734 function_name, "unknown texture for target"); 7715 function_name, "unknown texture for target");
7735 return false; 7716 return false;
7736 } 7717 }
7737 if (info->IsImmutable()) { 7718 if (texture->IsImmutable()) {
7738 SetGLError(GL_INVALID_OPERATION, 7719 SetGLError(GL_INVALID_OPERATION,
7739 function_name, "texture is immutable"); 7720 function_name, "texture is immutable");
7740 return false; 7721 return false;
7741 } 7722 }
7742 return true; 7723 return true;
7743 } 7724 }
7744 7725
7745 void GLES2DecoderImpl::DoTexImage2D( 7726 void GLES2DecoderImpl::DoTexImage2D(
7746 GLenum target, 7727 GLenum target,
7747 GLint level, 7728 GLint level,
7748 GLenum internal_format, 7729 GLenum internal_format,
7749 GLsizei width, 7730 GLsizei width,
7750 GLsizei height, 7731 GLsizei height,
7751 GLint border, 7732 GLint border,
7752 GLenum format, 7733 GLenum format,
7753 GLenum type, 7734 GLenum type,
7754 const void* pixels, 7735 const void* pixels,
7755 uint32 pixels_size) { 7736 uint32 pixels_size) {
7756 if (!ValidateTexImage2D("glTexImage2D", target, level, internal_format, 7737 if (!ValidateTexImage2D("glTexImage2D", target, level, internal_format,
7757 width, height, border, format, type, pixels, pixels_size)) { 7738 width, height, border, format, type, pixels, pixels_size)) {
7758 return; 7739 return;
7759 } 7740 }
7760 7741
7761 if (!EnsureGPUMemoryAvailable(pixels_size)) { 7742 if (!EnsureGPUMemoryAvailable(pixels_size)) {
7762 SetGLError(GL_OUT_OF_MEMORY, "glTexImage2D", "out of memory"); 7743 SetGLError(GL_OUT_OF_MEMORY, "glTexImage2D", "out of memory");
7763 return; 7744 return;
7764 } 7745 }
7765 7746
7766 Texture* info = GetTextureInfoForTarget(target); 7747 Texture* texture = GetTextureInfoForTarget(target);
7767 GLsizei tex_width = 0; 7748 GLsizei tex_width = 0;
7768 GLsizei tex_height = 0; 7749 GLsizei tex_height = 0;
7769 GLenum tex_type = 0; 7750 GLenum tex_type = 0;
7770 GLenum tex_format = 0; 7751 GLenum tex_format = 0;
7771 bool level_is_same = 7752 bool level_is_same =
7772 info->GetLevelSize(target, level, &tex_width, &tex_height) && 7753 texture->GetLevelSize(target, level, &tex_width, &tex_height) &&
7773 info->GetLevelType(target, level, &tex_type, &tex_format) && 7754 texture->GetLevelType(target, level, &tex_type, &tex_format) &&
7774 width == tex_width && height == tex_height && 7755 width == tex_width && height == tex_height &&
7775 type == tex_type && format == tex_format; 7756 type == tex_type && format == tex_format;
7776 7757
7777 if (level_is_same && !pixels) { 7758 if (level_is_same && !pixels) {
7778 // Just set the level info but mark the texture as uncleared. 7759 // Just set the level texture but mark the texture as uncleared.
7779 texture_manager()->SetLevelInfo( 7760 texture_manager()->SetLevelInfo(
7780 info, 7761 texture,
7781 target, level, internal_format, width, height, 1, border, format, type, 7762 target, level, internal_format, width, height, 1, border, format, type,
7782 false); 7763 false);
7783 tex_image_2d_failed_ = false; 7764 tex_image_2d_failed_ = false;
7784 return; 7765 return;
7785 } 7766 }
7786 7767
7787 if (info->IsAttachedToFramebuffer()) { 7768 if (texture->IsAttachedToFramebuffer()) {
7788 clear_state_dirty_ = true; 7769 clear_state_dirty_ = true;
7789 // TODO(gman): If textures tracked which framebuffers they were attached to 7770 // TODO(gman): If textures tracked which framebuffers they were attached to
7790 // we could just mark those framebuffers as not complete. 7771 // we could just mark those framebuffers as not complete.
7791 framebuffer_manager()->IncFramebufferStateChangeCount(); 7772 framebuffer_manager()->IncFramebufferStateChangeCount();
7792 } 7773 }
7793 7774
7794 if (!teximage2d_faster_than_texsubimage2d_ && level_is_same && pixels) { 7775 if (!teximage2d_faster_than_texsubimage2d_ && level_is_same && pixels) {
7795 glTexSubImage2D(target, level, 0, 0, width, height, format, type, pixels); 7776 glTexSubImage2D(target, level, 0, 0, width, height, format, type, pixels);
7796 texture_manager()->SetLevelCleared(info, target, level, true); 7777 texture_manager()->SetLevelCleared(texture, target, level, true);
7797 tex_image_2d_failed_ = false; 7778 tex_image_2d_failed_ = false;
7798 return; 7779 return;
7799 } 7780 }
7800 7781
7801 CopyRealGLErrorsToWrapper(); 7782 CopyRealGLErrorsToWrapper();
7802 WrappedTexImage2D( 7783 WrappedTexImage2D(
7803 target, level, internal_format, width, height, border, format, type, 7784 target, level, internal_format, width, height, border, format, type,
7804 pixels); 7785 pixels);
7805 GLenum error = PeekGLError(); 7786 GLenum error = PeekGLError();
7806 if (error == GL_NO_ERROR) { 7787 if (error == GL_NO_ERROR) {
7807 texture_manager()->SetLevelInfo( 7788 texture_manager()->SetLevelInfo(
7808 info, 7789 texture,
7809 target, level, internal_format, width, height, 1, border, format, type, 7790 target, level, internal_format, width, height, 1, border, format, type,
7810 pixels != NULL); 7791 pixels != NULL);
7811 tex_image_2d_failed_ = false; 7792 tex_image_2d_failed_ = false;
7812 } 7793 }
7813 return; 7794 return;
7814 } 7795 }
7815 7796
7816 error::Error GLES2DecoderImpl::HandleTexImage2D( 7797 error::Error GLES2DecoderImpl::HandleTexImage2D(
7817 uint32 immediate_data_size, const cmds::TexImage2D& c) { 7798 uint32 immediate_data_size, const cmds::TexImage2D& c) {
7818 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexImage2D"); 7799 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexImage2D");
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
7878 void GLES2DecoderImpl::DoCompressedTexSubImage2D( 7859 void GLES2DecoderImpl::DoCompressedTexSubImage2D(
7879 GLenum target, 7860 GLenum target,
7880 GLint level, 7861 GLint level,
7881 GLint xoffset, 7862 GLint xoffset,
7882 GLint yoffset, 7863 GLint yoffset,
7883 GLsizei width, 7864 GLsizei width,
7884 GLsizei height, 7865 GLsizei height,
7885 GLenum format, 7866 GLenum format,
7886 GLsizei image_size, 7867 GLsizei image_size,
7887 const void * data) { 7868 const void * data) {
7888 Texture* info = GetTextureInfoForTarget(target); 7869 Texture* texture = GetTextureInfoForTarget(target);
7889 if (!info) { 7870 if (!texture) {
7890 SetGLError(GL_INVALID_OPERATION, 7871 SetGLError(GL_INVALID_OPERATION,
7891 "glCompressedTexSubImage2D", "unknown texture for target"); 7872 "glCompressedTexSubImage2D", "unknown texture for target");
7892 return; 7873 return;
7893 } 7874 }
7894 GLenum type = 0; 7875 GLenum type = 0;
7895 GLenum internal_format = 0; 7876 GLenum internal_format = 0;
7896 if (!info->GetLevelType(target, level, &type, &internal_format)) { 7877 if (!texture->GetLevelType(target, level, &type, &internal_format)) {
7897 SetGLError( 7878 SetGLError(
7898 GL_INVALID_OPERATION, 7879 GL_INVALID_OPERATION,
7899 "glCompressedTexSubImage2D", "level does not exist."); 7880 "glCompressedTexSubImage2D", "level does not exist.");
7900 return; 7881 return;
7901 } 7882 }
7902 if (internal_format != format) { 7883 if (internal_format != format) {
7903 SetGLError( 7884 SetGLError(
7904 GL_INVALID_OPERATION, 7885 GL_INVALID_OPERATION,
7905 "glCompressedTexSubImage2D", "format does not match internal format."); 7886 "glCompressedTexSubImage2D", "format does not match internal format.");
7906 return; 7887 return;
7907 } 7888 }
7908 if (!info->ValidForTexture( 7889 if (!texture->ValidForTexture(
7909 target, level, xoffset, yoffset, width, height, format, type)) { 7890 target, level, xoffset, yoffset, width, height, format, type)) {
7910 SetGLError(GL_INVALID_VALUE, 7891 SetGLError(GL_INVALID_VALUE,
7911 "glCompressedTexSubImage2D", "bad dimensions."); 7892 "glCompressedTexSubImage2D", "bad dimensions.");
7912 return; 7893 return;
7913 } 7894 }
7914 7895
7915 if (!ValidateCompressedTexFuncData( 7896 if (!ValidateCompressedTexFuncData(
7916 "glCompressedTexSubImage2D", width, height, format, image_size) || 7897 "glCompressedTexSubImage2D", width, height, format, image_size) ||
7917 !ValidateCompressedTexSubDimensions( 7898 !ValidateCompressedTexSubDimensions(
7918 "glCompressedTexSubImage2D", 7899 "glCompressedTexSubImage2D",
7919 target, level, xoffset, yoffset, width, height, format, info)) { 7900 target, level, xoffset, yoffset, width, height, format, texture)) {
7920 return; 7901 return;
7921 } 7902 }
7922 7903
7923 7904
7924 // Note: There is no need to deal with texture cleared tracking here 7905 // Note: There is no need to deal with texture cleared tracking here
7925 // because the validation above means you can only get here if the level 7906 // because the validation above means you can only get here if the level
7926 // is already a matching compressed format and in that case 7907 // is already a matching compressed format and in that case
7927 // CompressedTexImage2D already cleared the texture. 7908 // CompressedTexImage2D already cleared the texture.
7928 glCompressedTexSubImage2D( 7909 glCompressedTexSubImage2D(
7929 target, level, xoffset, yoffset, width, height, format, image_size, data); 7910 target, level, xoffset, yoffset, width, height, format, image_size, data);
(...skipping 19 matching lines...) Expand all
7949 void GLES2DecoderImpl::DoCopyTexImage2D( 7930 void GLES2DecoderImpl::DoCopyTexImage2D(
7950 GLenum target, 7931 GLenum target,
7951 GLint level, 7932 GLint level,
7952 GLenum internal_format, 7933 GLenum internal_format,
7953 GLint x, 7934 GLint x,
7954 GLint y, 7935 GLint y,
7955 GLsizei width, 7936 GLsizei width,
7956 GLsizei height, 7937 GLsizei height,
7957 GLint border) { 7938 GLint border) {
7958 DCHECK(!ShouldDeferReads()); 7939 DCHECK(!ShouldDeferReads());
7959 Texture* info = GetTextureInfoForTarget(target); 7940 Texture* texture = GetTextureInfoForTarget(target);
7960 if (!info) { 7941 if (!texture) {
7961 SetGLError(GL_INVALID_OPERATION, 7942 SetGLError(GL_INVALID_OPERATION,
7962 "glCopyTexImage2D", "unknown texture for target"); 7943 "glCopyTexImage2D", "unknown texture for target");
7963 return; 7944 return;
7964 } 7945 }
7965 if (info->IsImmutable()) { 7946 if (texture->IsImmutable()) {
7966 SetGLError(GL_INVALID_OPERATION, 7947 SetGLError(GL_INVALID_OPERATION,
7967 "glCopyTexImage2D", "texture is immutable"); 7948 "glCopyTexImage2D", "texture is immutable");
7968 } 7949 }
7969 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || 7950 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) ||
7970 border != 0) { 7951 border != 0) {
7971 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "dimensions out of range"); 7952 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "dimensions out of range");
7972 return; 7953 return;
7973 } 7954 }
7974 if (!ValidateTextureParameters( 7955 if (!ValidateTextureParameters(
7975 "glCopyTexImage2D", target, internal_format, GL_UNSIGNED_BYTE, level)) { 7956 "glCopyTexImage2D", target, internal_format, GL_UNSIGNED_BYTE, level)) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
8007 } 7988 }
8008 7989
8009 if (!CheckBoundFramebuffersValid("glCopyTexImage2D")) { 7990 if (!CheckBoundFramebuffersValid("glCopyTexImage2D")) {
8010 return; 7991 return;
8011 } 7992 }
8012 7993
8013 CopyRealGLErrorsToWrapper(); 7994 CopyRealGLErrorsToWrapper();
8014 ScopedResolvedFrameBufferBinder binder(this, false, true); 7995 ScopedResolvedFrameBufferBinder binder(this, false, true);
8015 gfx::Size size = GetBoundReadFrameBufferSize(); 7996 gfx::Size size = GetBoundReadFrameBufferSize();
8016 7997
8017 if (info->IsAttachedToFramebuffer()) { 7998 if (texture->IsAttachedToFramebuffer()) {
8018 clear_state_dirty_ = true; 7999 clear_state_dirty_ = true;
8019 // TODO(gman): If textures tracked which framebuffers they were attached to 8000 // TODO(gman): If textures tracked which framebuffers they were attached to
8020 // we could just mark those framebuffers as not complete. 8001 // we could just mark those framebuffers as not complete.
8021 framebuffer_manager()->IncFramebufferStateChangeCount(); 8002 framebuffer_manager()->IncFramebufferStateChangeCount();
8022 } 8003 }
8023 8004
8024 // Clip to size to source dimensions 8005 // Clip to size to source dimensions
8025 GLint copyX = 0; 8006 GLint copyX = 0;
8026 GLint copyY = 0; 8007 GLint copyY = 0;
8027 GLint copyWidth = 0; 8008 GLint copyWidth = 0;
8028 GLint copyHeight = 0; 8009 GLint copyHeight = 0;
8029 Clip(x, width, size.width(), &copyX, &copyWidth); 8010 Clip(x, width, size.width(), &copyX, &copyWidth);
8030 Clip(y, height, size.height(), &copyY, &copyHeight); 8011 Clip(y, height, size.height(), &copyY, &copyHeight);
8031 8012
8032 if (copyX != x || 8013 if (copyX != x ||
8033 copyY != y || 8014 copyY != y ||
8034 copyWidth != width || 8015 copyWidth != width ||
8035 copyHeight != height) { 8016 copyHeight != height) {
8036 // some part was clipped so clear the texture. 8017 // some part was clipped so clear the texture.
8037 if (!ClearLevel( 8018 if (!ClearLevel(
8038 info->service_id(), info->target(), 8019 texture->service_id(), texture->target(),
8039 target, level, internal_format, GL_UNSIGNED_BYTE, width, height, 8020 target, level, internal_format, GL_UNSIGNED_BYTE, width, height,
8040 info->IsImmutable())) { 8021 texture->IsImmutable())) {
8041 SetGLError(GL_OUT_OF_MEMORY, "glCopyTexImage2D", "dimensions too big"); 8022 SetGLError(GL_OUT_OF_MEMORY, "glCopyTexImage2D", "dimensions too big");
8042 return; 8023 return;
8043 } 8024 }
8044 if (copyHeight > 0 && copyWidth > 0) { 8025 if (copyHeight > 0 && copyWidth > 0) {
8045 GLint dx = copyX - x; 8026 GLint dx = copyX - x;
8046 GLint dy = copyY - y; 8027 GLint dy = copyY - y;
8047 GLint destX = dx; 8028 GLint destX = dx;
8048 GLint destY = dy; 8029 GLint destY = dy;
8049 glCopyTexSubImage2D(target, level, 8030 glCopyTexSubImage2D(target, level,
8050 destX, destY, copyX, copyY, 8031 destX, destY, copyX, copyY,
8051 copyWidth, copyHeight); 8032 copyWidth, copyHeight);
8052 } 8033 }
8053 } else { 8034 } else {
8054 glCopyTexImage2D(target, level, internal_format, 8035 glCopyTexImage2D(target, level, internal_format,
8055 copyX, copyY, copyWidth, copyHeight, border); 8036 copyX, copyY, copyWidth, copyHeight, border);
8056 } 8037 }
8057 GLenum error = PeekGLError(); 8038 GLenum error = PeekGLError();
8058 if (error == GL_NO_ERROR) { 8039 if (error == GL_NO_ERROR) {
8059 texture_manager()->SetLevelInfo( 8040 texture_manager()->SetLevelInfo(
8060 info, target, level, internal_format, width, height, 1, 8041 texture, target, level, internal_format, width, height, 1,
8061 border, internal_format, GL_UNSIGNED_BYTE, true); 8042 border, internal_format, GL_UNSIGNED_BYTE, true);
8062 } 8043 }
8063 } 8044 }
8064 8045
8065 void GLES2DecoderImpl::DoCopyTexSubImage2D( 8046 void GLES2DecoderImpl::DoCopyTexSubImage2D(
8066 GLenum target, 8047 GLenum target,
8067 GLint level, 8048 GLint level,
8068 GLint xoffset, 8049 GLint xoffset,
8069 GLint yoffset, 8050 GLint yoffset,
8070 GLint x, 8051 GLint x,
8071 GLint y, 8052 GLint y,
8072 GLsizei width, 8053 GLsizei width,
8073 GLsizei height) { 8054 GLsizei height) {
8074 DCHECK(!ShouldDeferReads()); 8055 DCHECK(!ShouldDeferReads());
8075 Texture* info = GetTextureInfoForTarget(target); 8056 Texture* texture = GetTextureInfoForTarget(target);
8076 if (!info) { 8057 if (!texture) {
8077 SetGLError(GL_INVALID_OPERATION, 8058 SetGLError(GL_INVALID_OPERATION,
8078 "glCopyTexSubImage2D", "unknown texture for target"); 8059 "glCopyTexSubImage2D", "unknown texture for target");
8079 return; 8060 return;
8080 } 8061 }
8081 GLenum type = 0; 8062 GLenum type = 0;
8082 GLenum format = 0; 8063 GLenum format = 0;
8083 if (!info->GetLevelType(target, level, &type, &format) || 8064 if (!texture->GetLevelType(target, level, &type, &format) ||
8084 !info->ValidForTexture( 8065 !texture->ValidForTexture(
8085 target, level, xoffset, yoffset, width, height, format, type)) { 8066 target, level, xoffset, yoffset, width, height, format, type)) {
8086 SetGLError(GL_INVALID_VALUE, 8067 SetGLError(GL_INVALID_VALUE,
8087 "glCopyTexSubImage2D", "bad dimensions."); 8068 "glCopyTexSubImage2D", "bad dimensions.");
8088 return; 8069 return;
8089 } 8070 }
8090 if (info->AsyncTransferIsInProgress()) { 8071 if (texture->AsyncTransferIsInProgress()) {
8091 SetGLError(GL_INVALID_OPERATION, 8072 SetGLError(GL_INVALID_OPERATION,
8092 "glCopyTexSubImage2D", "async upload pending for texture"); 8073 "glCopyTexSubImage2D", "async upload pending for texture");
8093 return; 8074 return;
8094 } 8075 }
8095 8076
8096 // Check we have compatible formats. 8077 // Check we have compatible formats.
8097 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); 8078 GLenum read_format = GetBoundReadFrameBufferInternalFormat();
8098 uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); 8079 uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format);
8099 uint32 channels_needed = GLES2Util::GetChannelsForFormat(format); 8080 uint32 channels_needed = GLES2Util::GetChannelsForFormat(format);
8100 8081
(...skipping 17 matching lines...) Expand all
8118 8099
8119 ScopedResolvedFrameBufferBinder binder(this, false, true); 8100 ScopedResolvedFrameBufferBinder binder(this, false, true);
8120 gfx::Size size = GetBoundReadFrameBufferSize(); 8101 gfx::Size size = GetBoundReadFrameBufferSize();
8121 GLint copyX = 0; 8102 GLint copyX = 0;
8122 GLint copyY = 0; 8103 GLint copyY = 0;
8123 GLint copyWidth = 0; 8104 GLint copyWidth = 0;
8124 GLint copyHeight = 0; 8105 GLint copyHeight = 0;
8125 Clip(x, width, size.width(), &copyX, &copyWidth); 8106 Clip(x, width, size.width(), &copyX, &copyWidth);
8126 Clip(y, height, size.height(), &copyY, &copyHeight); 8107 Clip(y, height, size.height(), &copyY, &copyHeight);
8127 8108
8128 if (!texture_manager()->ClearTextureLevel(this, info, target, level)) { 8109 if (!texture_manager()->ClearTextureLevel(this, texture, target, level)) {
8129 SetGLError(GL_OUT_OF_MEMORY, "glCopyTexSubImage2D", "dimensions too big"); 8110 SetGLError(GL_OUT_OF_MEMORY, "glCopyTexSubImage2D", "dimensions too big");
8130 return; 8111 return;
8131 } 8112 }
8132 8113
8133 if (copyX != x || 8114 if (copyX != x ||
8134 copyY != y || 8115 copyY != y ||
8135 copyWidth != width || 8116 copyWidth != width ||
8136 copyHeight != height) { 8117 copyHeight != height) {
8137 // some part was clipped so clear the sub rect. 8118 // some part was clipped so clear the sub rect.
8138 uint32 pixels_size = 0; 8119 uint32 pixels_size = 0;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
8187 return false; 8168 return false;
8188 } 8169 }
8189 if (!validators_->texture_format.IsValid(format)) { 8170 if (!validators_->texture_format.IsValid(format)) {
8190 SetGLErrorInvalidEnum(function_name, format, "format"); 8171 SetGLErrorInvalidEnum(function_name, format, "format");
8191 return false; 8172 return false;
8192 } 8173 }
8193 if (!validators_->pixel_type.IsValid(type)) { 8174 if (!validators_->pixel_type.IsValid(type)) {
8194 SetGLErrorInvalidEnum(function_name, type, "type"); 8175 SetGLErrorInvalidEnum(function_name, type, "type");
8195 return false; 8176 return false;
8196 } 8177 }
8197 Texture* info = GetTextureInfoForTarget(target); 8178 Texture* texture = GetTextureInfoForTarget(target);
8198 if (!info) { 8179 if (!texture) {
8199 SetGLError(GL_INVALID_OPERATION, 8180 SetGLError(GL_INVALID_OPERATION,
8200 function_name, "unknown texture for target"); 8181 function_name, "unknown texture for target");
8201 return false; 8182 return false;
8202 } 8183 }
8203 GLenum current_type = 0; 8184 GLenum current_type = 0;
8204 GLenum internal_format = 0; 8185 GLenum internal_format = 0;
8205 if (!info->GetLevelType(target, level, &current_type, &internal_format)) { 8186 if (!texture->GetLevelType(target, level, &current_type, &internal_format)) {
8206 SetGLError( 8187 SetGLError(
8207 GL_INVALID_OPERATION, function_name, "level does not exist."); 8188 GL_INVALID_OPERATION, function_name, "level does not exist.");
8208 return false; 8189 return false;
8209 } 8190 }
8210 if (format != internal_format) { 8191 if (format != internal_format) {
8211 SetGLError(GL_INVALID_OPERATION, 8192 SetGLError(GL_INVALID_OPERATION,
8212 function_name, "format does not match internal format."); 8193 function_name, "format does not match internal format.");
8213 return false; 8194 return false;
8214 } 8195 }
8215 if (type != current_type) { 8196 if (type != current_type) {
8216 SetGLError(GL_INVALID_OPERATION, 8197 SetGLError(GL_INVALID_OPERATION,
8217 function_name, "type does not match type of texture."); 8198 function_name, "type does not match type of texture.");
8218 return false; 8199 return false;
8219 } 8200 }
8220 if (info->AsyncTransferIsInProgress()) { 8201 if (texture->AsyncTransferIsInProgress()) {
8221 SetGLError(GL_INVALID_OPERATION, 8202 SetGLError(GL_INVALID_OPERATION,
8222 function_name, "async upload pending for texture"); 8203 function_name, "async upload pending for texture");
8223 return false; 8204 return false;
8224 } 8205 }
8225 if (!info->ValidForTexture( 8206 if (!texture->ValidForTexture(
8226 target, level, xoffset, yoffset, width, height, format, type)) { 8207 target, level, xoffset, yoffset, width, height, format, type)) {
8227 SetGLError(GL_INVALID_VALUE, function_name, "bad dimensions."); 8208 SetGLError(GL_INVALID_VALUE, function_name, "bad dimensions.");
8228 return false; 8209 return false;
8229 } 8210 }
8230 if ((GLES2Util::GetChannelsForFormat(format) & 8211 if ((GLES2Util::GetChannelsForFormat(format) &
8231 (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { 8212 (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) {
8232 SetGLError( 8213 SetGLError(
8233 GL_INVALID_OPERATION, 8214 GL_INVALID_OPERATION,
8234 function_name, "can not supply data for depth or stencil textures"); 8215 function_name, "can not supply data for depth or stencil textures");
8235 return false; 8216 return false;
(...skipping 13 matching lines...) Expand all
8249 GLsizei width, 8230 GLsizei width,
8250 GLsizei height, 8231 GLsizei height,
8251 GLenum format, 8232 GLenum format,
8252 GLenum type, 8233 GLenum type,
8253 const void * data) { 8234 const void * data) {
8254 error::Error error = error::kNoError; 8235 error::Error error = error::kNoError;
8255 if (!ValidateTexSubImage2D(&error, "glTexSubImage2D", target, level, 8236 if (!ValidateTexSubImage2D(&error, "glTexSubImage2D", target, level,
8256 xoffset, yoffset, width, height, format, type, data)) { 8237 xoffset, yoffset, width, height, format, type, data)) {
8257 return error; 8238 return error;
8258 } 8239 }
8259 Texture* info = GetTextureInfoForTarget(target); 8240 Texture* texture = GetTextureInfoForTarget(target);
8260 GLsizei tex_width = 0; 8241 GLsizei tex_width = 0;
8261 GLsizei tex_height = 0; 8242 GLsizei tex_height = 0;
8262 bool ok = info->GetLevelSize(target, level, &tex_width, &tex_height); 8243 bool ok = texture->GetLevelSize(target, level, &tex_width, &tex_height);
8263 DCHECK(ok); 8244 DCHECK(ok);
8264 if (xoffset != 0 || yoffset != 0 || 8245 if (xoffset != 0 || yoffset != 0 ||
8265 width != tex_width || height != tex_height) { 8246 width != tex_width || height != tex_height) {
8266 if (!texture_manager()->ClearTextureLevel(this, info, target, level)) { 8247 if (!texture_manager()->ClearTextureLevel(this, texture, target, level)) {
8267 SetGLError(GL_OUT_OF_MEMORY, "glTexSubImage2D", "dimensions too big"); 8248 SetGLError(GL_OUT_OF_MEMORY, "glTexSubImage2D", "dimensions too big");
8268 return error::kNoError; 8249 return error::kNoError;
8269 } 8250 }
8270 ScopedTextureUploadTimer timer(this); 8251 ScopedTextureUploadTimer timer(this);
8271 glTexSubImage2D( 8252 glTexSubImage2D(
8272 target, level, xoffset, yoffset, width, height, format, type, data); 8253 target, level, xoffset, yoffset, width, height, format, type, data);
8273 return error::kNoError; 8254 return error::kNoError;
8274 } 8255 }
8275 8256
8276 if (teximage2d_faster_than_texsubimage2d_ && !info->IsImmutable()) { 8257 if (teximage2d_faster_than_texsubimage2d_ && !texture->IsImmutable()) {
8277 ScopedTextureUploadTimer timer(this); 8258 ScopedTextureUploadTimer timer(this);
8278 // NOTE: In OpenGL ES 2.0 border is always zero and format is always the 8259 // NOTE: In OpenGL ES 2.0 border is always zero and format is always the
8279 // same as internal_foramt. If that changes we'll need to look them up. 8260 // same as internal_foramt. If that changes we'll need to look them up.
8280 WrappedTexImage2D( 8261 WrappedTexImage2D(
8281 target, level, format, width, height, 0, format, type, data); 8262 target, level, format, width, height, 0, format, type, data);
8282 } else { 8263 } else {
8283 ScopedTextureUploadTimer timer(this); 8264 ScopedTextureUploadTimer timer(this);
8284 glTexSubImage2D( 8265 glTexSubImage2D(
8285 target, level, xoffset, yoffset, width, height, format, type, data); 8266 target, level, xoffset, yoffset, width, height, format, type, data);
8286 } 8267 }
8287 texture_manager()->SetLevelCleared(info, target, level, true); 8268 texture_manager()->SetLevelCleared(texture, target, level, true);
8288 return error::kNoError; 8269 return error::kNoError;
8289 } 8270 }
8290 8271
8291 error::Error GLES2DecoderImpl::HandleTexSubImage2D( 8272 error::Error GLES2DecoderImpl::HandleTexSubImage2D(
8292 uint32 immediate_data_size, const cmds::TexSubImage2D& c) { 8273 uint32 immediate_data_size, const cmds::TexSubImage2D& c) {
8293 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexSubImage2D"); 8274 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexSubImage2D");
8294 GLboolean internal = static_cast<GLboolean>(c.internal); 8275 GLboolean internal = static_cast<GLboolean>(c.internal);
8295 if (internal == GL_TRUE && tex_image_2d_failed_) 8276 if (internal == GL_TRUE && tex_image_2d_failed_)
8296 return error::kNoError; 8277 return error::kNoError;
8297 8278
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
9299 } 9280 }
9300 9281
9301 uint32 client_id = c.client_id; 9282 uint32 client_id = c.client_id;
9302 typedef cmds::CreateStreamTextureCHROMIUM::Result Result; 9283 typedef cmds::CreateStreamTextureCHROMIUM::Result Result;
9303 Result* result = GetSharedMemoryAs<Result*>( 9284 Result* result = GetSharedMemoryAs<Result*>(
9304 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 9285 c.result_shm_id, c.result_shm_offset, sizeof(*result));
9305 9286
9306 if (!result) 9287 if (!result)
9307 return error::kOutOfBounds; 9288 return error::kOutOfBounds;
9308 *result = GL_ZERO; 9289 *result = GL_ZERO;
9309 Texture* info = 9290 Texture* texture = texture_manager()->GetTexture(client_id);
9310 texture_manager()->GetTexture(client_id); 9291 if (!texture) {
9311 if (!info) {
9312 SetGLError(GL_INVALID_VALUE, 9292 SetGLError(GL_INVALID_VALUE,
9313 "glCreateStreamTextureCHROMIUM", "" 9293 "glCreateStreamTextureCHROMIUM", ""
9314 "bad texture id."); 9294 "bad texture id.");
9315 return error::kNoError; 9295 return error::kNoError;
9316 } 9296 }
9317 9297
9318 if (info->IsStreamTexture()) { 9298 if (texture->IsStreamTexture()) {
9319 SetGLError(GL_INVALID_OPERATION, 9299 SetGLError(GL_INVALID_OPERATION,
9320 "glCreateStreamTextureCHROMIUM", "" 9300 "glCreateStreamTextureCHROMIUM", ""
9321 "is already a stream texture."); 9301 "is already a stream texture.");
9322 return error::kNoError; 9302 return error::kNoError;
9323 } 9303 }
9324 9304
9325 if (info->target() && info->target() != GL_TEXTURE_EXTERNAL_OES) { 9305 if (texture->target() && texture->target() != GL_TEXTURE_EXTERNAL_OES) {
9326 SetGLError(GL_INVALID_OPERATION, 9306 SetGLError(GL_INVALID_OPERATION,
9327 "glCreateStreamTextureCHROMIUM", "" 9307 "glCreateStreamTextureCHROMIUM", ""
9328 "is already bound to incompatible target."); 9308 "is already bound to incompatible target.");
9329 return error::kNoError; 9309 return error::kNoError;
9330 } 9310 }
9331 9311
9332 if (!stream_texture_manager_) 9312 if (!stream_texture_manager_)
9333 return error::kInvalidArguments; 9313 return error::kInvalidArguments;
9334 9314
9335 GLuint object_id = stream_texture_manager_->CreateStreamTexture( 9315 GLuint object_id = stream_texture_manager_->CreateStreamTexture(
9336 info->service_id(), client_id); 9316 texture->service_id(), client_id);
9337 9317
9338 if (object_id) { 9318 if (object_id) {
9339 info->SetStreamTexture(true); 9319 texture->SetStreamTexture(true);
9340 } else { 9320 } else {
9341 SetGLError(GL_OUT_OF_MEMORY, 9321 SetGLError(GL_OUT_OF_MEMORY,
9342 "glCreateStreamTextureCHROMIUM", "" 9322 "glCreateStreamTextureCHROMIUM", ""
9343 "failed to create platform texture."); 9323 "failed to create platform texture.");
9344 } 9324 }
9345 9325
9346 *result = object_id; 9326 *result = object_id;
9347 return error::kNoError; 9327 return error::kNoError;
9348 } 9328 }
9349 9329
9350 error::Error GLES2DecoderImpl::HandleDestroyStreamTextureCHROMIUM( 9330 error::Error GLES2DecoderImpl::HandleDestroyStreamTextureCHROMIUM(
9351 uint32 immediate_data_size, 9331 uint32 immediate_data_size,
9352 const cmds::DestroyStreamTextureCHROMIUM& c) { 9332 const cmds::DestroyStreamTextureCHROMIUM& c) {
9353 GLuint client_id = c.texture; 9333 GLuint client_id = c.texture;
9354 Texture* info = 9334 Texture* texture = texture_manager()->GetTexture(client_id);
9355 texture_manager()->GetTexture(client_id); 9335 if (texture && texture->IsStreamTexture()) {
9356 if (info && info->IsStreamTexture()) {
9357 if (!stream_texture_manager_) 9336 if (!stream_texture_manager_)
9358 return error::kInvalidArguments; 9337 return error::kInvalidArguments;
9359 9338
9360 stream_texture_manager_->DestroyStreamTexture(info->service_id()); 9339 stream_texture_manager_->DestroyStreamTexture(texture->service_id());
9361 info->SetStreamTexture(false); 9340 texture->SetStreamTexture(false);
9362 } else { 9341 } else {
9363 SetGLError(GL_INVALID_VALUE, 9342 SetGLError(GL_INVALID_VALUE,
9364 "glDestroyStreamTextureCHROMIUM", "bad texture id."); 9343 "glDestroyStreamTextureCHROMIUM", "bad texture id.");
9365 } 9344 }
9366 9345
9367 return error::kNoError; 9346 return error::kNoError;
9368 } 9347 }
9369 9348
9370 #if defined(OS_MACOSX) 9349 #if defined(OS_MACOSX)
9371 void GLES2DecoderImpl::ReleaseIOSurfaceForTexture(GLuint texture_id) { 9350 void GLES2DecoderImpl::ReleaseIOSurfaceForTexture(GLuint texture_id) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
9405 // know what's going on. 9384 // know what's going on.
9406 SetGLError( 9385 SetGLError(
9407 GL_INVALID_OPERATION, 9386 GL_INVALID_OPERATION,
9408 "glTexImageIOSurface2DCHROMIUM", 9387 "glTexImageIOSurface2DCHROMIUM",
9409 "requires TEXTURE_RECTANGLE_ARB target"); 9388 "requires TEXTURE_RECTANGLE_ARB target");
9410 return; 9389 return;
9411 } 9390 }
9412 9391
9413 // Default target might be conceptually valid, but disallow it to avoid 9392 // Default target might be conceptually valid, but disallow it to avoid
9414 // accidents. 9393 // accidents.
9415 Texture* info = GetTextureInfoForTargetUnlessDefault( 9394 Texture* texture = GetTextureInfoForTargetUnlessDefault(target);
9416 target); 9395 if (!texture) {
9417 if (!info) {
9418 SetGLError(GL_INVALID_OPERATION, 9396 SetGLError(GL_INVALID_OPERATION,
9419 "glTexImageIOSurface2DCHROMIUM", "no rectangle texture bound"); 9397 "glTexImageIOSurface2DCHROMIUM", "no rectangle texture bound");
9420 return; 9398 return;
9421 } 9399 }
9422 9400
9423 // Look up the new IOSurface. Note that because of asynchrony 9401 // Look up the new IOSurface. Note that because of asynchrony
9424 // between processes this might fail; during live resizing the 9402 // between processes this might fail; during live resizing the
9425 // plugin process might allocate and release an IOSurface before 9403 // plugin process might allocate and release an IOSurface before
9426 // this process gets a chance to look it up. Hold on to any old 9404 // this process gets a chance to look it up. Hold on to any old
9427 // IOSurface in this case. 9405 // IOSurface in this case.
9428 CFTypeRef surface = surface_support->IOSurfaceLookup(io_surface_id); 9406 CFTypeRef surface = surface_support->IOSurfaceLookup(io_surface_id);
9429 if (!surface) { 9407 if (!surface) {
9430 SetGLError( 9408 SetGLError(
9431 GL_INVALID_OPERATION, 9409 GL_INVALID_OPERATION,
9432 "glTexImageIOSurface2DCHROMIUM", "no IOSurface with the given ID"); 9410 "glTexImageIOSurface2DCHROMIUM", "no IOSurface with the given ID");
9433 return; 9411 return;
9434 } 9412 }
9435 9413
9436 // Release any IOSurface previously bound to this texture. 9414 // Release any IOSurface previously bound to this texture.
9437 ReleaseIOSurfaceForTexture(info->service_id()); 9415 ReleaseIOSurfaceForTexture(texture->service_id());
9438 9416
9439 // Make sure we release the IOSurface even if CGLTexImageIOSurface2D fails. 9417 // Make sure we release the IOSurface even if CGLTexImageIOSurface2D fails.
9440 texture_to_io_surface_map_.insert( 9418 texture_to_io_surface_map_.insert(
9441 std::make_pair(info->service_id(), surface)); 9419 std::make_pair(texture->service_id(), surface));
9442 9420
9443 CGLContextObj context = 9421 CGLContextObj context =
9444 static_cast<CGLContextObj>(context_->GetHandle()); 9422 static_cast<CGLContextObj>(context_->GetHandle());
9445 9423
9446 CGLError err = surface_support->CGLTexImageIOSurface2D( 9424 CGLError err = surface_support->CGLTexImageIOSurface2D(
9447 context, 9425 context,
9448 target, 9426 target,
9449 GL_RGBA, 9427 GL_RGBA,
9450 width, 9428 width,
9451 height, 9429 height,
9452 GL_BGRA, 9430 GL_BGRA,
9453 GL_UNSIGNED_INT_8_8_8_8_REV, 9431 GL_UNSIGNED_INT_8_8_8_8_REV,
9454 surface, 9432 surface,
9455 plane); 9433 plane);
9456 9434
9457 if (err != kCGLNoError) { 9435 if (err != kCGLNoError) {
9458 SetGLError( 9436 SetGLError(
9459 GL_INVALID_OPERATION, 9437 GL_INVALID_OPERATION,
9460 "glTexImageIOSurface2DCHROMIUM", "error in CGLTexImageIOSurface2D"); 9438 "glTexImageIOSurface2DCHROMIUM", "error in CGLTexImageIOSurface2D");
9461 return; 9439 return;
9462 } 9440 }
9463 9441
9464 texture_manager()->SetLevelInfo( 9442 texture_manager()->SetLevelInfo(
9465 info, target, 0, GL_RGBA, width, height, 1, 0, 9443 texture, target, 0, GL_RGBA, width, height, 1, 0,
9466 GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, true); 9444 GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, true);
9467 9445
9468 #else 9446 #else
9469 SetGLError(GL_INVALID_OPERATION, 9447 SetGLError(GL_INVALID_OPERATION,
9470 "glTexImageIOSurface2DCHROMIUM", "not supported."); 9448 "glTexImageIOSurface2DCHROMIUM", "not supported.");
9471 #endif 9449 #endif
9472 } 9450 }
9473 9451
9474 static GLenum ExtractFormatFromStorageFormat(GLenum internalformat) { 9452 static GLenum ExtractFormatFromStorageFormat(GLenum internalformat) {
9475 switch (internalformat) { 9453 switch (internalformat) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
9512 case GL_BGRA8_EXT: 9490 case GL_BGRA8_EXT:
9513 return GL_BGRA_EXT; 9491 return GL_BGRA_EXT;
9514 default: 9492 default:
9515 return GL_NONE; 9493 return GL_NONE;
9516 } 9494 }
9517 } 9495 }
9518 9496
9519 void GLES2DecoderImpl::DoCopyTextureCHROMIUM( 9497 void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
9520 GLenum target, GLuint source_id, GLuint dest_id, GLint level, 9498 GLenum target, GLuint source_id, GLuint dest_id, GLint level,
9521 GLenum internal_format) { 9499 GLenum internal_format) {
9522 Texture* dest_info = GetTexture(dest_id); 9500 Texture* dest_texture = GetTexture(dest_id);
9523 Texture* source_info = GetTexture(source_id); 9501 Texture* source_texture = GetTexture(source_id);
9524 9502
9525 if (!source_info || !dest_info) { 9503 if (!source_texture || !dest_texture) {
9526 SetGLError(GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "unknown texture id"); 9504 SetGLError(GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "unknown texture id");
9527 return; 9505 return;
9528 } 9506 }
9529 9507
9530 if (GL_TEXTURE_2D != target) { 9508 if (GL_TEXTURE_2D != target) {
9531 SetGLError(GL_INVALID_VALUE, 9509 SetGLError(GL_INVALID_VALUE,
9532 "glCopyTextureCHROMIUM", "invalid texture target"); 9510 "glCopyTextureCHROMIUM", "invalid texture target");
9533 return; 9511 return;
9534 } 9512 }
9535 9513
9536 if (dest_info->target() != GL_TEXTURE_2D || 9514 if (dest_texture->target() != GL_TEXTURE_2D ||
9537 source_info->target() != GL_TEXTURE_2D) { 9515 source_texture->target() != GL_TEXTURE_2D) {
9538 SetGLError(GL_INVALID_VALUE, 9516 SetGLError(GL_INVALID_VALUE,
9539 "glCopyTextureCHROMIUM", "invalid texture target binding"); 9517 "glCopyTextureCHROMIUM", "invalid texture target binding");
9540 return; 9518 return;
9541 } 9519 }
9542 9520
9543 int source_width, source_height, dest_width, dest_height; 9521 int source_width, source_height, dest_width, dest_height;
9544 if (!source_info->GetLevelSize(GL_TEXTURE_2D, 0, &source_width, 9522 if (!source_texture->GetLevelSize(GL_TEXTURE_2D, 0, &source_width,
9545 &source_height)) { 9523 &source_height)) {
9546 SetGLError(GL_INVALID_VALUE, 9524 SetGLError(GL_INVALID_VALUE,
9547 "glCopyTextureChromium", "source texture has no level 0"); 9525 "glCopyTextureChromium", "source texture has no level 0");
9548 return; 9526 return;
9549 } 9527 }
9550 9528
9551 // Check that this type of texture is allowed. 9529 // Check that this type of texture is allowed.
9552 if (!texture_manager()->ValidForTarget(GL_TEXTURE_2D, level, source_width, 9530 if (!texture_manager()->ValidForTarget(GL_TEXTURE_2D, level, source_width,
9553 source_height, 1)) { 9531 source_height, 1)) {
9554 SetGLError(GL_INVALID_VALUE, 9532 SetGLError(GL_INVALID_VALUE,
9555 "glCopyTextureCHROMIUM", "Bad dimensions"); 9533 "glCopyTextureCHROMIUM", "Bad dimensions");
9556 return; 9534 return;
9557 } 9535 }
9558 9536
9559 // Defer initializing the CopyTextureCHROMIUMResourceManager until it is 9537 // Defer initializing the CopyTextureCHROMIUMResourceManager until it is
9560 // needed because it takes 10s of milliseconds to initialize. 9538 // needed because it takes 10s of milliseconds to initialize.
9561 if (!copy_texture_CHROMIUM_.get()) { 9539 if (!copy_texture_CHROMIUM_.get()) {
9562 CopyRealGLErrorsToWrapper(); 9540 CopyRealGLErrorsToWrapper();
9563 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); 9541 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager());
9564 copy_texture_CHROMIUM_->Initialize(this); 9542 copy_texture_CHROMIUM_->Initialize(this);
9565 RestoreCurrentFramebufferBindings(); 9543 RestoreCurrentFramebufferBindings();
9566 if (PeekGLError() != GL_NO_ERROR) 9544 if (PeekGLError() != GL_NO_ERROR)
9567 return; 9545 return;
9568 } 9546 }
9569 9547
9570 GLenum dest_type; 9548 GLenum dest_type;
9571 GLenum dest_internal_format; 9549 GLenum dest_internal_format;
9572 bool dest_level_defined = dest_info->GetLevelSize(GL_TEXTURE_2D, level, 9550 bool dest_level_defined = dest_texture->GetLevelSize(
9573 &dest_width, 9551 GL_TEXTURE_2D, level, &dest_width, &dest_height);
9574 &dest_height);
9575 9552
9576 if (dest_level_defined) { 9553 if (dest_level_defined) {
9577 dest_info->GetLevelType(GL_TEXTURE_2D, level, &dest_type, 9554 dest_texture->GetLevelType(GL_TEXTURE_2D, level, &dest_type,
9578 &dest_internal_format); 9555 &dest_internal_format);
9579 } else { 9556 } else {
9580 GLenum source_internal_format; 9557 GLenum source_internal_format;
9581 source_info->GetLevelType(GL_TEXTURE_2D, 0, &dest_type, 9558 source_texture->GetLevelType(GL_TEXTURE_2D, 0, &dest_type,
9582 &source_internal_format); 9559 &source_internal_format);
9583 } 9560 }
9584 9561
9585 // Resize the destination texture to the dimensions of the source texture. 9562 // Resize the destination texture to the dimensions of the source texture.
9586 if (!dest_level_defined || dest_width != source_width || 9563 if (!dest_level_defined || dest_width != source_width ||
9587 dest_height != source_height || 9564 dest_height != source_height ||
9588 dest_internal_format != internal_format) { 9565 dest_internal_format != internal_format) {
9589 // Ensure that the glTexImage2D succeeds. 9566 // Ensure that the glTexImage2D succeeds.
9590 CopyRealGLErrorsToWrapper(); 9567 CopyRealGLErrorsToWrapper();
9591 glBindTexture(GL_TEXTURE_2D, dest_info->service_id()); 9568 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id());
9592 WrappedTexImage2D( 9569 WrappedTexImage2D(
9593 GL_TEXTURE_2D, level, internal_format, source_width, source_height, 9570 GL_TEXTURE_2D, level, internal_format, source_width, source_height,
9594 0, internal_format, dest_type, NULL); 9571 0, internal_format, dest_type, NULL);
9595 GLenum error = PeekGLError(); 9572 GLenum error = PeekGLError();
9596 if (error != GL_NO_ERROR) { 9573 if (error != GL_NO_ERROR) {
9597 RestoreCurrentTexture2DBindings(); 9574 RestoreCurrentTexture2DBindings();
9598 return; 9575 return;
9599 } 9576 }
9600 9577
9601 texture_manager()->SetLevelInfo( 9578 texture_manager()->SetLevelInfo(
9602 dest_info, GL_TEXTURE_2D, level, internal_format, source_width, 9579 dest_texture, GL_TEXTURE_2D, level, internal_format, source_width,
9603 source_height, 1, 0, internal_format, dest_type, true); 9580 source_height, 1, 0, internal_format, dest_type, true);
9604 } else { 9581 } else {
9605 texture_manager()->SetLevelCleared(dest_info, GL_TEXTURE_2D, level, true); 9582 texture_manager()->SetLevelCleared(
9583 dest_texture, GL_TEXTURE_2D, level, true);
9606 } 9584 }
9607 9585
9608 copy_texture_CHROMIUM_->DoCopyTexture(this, 9586 copy_texture_CHROMIUM_->DoCopyTexture(this,
9609 source_info->target(), 9587 source_texture->target(),
9610 dest_info->target(), 9588 dest_texture->target(),
9611 source_info->service_id(), 9589 source_texture->service_id(),
9612 dest_info->service_id(), level, 9590 dest_texture->service_id(), level,
9613 source_width, source_height, 9591 source_width, source_height,
9614 unpack_flip_y_, 9592 unpack_flip_y_,
9615 unpack_premultiply_alpha_, 9593 unpack_premultiply_alpha_,
9616 unpack_unpremultiply_alpha_); 9594 unpack_unpremultiply_alpha_);
9617 } 9595 }
9618 9596
9619 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { 9597 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) {
9620 switch (internalformat) { 9598 switch (internalformat) {
9621 case GL_RGB565: 9599 case GL_RGB565:
9622 return GL_UNSIGNED_SHORT_5_6_5; 9600 return GL_UNSIGNED_SHORT_5_6_5;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
9667 GLenum internal_format, 9645 GLenum internal_format,
9668 GLsizei width, 9646 GLsizei width,
9669 GLsizei height) { 9647 GLsizei height) {
9670 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoTexStorage2DEXT"); 9648 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoTexStorage2DEXT");
9671 if (!texture_manager()->ValidForTarget(target, 0, width, height, 1) || 9649 if (!texture_manager()->ValidForTarget(target, 0, width, height, 1) ||
9672 TextureManager::ComputeMipMapCount(width, height, 1) < levels) { 9650 TextureManager::ComputeMipMapCount(width, height, 1) < levels) {
9673 SetGLError( 9651 SetGLError(
9674 GL_INVALID_VALUE, "glTexStorage2DEXT", "dimensions out of range"); 9652 GL_INVALID_VALUE, "glTexStorage2DEXT", "dimensions out of range");
9675 return; 9653 return;
9676 } 9654 }
9677 Texture* info = GetTextureInfoForTarget(target); 9655 Texture* texture = GetTextureInfoForTarget(target);
9678 if (!info) { 9656 if (!texture) {
9679 SetGLError(GL_INVALID_OPERATION, 9657 SetGLError(GL_INVALID_OPERATION,
9680 "glTexStorage2DEXT", "unknown texture for target"); 9658 "glTexStorage2DEXT", "unknown texture for target");
9681 return; 9659 return;
9682 } 9660 }
9683 if (info->IsAttachedToFramebuffer()) { 9661 if (texture->IsAttachedToFramebuffer()) {
9684 clear_state_dirty_ = true; 9662 clear_state_dirty_ = true;
9685 } 9663 }
9686 if (info->IsImmutable()) { 9664 if (texture->IsImmutable()) {
9687 SetGLError(GL_INVALID_OPERATION, 9665 SetGLError(GL_INVALID_OPERATION,
9688 "glTexStorage2DEXT", "texture is immutable"); 9666 "glTexStorage2DEXT", "texture is immutable");
9689 return; 9667 return;
9690 } 9668 }
9691 9669
9692 GLenum format = ExtractFormatFromStorageFormat(internal_format); 9670 GLenum format = ExtractFormatFromStorageFormat(internal_format);
9693 GLenum type = ExtractTypeFromStorageFormat(internal_format); 9671 GLenum type = ExtractTypeFromStorageFormat(internal_format);
9694 9672
9695 { 9673 {
9696 GLsizei level_width = width; 9674 GLsizei level_width = width;
(...skipping 20 matching lines...) Expand all
9717 9695
9718 CopyRealGLErrorsToWrapper(); 9696 CopyRealGLErrorsToWrapper();
9719 glTexStorage2DEXT(target, levels, GetTexInternalFormat(internal_format), 9697 glTexStorage2DEXT(target, levels, GetTexInternalFormat(internal_format),
9720 width, height); 9698 width, height);
9721 GLenum error = PeekGLError(); 9699 GLenum error = PeekGLError();
9722 if (error == GL_NO_ERROR) { 9700 if (error == GL_NO_ERROR) {
9723 GLsizei level_width = width; 9701 GLsizei level_width = width;
9724 GLsizei level_height = height; 9702 GLsizei level_height = height;
9725 for (int ii = 0; ii < levels; ++ii) { 9703 for (int ii = 0; ii < levels; ++ii) {
9726 texture_manager()->SetLevelInfo( 9704 texture_manager()->SetLevelInfo(
9727 info, target, ii, format, level_width, level_height, 1, 0, format, 9705 texture, target, ii, format, level_width, level_height, 1, 0, format,
9728 type, false); 9706 type, false);
9729 level_width = std::max(1, level_width >> 1); 9707 level_width = std::max(1, level_width >> 1);
9730 level_height = std::max(1, level_height >> 1); 9708 level_height = std::max(1, level_height >> 1);
9731 } 9709 }
9732 info->SetImmutable(true); 9710 texture->SetImmutable(true);
9733 } 9711 }
9734 } 9712 }
9735 9713
9736 error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM( 9714 error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM(
9737 uint32 immediate_data_size, const cmds::GenMailboxCHROMIUM& c) { 9715 uint32 immediate_data_size, const cmds::GenMailboxCHROMIUM& c) {
9738 MailboxName name; 9716 MailboxName name;
9739 mailbox_manager()->GenerateMailboxName(&name); 9717 mailbox_manager()->GenerateMailboxName(&name);
9740 uint32 bucket_id = static_cast<uint32>(c.bucket_id); 9718 uint32 bucket_id = static_cast<uint32>(c.bucket_id);
9741 Bucket* bucket = CreateBucket(bucket_id); 9719 Bucket* bucket = CreateBucket(bucket_id);
9742 9720
9743 bucket->SetSize(GL_MAILBOX_SIZE_CHROMIUM); 9721 bucket->SetSize(GL_MAILBOX_SIZE_CHROMIUM);
9744 bucket->SetData(&name, 0, GL_MAILBOX_SIZE_CHROMIUM); 9722 bucket->SetData(&name, 0, GL_MAILBOX_SIZE_CHROMIUM);
9745 9723
9746 return error::kNoError; 9724 return error::kNoError;
9747 } 9725 }
9748 9726
9749 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, 9727 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target,
9750 const GLbyte* mailbox) { 9728 const GLbyte* mailbox) {
9751 Texture* info = GetTextureInfoForTarget(target); 9729 Texture* texture = GetTextureInfoForTarget(target);
9752 if (!info) { 9730 if (!texture) {
9753 SetGLError(GL_INVALID_OPERATION, 9731 SetGLError(GL_INVALID_OPERATION,
9754 "glProduceTextureCHROMIUM", "unknown texture for target"); 9732 "glProduceTextureCHROMIUM", "unknown texture for target");
9755 return; 9733 return;
9756 } 9734 }
9757 9735
9758 TextureDefinition* definition = texture_manager()->Save(info); 9736 TextureDefinition* definition = texture_manager()->Save(texture);
9759 if (!definition) { 9737 if (!definition) {
9760 SetGLError(GL_INVALID_OPERATION, 9738 SetGLError(GL_INVALID_OPERATION,
9761 "glProduceTextureCHROMIUM", "invalid texture"); 9739 "glProduceTextureCHROMIUM", "invalid texture");
9762 return; 9740 return;
9763 } 9741 }
9764 9742
9765 if (!group_->mailbox_manager()->ProduceTexture( 9743 if (!group_->mailbox_manager()->ProduceTexture(
9766 target, 9744 target,
9767 *reinterpret_cast<const MailboxName*>(mailbox), 9745 *reinterpret_cast<const MailboxName*>(mailbox),
9768 definition, 9746 definition,
9769 texture_manager())) { 9747 texture_manager())) {
9770 bool success = texture_manager()->Restore(info, definition); 9748 bool success = texture_manager()->Restore(
9749 "glProductTextureCHROMIUM", this, texture, definition);
9771 DCHECK(success); 9750 DCHECK(success);
9772 SetGLError(GL_INVALID_OPERATION, 9751 SetGLError(GL_INVALID_OPERATION,
9773 "glProduceTextureCHROMIUM", "invalid mailbox name"); 9752 "glProduceTextureCHROMIUM", "invalid mailbox name");
9774 return; 9753 return;
9775 } 9754 }
9776 9755
9777 glBindTexture(info->target(), info->service_id()); 9756 glBindTexture(texture->target(), texture->service_id());
9778 } 9757 }
9779 9758
9780 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, 9759 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
9781 const GLbyte* mailbox) { 9760 const GLbyte* mailbox) {
9782 Texture* info = GetTextureInfoForTarget(target); 9761 Texture* texture = GetTextureInfoForTarget(target);
9783 if (!info) { 9762 if (!texture) {
9784 SetGLError(GL_INVALID_OPERATION, 9763 SetGLError(GL_INVALID_OPERATION,
9785 "glConsumeTextureCHROMIUM", "unknown texture for target"); 9764 "glConsumeTextureCHROMIUM", "unknown texture for target");
9786 return; 9765 return;
9787 } 9766 }
9788 9767
9789 scoped_ptr<TextureDefinition> definition( 9768 scoped_ptr<TextureDefinition> definition(
9790 group_->mailbox_manager()->ConsumeTexture( 9769 group_->mailbox_manager()->ConsumeTexture(
9791 target, 9770 target,
9792 *reinterpret_cast<const MailboxName*>(mailbox))); 9771 *reinterpret_cast<const MailboxName*>(mailbox)));
9793 if (!definition.get()) { 9772 if (!definition.get()) {
9794 SetGLError(GL_INVALID_OPERATION, 9773 SetGLError(GL_INVALID_OPERATION,
9795 "glConsumeTextureCHROMIUM", "invalid mailbox name"); 9774 "glConsumeTextureCHROMIUM", "invalid mailbox name");
9796 return; 9775 return;
9797 } 9776 }
9798 9777
9799 if (!texture_manager()->Restore(info, definition.release())) { 9778 if (!texture_manager()->Restore(
9779 "glConsumeTextureCHROMIUM", this, texture, definition.release())) {
9800 SetGLError(GL_INVALID_OPERATION, 9780 SetGLError(GL_INVALID_OPERATION,
9801 "glConsumeTextureCHROMIUM", "invalid texture"); 9781 "glConsumeTextureCHROMIUM", "invalid texture");
9802 return; 9782 return;
9803 } 9783 }
9804
9805 glBindTexture(info->target(), info->service_id());
9806 } 9784 }
9807 9785
9808 void GLES2DecoderImpl::DoInsertEventMarkerEXT( 9786 void GLES2DecoderImpl::DoInsertEventMarkerEXT(
9809 GLsizei length, const GLchar* marker) { 9787 GLsizei length, const GLchar* marker) {
9810 if (!marker) { 9788 if (!marker) {
9811 marker = ""; 9789 marker = "";
9812 } 9790 }
9813 debug_marker_manager_.SetMarker( 9791 debug_marker_manager_.SetMarker(
9814 length ? std::string(marker, length) : std::string(marker)); 9792 length ? std::string(marker, length) : std::string(marker));
9815 } 9793 }
(...skipping 17 matching lines...) Expand all
9833 if (target != GL_TEXTURE_2D) { 9811 if (target != GL_TEXTURE_2D) {
9834 // This might be supported in the future. 9812 // This might be supported in the future.
9835 SetGLError( 9813 SetGLError(
9836 GL_INVALID_OPERATION, 9814 GL_INVALID_OPERATION,
9837 "glBindTexImage2DCHROMIUM", "requires TEXTURE_2D target"); 9815 "glBindTexImage2DCHROMIUM", "requires TEXTURE_2D target");
9838 return; 9816 return;
9839 } 9817 }
9840 9818
9841 // Default target might be conceptually valid, but disallow it to avoid 9819 // Default target might be conceptually valid, but disallow it to avoid
9842 // accidents. 9820 // accidents.
9843 Texture* info = GetTextureInfoForTargetUnlessDefault( 9821 Texture* texture = GetTextureInfoForTargetUnlessDefault(target);
9844 target); 9822 if (!texture) {
9845 if (!info) {
9846 SetGLError(GL_INVALID_OPERATION, 9823 SetGLError(GL_INVALID_OPERATION,
9847 "glBindTexImage2DCHROMIUM", "no texture bound"); 9824 "glBindTexImage2DCHROMIUM", "no texture bound");
9848 return; 9825 return;
9849 } 9826 }
9850 9827
9851 gfx::GLImage* gl_image = image_manager()->LookupImage(image_id); 9828 gfx::GLImage* gl_image = image_manager()->LookupImage(image_id);
9852 if (!gl_image) { 9829 if (!gl_image) {
9853 SetGLError(GL_INVALID_OPERATION, 9830 SetGLError(GL_INVALID_OPERATION,
9854 "glBindTexImage2DCHROMIUM", 9831 "glBindTexImage2DCHROMIUM",
9855 "no image found with the given ID"); 9832 "no image found with the given ID");
9856 return; 9833 return;
9857 } 9834 }
9858 9835
9859 if (!gl_image->BindTexImage()) { 9836 if (!gl_image->BindTexImage()) {
9860 SetGLError(GL_INVALID_OPERATION, 9837 SetGLError(GL_INVALID_OPERATION,
9861 "glBindTexImage2DCHROMIUM", 9838 "glBindTexImage2DCHROMIUM",
9862 "fail to bind image with the given ID"); 9839 "fail to bind image with the given ID");
9863 return; 9840 return;
9864 } 9841 }
9865 9842
9866 gfx::Size size = gl_image->GetSize(); 9843 gfx::Size size = gl_image->GetSize();
9867 texture_manager()->SetLevelInfo( 9844 texture_manager()->SetLevelInfo(
9868 info, target, 0, GL_RGBA, size.width(), size.height(), 1, 0, 9845 texture, target, 0, GL_RGBA, size.width(), size.height(), 1, 0,
9869 GL_RGBA, GL_UNSIGNED_BYTE, true); 9846 GL_RGBA, GL_UNSIGNED_BYTE, true);
9870 texture_manager()->SetLevelImage(info, target, 0, gl_image); 9847 texture_manager()->SetLevelImage(texture, target, 0, gl_image);
9871 } 9848 }
9872 9849
9873 void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM( 9850 void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM(
9874 GLenum target, GLint image_id) { 9851 GLenum target, GLint image_id) {
9875 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM"); 9852 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM");
9876 if (target != GL_TEXTURE_2D) { 9853 if (target != GL_TEXTURE_2D) {
9877 // This might be supported in the future. 9854 // This might be supported in the future.
9878 SetGLError( 9855 SetGLError(
9879 GL_INVALID_OPERATION, 9856 GL_INVALID_OPERATION,
9880 "glReleaseTexImage2DCHROMIUM", "requires TEXTURE_2D target"); 9857 "glReleaseTexImage2DCHROMIUM", "requires TEXTURE_2D target");
9881 return; 9858 return;
9882 } 9859 }
9883 9860
9884 // Default target might be conceptually valid, but disallow it to avoid 9861 // Default target might be conceptually valid, but disallow it to avoid
9885 // accidents. 9862 // accidents.
9886 Texture* info = GetTextureInfoForTargetUnlessDefault( 9863 Texture* texture = GetTextureInfoForTargetUnlessDefault(target);
9887 target); 9864 if (!texture) {
9888 if (!info) {
9889 SetGLError(GL_INVALID_OPERATION, 9865 SetGLError(GL_INVALID_OPERATION,
9890 "glReleaseTexImage2DCHROMIUM", "no texture bound"); 9866 "glReleaseTexImage2DCHROMIUM", "no texture bound");
9891 return; 9867 return;
9892 } 9868 }
9893 9869
9894 gfx::GLImage* gl_image = image_manager()->LookupImage(image_id); 9870 gfx::GLImage* gl_image = image_manager()->LookupImage(image_id);
9895 if (!gl_image) { 9871 if (!gl_image) {
9896 SetGLError(GL_INVALID_OPERATION, 9872 SetGLError(GL_INVALID_OPERATION,
9897 "glReleaseTexImage2DCHROMIUM", 9873 "glReleaseTexImage2DCHROMIUM",
9898 "no image found with the given ID"); 9874 "no image found with the given ID");
9899 return; 9875 return;
9900 } 9876 }
9901 9877
9902 // Do nothing when image is not currently bound. 9878 // Do nothing when image is not currently bound.
9903 if (info->GetLevelImage(target, 0) != gl_image) 9879 if (texture->GetLevelImage(target, 0) != gl_image)
9904 return; 9880 return;
9905 9881
9906 gl_image->ReleaseTexImage(); 9882 gl_image->ReleaseTexImage();
9907 9883
9908 texture_manager()->SetLevelInfo( 9884 texture_manager()->SetLevelInfo(
9909 info, target, 0, GL_RGBA, 0, 0, 1, 0, 9885 texture, target, 0, GL_RGBA, 0, 0, 1, 0,
9910 GL_RGBA, GL_UNSIGNED_BYTE, false); 9886 GL_RGBA, GL_UNSIGNED_BYTE, false);
9911 } 9887 }
9912 9888
9913 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( 9889 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM(
9914 uint32 immediate_data_size, const cmds::TraceBeginCHROMIUM& c) { 9890 uint32 immediate_data_size, const cmds::TraceBeginCHROMIUM& c) {
9915 Bucket* bucket = GetBucket(c.bucket_id); 9891 Bucket* bucket = GetBucket(c.bucket_id);
9916 if (!bucket || bucket->size() == 0) { 9892 if (!bucket || bucket->size() == 0) {
9917 return error::kInvalidArguments; 9893 return error::kInvalidArguments;
9918 } 9894 }
9919 std::string command_name; 9895 std::string command_name;
(...skipping 14 matching lines...) Expand all
9934 SetGLError(GL_INVALID_OPERATION, 9910 SetGLError(GL_INVALID_OPERATION,
9935 "glTraceEndCHROMIUM", "no trace begin found"); 9911 "glTraceEndCHROMIUM", "no trace begin found");
9936 return; 9912 return;
9937 } 9913 }
9938 TRACE_EVENT_COPY_ASYNC_END0("gpu", gpu_tracer_->CurrentName().c_str(), this); 9914 TRACE_EVENT_COPY_ASYNC_END0("gpu", gpu_tracer_->CurrentName().c_str(), this);
9939 gpu_tracer_->End(); 9915 gpu_tracer_->End();
9940 } 9916 }
9941 9917
9942 bool GLES2DecoderImpl::ValidateAsyncTransfer( 9918 bool GLES2DecoderImpl::ValidateAsyncTransfer(
9943 const char* function_name, 9919 const char* function_name,
9944 Texture* info, 9920 Texture* texture,
9945 GLenum target, 9921 GLenum target,
9946 GLint level, 9922 GLint level,
9947 const void * data) { 9923 const void * data) {
9948 // We only support async uploads to 2D textures for now. 9924 // We only support async uploads to 2D textures for now.
9949 if (GL_TEXTURE_2D != target) { 9925 if (GL_TEXTURE_2D != target) {
9950 SetGLErrorInvalidEnum(function_name, target, "target"); 9926 SetGLErrorInvalidEnum(function_name, target, "target");
9951 return false; 9927 return false;
9952 } 9928 }
9953 // We only support uploads to level zero for now. 9929 // We only support uploads to level zero for now.
9954 if (level != 0) { 9930 if (level != 0) {
9955 SetGLError(GL_INVALID_VALUE, function_name, "level != 0"); 9931 SetGLError(GL_INVALID_VALUE, function_name, "level != 0");
9956 return false; 9932 return false;
9957 } 9933 }
9958 // A transfer buffer must be bound, even for asyncTexImage2D. 9934 // A transfer buffer must be bound, even for asyncTexImage2D.
9959 if (data == NULL) { 9935 if (data == NULL) {
9960 SetGLError(GL_INVALID_OPERATION, function_name, "buffer == 0"); 9936 SetGLError(GL_INVALID_OPERATION, function_name, "buffer == 0");
9961 return false; 9937 return false;
9962 } 9938 }
9963 // We only support one async transfer in progress. 9939 // We only support one async transfer in progress.
9964 if (!info || info->AsyncTransferIsInProgress()) { 9940 if (!texture || texture->AsyncTransferIsInProgress()) {
9965 SetGLError(GL_INVALID_OPERATION, 9941 SetGLError(GL_INVALID_OPERATION,
9966 function_name, "transfer already in progress"); 9942 function_name, "transfer already in progress");
9967 return false; 9943 return false;
9968 } 9944 }
9969 return true; 9945 return true;
9970 } 9946 }
9971 9947
9972 error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM( 9948 error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM(
9973 uint32 immediate_data_size, const cmds::AsyncTexImage2DCHROMIUM& c) { 9949 uint32 immediate_data_size, const cmds::AsyncTexImage2DCHROMIUM& c) {
9974 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM"); 9950 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM");
(...skipping 26 matching lines...) Expand all
10001 } 9977 }
10002 9978
10003 // All the normal glTexSubImage2D validation. 9979 // All the normal glTexSubImage2D validation.
10004 if (!ValidateTexImage2D( 9980 if (!ValidateTexImage2D(
10005 "glAsyncTexImage2DCHROMIUM", target, level, internal_format, 9981 "glAsyncTexImage2DCHROMIUM", target, level, internal_format,
10006 width, height, border, format, type, pixels, pixels_size)) { 9982 width, height, border, format, type, pixels, pixels_size)) {
10007 return error::kNoError; 9983 return error::kNoError;
10008 } 9984 }
10009 9985
10010 // Extra async validation. 9986 // Extra async validation.
10011 Texture* info = GetTextureInfoForTarget(target); 9987 Texture* texture = GetTextureInfoForTarget(target);
10012 if (!ValidateAsyncTransfer( 9988 if (!ValidateAsyncTransfer(
10013 "glAsyncTexImage2DCHROMIUM", info, target, level, pixels)) 9989 "glAsyncTexImage2DCHROMIUM", texture, target, level, pixels))
10014 return error::kNoError; 9990 return error::kNoError;
10015 9991
10016 // Don't allow async redefinition of a textures. 9992 // Don't allow async redefinition of a textures.
10017 if (info->IsDefined()) { 9993 if (texture->IsDefined()) {
10018 SetGLError(GL_INVALID_OPERATION, 9994 SetGLError(GL_INVALID_OPERATION,
10019 "glAsyncTexImage2DCHROMIUM", "already defined"); 9995 "glAsyncTexImage2DCHROMIUM", "already defined");
10020 return error::kNoError; 9996 return error::kNoError;
10021 } 9997 }
10022 9998
10023 if (!EnsureGPUMemoryAvailable(pixels_size)) { 9999 if (!EnsureGPUMemoryAvailable(pixels_size)) {
10024 SetGLError(GL_OUT_OF_MEMORY, "glAsyncTexImage2DCHROMIUM", "out of memory"); 10000 SetGLError(GL_OUT_OF_MEMORY, "glAsyncTexImage2DCHROMIUM", "out of memory");
10025 return error::kNoError; 10001 return error::kNoError;
10026 } 10002 }
10027 10003
10028 // We know the memory/size is safe, so get the real shared memory since 10004 // We know the memory/size is safe, so get the real shared memory since
10029 // it might need to be duped to prevent use-after-free of the memory. 10005 // it might need to be duped to prevent use-after-free of the memory.
10030 gpu::Buffer buffer = GetSharedMemoryBuffer(c.pixels_shm_id); 10006 gpu::Buffer buffer = GetSharedMemoryBuffer(c.pixels_shm_id);
10031 base::SharedMemory* shared_memory = buffer.shared_memory; 10007 base::SharedMemory* shared_memory = buffer.shared_memory;
10032 uint32 shm_size = buffer.size; 10008 uint32 shm_size = buffer.size;
10033 uint32 shm_data_offset = c.pixels_shm_offset; 10009 uint32 shm_data_offset = c.pixels_shm_offset;
10034 uint32 shm_data_size = pixels_size; 10010 uint32 shm_data_size = pixels_size;
10035 10011
10036 // Set up the async state if needed, and make the texture 10012 // Set up the async state if needed, and make the texture
10037 // immutable so the async state stays valid. The level info 10013 // immutable so the async state stays valid. The level texture
10038 // is set up lazily when the transfer completes. 10014 // is set up lazily when the transfer completes.
10039 DCHECK(!info->GetAsyncTransferState()); 10015 DCHECK(!texture->GetAsyncTransferState());
10040 info->SetAsyncTransferState( 10016 texture->SetAsyncTransferState(
10041 async_pixel_transfer_delegate_-> 10017 async_pixel_transfer_delegate_->
10042 CreatePixelTransferState(info->service_id())); 10018 CreatePixelTransferState(texture->service_id()));
10043 info->SetImmutable(true); 10019 texture->SetImmutable(true);
10044 10020
10045 // Issue the async call and set up the texture. 10021 // Issue the async call and set up the texture.
10046 GLenum gl_internal_format = 10022 GLenum gl_internal_format =
10047 GetTexInternalFormat(internal_format, format, type); 10023 GetTexInternalFormat(internal_format, format, type);
10048 gfx::AsyncTexImage2DParams tex_params = {target, level, gl_internal_format, 10024 gfx::AsyncTexImage2DParams tex_params = {target, level, gl_internal_format,
10049 width, height, border, format, type}; 10025 width, height, border, format, type};
10050 gfx::AsyncMemoryParams mem_params = {shared_memory, shm_size, 10026 gfx::AsyncMemoryParams mem_params = {shared_memory, shm_size,
10051 shm_data_offset, shm_data_size}; 10027 shm_data_offset, shm_data_size};
10052 10028
10053 // Add a pending transfer to the texture manager, which will bind the 10029 // Add a pending transfer to the texture manager, which will bind the
10054 // transfer data to the texture and set the level info at the same time, 10030 // transfer data to the texture and set the level texture at the same time,
10055 // after the the transfer is complete. 10031 // after the the transfer is complete.
10056 texture_manager()->AddPendingAsyncPixelTransfer( 10032 texture_manager()->AddPendingAsyncPixelTransfer(
10057 info->GetAsyncTransferState()->AsWeakPtr(), info); 10033 texture->GetAsyncTransferState()->AsWeakPtr(), texture);
10058 10034
10059 async_pixel_transfer_delegate_->AsyncTexImage2D( 10035 async_pixel_transfer_delegate_->AsyncTexImage2D(
10060 info->GetAsyncTransferState(), tex_params, mem_params); 10036 texture->GetAsyncTransferState(), tex_params, mem_params);
10061 return error::kNoError; 10037 return error::kNoError;
10062 } 10038 }
10063 10039
10064 error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM( 10040 error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM(
10065 uint32 immediate_data_size, const cmds::AsyncTexSubImage2DCHROMIUM& c) { 10041 uint32 immediate_data_size, const cmds::AsyncTexSubImage2DCHROMIUM& c) {
10066 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM"); 10042 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM");
10067 GLenum target = static_cast<GLenum>(c.target); 10043 GLenum target = static_cast<GLenum>(c.target);
10068 GLint level = static_cast<GLint>(c.level); 10044 GLint level = static_cast<GLint>(c.level);
10069 GLint xoffset = static_cast<GLint>(c.xoffset); 10045 GLint xoffset = static_cast<GLint>(c.xoffset);
10070 GLint yoffset = static_cast<GLint>(c.yoffset); 10046 GLint yoffset = static_cast<GLint>(c.yoffset);
(...skipping 14 matching lines...) Expand all
10085 c.data_shm_id, c.data_shm_offset, data_size); 10061 c.data_shm_id, c.data_shm_offset, data_size);
10086 10062
10087 // All the normal glTexSubImage2D validation. 10063 // All the normal glTexSubImage2D validation.
10088 error::Error error = error::kNoError; 10064 error::Error error = error::kNoError;
10089 if (!ValidateTexSubImage2D(&error, "glAsyncTexSubImage2DCHROMIUM", 10065 if (!ValidateTexSubImage2D(&error, "glAsyncTexSubImage2DCHROMIUM",
10090 target, level, xoffset, yoffset, width, height, format, type, pixels)) { 10066 target, level, xoffset, yoffset, width, height, format, type, pixels)) {
10091 return error; 10067 return error;
10092 } 10068 }
10093 10069
10094 // Extra async validation. 10070 // Extra async validation.
10095 Texture* info = GetTextureInfoForTarget(target); 10071 Texture* texture = GetTextureInfoForTarget(target);
10096 if (!ValidateAsyncTransfer( 10072 if (!ValidateAsyncTransfer(
10097 "glAsyncTexSubImage2DCHROMIUM", info, target, level, pixels)) 10073 "glAsyncTexSubImage2DCHROMIUM", texture, target, level, pixels))
10098 return error::kNoError; 10074 return error::kNoError;
10099 10075
10100 // Guarantee async textures are always 'cleared' as follows: 10076 // Guarantee async textures are always 'cleared' as follows:
10101 // - AsyncTexImage2D can not redefine an existing texture 10077 // - AsyncTexImage2D can not redefine an existing texture
10102 // - AsyncTexImage2D must initialize the entire image via non-null buffer. 10078 // - AsyncTexImage2D must initialize the entire image via non-null buffer.
10103 // - AsyncTexSubImage2D clears synchronously if not already cleared. 10079 // - AsyncTexSubImage2D clears synchronously if not already cleared.
10104 // - Textures become immutable after an async call. 10080 // - Textures become immutable after an async call.
10105 // This way we know in all cases that an async texture is always clear. 10081 // This way we know in all cases that an async texture is always clear.
10106 if (!info->SafeToRenderFrom()) { 10082 if (!texture->SafeToRenderFrom()) {
10107 if (!texture_manager()->ClearTextureLevel(this, info, target, level)) { 10083 if (!texture_manager()->ClearTextureLevel(this, texture, target, level)) {
10108 SetGLError(GL_OUT_OF_MEMORY, 10084 SetGLError(GL_OUT_OF_MEMORY,
10109 "glAsyncTexSubImage2DCHROMIUM", "dimensions too big"); 10085 "glAsyncTexSubImage2DCHROMIUM", "dimensions too big");
10110 return error::kNoError; 10086 return error::kNoError;
10111 } 10087 }
10112 } 10088 }
10113 10089
10114 // We know the memory/size is safe, so get the real shared memory since 10090 // We know the memory/size is safe, so get the real shared memory since
10115 // it might need to be duped to prevent use-after-free of the memory. 10091 // it might need to be duped to prevent use-after-free of the memory.
10116 gpu::Buffer buffer = GetSharedMemoryBuffer(c.data_shm_id); 10092 gpu::Buffer buffer = GetSharedMemoryBuffer(c.data_shm_id);
10117 base::SharedMemory* shared_memory = buffer.shared_memory; 10093 base::SharedMemory* shared_memory = buffer.shared_memory;
10118 uint32 shm_size = buffer.size; 10094 uint32 shm_size = buffer.size;
10119 uint32 shm_data_offset = c.data_shm_offset; 10095 uint32 shm_data_offset = c.data_shm_offset;
10120 uint32 shm_data_size = data_size; 10096 uint32 shm_data_size = data_size;
10121 10097
10122 if (!info->GetAsyncTransferState()) { 10098 if (!texture->GetAsyncTransferState()) {
10123 // Set up the async state if needed, and make the texture 10099 // Set up the async state if needed, and make the texture
10124 // immutable so the async state stays valid. 10100 // immutable so the async state stays valid.
10125 info->SetAsyncTransferState( 10101 texture->SetAsyncTransferState(
10126 async_pixel_transfer_delegate_-> 10102 async_pixel_transfer_delegate_->
10127 CreatePixelTransferState(info->service_id())); 10103 CreatePixelTransferState(texture->service_id()));
10128 info->SetImmutable(true); 10104 texture->SetImmutable(true);
10129 } 10105 }
10130 10106
10131 gfx::AsyncTexSubImage2DParams tex_params = {target, level, xoffset, yoffset, 10107 gfx::AsyncTexSubImage2DParams tex_params = {target, level, xoffset, yoffset,
10132 width, height, format, type}; 10108 width, height, format, type};
10133 gfx::AsyncMemoryParams mem_params = {shared_memory, shm_size, 10109 gfx::AsyncMemoryParams mem_params = {shared_memory, shm_size,
10134 shm_data_offset, shm_data_size}; 10110 shm_data_offset, shm_data_size};
10135 async_pixel_transfer_delegate_->AsyncTexSubImage2D( 10111 async_pixel_transfer_delegate_->AsyncTexSubImage2D(
10136 info->GetAsyncTransferState(), tex_params, mem_params); 10112 texture->GetAsyncTransferState(), tex_params, mem_params);
10137 return error::kNoError; 10113 return error::kNoError;
10138 } 10114 }
10139 10115
10140 error::Error GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM( 10116 error::Error GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM(
10141 uint32 immediate_data_size, const cmds::WaitAsyncTexImage2DCHROMIUM& c) { 10117 uint32 immediate_data_size, const cmds::WaitAsyncTexImage2DCHROMIUM& c) {
10142 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM"); 10118 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM");
10143 GLenum target = static_cast<GLenum>(c.target); 10119 GLenum target = static_cast<GLenum>(c.target);
10144 10120
10145 if (GL_TEXTURE_2D != target) { 10121 if (GL_TEXTURE_2D != target) {
10146 SetGLError(GL_INVALID_ENUM, "glWaitAsyncTexImage2DCHROMIUM", "target"); 10122 SetGLError(GL_INVALID_ENUM, "glWaitAsyncTexImage2DCHROMIUM", "target");
10147 return error::kNoError; 10123 return error::kNoError;
10148 } 10124 }
10149 Texture* info = GetTextureInfoForTarget(target); 10125 Texture* texture = GetTextureInfoForTarget(target);
10150 if (!info) { 10126 if (!texture) {
10151 SetGLError(GL_INVALID_OPERATION, 10127 SetGLError(GL_INVALID_OPERATION,
10152 "glWaitAsyncTexImage2DCHROMIUM", "unknown texture"); 10128 "glWaitAsyncTexImage2DCHROMIUM", "unknown texture");
10153 return error::kNoError; 10129 return error::kNoError;
10154 } 10130 }
10155 async_pixel_transfer_delegate_->WaitForTransferCompletion( 10131 async_pixel_transfer_delegate_->WaitForTransferCompletion(
10156 info->GetAsyncTransferState()); 10132 texture->GetAsyncTransferState());
10157 ProcessFinishedAsyncTransfers(); 10133 ProcessFinishedAsyncTransfers();
10158 return error::kNoError; 10134 return error::kNoError;
10159 } 10135 }
10160 10136
10161 // Include the auto-generated part of this file. We split this because it means 10137 // Include the auto-generated part of this file. We split this because it means
10162 // we can easily edit the non-auto generated parts right here in this file 10138 // we can easily edit the non-auto generated parts right here in this file
10163 // instead of having to edit some template or the code generator. 10139 // instead of having to edit some template or the code generator.
10164 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10140 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10165 10141
10166 } // namespace gles2 10142 } // namespace gles2
10167 } // namespace gpu 10143 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager_unittest.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