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 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1353 GLenum gl_error, | 1353 GLenum gl_error, |
1354 const char* func_name); | 1354 const char* func_name); |
1355 | 1355 |
1356 bool CheckBoundDrawFramebufferValid(const char* func_name); | 1356 bool CheckBoundDrawFramebufferValid(const char* func_name); |
1357 // Generates |gl_error| if the bound read fbo is incomplete. | 1357 // Generates |gl_error| if the bound read fbo is incomplete. |
1358 bool CheckBoundReadFramebufferValid(const char* func_name, GLenum gl_error); | 1358 bool CheckBoundReadFramebufferValid(const char* func_name, GLenum gl_error); |
1359 // This is only used by DoBlitFramebufferCHROMIUM which operates read/draw | 1359 // This is only used by DoBlitFramebufferCHROMIUM which operates read/draw |
1360 // framebuffer at the same time. | 1360 // framebuffer at the same time. |
1361 bool CheckBoundFramebufferValid(const char* func_name); | 1361 bool CheckBoundFramebufferValid(const char* func_name); |
1362 | 1362 |
1363 // If one or more drawBuffers have srgb color format, enable framebuffer srgb. | |
1364 // Otherwise, disable framebuffer srgb. | |
1365 void EnableDisableFramebufferSRGBForDrawBuffers(); | |
1366 | |
1363 // Checks if the current program exists and is valid. If not generates the | 1367 // Checks if the current program exists and is valid. If not generates the |
1364 // appropriate GL error. Returns true if the current program is in a usable | 1368 // appropriate GL error. Returns true if the current program is in a usable |
1365 // state. | 1369 // state. |
1366 bool CheckCurrentProgram(const char* function_name); | 1370 bool CheckCurrentProgram(const char* function_name); |
1367 | 1371 |
1368 // Checks if the current program exists and is valid and that location is not | 1372 // Checks if the current program exists and is valid and that location is not |
1369 // -1. If the current program is not valid generates the appropriate GL | 1373 // -1. If the current program is not valid generates the appropriate GL |
1370 // error. Returns true if the current program is in a usable state and | 1374 // error. Returns true if the current program is in a usable state and |
1371 // location is not -1. | 1375 // location is not -1. |
1372 bool CheckCurrentProgramForUniform(GLint location, const char* function_name); | 1376 bool CheckCurrentProgramForUniform(GLint location, const char* function_name); |
(...skipping 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4182 } | 4186 } |
4183 | 4187 |
4184 bool GLES2DecoderImpl::CheckBoundDrawFramebufferValid(const char* func_name) { | 4188 bool GLES2DecoderImpl::CheckBoundDrawFramebufferValid(const char* func_name) { |
4185 GLenum target = features().chromium_framebuffer_multisample ? | 4189 GLenum target = features().chromium_framebuffer_multisample ? |
4186 GL_DRAW_FRAMEBUFFER : GL_FRAMEBUFFER; | 4190 GL_DRAW_FRAMEBUFFER : GL_FRAMEBUFFER; |
4187 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); | 4191 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); |
4188 bool valid = CheckFramebufferValid( | 4192 bool valid = CheckFramebufferValid( |
4189 framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); | 4193 framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); |
4190 if (valid && !features().chromium_framebuffer_multisample) | 4194 if (valid && !features().chromium_framebuffer_multisample) |
4191 OnUseFramebuffer(); | 4195 OnUseFramebuffer(); |
4192 if (valid && feature_info_->feature_flags().desktop_srgb_support) { | |
4193 // If framebuffer contains sRGB images, then enable FRAMEBUFFER_SRGB. | |
4194 // Otherwise, disable FRAMEBUFFER_SRGB. Assume default fbo does not have | |
4195 // sRGB image. | |
4196 // In theory, we can just leave FRAMEBUFFER_SRGB on. However, many drivers | |
4197 // behave incorrectly when all images are linear encoding, they still apply | |
4198 // the sRGB conversion, but when at least one image is sRGB, then they | |
4199 // behave correctly. | |
4200 bool enable_framebuffer_srgb = | |
4201 framebuffer && framebuffer->HasSRGBAttachments(); | |
4202 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); | |
4203 } | |
4204 return valid; | 4196 return valid; |
4205 } | 4197 } |
4206 | 4198 |
4207 bool GLES2DecoderImpl::CheckBoundReadFramebufferValid( | 4199 bool GLES2DecoderImpl::CheckBoundReadFramebufferValid( |
4208 const char* func_name, GLenum gl_error) { | 4200 const char* func_name, GLenum gl_error) { |
4209 GLenum target = features().chromium_framebuffer_multisample ? | 4201 GLenum target = features().chromium_framebuffer_multisample ? |
4210 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER; | 4202 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER; |
4211 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); | 4203 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); |
4212 bool valid = CheckFramebufferValid( | 4204 bool valid = CheckFramebufferValid( |
4213 framebuffer, target, gl_error, func_name); | 4205 framebuffer, target, gl_error, func_name); |
4214 return valid; | 4206 return valid; |
4215 } | 4207 } |
4216 | 4208 |
4217 bool GLES2DecoderImpl::CheckBoundFramebufferValid(const char* func_name) { | 4209 bool GLES2DecoderImpl::CheckBoundFramebufferValid(const char* func_name) { |
4218 GLenum target = features().chromium_framebuffer_multisample ? | 4210 if (!features().chromium_framebufer_multisample) { |
4219 GL_DRAW_FRAMEBUFFER : GL_FRAMEBUFFER; | 4211 return CheckFramebufferValid(GetFramebufferInfoForTarget(GL_FRAMEBUFFER), |
4220 Framebuffer* draw_framebuffer = GetFramebufferInfoForTarget(target); | 4212 GL_FRAMEBUFFER, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); |
4221 bool valid = CheckFramebufferValid( | 4213 } |
4222 draw_framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); | 4214 return CheckFramebufferValid(GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER), |
4215 GL_READ_FRAMEBUFFER, GL_INVALID_FRAMEBUFFER_OPERATION, func_name) && | |
4216 CheckFramebufferValid(GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER), | |
4217 GL_DRAW_FRAMEBUFFER, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); | |
4218 } | |
4223 | 4219 |
4224 target = features().chromium_framebuffer_multisample ? | 4220 void GLES2DecoderImpl::EnableDisableFramebufferSRGBForDrawBuffers() { |
4225 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER; | 4221 bool draw_buffers_has_srgb = false; |
4226 Framebuffer* read_framebuffer = GetFramebufferInfoForTarget(target); | 4222 for (uint32_t ii = 0; ii < group_->max_draw_buffers(); ++ii) { |
4227 valid = valid && CheckFramebufferValid( | 4223 GLenum dst_format = GetBoundColorDrawBufferInternalFormat( |
4228 read_framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); | 4224 static_cast<GLint>(ii)); |
yunchao
2016/08/25 16:29:51
It is not necessary to check twice if the target i
| |
4229 | 4225 if (dst_format == 0) |
4230 if (valid && feature_info_->feature_flags().desktop_srgb_support) { | 4226 continue; |
4231 bool enable_framebuffer_srgb = | 4227 if (GetColorEncodingFromInternalFormat(dst_format) == GL_SRGB) { |
4232 (draw_framebuffer && draw_framebuffer->HasSRGBAttachments()) || | 4228 draw_buffers_has_srgb = true; |
4233 (read_framebuffer && read_framebuffer->HasSRGBAttachments()); | 4229 break; |
4234 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); | 4230 } |
4235 } | 4231 } |
4236 | 4232 state_.EnableDisableFramebufferSRGB(draw_buffers_has_srgb); |
4237 return valid; | |
4238 } | 4233 } |
4239 | 4234 |
4240 GLint GLES2DecoderImpl::GetColorEncodingFromInternalFormat( | 4235 GLint GLES2DecoderImpl::GetColorEncodingFromInternalFormat( |
4241 GLenum internalformat) { | 4236 GLenum internalformat) { |
4242 switch (internalformat) { | 4237 switch (internalformat) { |
4243 case GL_SRGB_EXT: | 4238 case GL_SRGB_EXT: |
4244 case GL_SRGB_ALPHA_EXT: | 4239 case GL_SRGB_ALPHA_EXT: |
4245 case GL_SRGB8: | 4240 case GL_SRGB8: |
4246 case GL_SRGB8_ALPHA8: | 4241 case GL_SRGB8_ALPHA8: |
4247 return GL_SRGB; | 4242 return GL_SRGB; |
(...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6923 return error::kNoError; | 6918 return error::kNoError; |
6924 } | 6919 } |
6925 if (mask & GL_COLOR_BUFFER_BIT) { | 6920 if (mask & GL_COLOR_BUFFER_BIT) { |
6926 Framebuffer* framebuffer = | 6921 Framebuffer* framebuffer = |
6927 framebuffer_state_.bound_draw_framebuffer.get(); | 6922 framebuffer_state_.bound_draw_framebuffer.get(); |
6928 if (framebuffer && framebuffer->ContainsActiveIntegerAttachments()) { | 6923 if (framebuffer && framebuffer->ContainsActiveIntegerAttachments()) { |
6929 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 6924 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
6930 "can't be called on integer buffers"); | 6925 "can't be called on integer buffers"); |
6931 return error::kNoError; | 6926 return error::kNoError; |
6932 } | 6927 } |
6928 if (feature_info_->feature_flags().desktop_srgb_support) { | |
6929 EnableDisableFramebufferSRGBForDrawBuffers(); | |
6930 } | |
6933 } | 6931 } |
6934 glClear(mask); | 6932 glClear(mask); |
6935 } | 6933 } |
6936 return error::kNoError; | 6934 return error::kNoError; |
6937 } | 6935 } |
6938 | 6936 |
6939 void GLES2DecoderImpl::DoClearBufferiv( | 6937 void GLES2DecoderImpl::DoClearBufferiv( |
6940 GLenum buffer, GLint drawbuffer, const GLint* value) { | 6938 GLenum buffer, GLint drawbuffer, const GLint* value) { |
6941 const char* func_name = "glClearBufferiv"; | 6939 const char* func_name = "glClearBufferiv"; |
6942 if (!CheckBoundDrawFramebufferValid(func_name)) | 6940 if (!CheckBoundDrawFramebufferValid(func_name)) |
6943 return; | 6941 return; |
6944 ApplyDirtyState(); | 6942 ApplyDirtyState(); |
6945 | 6943 |
6946 if (buffer == GL_COLOR) { | 6944 if (buffer == GL_COLOR) { |
6947 if (drawbuffer < 0 || | 6945 if (drawbuffer < 0 || |
6948 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { | 6946 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { |
6949 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); | 6947 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); |
6950 return; | 6948 return; |
6951 } | 6949 } |
6952 GLenum internal_format = | 6950 GLenum internal_format = |
6953 GetBoundColorDrawBufferInternalFormat(drawbuffer); | 6951 GetBoundColorDrawBufferInternalFormat(drawbuffer); |
6954 if (!GLES2Util::IsSignedIntegerFormat(internal_format)) { | 6952 if (!GLES2Util::IsSignedIntegerFormat(internal_format)) { |
6955 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 6953 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
6956 "can only be called on signed integer buffers"); | 6954 "can only be called on signed integer buffers"); |
6957 return; | 6955 return; |
6958 } | 6956 } |
6957 if (feature_info_->feature_flags().desktop_srgb_support) { | |
6958 bool draw_buffer_has_srgb = | |
6959 GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB; | |
6960 state_.EnableDisableFramebufferSRGB(draw_buffer_has_srgb); | |
6961 } | |
6959 } else { | 6962 } else { |
6960 DCHECK(buffer == GL_STENCIL); | 6963 DCHECK(buffer == GL_STENCIL); |
6961 if (drawbuffer != 0) { | 6964 if (drawbuffer != 0) { |
6962 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); | 6965 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); |
6963 return; | 6966 return; |
6964 } | 6967 } |
6965 if (!BoundFramebufferHasStencilAttachment()) { | 6968 if (!BoundFramebufferHasStencilAttachment()) { |
6966 return; | 6969 return; |
6967 } | 6970 } |
6968 } | 6971 } |
(...skipping 13 matching lines...) Expand all Loading... | |
6982 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); | 6985 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); |
6983 return; | 6986 return; |
6984 } | 6987 } |
6985 GLenum internal_format = | 6988 GLenum internal_format = |
6986 GetBoundColorDrawBufferInternalFormat(drawbuffer); | 6989 GetBoundColorDrawBufferInternalFormat(drawbuffer); |
6987 if (!GLES2Util::IsUnsignedIntegerFormat(internal_format)) { | 6990 if (!GLES2Util::IsUnsignedIntegerFormat(internal_format)) { |
6988 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 6991 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
6989 "can only be called on unsigned integer buffers"); | 6992 "can only be called on unsigned integer buffers"); |
6990 return; | 6993 return; |
6991 } | 6994 } |
6995 if (feature_info_->feature_flags().desktop_srgb_support) { | |
6996 bool draw_buffer_has_srgb = | |
6997 GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB; | |
6998 state_.EnableDisableFramebufferSRGB(draw_buffer_has_srgb); | |
6999 } | |
6992 MarkDrawBufferAsCleared(buffer, drawbuffer); | 7000 MarkDrawBufferAsCleared(buffer, drawbuffer); |
6993 glClearBufferuiv(buffer, drawbuffer, value); | 7001 glClearBufferuiv(buffer, drawbuffer, value); |
6994 } | 7002 } |
6995 | 7003 |
6996 void GLES2DecoderImpl::DoClearBufferfv( | 7004 void GLES2DecoderImpl::DoClearBufferfv( |
6997 GLenum buffer, GLint drawbuffer, const GLfloat* value) { | 7005 GLenum buffer, GLint drawbuffer, const GLfloat* value) { |
6998 const char* func_name = "glClearBufferfv"; | 7006 const char* func_name = "glClearBufferfv"; |
6999 if (!CheckBoundDrawFramebufferValid(func_name)) | 7007 if (!CheckBoundDrawFramebufferValid(func_name)) |
7000 return; | 7008 return; |
7001 ApplyDirtyState(); | 7009 ApplyDirtyState(); |
7002 | 7010 |
7003 if (buffer == GL_COLOR) { | 7011 if (buffer == GL_COLOR) { |
7004 if (drawbuffer < 0 || | 7012 if (drawbuffer < 0 || |
7005 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { | 7013 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { |
7006 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); | 7014 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); |
7007 return; | 7015 return; |
7008 } | 7016 } |
7009 GLenum internal_format = | 7017 GLenum internal_format = |
7010 GetBoundColorDrawBufferInternalFormat(drawbuffer); | 7018 GetBoundColorDrawBufferInternalFormat(drawbuffer); |
7011 if (GLES2Util::IsIntegerFormat(internal_format)) { | 7019 if (GLES2Util::IsIntegerFormat(internal_format)) { |
7012 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 7020 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
7013 "can only be called on float buffers"); | 7021 "can only be called on float buffers"); |
7014 return; | 7022 return; |
7015 } | 7023 } |
7024 if (feature_info_->feature_flags().desktop_srgb_support) { | |
7025 bool draw_buffer_has_srgb = | |
7026 GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB; | |
7027 state_.EnableDisableFramebufferSRGB(draw_buffer_has_srgb); | |
7028 } | |
7016 } else { | 7029 } else { |
7017 DCHECK(buffer == GL_DEPTH); | 7030 DCHECK(buffer == GL_DEPTH); |
7018 if (drawbuffer != 0) { | 7031 if (drawbuffer != 0) { |
7019 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); | 7032 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); |
7020 return; | 7033 return; |
7021 } | 7034 } |
7022 if (!BoundFramebufferHasDepthAttachment()) { | 7035 if (!BoundFramebufferHasDepthAttachment()) { |
7023 return; | 7036 return; |
7024 } | 7037 } |
7025 } | 7038 } |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7520 if (read_buffer_samples > 0 && | 7533 if (read_buffer_samples > 0 && |
7521 (srcX0 != dstX0 || srcY0 != dstY0 || srcX1 != dstX1 || srcY1 != dstY1)) { | 7534 (srcX0 != dstX0 || srcY0 != dstY0 || srcX1 != dstX1 || srcY1 != dstY1)) { |
7522 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 7535 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
7523 "src framebuffer is multisampled, but src/dst regions are different"); | 7536 "src framebuffer is multisampled, but src/dst regions are different"); |
7524 return; | 7537 return; |
7525 } | 7538 } |
7526 | 7539 |
7527 GLenum src_format = GetBoundReadFrameBufferInternalFormat(); | 7540 GLenum src_format = GetBoundReadFrameBufferInternalFormat(); |
7528 GLenum src_type = GetBoundReadFrameBufferTextureType(); | 7541 GLenum src_type = GetBoundReadFrameBufferTextureType(); |
7529 | 7542 |
7543 bool read_buffer_has_srgb = | |
7544 GetColorEncodingFromInternalFormat(src_format) == GL_SRGB; | |
7545 bool draw_buffers_has_srgb = false; | |
7530 if ((mask & GL_COLOR_BUFFER_BIT) != 0) { | 7546 if ((mask & GL_COLOR_BUFFER_BIT) != 0) { |
7531 bool is_src_signed_int = GLES2Util::IsSignedIntegerFormat(src_format); | 7547 bool is_src_signed_int = GLES2Util::IsSignedIntegerFormat(src_format); |
7532 bool is_src_unsigned_int = GLES2Util::IsUnsignedIntegerFormat(src_format); | 7548 bool is_src_unsigned_int = GLES2Util::IsUnsignedIntegerFormat(src_format); |
7533 DCHECK(!is_src_signed_int || !is_src_unsigned_int); | 7549 DCHECK(!is_src_signed_int || !is_src_unsigned_int); |
7534 | 7550 |
7535 if ((is_src_signed_int || is_src_unsigned_int) && filter == GL_LINEAR) { | 7551 if ((is_src_signed_int || is_src_unsigned_int) && filter == GL_LINEAR) { |
7536 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 7552 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
7537 "invalid filter for integer format"); | 7553 "invalid filter for integer format"); |
7538 return; | 7554 return; |
7539 } | 7555 } |
7540 | 7556 |
7541 GLenum src_sized_format = | 7557 GLenum src_sized_format = |
7542 GLES2Util::ConvertToSizedFormat(src_format, src_type); | 7558 GLES2Util::ConvertToSizedFormat(src_format, src_type); |
7543 for (uint32_t ii = 0; ii < group_->max_draw_buffers(); ++ii) { | 7559 for (uint32_t ii = 0; ii < group_->max_draw_buffers(); ++ii) { |
7544 GLenum dst_format = GetBoundColorDrawBufferInternalFormat( | 7560 GLenum dst_format = GetBoundColorDrawBufferInternalFormat( |
7545 static_cast<GLint>(ii)); | 7561 static_cast<GLint>(ii)); |
7546 GLenum dst_type = GetBoundColorDrawBufferType(static_cast<GLint>(ii)); | 7562 GLenum dst_type = GetBoundColorDrawBufferType(static_cast<GLint>(ii)); |
7547 if (dst_format == 0) | 7563 if (dst_format == 0) |
7548 continue; | 7564 continue; |
7565 if (GetColorEncodingFromInternalFormat(dst_format) == GL_SRGB) | |
7566 draw_buffers_has_srgb = true; | |
7549 if (read_buffer_samples > 0 && | 7567 if (read_buffer_samples > 0 && |
7550 (src_sized_format != | 7568 (src_sized_format != |
7551 GLES2Util::ConvertToSizedFormat(dst_format, dst_type))) { | 7569 GLES2Util::ConvertToSizedFormat(dst_format, dst_type))) { |
7552 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 7570 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
7553 "src and dst formats differ for color"); | 7571 "src and dst formats differ for color"); |
7554 return; | 7572 return; |
7555 } | 7573 } |
7556 bool is_dst_signed_int = GLES2Util::IsSignedIntegerFormat(dst_format); | 7574 bool is_dst_signed_int = GLES2Util::IsSignedIntegerFormat(dst_format); |
7557 bool is_dst_unsigned_int = GLES2Util::IsUnsignedIntegerFormat(dst_format); | 7575 bool is_dst_unsigned_int = GLES2Util::IsUnsignedIntegerFormat(dst_format); |
7558 DCHECK(!is_dst_signed_int || !is_dst_unsigned_int); | 7576 DCHECK(!is_dst_signed_int || !is_dst_unsigned_int); |
(...skipping 16 matching lines...) Expand all Loading... | |
7575 if ((GetBoundFrameBufferDepthFormat(GL_READ_FRAMEBUFFER) != | 7593 if ((GetBoundFrameBufferDepthFormat(GL_READ_FRAMEBUFFER) != |
7576 GetBoundFrameBufferDepthFormat(GL_DRAW_FRAMEBUFFER)) || | 7594 GetBoundFrameBufferDepthFormat(GL_DRAW_FRAMEBUFFER)) || |
7577 (GetBoundFrameBufferStencilFormat(GL_READ_FRAMEBUFFER) != | 7595 (GetBoundFrameBufferStencilFormat(GL_READ_FRAMEBUFFER) != |
7578 GetBoundFrameBufferStencilFormat(GL_DRAW_FRAMEBUFFER))) { | 7596 GetBoundFrameBufferStencilFormat(GL_DRAW_FRAMEBUFFER))) { |
7579 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 7597 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
7580 "src and dst formats differ for depth/stencil"); | 7598 "src and dst formats differ for depth/stencil"); |
7581 return; | 7599 return; |
7582 } | 7600 } |
7583 } | 7601 } |
7584 | 7602 |
7603 if (feature_info_->feature_flags().desktop_srgb_support) { | |
7604 bool enable_srgb = read_buffer_has_srgb || draw_buffers_has_srgb; | |
7605 state_.EnableDisableFramebufferSRGB(enable_srgb); | |
7606 } | |
7607 | |
7585 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); | 7608 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); |
7586 BlitFramebufferHelper( | 7609 BlitFramebufferHelper( |
7587 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | 7610 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
7588 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, | 7611 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, |
7589 state_.enable_flags.scissor_test); | 7612 state_.enable_flags.scissor_test); |
7590 } | 7613 } |
7591 | 7614 |
7592 void GLES2DecoderImpl::EnsureRenderbufferBound() { | 7615 void GLES2DecoderImpl::EnsureRenderbufferBound() { |
7593 if (!state_.bound_renderbuffer_valid) { | 7616 if (!state_.bound_renderbuffer_valid) { |
7594 state_.bound_renderbuffer_valid = true; | 7617 state_.bound_renderbuffer_valid = true; |
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9207 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "count < 0"); | 9230 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "count < 0"); |
9208 return error::kNoError; | 9231 return error::kNoError; |
9209 } | 9232 } |
9210 if (primcount < 0) { | 9233 if (primcount < 0) { |
9211 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); | 9234 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); |
9212 return error::kNoError; | 9235 return error::kNoError; |
9213 } | 9236 } |
9214 if (!CheckBoundDrawFramebufferValid(function_name)) { | 9237 if (!CheckBoundDrawFramebufferValid(function_name)) { |
9215 return error::kNoError; | 9238 return error::kNoError; |
9216 } | 9239 } |
9240 | |
9241 if (feature_info_->feature_flags().desktop_srgb_support) { | |
9242 EnableDisableFramebufferSRGBForDrawBuffers(); | |
9243 } | |
9244 | |
9217 // We have to check this here because the prototype for glDrawArrays | 9245 // We have to check this here because the prototype for glDrawArrays |
9218 // is GLint not GLsizei. | 9246 // is GLint not GLsizei. |
9219 if (first < 0) { | 9247 if (first < 0) { |
9220 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "first < 0"); | 9248 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "first < 0"); |
9221 return error::kNoError; | 9249 return error::kNoError; |
9222 } | 9250 } |
9223 | 9251 |
9224 if (state_.bound_transform_feedback.get() && | 9252 if (state_.bound_transform_feedback.get() && |
9225 state_.bound_transform_feedback->active() && | 9253 state_.bound_transform_feedback->active() && |
9226 !state_.bound_transform_feedback->paused() && | 9254 !state_.bound_transform_feedback->paused() && |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9348 } | 9376 } |
9349 if (primcount < 0) { | 9377 if (primcount < 0) { |
9350 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); | 9378 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); |
9351 return error::kNoError; | 9379 return error::kNoError; |
9352 } | 9380 } |
9353 | 9381 |
9354 if (!CheckBoundDrawFramebufferValid(function_name)) { | 9382 if (!CheckBoundDrawFramebufferValid(function_name)) { |
9355 return error::kNoError; | 9383 return error::kNoError; |
9356 } | 9384 } |
9357 | 9385 |
9386 if (feature_info_->feature_flags().desktop_srgb_support) { | |
9387 EnableDisableFramebufferSRGBForDrawBuffers(); | |
9388 } | |
9389 | |
9358 if (state_.bound_transform_feedback.get() && | 9390 if (state_.bound_transform_feedback.get() && |
9359 state_.bound_transform_feedback->active() && | 9391 state_.bound_transform_feedback->active() && |
9360 !state_.bound_transform_feedback->paused()) { | 9392 !state_.bound_transform_feedback->paused()) { |
9361 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | 9393 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
9362 "transformfeedback is active and not paused"); | 9394 "transformfeedback is active and not paused"); |
9363 return error::kNoError; | 9395 return error::kNoError; |
9364 } | 9396 } |
9365 | 9397 |
9366 if (count == 0 || primcount == 0) { | 9398 if (count == 0 || primcount == 0) { |
9367 return error::kNoError; | 9399 return error::kNoError; |
(...skipping 8360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17728 } | 17760 } |
17729 | 17761 |
17730 // Include the auto-generated part of this file. We split this because it means | 17762 // Include the auto-generated part of this file. We split this because it means |
17731 // we can easily edit the non-auto generated parts right here in this file | 17763 // we can easily edit the non-auto generated parts right here in this file |
17732 // instead of having to edit some template or the code generator. | 17764 // instead of having to edit some template or the code generator. |
17733 #include "base/macros.h" | 17765 #include "base/macros.h" |
17734 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17766 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
17735 | 17767 |
17736 } // namespace gles2 | 17768 } // namespace gles2 |
17737 } // namespace gpu | 17769 } // namespace gpu |
OLD | NEW |