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 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1424 // Wrapper for glBlitFramebufferCHROMIUM. | 1424 // Wrapper for glBlitFramebufferCHROMIUM. |
| 1425 void DoBlitFramebufferCHROMIUM( | 1425 void DoBlitFramebufferCHROMIUM( |
| 1426 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, | 1426 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, |
| 1427 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, | 1427 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, |
| 1428 GLbitfield mask, GLenum filter); | 1428 GLbitfield mask, GLenum filter); |
| 1429 | 1429 |
| 1430 // Wrapper for glBufferSubData. | 1430 // Wrapper for glBufferSubData. |
| 1431 void DoBufferSubData( | 1431 void DoBufferSubData( |
| 1432 GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data); | 1432 GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data); |
| 1433 | 1433 |
| 1434 // A workaround to adjust read buffer and draw buffers to GL_NONE | |
| 1435 // if the specified read buffer or draw buffers have no image attached. | |
|
Zhenyao Mo
2016/11/14 19:42:24
have missing images.
yunchao
2016/11/15 16:21:59
Done.
| |
| 1436 // Return false if read buffer has no image or all of the draw buffers | |
| 1437 // have no image. Then we can generate INVALID_OPERATION or return directly | |
| 1438 // in the callers accordingly. | |
| 1439 bool AdjustColorBufferAttachmentsIfNecessary( | |
| 1440 bool read, bool draw); | |
| 1441 | |
| 1434 // Wrapper for glCheckFramebufferStatus | 1442 // Wrapper for glCheckFramebufferStatus |
| 1435 GLenum DoCheckFramebufferStatus(GLenum target); | 1443 GLenum DoCheckFramebufferStatus(GLenum target); |
| 1436 | 1444 |
| 1437 // Wrapper for glClear*() | 1445 // Wrapper for glClear*() |
| 1438 error::Error DoClear(GLbitfield mask); | 1446 error::Error DoClear(GLbitfield mask); |
| 1439 void DoClearBufferiv(GLenum buffer, | 1447 void DoClearBufferiv(GLenum buffer, |
| 1440 GLint drawbuffer, | 1448 GLint drawbuffer, |
| 1441 const volatile GLint* value); | 1449 const volatile GLint* value); |
| 1442 void DoClearBufferuiv(GLenum buffer, | 1450 void DoClearBufferuiv(GLenum buffer, |
| 1443 GLint drawbuffer, | 1451 GLint drawbuffer, |
| (...skipping 5762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7206 LOCAL_SET_GL_ERROR( | 7214 LOCAL_SET_GL_ERROR( |
| 7207 GL_INVALID_VALUE, "glDeleteProgram", "unknown program"); | 7215 GL_INVALID_VALUE, "glDeleteProgram", "unknown program"); |
| 7208 } | 7216 } |
| 7209 } | 7217 } |
| 7210 return error::kNoError; | 7218 return error::kNoError; |
| 7211 } | 7219 } |
| 7212 | 7220 |
| 7213 error::Error GLES2DecoderImpl::DoClear(GLbitfield mask) { | 7221 error::Error GLES2DecoderImpl::DoClear(GLbitfield mask) { |
| 7214 const char* func_name = "glClear"; | 7222 const char* func_name = "glClear"; |
| 7215 DCHECK(!ShouldDeferDraws()); | 7223 DCHECK(!ShouldDeferDraws()); |
| 7224 if (mask & GL_COLOR_BUFFER_BIT && | |
|
Zhenyao Mo
2016/11/14 19:42:24
(mask & GL_COLOR_BUFFER_BIT) != 0
yunchao
2016/11/15 16:21:59
Done.
| |
| 7225 workarounds().adjust_framebuffer_complete_status && | |
| 7226 SupportsDrawBuffers() && | |
| 7227 framebuffer_state_.clear_state_dirty) { | |
| 7228 if (!AdjustColorBufferAttachmentsIfNecessary(false, true)) | |
| 7229 return error::kNoError; | |
| 7230 } | |
| 7216 if (CheckBoundDrawFramebufferValid(func_name)) { | 7231 if (CheckBoundDrawFramebufferValid(func_name)) { |
| 7217 ApplyDirtyState(); | 7232 ApplyDirtyState(); |
| 7218 if (workarounds().gl_clear_broken) { | 7233 if (workarounds().gl_clear_broken) { |
| 7219 if (!BoundFramebufferHasDepthAttachment()) | 7234 if (!BoundFramebufferHasDepthAttachment()) |
| 7220 mask &= ~GL_DEPTH_BUFFER_BIT; | 7235 mask &= ~GL_DEPTH_BUFFER_BIT; |
| 7221 if (!BoundFramebufferHasStencilAttachment()) | 7236 if (!BoundFramebufferHasStencilAttachment()) |
| 7222 mask &= ~GL_STENCIL_BUFFER_BIT; | 7237 mask &= ~GL_STENCIL_BUFFER_BIT; |
| 7223 ClearFramebufferForWorkaround(mask); | 7238 ClearFramebufferForWorkaround(mask); |
| 7224 return error::kNoError; | 7239 return error::kNoError; |
| 7225 } | 7240 } |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7525 state_.color_clear_red, state_.color_clear_green, state_.color_clear_blue, | 7540 state_.color_clear_red, state_.color_clear_green, state_.color_clear_blue, |
| 7526 state_.color_clear_alpha); | 7541 state_.color_clear_alpha); |
| 7527 glClearStencil(state_.stencil_clear); | 7542 glClearStencil(state_.stencil_clear); |
| 7528 glClearDepth(state_.depth_clear); | 7543 glClearDepth(state_.depth_clear); |
| 7529 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, | 7544 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, |
| 7530 state_.enable_flags.scissor_test); | 7545 state_.enable_flags.scissor_test); |
| 7531 glScissor(state_.scissor_x, state_.scissor_y, state_.scissor_width, | 7546 glScissor(state_.scissor_x, state_.scissor_y, state_.scissor_width, |
| 7532 state_.scissor_height); | 7547 state_.scissor_height); |
| 7533 } | 7548 } |
| 7534 | 7549 |
| 7550 bool GLES2DecoderImpl::AdjustColorBufferAttachmentsIfNecessary( | |
| 7551 bool read, bool draw) { | |
| 7552 DCHECK(workarounds().adjust_framebuffer_complete_status && | |
| 7553 SupportsDrawBuffers() && | |
| 7554 framebuffer_state_.clear_state_dirty); | |
| 7555 if (read) { | |
| 7556 const Framebuffer* framebuffer = | |
| 7557 GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); | |
| 7558 if (framebuffer && | |
| 7559 framebuffer->ReadBufferHasNoImage() && | |
| 7560 framebuffer->ColorBuffersHaveImage()) { | |
| 7561 glReadBuffer(GL_NONE); | |
| 7562 return false; | |
| 7563 } | |
| 7564 } else { | |
| 7565 GLsizei num = 0; | |
| 7566 GLenum buf[8]; | |
| 7567 for (int i = 0; i < 8; ++i) | |
| 7568 buf[i] = GL_NONE; | |
| 7569 const Framebuffer* framebuffer = | |
| 7570 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); | |
| 7571 if (framebuffer && | |
| 7572 framebuffer->DrawBuffersHaveNoImage(num, buf) && | |
| 7573 framebuffer->ColorBuffersHaveImage()) { | |
| 7574 glDrawBuffersARB(8, buf); | |
| 7575 } | |
| 7576 if (num == 0) { | |
| 7577 return false; | |
| 7578 } | |
| 7579 } | |
| 7580 return true; | |
| 7581 } | |
| 7582 | |
| 7535 GLenum GLES2DecoderImpl::DoCheckFramebufferStatus(GLenum target) { | 7583 GLenum GLES2DecoderImpl::DoCheckFramebufferStatus(GLenum target) { |
| 7536 Framebuffer* framebuffer = | 7584 Framebuffer* framebuffer = |
| 7537 GetFramebufferInfoForTarget(target); | 7585 GetFramebufferInfoForTarget(target); |
| 7538 if (!framebuffer) { | 7586 if (!framebuffer) { |
| 7539 return GL_FRAMEBUFFER_COMPLETE; | 7587 return GL_FRAMEBUFFER_COMPLETE; |
| 7540 } | 7588 } |
| 7541 GLenum completeness = framebuffer->IsPossiblyComplete(feature_info_.get()); | 7589 GLenum completeness = framebuffer->IsPossiblyComplete(feature_info_.get()); |
| 7542 if (completeness != GL_FRAMEBUFFER_COMPLETE) { | 7590 if (completeness != GL_FRAMEBUFFER_COMPLETE) { |
| 7543 return completeness; | 7591 return completeness; |
| 7544 } | 7592 } |
| 7593 | |
| 7594 bool has_image = true; | |
| 7595 if (workarounds().adjust_framebuffer_complete_status && | |
| 7596 SupportsDrawBuffers() && | |
| 7597 framebuffer_state_.clear_state_dirty) { | |
| 7598 if (target == GL_READ_FRAMEBUFFER) { | |
| 7599 has_image = AdjustColorBufferAttachmentsIfNecessary(true, false); | |
| 7600 } else { | |
| 7601 has_image = AdjustColorBufferAttachmentsIfNecessary(false, true); | |
| 7602 } | |
| 7603 if (!has_image) { | |
| 7604 return GL_FRAMEBUFFER_COMPLETE; | |
| 7605 } | |
| 7606 } | |
| 7607 | |
| 7545 return framebuffer->GetStatus(texture_manager(), target); | 7608 return framebuffer->GetStatus(texture_manager(), target); |
| 7546 } | 7609 } |
| 7547 | 7610 |
| 7548 void GLES2DecoderImpl::DoFramebufferTexture2D( | 7611 void GLES2DecoderImpl::DoFramebufferTexture2D( |
| 7549 GLenum target, GLenum attachment, GLenum textarget, | 7612 GLenum target, GLenum attachment, GLenum textarget, |
| 7550 GLuint client_texture_id, GLint level) { | 7613 GLuint client_texture_id, GLint level) { |
| 7551 DoFramebufferTexture2DCommon( | 7614 DoFramebufferTexture2DCommon( |
| 7552 "glFramebufferTexture2D", target, attachment, | 7615 "glFramebufferTexture2D", target, attachment, |
| 7553 textarget, client_texture_id, level, 0); | 7616 textarget, client_texture_id, level, 0); |
| 7554 } | 7617 } |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7825 } | 7888 } |
| 7826 } | 7889 } |
| 7827 | 7890 |
| 7828 void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM( | 7891 void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM( |
| 7829 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, | 7892 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, |
| 7830 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, | 7893 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, |
| 7831 GLbitfield mask, GLenum filter) { | 7894 GLbitfield mask, GLenum filter) { |
| 7832 const char* func_name = "glBlitFramebufferCHROMIUM"; | 7895 const char* func_name = "glBlitFramebufferCHROMIUM"; |
| 7833 DCHECK(!ShouldDeferReads() && !ShouldDeferDraws()); | 7896 DCHECK(!ShouldDeferReads() && !ShouldDeferDraws()); |
| 7834 | 7897 |
| 7898 if (workarounds().adjust_framebuffer_complete_status && | |
| 7899 (mask & GL_COLOR_BUFFER_BIT) != 0 && | |
| 7900 SupportsDrawBuffers() && | |
| 7901 framebuffer_state_.clear_state_dirty) { | |
| 7902 if (!AdjustColorBufferAttachmentsIfNecessary(false, true)) { | |
| 7903 return; | |
| 7904 } | |
| 7905 if (!AdjustColorBufferAttachmentsIfNecessary(true, false)) { | |
| 7906 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | |
| 7907 "no valid color image"); | |
| 7908 return; | |
| 7909 } | |
| 7910 } | |
| 7835 if (!CheckBoundFramebufferValid(func_name)) { | 7911 if (!CheckBoundFramebufferValid(func_name)) { |
| 7836 return; | 7912 return; |
| 7837 } | 7913 } |
| 7838 | 7914 |
| 7839 if (GetBoundFramebufferSamples(GL_DRAW_FRAMEBUFFER) > 0) { | 7915 if (GetBoundFramebufferSamples(GL_DRAW_FRAMEBUFFER) > 0) { |
| 7840 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | 7916 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
| 7841 "destination framebuffer is multisampled"); | 7917 "destination framebuffer is multisampled"); |
| 7842 return; | 7918 return; |
| 7843 } | 7919 } |
| 7844 | 7920 |
| (...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9799 return error::kNoError; | 9875 return error::kNoError; |
| 9800 } | 9876 } |
| 9801 if (count < 0) { | 9877 if (count < 0) { |
| 9802 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "count < 0"); | 9878 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "count < 0"); |
| 9803 return error::kNoError; | 9879 return error::kNoError; |
| 9804 } | 9880 } |
| 9805 if (primcount < 0) { | 9881 if (primcount < 0) { |
| 9806 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); | 9882 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); |
| 9807 return error::kNoError; | 9883 return error::kNoError; |
| 9808 } | 9884 } |
| 9885 if (workarounds().adjust_framebuffer_complete_status && | |
| 9886 SupportsDrawBuffers() && | |
| 9887 framebuffer_state_.clear_state_dirty) { | |
| 9888 if (!AdjustColorBufferAttachmentsIfNecessary(false, true)) { | |
| 9889 return error::kNoError; | |
| 9890 } | |
| 9891 } | |
| 9809 if (!CheckBoundDrawFramebufferValid(function_name)) { | 9892 if (!CheckBoundDrawFramebufferValid(function_name)) { |
|
Zhenyao Mo
2016/11/14 19:42:24
All this same code is right above CheckBoundDrawFr
yunchao
2016/11/15 16:21:59
Done.
It is a little different in Clear and Clea
| |
| 9810 return error::kNoError; | 9893 return error::kNoError; |
| 9811 } | 9894 } |
| 9812 // We have to check this here because the prototype for glDrawArrays | 9895 // We have to check this here because the prototype for glDrawArrays |
| 9813 // is GLint not GLsizei. | 9896 // is GLint not GLsizei. |
| 9814 if (first < 0) { | 9897 if (first < 0) { |
| 9815 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "first < 0"); | 9898 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "first < 0"); |
| 9816 return error::kNoError; | 9899 return error::kNoError; |
| 9817 } | 9900 } |
| 9818 | 9901 |
| 9819 if (feature_info_->IsWebGL2OrES3Context()) { | 9902 if (feature_info_->IsWebGL2OrES3Context()) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9963 if (primcount < 0) { | 10046 if (primcount < 0) { |
| 9964 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); | 10047 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); |
| 9965 return error::kNoError; | 10048 return error::kNoError; |
| 9966 } | 10049 } |
| 9967 Buffer* element_array_buffer = buffer_manager()->RequestBufferAccess( | 10050 Buffer* element_array_buffer = buffer_manager()->RequestBufferAccess( |
| 9968 &state_, GL_ELEMENT_ARRAY_BUFFER, function_name); | 10051 &state_, GL_ELEMENT_ARRAY_BUFFER, function_name); |
| 9969 if (!element_array_buffer) { | 10052 if (!element_array_buffer) { |
| 9970 return error::kNoError; | 10053 return error::kNoError; |
| 9971 } | 10054 } |
| 9972 | 10055 |
| 10056 if (workarounds().adjust_framebuffer_complete_status && | |
| 10057 SupportsDrawBuffers() && | |
| 10058 framebuffer_state_.clear_state_dirty) { | |
| 10059 if (!AdjustColorBufferAttachmentsIfNecessary(false, true)) { | |
| 10060 return error::kNoError; | |
| 10061 } | |
| 10062 } | |
| 9973 if (!CheckBoundDrawFramebufferValid(function_name)) { | 10063 if (!CheckBoundDrawFramebufferValid(function_name)) { |
| 9974 return error::kNoError; | 10064 return error::kNoError; |
| 9975 } | 10065 } |
| 9976 | 10066 |
| 9977 if (state_.bound_transform_feedback.get() && | 10067 if (state_.bound_transform_feedback.get() && |
| 9978 state_.bound_transform_feedback->active() && | 10068 state_.bound_transform_feedback->active() && |
| 9979 !state_.bound_transform_feedback->paused()) { | 10069 !state_.bound_transform_feedback->paused()) { |
| 9980 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | 10070 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
| 9981 "transformfeedback is active and not paused"); | 10071 "transformfeedback is active and not paused"); |
| 9982 return error::kNoError; | 10072 return error::kNoError; |
| (...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11188 | 11278 |
| 11189 if (!validators_->read_pixel_format.IsValid(format)) { | 11279 if (!validators_->read_pixel_format.IsValid(format)) { |
| 11190 LOCAL_SET_GL_ERROR_INVALID_ENUM(func_name, format, "format"); | 11280 LOCAL_SET_GL_ERROR_INVALID_ENUM(func_name, format, "format"); |
| 11191 return error::kNoError; | 11281 return error::kNoError; |
| 11192 } | 11282 } |
| 11193 if (!validators_->read_pixel_type.IsValid(type)) { | 11283 if (!validators_->read_pixel_type.IsValid(type)) { |
| 11194 LOCAL_SET_GL_ERROR_INVALID_ENUM(func_name, type, "type"); | 11284 LOCAL_SET_GL_ERROR_INVALID_ENUM(func_name, type, "type"); |
| 11195 return error::kNoError; | 11285 return error::kNoError; |
| 11196 } | 11286 } |
| 11197 | 11287 |
| 11288 if (workarounds().adjust_framebuffer_complete_status && | |
| 11289 SupportsDrawBuffers() && | |
| 11290 framebuffer_state_.clear_state_dirty) { | |
| 11291 if (!AdjustColorBufferAttachmentsIfNecessary(true, false)) { | |
| 11292 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | |
| 11293 "no valid color image"); | |
| 11294 return error::kNoError; | |
| 11295 } | |
| 11296 } | |
| 11297 | |
| 11198 if (!CheckBoundReadFramebufferValid( | 11298 if (!CheckBoundReadFramebufferValid( |
| 11199 func_name, GL_INVALID_FRAMEBUFFER_OPERATION)) { | 11299 func_name, GL_INVALID_FRAMEBUFFER_OPERATION)) { |
| 11200 return error::kNoError; | 11300 return error::kNoError; |
| 11201 } | 11301 } |
| 11202 GLenum src_internal_format = GetBoundReadFramebufferInternalFormat(); | 11302 GLenum src_internal_format = GetBoundReadFramebufferInternalFormat(); |
| 11203 if (src_internal_format == 0) { | 11303 if (src_internal_format == 0) { |
| 11204 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, "no valid color image"); | 11304 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, "no valid color image"); |
| 11205 return error::kNoError; | 11305 return error::kNoError; |
| 11206 } | 11306 } |
| 11207 std::vector<GLenum> accepted_formats; | 11307 std::vector<GLenum> accepted_formats; |
| (...skipping 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13821 GL_INVALID_OPERATION, func_name, "texture is immutable"); | 13921 GL_INVALID_OPERATION, func_name, "texture is immutable"); |
| 13822 return; | 13922 return; |
| 13823 } | 13923 } |
| 13824 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || | 13924 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || |
| 13825 border != 0) { | 13925 border != 0) { |
| 13826 LOCAL_SET_GL_ERROR( | 13926 LOCAL_SET_GL_ERROR( |
| 13827 GL_INVALID_VALUE, func_name, "dimensions out of range"); | 13927 GL_INVALID_VALUE, func_name, "dimensions out of range"); |
| 13828 return; | 13928 return; |
| 13829 } | 13929 } |
| 13830 | 13930 |
| 13931 if (workarounds().adjust_framebuffer_complete_status && | |
| 13932 SupportsDrawBuffers() && | |
| 13933 framebuffer_state_.clear_state_dirty) { | |
| 13934 if (!AdjustColorBufferAttachmentsIfNecessary(true, false)) { | |
| 13935 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | |
| 13936 "no valid color image"); | |
| 13937 return; | |
| 13938 } | |
| 13939 } | |
| 13940 | |
| 13831 if (!CheckBoundReadFramebufferValid(func_name, | 13941 if (!CheckBoundReadFramebufferValid(func_name, |
| 13832 GL_INVALID_FRAMEBUFFER_OPERATION)) { | 13942 GL_INVALID_FRAMEBUFFER_OPERATION)) { |
| 13833 return; | 13943 return; |
| 13834 } | 13944 } |
| 13835 | 13945 |
| 13836 GLenum read_format = GetBoundReadFramebufferInternalFormat(); | 13946 GLenum read_format = GetBoundReadFramebufferInternalFormat(); |
| 13837 GLenum read_type = GetBoundReadFramebufferTextureType(); | 13947 GLenum read_type = GetBoundReadFramebufferTextureType(); |
| 13838 if (!ValidateCopyTexFormat(func_name, internal_format, | 13948 if (!ValidateCopyTexFormat(func_name, internal_format, |
| 13839 read_format, read_type)) { | 13949 read_format, read_type)) { |
| 13840 return; | 13950 return; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14068 Texture* texture = texture_ref->texture(); | 14178 Texture* texture = texture_ref->texture(); |
| 14069 GLenum type = 0; | 14179 GLenum type = 0; |
| 14070 GLenum internal_format = 0; | 14180 GLenum internal_format = 0; |
| 14071 if (!texture->GetLevelType(target, level, &type, &internal_format) || | 14181 if (!texture->GetLevelType(target, level, &type, &internal_format) || |
| 14072 !texture->ValidForTexture( | 14182 !texture->ValidForTexture( |
| 14073 target, level, xoffset, yoffset, 0, width, height, 1)) { | 14183 target, level, xoffset, yoffset, 0, width, height, 1)) { |
| 14074 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "bad dimensions."); | 14184 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "bad dimensions."); |
| 14075 return; | 14185 return; |
| 14076 } | 14186 } |
| 14077 | 14187 |
| 14188 if (workarounds().adjust_framebuffer_complete_status && | |
| 14189 SupportsDrawBuffers() && | |
| 14190 framebuffer_state_.clear_state_dirty) { | |
| 14191 if (!AdjustColorBufferAttachmentsIfNecessary(true, false)) { | |
| 14192 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | |
| 14193 "no valid color image"); | |
| 14194 return; | |
| 14195 } | |
| 14196 } | |
| 14078 if (!CheckBoundReadFramebufferValid(func_name, | 14197 if (!CheckBoundReadFramebufferValid(func_name, |
| 14079 GL_INVALID_FRAMEBUFFER_OPERATION)) { | 14198 GL_INVALID_FRAMEBUFFER_OPERATION)) { |
| 14080 return; | 14199 return; |
| 14081 } | 14200 } |
| 14082 | 14201 |
| 14083 GLenum read_format = GetBoundReadFramebufferInternalFormat(); | 14202 GLenum read_format = GetBoundReadFramebufferInternalFormat(); |
| 14084 GLenum read_type = GetBoundReadFramebufferTextureType(); | 14203 GLenum read_type = GetBoundReadFramebufferTextureType(); |
| 14085 if (!ValidateCopyTexFormat(func_name, internal_format, | 14204 if (!ValidateCopyTexFormat(func_name, internal_format, |
| 14086 read_format, read_type)) { | 14205 read_format, read_type)) { |
| 14087 return; | 14206 return; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14184 Texture* texture = texture_ref->texture(); | 14303 Texture* texture = texture_ref->texture(); |
| 14185 GLenum type = 0; | 14304 GLenum type = 0; |
| 14186 GLenum internal_format = 0; | 14305 GLenum internal_format = 0; |
| 14187 if (!texture->GetLevelType(target, level, &type, &internal_format) || | 14306 if (!texture->GetLevelType(target, level, &type, &internal_format) || |
| 14188 !texture->ValidForTexture( | 14307 !texture->ValidForTexture( |
| 14189 target, level, xoffset, yoffset, zoffset, width, height, 1)) { | 14308 target, level, xoffset, yoffset, zoffset, width, height, 1)) { |
| 14190 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "bad dimensions."); | 14309 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "bad dimensions."); |
| 14191 return; | 14310 return; |
| 14192 } | 14311 } |
| 14193 | 14312 |
| 14313 if (workarounds().adjust_framebuffer_complete_status && | |
| 14314 SupportsDrawBuffers() && | |
| 14315 framebuffer_state_.clear_state_dirty) { | |
| 14316 if (!AdjustColorBufferAttachmentsIfNecessary(true, false)) { | |
| 14317 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, | |
| 14318 "no valid color image"); | |
| 14319 return; | |
| 14320 } | |
| 14321 } | |
| 14194 if (!CheckBoundReadFramebufferValid(func_name, | 14322 if (!CheckBoundReadFramebufferValid(func_name, |
| 14195 GL_INVALID_FRAMEBUFFER_OPERATION)) { | 14323 GL_INVALID_FRAMEBUFFER_OPERATION)) { |
| 14196 return; | 14324 return; |
| 14197 } | 14325 } |
| 14198 | 14326 |
| 14199 GLenum read_format = GetBoundReadFramebufferInternalFormat(); | 14327 GLenum read_format = GetBoundReadFramebufferInternalFormat(); |
| 14200 GLenum read_type = GetBoundReadFramebufferTextureType(); | 14328 GLenum read_type = GetBoundReadFramebufferTextureType(); |
| 14201 if (!ValidateCopyTexFormat(func_name, internal_format, | 14329 if (!ValidateCopyTexFormat(func_name, internal_format, |
| 14202 read_format, read_type)) { | 14330 read_format, read_type)) { |
| 14203 return; | 14331 return; |
| (...skipping 4654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18858 } | 18986 } |
| 18859 | 18987 |
| 18860 // Include the auto-generated part of this file. We split this because it means | 18988 // Include the auto-generated part of this file. We split this because it means |
| 18861 // we can easily edit the non-auto generated parts right here in this file | 18989 // we can easily edit the non-auto generated parts right here in this file |
| 18862 // instead of having to edit some template or the code generator. | 18990 // instead of having to edit some template or the code generator. |
| 18863 #include "base/macros.h" | 18991 #include "base/macros.h" |
| 18864 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 18992 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 18865 | 18993 |
| 18866 } // namespace gles2 | 18994 } // namespace gles2 |
| 18867 } // namespace gpu | 18995 } // namespace gpu |
| OLD | NEW |