Chromium Code Reviews| Index: gpu/command_buffer/service/texture_manager.cc |
| diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc |
| index ed0fd10e5b1e6e1ae96fc5b0316d0be8b10290fb..71aa3a05748ec4a8dda61875e2915d184c5995e1 100644 |
| --- a/gpu/command_buffer/service/texture_manager.cc |
| +++ b/gpu/command_buffer/service/texture_manager.cc |
| @@ -1939,6 +1939,12 @@ void TextureManager::ValidateAndDoTexImage( |
| return; |
| } |
| + if (texture_state->force_cube_map_positive_x_allocation) { |
| + DoTexImage2DCubeMapPositiveXIfNeeded(texture_state, state->GetErrorState(), |
| + framebuffer_state, function_name, |
| + texture_ref, args); |
| + } |
| + |
| DoTexImage(texture_state, state->GetErrorState(), framebuffer_state, |
| function_name, texture_ref, args); |
| } |
| @@ -1955,6 +1961,40 @@ GLenum TextureManager::AdjustTexFormat(GLenum format) const { |
| return format; |
| } |
| +// Nexus 5 crashes on allocating a cube map texture bound to FBO, if |
| +// the CUBE_MAP_POSITIVE_X texture is not allocated yet. |
| +void TextureManager::DoTexImage2DCubeMapPositiveXIfNeeded( |
| + DecoderTextureState* texture_state, |
| + ErrorState* error_state, |
| + DecoderFramebufferState* framebuffer_state, |
| + const char* function_name, |
| + TextureRef* texture_ref, |
| + const DoTexImageArguments& args) { |
| + switch (args.target) { |
| + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| + break; |
| + default: |
| + return; |
| + } |
| + |
| + // ValidateTexImage is passed already. |
| + Texture* texture = texture_ref->texture(); |
| + int width = 0; |
| + int height = 0; |
| + bool positive_x_level_defined = texture->GetLevelSize( |
| + GL_TEXTURE_CUBE_MAP_POSITIVE_X, args.level, &width, &height, nullptr); |
| + if (!positive_x_level_defined) { |
| + DoTexImageArguments positive_x_args = args; |
|
no sievers
2015/08/11 21:07:39
I don't think we should use the pixels passed in w
dshwang
2015/08/12 08:06:09
Good point. I'll reset pixels to nullptr like regu
no sievers
2015/08/12 18:54:05
I don't think it's true that it needs to be comple
dshwang
2015/08/13 09:12:35
Yes, I incorrectly explained the implementation de
|
| + positive_x_args.target = GL_TEXTURE_CUBE_MAP_POSITIVE_X; |
| + DoTexImage(texture_state, error_state, framebuffer_state, function_name, |
| + texture_ref, positive_x_args); |
| + } |
| +} |
| + |
| void TextureManager::DoTexImage( |
| DecoderTextureState* texture_state, |
| ErrorState* error_state, |