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 2973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2984 GLuint width = static_cast<GLuint>(c.width); | 2984 GLuint width = static_cast<GLuint>(c.width); |
2985 GLuint height = static_cast<GLuint>(c.height); | 2985 GLuint height = static_cast<GLuint>(c.height); |
2986 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); | 2986 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); |
2987 #if defined(OS_POSIX) && !defined(OS_MACOSX) && \ | 2987 #if defined(OS_POSIX) && !defined(OS_MACOSX) && \ |
2988 !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 2988 !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
2989 // Make sure that we are done drawing to the back buffer before resizing. | 2989 // Make sure that we are done drawing to the back buffer before resizing. |
2990 glFinish(); | 2990 glFinish(); |
2991 #endif | 2991 #endif |
2992 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); | 2992 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
2993 if (is_offscreen) { | 2993 if (is_offscreen) { |
2994 if (!ResizeOffscreenFrameBuffer(gfx::Size(width, height))) | 2994 if (!ResizeOffscreenFrameBuffer(gfx::Size(width, height))) { |
| 2995 LOG(ERROR) << "GLES2DecoderImpl: Context lost because " |
| 2996 << "ResizeOffscreenFrameBuffer failed."; |
2995 return error::kLostContext; | 2997 return error::kLostContext; |
| 2998 } |
2996 } | 2999 } |
2997 | 3000 |
2998 if (!resize_callback_.is_null()) { | 3001 if (!resize_callback_.is_null()) { |
2999 resize_callback_.Run(gfx::Size(width, height)); | 3002 resize_callback_.Run(gfx::Size(width, height)); |
3000 DCHECK(context_->IsCurrent(surface_.get())); | 3003 DCHECK(context_->IsCurrent(surface_.get())); |
3001 if (!context_->IsCurrent(surface_.get())) | 3004 if (!context_->IsCurrent(surface_.get())) { |
| 3005 LOG(ERROR) << "GLES2DecoderImpl: Context lost because context no longer " |
| 3006 << "current after resize callback."; |
3002 return error::kLostContext; | 3007 return error::kLostContext; |
| 3008 } |
3003 } | 3009 } |
3004 | 3010 |
3005 UpdateBackbufferMemoryAccounting(); | 3011 UpdateBackbufferMemoryAccounting(); |
3006 | 3012 |
3007 return error::kNoError; | 3013 return error::kNoError; |
3008 } | 3014 } |
3009 | 3015 |
3010 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { | 3016 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { |
3011 if (command_id > kStartPoint && command_id < kNumCommands) { | 3017 if (command_id > kStartPoint && command_id < kNumCommands) { |
3012 return gles2::GetCommandName(static_cast<CommandId>(command_id)); | 3018 return gles2::GetCommandName(static_cast<CommandId>(command_id)); |
(...skipping 3128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6141 } | 6147 } |
6142 | 6148 |
6143 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( | 6149 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |
6144 uint32 immediate_data_size, const gles2::PostSubBufferCHROMIUM& c) { | 6150 uint32 immediate_data_size, const gles2::PostSubBufferCHROMIUM& c) { |
6145 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); | 6151 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); |
6146 if (!context_->HasExtension("GL_CHROMIUM_post_sub_buffer")) { | 6152 if (!context_->HasExtension("GL_CHROMIUM_post_sub_buffer")) { |
6147 SetGLError(GL_INVALID_OPERATION, | 6153 SetGLError(GL_INVALID_OPERATION, |
6148 "glPostSubBufferCHROMIUM: command not supported by surface"); | 6154 "glPostSubBufferCHROMIUM: command not supported by surface"); |
6149 return error::kNoError; | 6155 return error::kNoError; |
6150 } | 6156 } |
6151 if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) | 6157 if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) { |
6152 return error::kNoError; | 6158 return error::kNoError; |
6153 else | 6159 } else { |
| 6160 LOG(ERROR) << "Context lost because PostSubBuffer failed."; |
6154 return error::kLostContext; | 6161 return error::kLostContext; |
| 6162 } |
6155 } | 6163 } |
6156 | 6164 |
6157 error::Error GLES2DecoderImpl::GetAttribLocationHelper( | 6165 error::Error GLES2DecoderImpl::GetAttribLocationHelper( |
6158 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 6166 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, |
6159 const std::string& name_str) { | 6167 const std::string& name_str) { |
6160 if (!StringIsValidForGLES(name_str.c_str())) { | 6168 if (!StringIsValidForGLES(name_str.c_str())) { |
6161 SetGLError(GL_INVALID_VALUE, "glGetAttribLocation: Invalid character"); | 6169 SetGLError(GL_INVALID_VALUE, "glGetAttribLocation: Invalid character"); |
6162 return error::kNoError; | 6170 return error::kNoError; |
6163 } | 6171 } |
6164 ProgramManager::ProgramInfo* info = GetProgramInfoNotShader( | 6172 ProgramManager::ProgramInfo* info = GetProgramInfoNotShader( |
(...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8306 } | 8314 } |
8307 } | 8315 } |
8308 | 8316 |
8309 // Include the auto-generated part of this file. We split this because it means | 8317 // Include the auto-generated part of this file. We split this because it means |
8310 // we can easily edit the non-auto generated parts right here in this file | 8318 // we can easily edit the non-auto generated parts right here in this file |
8311 // instead of having to edit some template or the code generator. | 8319 // instead of having to edit some template or the code generator. |
8312 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 8320 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
8313 | 8321 |
8314 } // namespace gles2 | 8322 } // namespace gles2 |
8315 } // namespace gpu | 8323 } // namespace gpu |
OLD | NEW |