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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 GLint xoffset, | 962 GLint xoffset, |
| 963 GLint yoffset, | 963 GLint yoffset, |
| 964 GLint zoffset, | 964 GLint zoffset, |
| 965 GLsizei width, | 965 GLsizei width, |
| 966 GLsizei height, | 966 GLsizei height, |
| 967 GLsizei depth, | 967 GLsizei depth, |
| 968 GLenum format, | 968 GLenum format, |
| 969 GLsizei image_size, | 969 GLsizei image_size, |
| 970 const void* data); | 970 const void* data); |
| 971 | 971 |
| 972 // Wrapper for CopyTexSubImage3D. | |
| 973 void DoCopyTexSubImage3D( | |
| 974 GLenum target, | |
| 975 GLint level, | |
| 976 GLint xoffset, | |
| 977 GLint yoffset, | |
| 978 GLint zoffset, | |
| 979 GLint x, | |
| 980 GLint y, | |
| 981 GLsizei width, | |
| 982 GLsizei height); | |
| 983 | |
| 972 // Validate if |format| is valid for CopyTex{Sub}Image functions. | 984 // Validate if |format| is valid for CopyTex{Sub}Image functions. |
| 973 // If not, generate a GL error and return false. | 985 // If not, generate a GL error and return false. |
| 974 bool ValidateCopyTexFormat(const char* func_name, GLenum internal_format, | 986 bool ValidateCopyTexFormat(const char* func_name, GLenum internal_format, |
| 975 GLenum read_format, GLenum read_type); | 987 GLenum read_format, GLenum read_type); |
| 976 | 988 |
| 977 // Wrapper for CopyTexImage2D. | 989 // Wrapper for CopyTexImage2D. |
| 978 void DoCopyTexImage2D( | 990 void DoCopyTexImage2D( |
| 979 GLenum target, | 991 GLenum target, |
| 980 GLint level, | 992 GLint level, |
| 981 GLenum internal_format, | 993 GLenum internal_format, |
| (...skipping 11594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12576 } else { | 12588 } else { |
| 12577 glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, | 12589 glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, |
| 12578 height, depth, format, image_size, data); | 12590 height, depth, format, image_size, data); |
| 12579 } | 12591 } |
| 12580 | 12592 |
| 12581 // This may be a slow command. Exit command processing to allow for | 12593 // This may be a slow command. Exit command processing to allow for |
| 12582 // context preemption and GPU watchdog checks. | 12594 // context preemption and GPU watchdog checks. |
| 12583 ExitCommandProcessingEarly(); | 12595 ExitCommandProcessingEarly(); |
| 12584 } | 12596 } |
| 12585 | 12597 |
| 12598 void GLES2DecoderImpl::DoCopyTexSubImage3D( | |
| 12599 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, | |
| 12600 GLint x, GLint y, GLsizei width, GLsizei height) { | |
| 12601 if (!texture_manager()->ValidForTarget(target, level, width, height, 1)) { | |
|
Zhenyao Mo
2016/07/26 13:25:55
Please look at CopyTexSubImage2D. You will need m
yunchao
2016/07/26 13:30:50
Acknowledged.
| |
| 12602 LOCAL_SET_GL_ERROR( | |
| 12603 GL_INVALID_VALUE, | |
| 12604 "glCopyTexSubImage3D", "dimensions out of range"); | |
|
Zhenyao Mo
2016/07/26 13:25:55
nit: define a const char* function_name, so you do
yunchao
2016/07/26 13:30:50
Acknowledged.
| |
| 12605 return; | |
| 12606 } | |
| 12607 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | |
| 12608 &state_, target); | |
| 12609 if (!texture_ref) { | |
| 12610 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopyTexSubImage3D", | |
| 12611 "unknown texture for target"); | |
| 12612 return; | |
| 12613 } | |
| 12614 Texture* texture = texture_ref->texture(); | |
| 12615 if (!texture->ValidForTexture(target, level, xoffset, yoffset, zoffset, | |
| 12616 width, height, 1)) { | |
| 12617 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopyTexSubImage3D", | |
| 12618 "bad dimensions"); | |
| 12619 return; | |
| 12620 } | |
| 12621 glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, | |
| 12622 height); | |
| 12623 } | |
| 12624 | |
| 12586 error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size, | 12625 error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size, |
| 12587 const void* cmd_data) { | 12626 const void* cmd_data) { |
| 12588 const gles2::cmds::TexImage2D& c = | 12627 const gles2::cmds::TexImage2D& c = |
| 12589 *static_cast<const gles2::cmds::TexImage2D*>(cmd_data); | 12628 *static_cast<const gles2::cmds::TexImage2D*>(cmd_data); |
| 12590 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D", | 12629 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D", |
| 12591 "width", c.width, "height", c.height); | 12630 "width", c.width, "height", c.height); |
| 12592 // Set as failed for now, but if it successed, this will be set to not failed. | 12631 // Set as failed for now, but if it successed, this will be set to not failed. |
| 12593 texture_state_.tex_image_failed = true; | 12632 texture_state_.tex_image_failed = true; |
| 12594 GLenum target = static_cast<GLenum>(c.target); | 12633 GLenum target = static_cast<GLenum>(c.target); |
| 12595 GLint level = static_cast<GLint>(c.level); | 12634 GLint level = static_cast<GLint>(c.level); |
| (...skipping 5092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 17688 } | 17727 } |
| 17689 | 17728 |
| 17690 // Include the auto-generated part of this file. We split this because it means | 17729 // Include the auto-generated part of this file. We split this because it means |
| 17691 // we can easily edit the non-auto generated parts right here in this file | 17730 // we can easily edit the non-auto generated parts right here in this file |
| 17692 // instead of having to edit some template or the code generator. | 17731 // instead of having to edit some template or the code generator. |
| 17693 #include "base/macros.h" | 17732 #include "base/macros.h" |
| 17694 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17733 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17695 | 17734 |
| 17696 } // namespace gles2 | 17735 } // namespace gles2 |
| 17697 } // namespace gpu | 17736 } // namespace gpu |
| OLD | NEW |