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 26 matching lines...) Expand all Loading... |
37 #include "gpu/command_buffer/service/error_state.h" | 37 #include "gpu/command_buffer/service/error_state.h" |
38 #include "gpu/command_buffer/service/feature_info.h" | 38 #include "gpu/command_buffer/service/feature_info.h" |
39 #include "gpu/command_buffer/service/framebuffer_manager.h" | 39 #include "gpu/command_buffer/service/framebuffer_manager.h" |
40 #include "gpu/command_buffer/service/gl_stream_texture_image.h" | 40 #include "gpu/command_buffer/service/gl_stream_texture_image.h" |
41 #include "gpu/command_buffer/service/gl_utils.h" | 41 #include "gpu/command_buffer/service/gl_utils.h" |
42 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa
_intel.h" | 42 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa
_intel.h" |
43 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" | 43 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" |
44 #include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.h" | 44 #include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.h" |
45 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | 45 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
46 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" | 46 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
| 47 #include "gpu/command_buffer/service/gles2_cmd_srgb_converter.h" |
47 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 48 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
48 #include "gpu/command_buffer/service/gpu_preferences.h" | 49 #include "gpu/command_buffer/service/gpu_preferences.h" |
49 #include "gpu/command_buffer/service/gpu_state_tracer.h" | 50 #include "gpu/command_buffer/service/gpu_state_tracer.h" |
50 #include "gpu/command_buffer/service/gpu_tracer.h" | 51 #include "gpu/command_buffer/service/gpu_tracer.h" |
51 #include "gpu/command_buffer/service/image_factory.h" | 52 #include "gpu/command_buffer/service/image_factory.h" |
52 #include "gpu/command_buffer/service/image_manager.h" | 53 #include "gpu/command_buffer/service/image_manager.h" |
53 #include "gpu/command_buffer/service/logger.h" | 54 #include "gpu/command_buffer/service/logger.h" |
54 #include "gpu/command_buffer/service/mailbox_manager.h" | 55 #include "gpu/command_buffer/service/mailbox_manager.h" |
55 #include "gpu/command_buffer/service/memory_tracking.h" | 56 #include "gpu/command_buffer/service/memory_tracking.h" |
56 #include "gpu/command_buffer/service/path_manager.h" | 57 #include "gpu/command_buffer/service/path_manager.h" |
(...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2064 // Whether a texture backed by a Chromium Image needs to emulate GL_RGB format | 2065 // Whether a texture backed by a Chromium Image needs to emulate GL_RGB format |
2065 // using GL_RGBA and glColorMask. | 2066 // using GL_RGBA and glColorMask. |
2066 bool ChromiumImageNeedsRGBEmulation(); | 2067 bool ChromiumImageNeedsRGBEmulation(); |
2067 | 2068 |
2068 // The GL_CHROMIUM_schedule_ca_layer extension requires that SwapBuffers and | 2069 // The GL_CHROMIUM_schedule_ca_layer extension requires that SwapBuffers and |
2069 // equivalent functions reset shared state. | 2070 // equivalent functions reset shared state. |
2070 void ClearScheduleCALayerState(); | 2071 void ClearScheduleCALayerState(); |
2071 | 2072 |
2072 bool InitializeCopyTexImageBlitter(const char* function_name); | 2073 bool InitializeCopyTexImageBlitter(const char* function_name); |
2073 bool InitializeCopyTextureCHROMIUM(const char* function_name); | 2074 bool InitializeCopyTextureCHROMIUM(const char* function_name); |
| 2075 bool InitializeSRGBDecoder(const char* function_name); |
| 2076 bool InitializeSRGBEncoder(const char* function_name); |
2074 // Generate a member function prototype for each command in an automated and | 2077 // Generate a member function prototype for each command in an automated and |
2075 // typesafe way. | 2078 // typesafe way. |
2076 #define GLES2_CMD_OP(name) \ | 2079 #define GLES2_CMD_OP(name) \ |
2077 Error Handle##name(uint32_t immediate_data_size, const void* data); | 2080 Error Handle##name(uint32_t immediate_data_size, const void* data); |
2078 | 2081 |
2079 GLES2_COMMAND_LIST(GLES2_CMD_OP) | 2082 GLES2_COMMAND_LIST(GLES2_CMD_OP) |
2080 | 2083 |
2081 #undef GLES2_CMD_OP | 2084 #undef GLES2_CMD_OP |
2082 | 2085 |
2083 // The GL context this decoder renders to on behalf of the client. | 2086 // The GL context this decoder renders to on behalf of the client. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2255 // Forces the backbuffer to use native GMBs rather than a TEXTURE_2D texture. | 2258 // Forces the backbuffer to use native GMBs rather than a TEXTURE_2D texture. |
2256 bool should_use_native_gmb_for_backbuffer_; | 2259 bool should_use_native_gmb_for_backbuffer_; |
2257 | 2260 |
2258 // Log extra info. | 2261 // Log extra info. |
2259 bool service_logging_; | 2262 bool service_logging_; |
2260 | 2263 |
2261 std::unique_ptr<ApplyFramebufferAttachmentCMAAINTELResourceManager> | 2264 std::unique_ptr<ApplyFramebufferAttachmentCMAAINTELResourceManager> |
2262 apply_framebuffer_attachment_cmaa_intel_; | 2265 apply_framebuffer_attachment_cmaa_intel_; |
2263 std::unique_ptr<CopyTexImageResourceManager> copy_tex_image_blit_; | 2266 std::unique_ptr<CopyTexImageResourceManager> copy_tex_image_blit_; |
2264 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | 2267 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
| 2268 std::unique_ptr<SRGBConverter> srgb_converter_; |
2265 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; | 2269 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; |
2266 | 2270 |
2267 // Cached values of the currently assigned viewport dimensions. | 2271 // Cached values of the currently assigned viewport dimensions. |
2268 GLsizei viewport_max_width_; | 2272 GLsizei viewport_max_width_; |
2269 GLsizei viewport_max_height_; | 2273 GLsizei viewport_max_height_; |
2270 | 2274 |
2271 // Command buffer stats. | 2275 // Command buffer stats. |
2272 base::TimeDelta total_processing_commands_time_; | 2276 base::TimeDelta total_processing_commands_time_; |
2273 | 2277 |
2274 // States related to each manager. | 2278 // States related to each manager. |
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4219 GL_DRAW_FRAMEBUFFER : GL_FRAMEBUFFER; | 4223 GL_DRAW_FRAMEBUFFER : GL_FRAMEBUFFER; |
4220 Framebuffer* draw_framebuffer = GetFramebufferInfoForTarget(target); | 4224 Framebuffer* draw_framebuffer = GetFramebufferInfoForTarget(target); |
4221 bool valid = CheckFramebufferValid( | 4225 bool valid = CheckFramebufferValid( |
4222 draw_framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); | 4226 draw_framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); |
4223 | 4227 |
4224 target = features().chromium_framebuffer_multisample ? | 4228 target = features().chromium_framebuffer_multisample ? |
4225 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER; | 4229 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER; |
4226 Framebuffer* read_framebuffer = GetFramebufferInfoForTarget(target); | 4230 Framebuffer* read_framebuffer = GetFramebufferInfoForTarget(target); |
4227 valid = valid && CheckFramebufferValid( | 4231 valid = valid && CheckFramebufferValid( |
4228 read_framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); | 4232 read_framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); |
4229 | |
4230 if (valid && feature_info_->feature_flags().desktop_srgb_support) { | |
4231 bool enable_framebuffer_srgb = | |
4232 (draw_framebuffer && draw_framebuffer->HasSRGBAttachments()) || | |
4233 (read_framebuffer && read_framebuffer->HasSRGBAttachments()); | |
4234 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); | |
4235 } | |
4236 | |
4237 return valid; | 4233 return valid; |
4238 } | 4234 } |
4239 | 4235 |
4240 GLint GLES2DecoderImpl::GetColorEncodingFromInternalFormat( | 4236 GLint GLES2DecoderImpl::GetColorEncodingFromInternalFormat( |
4241 GLenum internalformat) { | 4237 GLenum internalformat) { |
4242 switch (internalformat) { | 4238 switch (internalformat) { |
4243 case GL_SRGB_EXT: | 4239 case GL_SRGB_EXT: |
4244 case GL_SRGB_ALPHA_EXT: | 4240 case GL_SRGB_ALPHA_EXT: |
4245 case GL_SRGB8: | 4241 case GL_SRGB8: |
4246 case GL_SRGB8_ALPHA8: | 4242 case GL_SRGB8_ALPHA8: |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4528 if (copy_tex_image_blit_.get()) { | 4524 if (copy_tex_image_blit_.get()) { |
4529 copy_tex_image_blit_->Destroy(); | 4525 copy_tex_image_blit_->Destroy(); |
4530 copy_tex_image_blit_.reset(); | 4526 copy_tex_image_blit_.reset(); |
4531 } | 4527 } |
4532 | 4528 |
4533 if (copy_texture_CHROMIUM_.get()) { | 4529 if (copy_texture_CHROMIUM_.get()) { |
4534 copy_texture_CHROMIUM_->Destroy(); | 4530 copy_texture_CHROMIUM_->Destroy(); |
4535 copy_texture_CHROMIUM_.reset(); | 4531 copy_texture_CHROMIUM_.reset(); |
4536 } | 4532 } |
4537 | 4533 |
| 4534 if (srgb_converter_.get()) { |
| 4535 srgb_converter_->Destroy(); |
| 4536 srgb_converter_.reset(); |
| 4537 } |
| 4538 |
4538 clear_framebuffer_blit_.reset(); | 4539 clear_framebuffer_blit_.reset(); |
4539 | 4540 |
4540 if (state_.current_program.get()) { | 4541 if (state_.current_program.get()) { |
4541 program_manager()->UnuseProgram(shader_manager(), | 4542 program_manager()->UnuseProgram(shader_manager(), |
4542 state_.current_program.get()); | 4543 state_.current_program.get()); |
4543 } | 4544 } |
4544 | 4545 |
4545 if (attrib_0_buffer_id_) { | 4546 if (attrib_0_buffer_id_) { |
4546 glDeleteBuffersARB(1, &attrib_0_buffer_id_); | 4547 glDeleteBuffersARB(1, &attrib_0_buffer_id_); |
4547 } | 4548 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4620 // Current program must be cleared after calling ProgramManager::UnuseProgram. | 4621 // Current program must be cleared after calling ProgramManager::UnuseProgram. |
4621 // Otherwise, we can leak objects. http://crbug.com/258772. | 4622 // Otherwise, we can leak objects. http://crbug.com/258772. |
4622 // state_.current_program must be reset before group_ is reset because | 4623 // state_.current_program must be reset before group_ is reset because |
4623 // the later deletes the ProgramManager object that referred by | 4624 // the later deletes the ProgramManager object that referred by |
4624 // state_.current_program object. | 4625 // state_.current_program object. |
4625 state_.current_program = NULL; | 4626 state_.current_program = NULL; |
4626 | 4627 |
4627 apply_framebuffer_attachment_cmaa_intel_.reset(); | 4628 apply_framebuffer_attachment_cmaa_intel_.reset(); |
4628 copy_tex_image_blit_.reset(); | 4629 copy_tex_image_blit_.reset(); |
4629 copy_texture_CHROMIUM_.reset(); | 4630 copy_texture_CHROMIUM_.reset(); |
| 4631 srgb_converter_.reset(); |
4630 clear_framebuffer_blit_.reset(); | 4632 clear_framebuffer_blit_.reset(); |
4631 | 4633 |
4632 if (query_manager_.get()) { | 4634 if (query_manager_.get()) { |
4633 query_manager_->Destroy(have_context); | 4635 query_manager_->Destroy(have_context); |
4634 query_manager_.reset(); | 4636 query_manager_.reset(); |
4635 } | 4637 } |
4636 | 4638 |
4637 if (vertex_array_manager_ .get()) { | 4639 if (vertex_array_manager_ .get()) { |
4638 vertex_array_manager_->Destroy(have_context); | 4640 vertex_array_manager_->Destroy(have_context); |
4639 vertex_array_manager_.reset(); | 4641 vertex_array_manager_.reset(); |
(...skipping 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7517 } | 7519 } |
7518 | 7520 |
7519 GLsizei read_buffer_samples = GetBoundFramebufferSamples(GL_READ_FRAMEBUFFER); | 7521 GLsizei read_buffer_samples = GetBoundFramebufferSamples(GL_READ_FRAMEBUFFER); |
7520 if (read_buffer_samples > 0 && | 7522 if (read_buffer_samples > 0 && |
7521 (srcX0 != dstX0 || srcY0 != dstY0 || srcX1 != dstX1 || srcY1 != dstY1)) { | 7523 (srcX0 != dstX0 || srcY0 != dstY0 || srcX1 != dstX1 || srcY1 != dstY1)) { |
7522 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 7524 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
7523 "src framebuffer is multisampled, but src/dst regions are different"); | 7525 "src framebuffer is multisampled, but src/dst regions are different"); |
7524 return; | 7526 return; |
7525 } | 7527 } |
7526 | 7528 |
7527 GLenum src_format = GetBoundReadFramebufferInternalFormat(); | 7529 GLenum src_internal_format = GetBoundReadFramebufferInternalFormat(); |
7528 GLenum src_type = GetBoundReadFramebufferTextureType(); | 7530 GLenum src_type = GetBoundReadFramebufferTextureType(); |
7529 | 7531 |
| 7532 bool read_buffer_has_srgb = |
| 7533 GetColorEncodingFromInternalFormat(src_internal_format) == GL_SRGB; |
| 7534 bool draw_buffers_has_srgb = false; |
7530 if ((mask & GL_COLOR_BUFFER_BIT) != 0) { | 7535 if ((mask & GL_COLOR_BUFFER_BIT) != 0) { |
7531 bool is_src_signed_int = GLES2Util::IsSignedIntegerFormat(src_format); | 7536 bool is_src_signed_int = |
7532 bool is_src_unsigned_int = GLES2Util::IsUnsignedIntegerFormat(src_format); | 7537 GLES2Util::IsSignedIntegerFormat(src_internal_format); |
| 7538 bool is_src_unsigned_int = |
| 7539 GLES2Util::IsUnsignedIntegerFormat(src_internal_format); |
7533 DCHECK(!is_src_signed_int || !is_src_unsigned_int); | 7540 DCHECK(!is_src_signed_int || !is_src_unsigned_int); |
7534 | 7541 |
7535 if ((is_src_signed_int || is_src_unsigned_int) && filter == GL_LINEAR) { | 7542 if ((is_src_signed_int || is_src_unsigned_int) && filter == GL_LINEAR) { |
7536 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 7543 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
7537 "invalid filter for integer format"); | 7544 "invalid filter for integer format"); |
7538 return; | 7545 return; |
7539 } | 7546 } |
7540 | 7547 |
7541 GLenum src_sized_format = | 7548 GLenum src_sized_format = |
7542 GLES2Util::ConvertToSizedFormat(src_format, src_type); | 7549 GLES2Util::ConvertToSizedFormat(src_internal_format, src_type); |
7543 for (uint32_t ii = 0; ii < group_->max_draw_buffers(); ++ii) { | 7550 for (uint32_t ii = 0; ii < group_->max_draw_buffers(); ++ii) { |
7544 GLenum dst_format = GetBoundColorDrawBufferInternalFormat( | 7551 GLenum dst_format = GetBoundColorDrawBufferInternalFormat( |
7545 static_cast<GLint>(ii)); | 7552 static_cast<GLint>(ii)); |
7546 GLenum dst_type = GetBoundColorDrawBufferType(static_cast<GLint>(ii)); | 7553 GLenum dst_type = GetBoundColorDrawBufferType(static_cast<GLint>(ii)); |
7547 if (dst_format == 0) | 7554 if (dst_format == 0) |
7548 continue; | 7555 continue; |
| 7556 if (GetColorEncodingFromInternalFormat(dst_format) == GL_SRGB) |
| 7557 draw_buffers_has_srgb = true; |
7549 if (read_buffer_samples > 0 && | 7558 if (read_buffer_samples > 0 && |
7550 (src_sized_format != | 7559 (src_sized_format != |
7551 GLES2Util::ConvertToSizedFormat(dst_format, dst_type))) { | 7560 GLES2Util::ConvertToSizedFormat(dst_format, dst_type))) { |
7552 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 7561 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
7553 "src and dst formats differ for color"); | 7562 "src and dst formats differ for color"); |
7554 return; | 7563 return; |
7555 } | 7564 } |
7556 bool is_dst_signed_int = GLES2Util::IsSignedIntegerFormat(dst_format); | 7565 bool is_dst_signed_int = GLES2Util::IsSignedIntegerFormat(dst_format); |
7557 bool is_dst_unsigned_int = GLES2Util::IsUnsignedIntegerFormat(dst_format); | 7566 bool is_dst_unsigned_int = GLES2Util::IsUnsignedIntegerFormat(dst_format); |
7558 DCHECK(!is_dst_signed_int || !is_dst_unsigned_int); | 7567 DCHECK(!is_dst_signed_int || !is_dst_unsigned_int); |
(...skipping 16 matching lines...) Expand all Loading... |
7575 if ((GetBoundFramebufferDepthFormat(GL_READ_FRAMEBUFFER) != | 7584 if ((GetBoundFramebufferDepthFormat(GL_READ_FRAMEBUFFER) != |
7576 GetBoundFramebufferDepthFormat(GL_DRAW_FRAMEBUFFER)) || | 7585 GetBoundFramebufferDepthFormat(GL_DRAW_FRAMEBUFFER)) || |
7577 (GetBoundFramebufferStencilFormat(GL_READ_FRAMEBUFFER) != | 7586 (GetBoundFramebufferStencilFormat(GL_READ_FRAMEBUFFER) != |
7578 GetBoundFramebufferStencilFormat(GL_DRAW_FRAMEBUFFER))) { | 7587 GetBoundFramebufferStencilFormat(GL_DRAW_FRAMEBUFFER))) { |
7579 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 7588 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
7580 "src and dst formats differ for depth/stencil"); | 7589 "src and dst formats differ for depth/stencil"); |
7581 return; | 7590 return; |
7582 } | 7591 } |
7583 } | 7592 } |
7584 | 7593 |
7585 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); | 7594 bool enable_srgb = read_buffer_has_srgb || draw_buffers_has_srgb; |
7586 BlitFramebufferHelper( | 7595 bool same_size = (abs(srcX1 - srcX0) == abs(dstX1 - dstX0)) && |
7587 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | 7596 (abs(srcY1 - srcY0) == abs(dstY1 - dstY0)); |
7588 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, | 7597 if (!enable_srgb || |
| 7598 !feature_info_->feature_flags().desktop_srgb_support || |
| 7599 (read_buffer_has_srgb && draw_buffers_has_srgb && same_size) || |
| 7600 gl_version_info().IsAtLeastGL(4, 4)) { |
| 7601 if (enable_srgb && gl_version_info().IsAtLeastGL(4, 4)) { |
| 7602 state_.EnableDisableFramebufferSRGB(enable_srgb); |
| 7603 } |
| 7604 |
| 7605 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); |
| 7606 BlitFramebufferHelper( |
| 7607 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 7608 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, |
7589 state_.enable_flags.scissor_test); | 7609 state_.enable_flags.scissor_test); |
| 7610 return; |
| 7611 } |
| 7612 |
| 7613 // emulate srgb for desktop core profile when GL version < 4.4 |
| 7614 // TODO(yunchao): Need to handle this situation: |
| 7615 // There are multiple draw buffers. Some of them are srgb image. |
| 7616 // The others are not. |
| 7617 GLenum target = features().chromium_framebuffer_multisample ? |
| 7618 GL_DRAW_FRAMEBUFFER : GL_FRAMEBUFFER; |
| 7619 Framebuffer* draw_framebuffer = GetFramebufferInfoForTarget(target); |
| 7620 |
| 7621 target = features().chromium_framebuffer_multisample ? |
| 7622 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER; |
| 7623 Framebuffer* read_framebuffer = GetFramebufferInfoForTarget(target); |
| 7624 |
| 7625 if (read_buffer_has_srgb) { |
| 7626 state_.EnableDisableFramebufferSRGB(false); |
| 7627 if (!InitializeSRGBDecoder(func_name)) { |
| 7628 return; |
| 7629 } |
| 7630 srgb_converter_->SRGBToLinear(this, srcX0, srcY0, srcX1, srcY1, |
| 7631 dstX0, dstY0, dstX1, dstY1, |
| 7632 mask, filter, |
| 7633 GetBoundReadFramebufferSize(), |
| 7634 read_framebuffer->service_id(), |
| 7635 src_internal_format, |
| 7636 draw_framebuffer->service_id(), |
| 7637 GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE); |
| 7638 } |
| 7639 |
| 7640 if (draw_buffers_has_srgb) { |
| 7641 state_.EnableDisableFramebufferSRGB(false); |
| 7642 if (!InitializeSRGBEncoder(func_name)) { |
| 7643 return; |
| 7644 } |
| 7645 srgb_converter_->LinearToSRGB(this, srcX0, srcY0, srcX1, srcY1, |
| 7646 dstX0, dstY0, dstX1, dstY1, |
| 7647 mask, filter, |
| 7648 GetBoundReadFramebufferSize(), |
| 7649 read_framebuffer->service_id(), |
| 7650 src_internal_format, |
| 7651 draw_framebuffer->service_id(), |
| 7652 GL_SRGB8_ALPHA8, |
| 7653 GL_RGBA, GL_UNSIGNED_BYTE); |
| 7654 } |
| 7655 } |
| 7656 |
| 7657 bool GLES2DecoderImpl::InitializeSRGBDecoder( |
| 7658 const char* function_name) { |
| 7659 if (!srgb_converter_.get()) { |
| 7660 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); |
| 7661 srgb_converter_.reset( |
| 7662 new SRGBConverter(feature_info_.get())); |
| 7663 } |
| 7664 srgb_converter_->InitializeSRGBDecoder(this); |
| 7665 if (LOCAL_PEEK_GL_ERROR(function_name) != GL_NO_ERROR) { |
| 7666 return false; |
| 7667 } |
| 7668 return true; |
| 7669 } |
| 7670 |
| 7671 bool GLES2DecoderImpl::InitializeSRGBEncoder( |
| 7672 const char* function_name) { |
| 7673 if (!srgb_converter_.get()) { |
| 7674 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); |
| 7675 srgb_converter_.reset( |
| 7676 new SRGBConverter(feature_info_.get())); |
| 7677 } |
| 7678 srgb_converter_->InitializeSRGBEncoder(this); |
| 7679 if (LOCAL_PEEK_GL_ERROR(function_name) != GL_NO_ERROR) { |
| 7680 return false; |
| 7681 } |
| 7682 return true; |
7590 } | 7683 } |
7591 | 7684 |
7592 void GLES2DecoderImpl::EnsureRenderbufferBound() { | 7685 void GLES2DecoderImpl::EnsureRenderbufferBound() { |
7593 if (!state_.bound_renderbuffer_valid) { | 7686 if (!state_.bound_renderbuffer_valid) { |
7594 state_.bound_renderbuffer_valid = true; | 7687 state_.bound_renderbuffer_valid = true; |
7595 glBindRenderbufferEXT(GL_RENDERBUFFER, | 7688 glBindRenderbufferEXT(GL_RENDERBUFFER, |
7596 state_.bound_renderbuffer.get() | 7689 state_.bound_renderbuffer.get() |
7597 ? state_.bound_renderbuffer->service_id() | 7690 ? state_.bound_renderbuffer->service_id() |
7598 : 0); | 7691 : 0); |
7599 } | 7692 } |
(...skipping 10134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17734 } | 17827 } |
17735 | 17828 |
17736 // Include the auto-generated part of this file. We split this because it means | 17829 // Include the auto-generated part of this file. We split this because it means |
17737 // we can easily edit the non-auto generated parts right here in this file | 17830 // we can easily edit the non-auto generated parts right here in this file |
17738 // instead of having to edit some template or the code generator. | 17831 // instead of having to edit some template or the code generator. |
17739 #include "base/macros.h" | 17832 #include "base/macros.h" |
17740 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17833 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
17741 | 17834 |
17742 } // namespace gles2 | 17835 } // namespace gles2 |
17743 } // namespace gpu | 17836 } // namespace gpu |
OLD | NEW |