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 3574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3585 if (w < 0 || h < 0 || h >= (INT_MAX / 4) / (w ? w : 1)) { | 3585 if (w < 0 || h < 0 || h >= (INT_MAX / 4) / (w ? w : 1)) { |
3586 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " | 3586 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " |
3587 << "to allocate storage due to excessive dimensions."; | 3587 << "to allocate storage due to excessive dimensions."; |
3588 return false; | 3588 return false; |
3589 } | 3589 } |
3590 | 3590 |
3591 // Reallocate the offscreen target buffers. | 3591 // Reallocate the offscreen target buffers. |
3592 DCHECK(offscreen_target_color_format_); | 3592 DCHECK(offscreen_target_color_format_); |
3593 if (IsOffscreenBufferMultisampled()) { | 3593 if (IsOffscreenBufferMultisampled()) { |
3594 if (!offscreen_target_color_render_buffer_->AllocateStorage( | 3594 if (!offscreen_target_color_render_buffer_->AllocateStorage( |
3595 feature_info_, offscreen_size_, offscreen_target_color_format_, | 3595 feature_info_.get(), |
3596 offscreen_target_samples_)) { | 3596 offscreen_size_, |
| 3597 offscreen_target_color_format_, |
| 3598 offscreen_target_samples_)) { |
3597 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " | 3599 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " |
3598 << "to allocate storage for offscreen target color buffer."; | 3600 << "to allocate storage for offscreen target color buffer."; |
3599 return false; | 3601 return false; |
3600 } | 3602 } |
3601 } else { | 3603 } else { |
3602 if (!offscreen_target_color_texture_->AllocateStorage( | 3604 if (!offscreen_target_color_texture_->AllocateStorage( |
3603 offscreen_size_, offscreen_target_color_format_, false)) { | 3605 offscreen_size_, offscreen_target_color_format_, false)) { |
3604 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " | 3606 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " |
3605 << "to allocate storage for offscreen target color texture."; | 3607 << "to allocate storage for offscreen target color texture."; |
3606 return false; | 3608 return false; |
3607 } | 3609 } |
3608 } | 3610 } |
3609 if (offscreen_target_depth_format_ && | 3611 if (offscreen_target_depth_format_ && |
3610 !offscreen_target_depth_render_buffer_->AllocateStorage( | 3612 !offscreen_target_depth_render_buffer_->AllocateStorage( |
3611 feature_info_, offscreen_size_, offscreen_target_depth_format_, | 3613 feature_info_.get(), |
3612 offscreen_target_samples_)) { | 3614 offscreen_size_, |
| 3615 offscreen_target_depth_format_, |
| 3616 offscreen_target_samples_)) { |
3613 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " | 3617 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " |
3614 << "to allocate storage for offscreen target depth buffer."; | 3618 << "to allocate storage for offscreen target depth buffer."; |
3615 return false; | 3619 return false; |
3616 } | 3620 } |
3617 if (offscreen_target_stencil_format_ && | 3621 if (offscreen_target_stencil_format_ && |
3618 !offscreen_target_stencil_render_buffer_->AllocateStorage( | 3622 !offscreen_target_stencil_render_buffer_->AllocateStorage( |
3619 feature_info_, offscreen_size_, offscreen_target_stencil_format_, | 3623 feature_info_.get(), |
3620 offscreen_target_samples_)) { | 3624 offscreen_size_, |
| 3625 offscreen_target_stencil_format_, |
| 3626 offscreen_target_samples_)) { |
3621 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " | 3627 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed " |
3622 << "to allocate storage for offscreen target stencil buffer."; | 3628 << "to allocate storage for offscreen target stencil buffer."; |
3623 return false; | 3629 return false; |
3624 } | 3630 } |
3625 | 3631 |
3626 // Attach the offscreen target buffers to the target frame buffer. | 3632 // Attach the offscreen target buffers to the target frame buffer. |
3627 if (IsOffscreenBufferMultisampled()) { | 3633 if (IsOffscreenBufferMultisampled()) { |
3628 offscreen_target_frame_buffer_->AttachRenderBuffer( | 3634 offscreen_target_frame_buffer_->AttachRenderBuffer( |
3629 GL_COLOR_ATTACHMENT0, | 3635 GL_COLOR_ATTACHMENT0, |
3630 offscreen_target_color_render_buffer_.get()); | 3636 offscreen_target_color_render_buffer_.get()); |
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5421 return; | 5427 return; |
5422 } | 5428 } |
5423 | 5429 |
5424 EnsureRenderbufferBound(); | 5430 EnsureRenderbufferBound(); |
5425 GLenum impl_format = | 5431 GLenum impl_format = |
5426 renderbuffer_manager()->InternalRenderbufferFormatToImplFormat( | 5432 renderbuffer_manager()->InternalRenderbufferFormatToImplFormat( |
5427 internalformat); | 5433 internalformat); |
5428 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER( | 5434 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER( |
5429 "glRenderbufferStorageMultisampleCHROMIUM"); | 5435 "glRenderbufferStorageMultisampleCHROMIUM"); |
5430 RenderbufferStorageMultisampleHelper( | 5436 RenderbufferStorageMultisampleHelper( |
5431 feature_info_, target, samples, impl_format, width, height); | 5437 feature_info_.get(), target, samples, impl_format, width, height); |
5432 GLenum error = | 5438 GLenum error = |
5433 LOCAL_PEEK_GL_ERROR("glRenderbufferStorageMultisampleCHROMIUM"); | 5439 LOCAL_PEEK_GL_ERROR("glRenderbufferStorageMultisampleCHROMIUM"); |
5434 if (error == GL_NO_ERROR) { | 5440 if (error == GL_NO_ERROR) { |
5435 | 5441 |
5436 if (workarounds().validate_multisample_buffer_allocation) { | 5442 if (workarounds().validate_multisample_buffer_allocation) { |
5437 if (!VerifyMultisampleRenderbufferIntegrity( | 5443 if (!VerifyMultisampleRenderbufferIntegrity( |
5438 renderbuffer->service_id(), impl_format)) { | 5444 renderbuffer->service_id(), impl_format)) { |
5439 LOCAL_SET_GL_ERROR( | 5445 LOCAL_SET_GL_ERROR( |
5440 GL_OUT_OF_MEMORY, | 5446 GL_OUT_OF_MEMORY, |
5441 "glRenderbufferStorageMultisampleCHROMIUM", "out of memory"); | 5447 "glRenderbufferStorageMultisampleCHROMIUM", "out of memory"); |
(...skipping 5240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10682 return false; | 10688 return false; |
10683 } | 10689 } |
10684 return true; | 10690 return true; |
10685 } | 10691 } |
10686 | 10692 |
10687 base::Closure GLES2DecoderImpl::AsyncUploadTokenCompletionClosure( | 10693 base::Closure GLES2DecoderImpl::AsyncUploadTokenCompletionClosure( |
10688 uint32 async_upload_token, | 10694 uint32 async_upload_token, |
10689 uint32 sync_data_shm_id, | 10695 uint32 sync_data_shm_id, |
10690 uint32 sync_data_shm_offset) { | 10696 uint32 sync_data_shm_offset) { |
10691 scoped_refptr<gpu::Buffer> buffer = GetSharedMemoryBuffer(sync_data_shm_id); | 10697 scoped_refptr<gpu::Buffer> buffer = GetSharedMemoryBuffer(sync_data_shm_id); |
10692 if (!buffer || !buffer->GetDataAddress(sync_data_shm_offset, | 10698 if (!buffer.get() || |
10693 sizeof(AsyncUploadSync))) | 10699 !buffer->GetDataAddress(sync_data_shm_offset, sizeof(AsyncUploadSync))) |
10694 return base::Closure(); | 10700 return base::Closure(); |
10695 | 10701 |
10696 AsyncMemoryParams mem_params(buffer, | 10702 AsyncMemoryParams mem_params(buffer, |
10697 sync_data_shm_offset, | 10703 sync_data_shm_offset, |
10698 sizeof(AsyncUploadSync)); | 10704 sizeof(AsyncUploadSync)); |
10699 | 10705 |
10700 scoped_refptr<AsyncUploadTokenCompletionObserver> observer( | 10706 scoped_refptr<AsyncUploadTokenCompletionObserver> observer( |
10701 new AsyncUploadTokenCompletionObserver(async_upload_token)); | 10707 new AsyncUploadTokenCompletionObserver(async_upload_token)); |
10702 | 10708 |
10703 return base::Bind( | 10709 return base::Bind( |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10961 } | 10967 } |
10962 } | 10968 } |
10963 | 10969 |
10964 // Include the auto-generated part of this file. We split this because it means | 10970 // Include the auto-generated part of this file. We split this because it means |
10965 // we can easily edit the non-auto generated parts right here in this file | 10971 // we can easily edit the non-auto generated parts right here in this file |
10966 // instead of having to edit some template or the code generator. | 10972 // instead of having to edit some template or the code generator. |
10967 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10973 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10968 | 10974 |
10969 } // namespace gles2 | 10975 } // namespace gles2 |
10970 } // namespace gpu | 10976 } // namespace gpu |
OLD | NEW |