OLD | NEW |
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 3077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3088 GLuint width = static_cast<GLuint>(c.width); | 3088 GLuint width = static_cast<GLuint>(c.width); |
3089 GLuint height = static_cast<GLuint>(c.height); | 3089 GLuint height = static_cast<GLuint>(c.height); |
3090 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); | 3090 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); |
3091 #if defined(OS_POSIX) && !defined(OS_MACOSX) && \ | 3091 #if defined(OS_POSIX) && !defined(OS_MACOSX) && \ |
3092 !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 3092 !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
3093 // Make sure that we are done drawing to the back buffer before resizing. | 3093 // Make sure that we are done drawing to the back buffer before resizing. |
3094 glFinish(); | 3094 glFinish(); |
3095 #endif | 3095 #endif |
3096 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); | 3096 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
3097 if (is_offscreen) { | 3097 if (is_offscreen) { |
3098 if (!ResizeOffscreenFrameBuffer(gfx::Size(width, height))) | 3098 if (!ResizeOffscreenFrameBuffer(gfx::Size(width, height))) { |
| 3099 LOG(ERROR) << "GLES2DecoderImpl: Context lost because " |
| 3100 << "ResizeOffscreenFrameBuffer failed."; |
3099 return error::kLostContext; | 3101 return error::kLostContext; |
| 3102 } |
3100 } | 3103 } |
3101 | 3104 |
3102 if (!resize_callback_.is_null()) { | 3105 if (!resize_callback_.is_null()) { |
3103 resize_callback_.Run(gfx::Size(width, height)); | 3106 resize_callback_.Run(gfx::Size(width, height)); |
3104 DCHECK(context_->IsCurrent(surface_.get())); | 3107 DCHECK(context_->IsCurrent(surface_.get())); |
3105 if (!context_->IsCurrent(surface_.get())) | 3108 if (!context_->IsCurrent(surface_.get())) { |
| 3109 LOG(ERROR) << "GLES2DecoderImpl: Context lost because context no longer " |
| 3110 << "current after resize callback."; |
3106 return error::kLostContext; | 3111 return error::kLostContext; |
| 3112 } |
3107 } | 3113 } |
3108 | 3114 |
3109 UpdateBackbufferMemoryAccounting(); | 3115 UpdateBackbufferMemoryAccounting(); |
3110 | 3116 |
3111 return error::kNoError; | 3117 return error::kNoError; |
3112 } | 3118 } |
3113 | 3119 |
3114 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { | 3120 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { |
3115 if (command_id > kStartPoint && command_id < kNumCommands) { | 3121 if (command_id > kStartPoint && command_id < kNumCommands) { |
3116 return gles2::GetCommandName(static_cast<CommandId>(command_id)); | 3122 return gles2::GetCommandName(static_cast<CommandId>(command_id)); |
(...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6250 } | 6256 } |
6251 | 6257 |
6252 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( | 6258 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |
6253 uint32 immediate_data_size, const gles2::PostSubBufferCHROMIUM& c) { | 6259 uint32 immediate_data_size, const gles2::PostSubBufferCHROMIUM& c) { |
6254 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); | 6260 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); |
6255 if (!context_->HasExtension("GL_CHROMIUM_post_sub_buffer")) { | 6261 if (!context_->HasExtension("GL_CHROMIUM_post_sub_buffer")) { |
6256 SetGLError(GL_INVALID_OPERATION, | 6262 SetGLError(GL_INVALID_OPERATION, |
6257 "glPostSubBufferCHROMIUM: command not supported by surface"); | 6263 "glPostSubBufferCHROMIUM: command not supported by surface"); |
6258 return error::kNoError; | 6264 return error::kNoError; |
6259 } | 6265 } |
6260 if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) | 6266 if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) { |
6261 return error::kNoError; | 6267 return error::kNoError; |
6262 else | 6268 } else { |
| 6269 LOG(ERROR) << "Context lost because PostSubBuffer failed."; |
6263 return error::kLostContext; | 6270 return error::kLostContext; |
| 6271 } |
6264 } | 6272 } |
6265 | 6273 |
6266 error::Error GLES2DecoderImpl::GetAttribLocationHelper( | 6274 error::Error GLES2DecoderImpl::GetAttribLocationHelper( |
6267 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 6275 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, |
6268 const std::string& name_str) { | 6276 const std::string& name_str) { |
6269 if (!StringIsValidForGLES(name_str.c_str())) { | 6277 if (!StringIsValidForGLES(name_str.c_str())) { |
6270 SetGLError(GL_INVALID_VALUE, "glGetAttribLocation: Invalid character"); | 6278 SetGLError(GL_INVALID_VALUE, "glGetAttribLocation: Invalid character"); |
6271 return error::kNoError; | 6279 return error::kNoError; |
6272 } | 6280 } |
6273 ProgramManager::ProgramInfo* info = GetProgramInfoNotShader( | 6281 ProgramManager::ProgramInfo* info = GetProgramInfoNotShader( |
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8410 } | 8418 } |
8411 } | 8419 } |
8412 | 8420 |
8413 // Include the auto-generated part of this file. We split this because it means | 8421 // Include the auto-generated part of this file. We split this because it means |
8414 // we can easily edit the non-auto generated parts right here in this file | 8422 // we can easily edit the non-auto generated parts right here in this file |
8415 // instead of having to edit some template or the code generator. | 8423 // instead of having to edit some template or the code generator. |
8416 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 8424 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
8417 | 8425 |
8418 } // namespace gles2 | 8426 } // namespace gles2 |
8419 } // namespace gpu | 8427 } // namespace gpu |
OLD | NEW |