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 <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 7704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7715 ((mask & GL_COLOR_BUFFER_BIT) != 0); | 7715 ((mask & GL_COLOR_BUFFER_BIT) != 0); |
| 7716 if (!enable_srgb || | 7716 if (!enable_srgb || |
| 7717 read_buffer_samples > 0 || | 7717 read_buffer_samples > 0 || |
| 7718 !feature_info_->feature_flags().desktop_srgb_support || | 7718 !feature_info_->feature_flags().desktop_srgb_support || |
| 7719 gl_version_info().IsAtLeastGL(4, 4) || | 7719 gl_version_info().IsAtLeastGL(4, 4) || |
| 7720 (gl_version_info().IsAtLeastGL(4, 2) && encode_srgb_only)) { | 7720 (gl_version_info().IsAtLeastGL(4, 2) && encode_srgb_only)) { |
| 7721 if (enable_srgb && gl_version_info().IsAtLeastGL(4, 2)) { | 7721 if (enable_srgb && gl_version_info().IsAtLeastGL(4, 2)) { |
| 7722 state_.EnableDisableFramebufferSRGB(enable_srgb); | 7722 state_.EnableDisableFramebufferSRGB(enable_srgb); |
| 7723 } | 7723 } |
| 7724 | 7724 |
| 7725 // TODO(yunchao) Need to revisit here. In GLES spec, blitFramebuffer | |
| 7726 // should do scissor test per fragment operation. | |
| 7727 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); | |
|
Zhenyao Mo
2016/09/23 18:35:21
You can only remove this conditionally. The CHROM
| |
| 7728 BlitFramebufferHelper( | 7725 BlitFramebufferHelper( |
| 7729 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | 7726 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 7730 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, | |
| 7731 state_.enable_flags.scissor_test); | |
| 7732 return; | 7727 return; |
| 7733 } | 7728 } |
| 7734 | 7729 |
| 7735 // emulate srgb for desktop core profile when GL version < 4.4 | 7730 // emulate srgb for desktop core profile when GL version < 4.4 |
| 7736 // TODO(yunchao): Need to handle this situation: | 7731 // TODO(yunchao): Need to handle this situation: |
| 7737 // There are multiple draw buffers. Some of them are srgb images. | 7732 // There are multiple draw buffers. Some of them are srgb images. |
| 7738 // The others are not. | 7733 // The others are not. |
| 7739 state_.EnableDisableFramebufferSRGB(true); | 7734 state_.EnableDisableFramebufferSRGB(true); |
| 7740 if (!InitializeSRGBConverter(func_name)) { | 7735 if (!InitializeSRGBConverter(func_name)) { |
| 7741 return; | 7736 return; |
| 7742 } | 7737 } |
| 7743 GLenum src_format = | 7738 GLenum src_format = |
| 7744 TextureManager::ExtractFormatFromStorageFormat(src_internal_format); | 7739 TextureManager::ExtractFormatFromStorageFormat(src_internal_format); |
| 7745 srgb_converter_->Blit(this, srcX0, srcY0, srcX1, srcY1, | 7740 srgb_converter_->Blit(this, srcX0, srcY0, srcX1, srcY1, |
| 7746 dstX0, dstY0, dstX1, dstY1, | 7741 dstX0, dstY0, dstX1, dstY1, |
| 7747 mask, filter, | 7742 mask, filter, |
| 7748 GetBoundReadFramebufferSize(), | 7743 GetBoundReadFramebufferSize(), |
| 7749 GetBoundReadFramebufferServiceId(), | 7744 GetBoundReadFramebufferServiceId(), |
| 7750 src_internal_format, src_format, src_type, | 7745 src_internal_format, src_format, src_type, |
| 7751 GetBoundDrawFramebufferServiceId(), | 7746 GetBoundDrawFramebufferServiceId(), |
| 7752 read_buffer_has_srgb, draw_buffers_has_srgb); | 7747 read_buffer_has_srgb, draw_buffers_has_srgb, |
| 7748 state_.enable_flags.scissor_test); | |
| 7753 } | 7749 } |
| 7754 | 7750 |
| 7755 bool GLES2DecoderImpl::InitializeSRGBConverter( | 7751 bool GLES2DecoderImpl::InitializeSRGBConverter( |
| 7756 const char* function_name) { | 7752 const char* function_name) { |
| 7757 if (!srgb_converter_.get()) { | 7753 if (!srgb_converter_.get()) { |
| 7758 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); | 7754 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); |
| 7759 srgb_converter_.reset( | 7755 srgb_converter_.reset( |
| 7760 new SRGBConverter(feature_info_.get())); | 7756 new SRGBConverter(feature_info_.get())); |
| 7761 srgb_converter_->InitializeSRGBConverter(this); | 7757 srgb_converter_->InitializeSRGBConverter(this); |
| 7762 if (LOCAL_PEEK_GL_ERROR(function_name) != GL_NO_ERROR) { | 7758 if (LOCAL_PEEK_GL_ERROR(function_name) != GL_NO_ERROR) { |
| (...skipping 10314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18077 } | 18073 } |
| 18078 | 18074 |
| 18079 // Include the auto-generated part of this file. We split this because it means | 18075 // Include the auto-generated part of this file. We split this because it means |
| 18080 // we can easily edit the non-auto generated parts right here in this file | 18076 // we can easily edit the non-auto generated parts right here in this file |
| 18081 // instead of having to edit some template or the code generator. | 18077 // instead of having to edit some template or the code generator. |
| 18082 #include "base/macros.h" | 18078 #include "base/macros.h" |
| 18083 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 18079 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 18084 | 18080 |
| 18085 } // namespace gles2 | 18081 } // namespace gles2 |
| 18086 } // namespace gpu | 18082 } // namespace gpu |
| OLD | NEW |