Chromium Code Reviews| 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 return query_manager_.get(); | 554 return query_manager_.get(); |
| 555 } | 555 } |
| 556 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { | 556 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { |
| 557 return vertex_array_manager_.get(); | 557 return vertex_array_manager_.get(); |
| 558 } | 558 } |
| 559 virtual bool ProcessPendingQueries() OVERRIDE; | 559 virtual bool ProcessPendingQueries() OVERRIDE; |
| 560 virtual bool HasMoreIdleWork() OVERRIDE; | 560 virtual bool HasMoreIdleWork() OVERRIDE; |
| 561 virtual void PerformIdleWork() OVERRIDE; | 561 virtual void PerformIdleWork() OVERRIDE; |
| 562 | 562 |
| 563 virtual void SetResizeCallback( | 563 virtual void SetResizeCallback( |
| 564 const base::Callback<void(gfx::Size)>& callback) OVERRIDE; | 564 const base::Callback<void(gfx::Size, float)>& callback) OVERRIDE; |
| 565 | 565 |
| 566 virtual Logger* GetLogger() OVERRIDE; | 566 virtual Logger* GetLogger() OVERRIDE; |
| 567 virtual ErrorState* GetErrorState() OVERRIDE; | 567 virtual ErrorState* GetErrorState() OVERRIDE; |
| 568 | 568 |
| 569 virtual void SetShaderCacheCallback( | 569 virtual void SetShaderCacheCallback( |
| 570 const ShaderCacheCallback& callback) OVERRIDE; | 570 const ShaderCacheCallback& callback) OVERRIDE; |
| 571 virtual void SetWaitSyncPointCallback( | 571 virtual void SetWaitSyncPointCallback( |
| 572 const WaitSyncPointCallback& callback) OVERRIDE; | 572 const WaitSyncPointCallback& callback) OVERRIDE; |
| 573 | 573 |
| 574 virtual void SetStreamTextureManager(StreamTextureManager* manager) OVERRIDE; | 574 virtual void SetStreamTextureManager(StreamTextureManager* manager) OVERRIDE; |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1619 | 1619 |
| 1620 // The copy that is used as the destination for multi-sample resolves. | 1620 // The copy that is used as the destination for multi-sample resolves. |
| 1621 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; | 1621 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; |
| 1622 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; | 1622 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; |
| 1623 GLenum offscreen_saved_color_format_; | 1623 GLenum offscreen_saved_color_format_; |
| 1624 | 1624 |
| 1625 scoped_ptr<QueryManager> query_manager_; | 1625 scoped_ptr<QueryManager> query_manager_; |
| 1626 | 1626 |
| 1627 scoped_ptr<VertexArrayManager> vertex_array_manager_; | 1627 scoped_ptr<VertexArrayManager> vertex_array_manager_; |
| 1628 | 1628 |
| 1629 base::Callback<void(gfx::Size)> resize_callback_; | 1629 base::Callback<void(gfx::Size, float)> resize_callback_; |
| 1630 | 1630 |
| 1631 WaitSyncPointCallback wait_sync_point_callback_; | 1631 WaitSyncPointCallback wait_sync_point_callback_; |
| 1632 | 1632 |
| 1633 ShaderCacheCallback shader_cache_callback_; | 1633 ShaderCacheCallback shader_cache_callback_; |
| 1634 | 1634 |
| 1635 StreamTextureManager* stream_texture_manager_; | 1635 StreamTextureManager* stream_texture_manager_; |
| 1636 scoped_ptr<AsyncPixelTransferDelegate> async_pixel_transfer_delegate_; | 1636 scoped_ptr<AsyncPixelTransferDelegate> async_pixel_transfer_delegate_; |
| 1637 | 1637 |
| 1638 // The format of the back buffer_ | 1638 // The format of the back buffer_ |
| 1639 GLenum back_buffer_color_format_; | 1639 GLenum back_buffer_color_format_; |
| (...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3016 GL_TEXTURE_WRAP_T, | 3016 GL_TEXTURE_WRAP_T, |
| 3017 GL_CLAMP_TO_EDGE); | 3017 GL_CLAMP_TO_EDGE); |
| 3018 TextureRef* texture_ref = GetTextureInfoForTarget(target); | 3018 TextureRef* texture_ref = GetTextureInfoForTarget(target); |
| 3019 glBindTexture(target, texture_ref ? texture_ref->service_id() : 0); | 3019 glBindTexture(target, texture_ref ? texture_ref->service_id() : 0); |
| 3020 } else { | 3020 } else { |
| 3021 offscreen_saved_color_texture_info_ = NULL; | 3021 offscreen_saved_color_texture_info_ = NULL; |
| 3022 } | 3022 } |
| 3023 } | 3023 } |
| 3024 | 3024 |
| 3025 void GLES2DecoderImpl::SetResizeCallback( | 3025 void GLES2DecoderImpl::SetResizeCallback( |
| 3026 const base::Callback<void(gfx::Size)>& callback) { | 3026 const base::Callback<void(gfx::Size, float)>& callback) { |
| 3027 resize_callback_ = callback; | 3027 resize_callback_ = callback; |
| 3028 } | 3028 } |
| 3029 | 3029 |
| 3030 Logger* GLES2DecoderImpl::GetLogger() { | 3030 Logger* GLES2DecoderImpl::GetLogger() { |
| 3031 return &logger_; | 3031 return &logger_; |
| 3032 } | 3032 } |
| 3033 | 3033 |
| 3034 ErrorState* GLES2DecoderImpl::GetErrorState() { | 3034 ErrorState* GLES2DecoderImpl::GetErrorState() { |
| 3035 return state_.GetErrorState(); | 3035 return state_.GetErrorState(); |
| 3036 } | 3036 } |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3421 return true; | 3421 return true; |
| 3422 } | 3422 } |
| 3423 | 3423 |
| 3424 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( | 3424 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( |
| 3425 uint32 immediate_data_size, const cmds::ResizeCHROMIUM& c) { | 3425 uint32 immediate_data_size, const cmds::ResizeCHROMIUM& c) { |
| 3426 if (!offscreen_target_frame_buffer_.get() && surface_->DeferDraws()) | 3426 if (!offscreen_target_frame_buffer_.get() && surface_->DeferDraws()) |
| 3427 return error::kDeferCommandUntilLater; | 3427 return error::kDeferCommandUntilLater; |
| 3428 | 3428 |
| 3429 GLuint width = static_cast<GLuint>(c.width); | 3429 GLuint width = static_cast<GLuint>(c.width); |
| 3430 GLuint height = static_cast<GLuint>(c.height); | 3430 GLuint height = static_cast<GLuint>(c.height); |
| 3431 GLfloat scale_factor = static_cast<GLuint>(c.scale_factor); | |
|
piman
2013/05/22 19:41:14
static_cast<GLuint> is certainly wrong.
I think yo
ccameron
2013/05/22 20:00:06
Ooof, embarrassing. Thanks -- done!
| |
| 3431 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); | 3432 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); |
| 3432 | 3433 |
| 3433 width = std::max(1U, width); | 3434 width = std::max(1U, width); |
| 3434 height = std::max(1U, height); | 3435 height = std::max(1U, height); |
| 3435 | 3436 |
| 3436 #if defined(OS_POSIX) && !defined(OS_MACOSX) && \ | 3437 #if defined(OS_POSIX) && !defined(OS_MACOSX) && \ |
| 3437 !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 3438 !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 3438 // Make sure that we are done drawing to the back buffer before resizing. | 3439 // Make sure that we are done drawing to the back buffer before resizing. |
| 3439 glFinish(); | 3440 glFinish(); |
| 3440 #endif | 3441 #endif |
| 3441 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); | 3442 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
| 3442 if (is_offscreen) { | 3443 if (is_offscreen) { |
| 3443 if (!ResizeOffscreenFrameBuffer(gfx::Size(width, height))) { | 3444 if (!ResizeOffscreenFrameBuffer(gfx::Size(width, height))) { |
| 3444 LOG(ERROR) << "GLES2DecoderImpl: Context lost because " | 3445 LOG(ERROR) << "GLES2DecoderImpl: Context lost because " |
| 3445 << "ResizeOffscreenFrameBuffer failed."; | 3446 << "ResizeOffscreenFrameBuffer failed."; |
| 3446 return error::kLostContext; | 3447 return error::kLostContext; |
| 3447 } | 3448 } |
| 3448 } | 3449 } |
| 3449 | 3450 |
| 3450 if (!resize_callback_.is_null()) { | 3451 if (!resize_callback_.is_null()) { |
| 3451 resize_callback_.Run(gfx::Size(width, height)); | 3452 resize_callback_.Run(gfx::Size(width, height), scale_factor); |
| 3452 DCHECK(context_->IsCurrent(surface_.get())); | 3453 DCHECK(context_->IsCurrent(surface_.get())); |
| 3453 if (!context_->IsCurrent(surface_.get())) { | 3454 if (!context_->IsCurrent(surface_.get())) { |
| 3454 LOG(ERROR) << "GLES2DecoderImpl: Context lost because context no longer " | 3455 LOG(ERROR) << "GLES2DecoderImpl: Context lost because context no longer " |
| 3455 << "current after resize callback."; | 3456 << "current after resize callback."; |
| 3456 return error::kLostContext; | 3457 return error::kLostContext; |
| 3457 } | 3458 } |
| 3458 } | 3459 } |
| 3459 | 3460 |
| 3460 return error::kNoError; | 3461 return error::kNoError; |
| 3461 } | 3462 } |
| (...skipping 6887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10349 return error::kNoError; | 10350 return error::kNoError; |
| 10350 } | 10351 } |
| 10351 | 10352 |
| 10352 // Include the auto-generated part of this file. We split this because it means | 10353 // Include the auto-generated part of this file. We split this because it means |
| 10353 // we can easily edit the non-auto generated parts right here in this file | 10354 // we can easily edit the non-auto generated parts right here in this file |
| 10354 // instead of having to edit some template or the code generator. | 10355 // instead of having to edit some template or the code generator. |
| 10355 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10356 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10356 | 10357 |
| 10357 } // namespace gles2 | 10358 } // namespace gles2 |
| 10358 } // namespace gpu | 10359 } // namespace gpu |
| OLD | NEW |