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 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3018 GL_TEXTURE_WRAP_T, | 3018 GL_TEXTURE_WRAP_T, |
3019 GL_CLAMP_TO_EDGE); | 3019 GL_CLAMP_TO_EDGE); |
3020 TextureRef* texture_ref = GetTextureInfoForTarget(target); | 3020 TextureRef* texture_ref = GetTextureInfoForTarget(target); |
3021 glBindTexture(target, texture_ref ? texture_ref->service_id() : 0); | 3021 glBindTexture(target, texture_ref ? texture_ref->service_id() : 0); |
3022 } else { | 3022 } else { |
3023 offscreen_saved_color_texture_info_ = NULL; | 3023 offscreen_saved_color_texture_info_ = NULL; |
3024 } | 3024 } |
3025 } | 3025 } |
3026 | 3026 |
3027 void GLES2DecoderImpl::SetResizeCallback( | 3027 void GLES2DecoderImpl::SetResizeCallback( |
3028 const base::Callback<void(gfx::Size)>& callback) { | 3028 const base::Callback<void(gfx::Size, float)>& callback) { |
3029 resize_callback_ = callback; | 3029 resize_callback_ = callback; |
3030 } | 3030 } |
3031 | 3031 |
3032 Logger* GLES2DecoderImpl::GetLogger() { | 3032 Logger* GLES2DecoderImpl::GetLogger() { |
3033 return &logger_; | 3033 return &logger_; |
3034 } | 3034 } |
3035 | 3035 |
3036 ErrorState* GLES2DecoderImpl::GetErrorState() { | 3036 ErrorState* GLES2DecoderImpl::GetErrorState() { |
3037 return state_.GetErrorState(); | 3037 return state_.GetErrorState(); |
3038 } | 3038 } |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3423 return true; | 3423 return true; |
3424 } | 3424 } |
3425 | 3425 |
3426 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( | 3426 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( |
3427 uint32 immediate_data_size, const cmds::ResizeCHROMIUM& c) { | 3427 uint32 immediate_data_size, const cmds::ResizeCHROMIUM& c) { |
3428 if (!offscreen_target_frame_buffer_.get() && surface_->DeferDraws()) | 3428 if (!offscreen_target_frame_buffer_.get() && surface_->DeferDraws()) |
3429 return error::kDeferCommandUntilLater; | 3429 return error::kDeferCommandUntilLater; |
3430 | 3430 |
3431 GLuint width = static_cast<GLuint>(c.width); | 3431 GLuint width = static_cast<GLuint>(c.width); |
3432 GLuint height = static_cast<GLuint>(c.height); | 3432 GLuint height = static_cast<GLuint>(c.height); |
| 3433 GLfloat scale_factor = c.scale_factor; |
3433 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); | 3434 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); |
3434 | 3435 |
3435 width = std::max(1U, width); | 3436 width = std::max(1U, width); |
3436 height = std::max(1U, height); | 3437 height = std::max(1U, height); |
3437 | 3438 |
3438 #if defined(OS_POSIX) && !defined(OS_MACOSX) && \ | 3439 #if defined(OS_POSIX) && !defined(OS_MACOSX) && \ |
3439 !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 3440 !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
3440 // Make sure that we are done drawing to the back buffer before resizing. | 3441 // Make sure that we are done drawing to the back buffer before resizing. |
3441 glFinish(); | 3442 glFinish(); |
3442 #endif | 3443 #endif |
3443 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); | 3444 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
3444 if (is_offscreen) { | 3445 if (is_offscreen) { |
3445 if (!ResizeOffscreenFrameBuffer(gfx::Size(width, height))) { | 3446 if (!ResizeOffscreenFrameBuffer(gfx::Size(width, height))) { |
3446 LOG(ERROR) << "GLES2DecoderImpl: Context lost because " | 3447 LOG(ERROR) << "GLES2DecoderImpl: Context lost because " |
3447 << "ResizeOffscreenFrameBuffer failed."; | 3448 << "ResizeOffscreenFrameBuffer failed."; |
3448 return error::kLostContext; | 3449 return error::kLostContext; |
3449 } | 3450 } |
3450 } | 3451 } |
3451 | 3452 |
3452 if (!resize_callback_.is_null()) { | 3453 if (!resize_callback_.is_null()) { |
3453 resize_callback_.Run(gfx::Size(width, height)); | 3454 resize_callback_.Run(gfx::Size(width, height), scale_factor); |
3454 DCHECK(context_->IsCurrent(surface_.get())); | 3455 DCHECK(context_->IsCurrent(surface_.get())); |
3455 if (!context_->IsCurrent(surface_.get())) { | 3456 if (!context_->IsCurrent(surface_.get())) { |
3456 LOG(ERROR) << "GLES2DecoderImpl: Context lost because context no longer " | 3457 LOG(ERROR) << "GLES2DecoderImpl: Context lost because context no longer " |
3457 << "current after resize callback."; | 3458 << "current after resize callback."; |
3458 return error::kLostContext; | 3459 return error::kLostContext; |
3459 } | 3460 } |
3460 } | 3461 } |
3461 | 3462 |
3462 return error::kNoError; | 3463 return error::kNoError; |
3463 } | 3464 } |
(...skipping 6889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10353 return error::kNoError; | 10354 return error::kNoError; |
10354 } | 10355 } |
10355 | 10356 |
10356 // Include the auto-generated part of this file. We split this because it means | 10357 // Include the auto-generated part of this file. We split this because it means |
10357 // we can easily edit the non-auto generated parts right here in this file | 10358 // we can easily edit the non-auto generated parts right here in this file |
10358 // instead of having to edit some template or the code generator. | 10359 // instead of having to edit some template or the code generator. |
10359 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10360 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10360 | 10361 |
10361 } // namespace gles2 | 10362 } // namespace gles2 |
10362 } // namespace gpu | 10363 } // namespace gpu |
OLD | NEW |