| 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> |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <cmath> | 13 #include <cmath> |
| 14 #include <list> | 14 #include <list> |
| 15 #include <map> | 15 #include <map> |
| 16 #include <memory> | 16 #include <memory> |
| 17 #include <queue> | 17 #include <queue> |
| 18 | 18 |
| 19 #include "base/callback.h" | 19 #include "base/callback.h" |
| 20 #include "base/callback_helpers.h" | 20 #include "base/callback_helpers.h" |
| 21 #include "base/logging.h" | 21 #include "base/logging.h" |
| 22 #include "base/memory/linked_ptr.h" | 22 #include "base/memory/linked_ptr.h" |
| 23 #include "base/metrics/histogram_macros.h" | 23 #include "base/metrics/histogram_macros.h" |
| 24 #include "base/numerics/safe_math.h" | 24 #include "base/numerics/safe_math.h" |
| 25 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
| 26 #include "base/strings/stringprintf.h" |
| 26 #include "base/trace_event/trace_event.h" | 27 #include "base/trace_event/trace_event.h" |
| 27 #include "base/trace_event/trace_event_synthetic_delay.h" | 28 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 28 #include "build/build_config.h" | 29 #include "build/build_config.h" |
| 29 #include "gpu/command_buffer/common/debug_marker_manager.h" | 30 #include "gpu/command_buffer/common/debug_marker_manager.h" |
| 30 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 31 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 31 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 32 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 32 #include "gpu/command_buffer/common/mailbox.h" | 33 #include "gpu/command_buffer/common/mailbox.h" |
| 33 #include "gpu/command_buffer/service/buffer_manager.h" | 34 #include "gpu/command_buffer/service/buffer_manager.h" |
| 34 #include "gpu/command_buffer/service/context_group.h" | 35 #include "gpu/command_buffer/service/context_group.h" |
| 35 #include "gpu/command_buffer/service/context_state.h" | 36 #include "gpu/command_buffer/service/context_state.h" |
| (...skipping 11681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11717 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | 11718 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( |
| 11718 &state_, target); | 11719 &state_, target); |
| 11719 if (!texture_ref) { | 11720 if (!texture_ref) { |
| 11720 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCompressedTexSubImage3D", | 11721 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCompressedTexSubImage3D", |
| 11721 "unknown texture for target"); | 11722 "unknown texture for target"); |
| 11722 return; | 11723 return; |
| 11723 } | 11724 } |
| 11724 Texture* texture = texture_ref->texture(); | 11725 Texture* texture = texture_ref->texture(); |
| 11725 GLenum type = 0, internal_format = 0; | 11726 GLenum type = 0, internal_format = 0; |
| 11726 if (!texture->GetLevelType(target, level, &type, &internal_format)) { | 11727 if (!texture->GetLevelType(target, level, &type, &internal_format)) { |
| 11728 std::string msg = base::StringPrintf( |
| 11729 "level %d does not exist", level); |
| 11727 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCompressedTexSubImage3D", | 11730 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCompressedTexSubImage3D", |
| 11728 "level does not exist"); | 11731 msg.c_str()); |
| 11729 return; | 11732 return; |
| 11730 } | 11733 } |
| 11731 if (internal_format != format) { | 11734 if (internal_format != format) { |
| 11732 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCompressedTexSubImage3D", | 11735 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCompressedTexSubImage3D", |
| 11733 "format does not match internal format"); | 11736 "format does not match internal format"); |
| 11734 return; | 11737 return; |
| 11735 } | 11738 } |
| 11736 if (!texture->ValidForTexture(target, level, xoffset, yoffset, zoffset, | 11739 if (!texture->ValidForTexture(target, level, xoffset, yoffset, zoffset, |
| 11737 width, height, depth)) { | 11740 width, height, depth)) { |
| 11738 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedTexSubImage3D", | 11741 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedTexSubImage3D", |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11988 if (!texture_manager()->ValidForTarget(target, level, width, height, 1)) { | 11991 if (!texture_manager()->ValidForTarget(target, level, width, height, 1)) { |
| 11989 LOCAL_SET_GL_ERROR( | 11992 LOCAL_SET_GL_ERROR( |
| 11990 GL_INVALID_VALUE, | 11993 GL_INVALID_VALUE, |
| 11991 "glCompressedTexSubImage2D", "dimensions out of range"); | 11994 "glCompressedTexSubImage2D", "dimensions out of range"); |
| 11992 return; | 11995 return; |
| 11993 } | 11996 } |
| 11994 Texture* texture = texture_ref->texture(); | 11997 Texture* texture = texture_ref->texture(); |
| 11995 GLenum type = 0; | 11998 GLenum type = 0; |
| 11996 GLenum internal_format = 0; | 11999 GLenum internal_format = 0; |
| 11997 if (!texture->GetLevelType(target, level, &type, &internal_format)) { | 12000 if (!texture->GetLevelType(target, level, &type, &internal_format)) { |
| 12001 std::string msg = base::StringPrintf( |
| 12002 "level %d does not exist", level); |
| 11998 LOCAL_SET_GL_ERROR( | 12003 LOCAL_SET_GL_ERROR( |
| 11999 GL_INVALID_OPERATION, | 12004 GL_INVALID_OPERATION, "glCompressedTexSubImage2D", msg.c_str()); |
| 12000 "glCompressedTexSubImage2D", "level does not exist."); | |
| 12001 return; | 12005 return; |
| 12002 } | 12006 } |
| 12003 if (internal_format != format) { | 12007 if (internal_format != format) { |
| 12004 LOCAL_SET_GL_ERROR( | 12008 LOCAL_SET_GL_ERROR( |
| 12005 GL_INVALID_OPERATION, | 12009 GL_INVALID_OPERATION, |
| 12006 "glCompressedTexSubImage2D", "format does not match internal format."); | 12010 "glCompressedTexSubImage2D", "format does not match internal format."); |
| 12007 return; | 12011 return; |
| 12008 } | 12012 } |
| 12009 if (!texture->ValidForTexture(target, level, xoffset, yoffset, 0, width, | 12013 if (!texture->ValidForTexture(target, level, xoffset, yoffset, 0, width, |
| 12010 height, 1)) { | 12014 height, 1)) { |
| (...skipping 4763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16774 } | 16778 } |
| 16775 | 16779 |
| 16776 // Include the auto-generated part of this file. We split this because it means | 16780 // Include the auto-generated part of this file. We split this because it means |
| 16777 // we can easily edit the non-auto generated parts right here in this file | 16781 // we can easily edit the non-auto generated parts right here in this file |
| 16778 // instead of having to edit some template or the code generator. | 16782 // instead of having to edit some template or the code generator. |
| 16779 #include "base/macros.h" | 16783 #include "base/macros.h" |
| 16780 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16784 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 16781 | 16785 |
| 16782 } // namespace gles2 | 16786 } // namespace gles2 |
| 16783 } // namespace gpu | 16787 } // namespace gpu |
| OLD | NEW |