| 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 <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 0, // border | 1651 0, // border |
| 1652 format, | 1652 format, |
| 1653 GL_UNSIGNED_BYTE, | 1653 GL_UNSIGNED_BYTE, |
| 1654 NULL); | 1654 NULL); |
| 1655 | 1655 |
| 1656 size_ = size; | 1656 size_ = size; |
| 1657 | 1657 |
| 1658 bool success = glGetError() == GL_NO_ERROR; | 1658 bool success = glGetError() == GL_NO_ERROR; |
| 1659 if (success) { | 1659 if (success) { |
| 1660 uint32 image_size = 0; | 1660 uint32 image_size = 0; |
| 1661 GLES2Util::ComputeImageDataSize( | 1661 GLES2Util::ComputeImageDataSizes( |
| 1662 size.width(), size.height(), format, GL_UNSIGNED_BYTE, 4, &image_size); | 1662 size.width(), size.height(), format, GL_UNSIGNED_BYTE, 4, &image_size, |
| 1663 NULL, NULL); |
| 1663 estimated_size_ = image_size; | 1664 estimated_size_ = image_size; |
| 1664 decoder_->UpdateBackbufferMemoryAccounting(); | 1665 decoder_->UpdateBackbufferMemoryAccounting(); |
| 1665 } | 1666 } |
| 1666 return success; | 1667 return success; |
| 1667 } | 1668 } |
| 1668 | 1669 |
| 1669 void Texture::Copy(const gfx::Size& size, GLenum format) { | 1670 void Texture::Copy(const gfx::Size& size, GLenum format) { |
| 1670 DCHECK_NE(id_, 0u); | 1671 DCHECK_NE(id_, 0u); |
| 1671 ScopedGLErrorSuppressor suppressor(decoder_); | 1672 ScopedGLErrorSuppressor suppressor(decoder_); |
| 1672 ScopedTexture2DBinder binder(decoder_, id_); | 1673 ScopedTexture2DBinder binder(decoder_, id_); |
| (...skipping 4292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5965 GLsizei width = c.width; | 5966 GLsizei width = c.width; |
| 5966 GLsizei height = c.height; | 5967 GLsizei height = c.height; |
| 5967 GLenum format = c.format; | 5968 GLenum format = c.format; |
| 5968 GLenum type = c.type; | 5969 GLenum type = c.type; |
| 5969 if (width < 0 || height < 0) { | 5970 if (width < 0 || height < 0) { |
| 5970 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions < 0"); | 5971 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions < 0"); |
| 5971 return error::kNoError; | 5972 return error::kNoError; |
| 5972 } | 5973 } |
| 5973 typedef gles2::ReadPixels::Result Result; | 5974 typedef gles2::ReadPixels::Result Result; |
| 5974 uint32 pixels_size; | 5975 uint32 pixels_size; |
| 5975 if (!GLES2Util::ComputeImageDataSize( | 5976 if (!GLES2Util::ComputeImageDataSizes( |
| 5976 width, height, format, type, pack_alignment_, &pixels_size)) { | 5977 width, height, format, type, pack_alignment_, &pixels_size, NULL, NULL)) { |
| 5977 return error::kOutOfBounds; | 5978 return error::kOutOfBounds; |
| 5978 } | 5979 } |
| 5979 void* pixels = GetSharedMemoryAs<void*>( | 5980 void* pixels = GetSharedMemoryAs<void*>( |
| 5980 c.pixels_shm_id, c.pixels_shm_offset, pixels_size); | 5981 c.pixels_shm_id, c.pixels_shm_offset, pixels_size); |
| 5981 Result* result = GetSharedMemoryAs<Result*>( | 5982 Result* result = GetSharedMemoryAs<Result*>( |
| 5982 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 5983 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 5983 if (!pixels || !result) { | 5984 if (!pixels || !result) { |
| 5984 return error::kOutOfBounds; | 5985 return error::kOutOfBounds; |
| 5985 } | 5986 } |
| 5986 | 5987 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 6011 } | 6012 } |
| 6012 | 6013 |
| 6013 CopyRealGLErrorsToWrapper(); | 6014 CopyRealGLErrorsToWrapper(); |
| 6014 | 6015 |
| 6015 ScopedResolvedFrameBufferBinder binder(this, false, true); | 6016 ScopedResolvedFrameBufferBinder binder(this, false, true); |
| 6016 | 6017 |
| 6017 if (x < 0 || y < 0 || max_x > max_size.width() || max_y > max_size.height()) { | 6018 if (x < 0 || y < 0 || max_x > max_size.width() || max_y > max_size.height()) { |
| 6018 // The user requested an out of range area. Get the results 1 line | 6019 // The user requested an out of range area. Get the results 1 line |
| 6019 // at a time. | 6020 // at a time. |
| 6020 uint32 temp_size; | 6021 uint32 temp_size; |
| 6021 if (!GLES2Util::ComputeImageDataSize( | 6022 uint32 unpadded_row_size; |
| 6022 width, 1, format, type, pack_alignment_, &temp_size)) { | 6023 uint32 padded_row_size; |
| 6023 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range"); | 6024 if (!GLES2Util::ComputeImageDataSizes( |
| 6024 return error::kNoError; | 6025 width, 2, format, type, pack_alignment_, &temp_size, |
| 6025 } | 6026 &unpadded_row_size, &padded_row_size)) { |
| 6026 GLsizei unpadded_row_size = temp_size; | |
| 6027 if (!GLES2Util::ComputeImageDataSize( | |
| 6028 width, 2, format, type, pack_alignment_, &temp_size)) { | |
| 6029 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range"); | |
| 6030 return error::kNoError; | |
| 6031 } | |
| 6032 GLsizei padded_row_size = temp_size - unpadded_row_size; | |
| 6033 if (padded_row_size < 0 || unpadded_row_size < 0) { | |
| 6034 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range"); | 6027 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range"); |
| 6035 return error::kNoError; | 6028 return error::kNoError; |
| 6036 } | 6029 } |
| 6037 | 6030 |
| 6038 GLint dest_x_offset = std::max(-x, 0); | 6031 GLint dest_x_offset = std::max(-x, 0); |
| 6039 uint32 dest_row_offset; | 6032 uint32 dest_row_offset; |
| 6040 if (!GLES2Util::ComputeImageDataSize( | 6033 if (!GLES2Util::ComputeImageDataSizes( |
| 6041 dest_x_offset, 1, format, type, pack_alignment_, &dest_row_offset)) { | 6034 dest_x_offset, 1, format, type, pack_alignment_, &dest_row_offset, NULL, |
| 6035 NULL)) { |
| 6042 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range"); | 6036 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range"); |
| 6043 return error::kNoError; | 6037 return error::kNoError; |
| 6044 } | 6038 } |
| 6045 | 6039 |
| 6046 // Copy each row into the larger dest rect. | 6040 // Copy each row into the larger dest rect. |
| 6047 int8* dst = static_cast<int8*>(pixels); | 6041 int8* dst = static_cast<int8*>(pixels); |
| 6048 GLint read_x = std::max(0, x); | 6042 GLint read_x = std::max(0, x); |
| 6049 GLint read_end_x = std::max(0, std::min(max_size.width(), max_x)); | 6043 GLint read_end_x = std::max(0, std::min(max_size.width(), max_x)); |
| 6050 GLint read_width = read_end_x - read_x; | 6044 GLint read_width = read_end_x - read_x; |
| 6051 for (GLint yy = 0; yy < height; ++yy) { | 6045 for (GLint yy = 0; yy < height; ++yy) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6066 } | 6060 } |
| 6067 GLenum error = PeekGLError(); | 6061 GLenum error = PeekGLError(); |
| 6068 if (error == GL_NO_ERROR) { | 6062 if (error == GL_NO_ERROR) { |
| 6069 *result = true; | 6063 *result = true; |
| 6070 | 6064 |
| 6071 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); | 6065 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); |
| 6072 uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); | 6066 uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); |
| 6073 if ((channels_exist & 0x0008) == 0) { | 6067 if ((channels_exist & 0x0008) == 0) { |
| 6074 // Set the alpha to 255 because some drivers are buggy in this regard. | 6068 // Set the alpha to 255 because some drivers are buggy in this regard. |
| 6075 uint32 temp_size; | 6069 uint32 temp_size; |
| 6076 if (!GLES2Util::ComputeImageDataSize( | 6070 |
| 6077 width, 1, format, type, pack_alignment_, &temp_size)) { | 6071 uint32 unpadded_row_size; |
| 6078 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range"); | 6072 uint32 padded_row_size; |
| 6079 return error::kNoError; | 6073 if (!GLES2Util::ComputeImageDataSizes( |
| 6080 } | 6074 width, 2, format, type, pack_alignment_, &temp_size, |
| 6081 GLsizei unpadded_row_size = temp_size; | 6075 &unpadded_row_size, &padded_row_size)) { |
| 6082 if (!GLES2Util::ComputeImageDataSize( | |
| 6083 width, 2, format, type, pack_alignment_, &temp_size)) { | |
| 6084 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range"); | |
| 6085 return error::kNoError; | |
| 6086 } | |
| 6087 GLsizei padded_row_size = temp_size - unpadded_row_size; | |
| 6088 if (padded_row_size < 0 || unpadded_row_size < 0) { | |
| 6089 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range"); | 6076 SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range"); |
| 6090 return error::kNoError; | 6077 return error::kNoError; |
| 6091 } | 6078 } |
| 6092 // NOTE: Assumes the type is GL_UNSIGNED_BYTE which was true at the time | 6079 // NOTE: Assumes the type is GL_UNSIGNED_BYTE which was true at the time |
| 6093 // of this implementation. | 6080 // of this implementation. |
| 6094 if (type != GL_UNSIGNED_BYTE) { | 6081 if (type != GL_UNSIGNED_BYTE) { |
| 6095 SetGLError(GL_INVALID_OPERATION, "unsupported readPixel format"); | 6082 SetGLError(GL_INVALID_OPERATION, "unsupported readPixel format"); |
| 6096 return error::kNoError; | 6083 return error::kNoError; |
| 6097 } | 6084 } |
| 6098 switch (format) { | 6085 switch (format) { |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6457 unsigned bind_target, | 6444 unsigned bind_target, |
| 6458 unsigned target, | 6445 unsigned target, |
| 6459 int level, | 6446 int level, |
| 6460 unsigned format, | 6447 unsigned format, |
| 6461 unsigned type, | 6448 unsigned type, |
| 6462 int width, | 6449 int width, |
| 6463 int height, | 6450 int height, |
| 6464 bool is_texture_immutable) { | 6451 bool is_texture_immutable) { |
| 6465 // Assumes the size has already been checked. | 6452 // Assumes the size has already been checked. |
| 6466 uint32 pixels_size = 0; | 6453 uint32 pixels_size = 0; |
| 6467 if (!GLES2Util::ComputeImageDataSize( | 6454 if (!GLES2Util::ComputeImageDataSizes( |
| 6468 width, height, format, type, unpack_alignment_, &pixels_size)) { | 6455 width, height, format, type, unpack_alignment_, &pixels_size, NULL, |
| 6456 NULL)) { |
| 6469 return false; | 6457 return false; |
| 6470 } | 6458 } |
| 6471 scoped_array<char> zero(new char[pixels_size]); | 6459 scoped_array<char> zero(new char[pixels_size]); |
| 6472 memset(zero.get(), 0, pixels_size); | 6460 memset(zero.get(), 0, pixels_size); |
| 6473 glBindTexture(bind_target, service_id); | 6461 glBindTexture(bind_target, service_id); |
| 6474 if (is_texture_immutable) { | 6462 if (is_texture_immutable) { |
| 6475 glTexSubImage2D( | 6463 glTexSubImage2D( |
| 6476 target, level, 0, 0, width, height, format, type, zero.get()); | 6464 target, level, 0, 0, width, height, format, type, zero.get()); |
| 6477 } else { | 6465 } else { |
| 6478 WrappedTexImage2D( | 6466 WrappedTexImage2D( |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6765 GLint level = static_cast<GLint>(c.level); | 6753 GLint level = static_cast<GLint>(c.level); |
| 6766 GLint internal_format = static_cast<GLint>(c.internalformat); | 6754 GLint internal_format = static_cast<GLint>(c.internalformat); |
| 6767 GLsizei width = static_cast<GLsizei>(c.width); | 6755 GLsizei width = static_cast<GLsizei>(c.width); |
| 6768 GLsizei height = static_cast<GLsizei>(c.height); | 6756 GLsizei height = static_cast<GLsizei>(c.height); |
| 6769 GLint border = static_cast<GLint>(c.border); | 6757 GLint border = static_cast<GLint>(c.border); |
| 6770 GLenum format = static_cast<GLenum>(c.format); | 6758 GLenum format = static_cast<GLenum>(c.format); |
| 6771 GLenum type = static_cast<GLenum>(c.type); | 6759 GLenum type = static_cast<GLenum>(c.type); |
| 6772 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); | 6760 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); |
| 6773 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); | 6761 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); |
| 6774 uint32 pixels_size; | 6762 uint32 pixels_size; |
| 6775 if (!GLES2Util::ComputeImageDataSize( | 6763 if (!GLES2Util::ComputeImageDataSizes( |
| 6776 width, height, format, type, unpack_alignment_, &pixels_size)) { | 6764 width, height, format, type, unpack_alignment_, &pixels_size, NULL, |
| 6765 NULL)) { |
| 6777 return error::kOutOfBounds; | 6766 return error::kOutOfBounds; |
| 6778 } | 6767 } |
| 6779 const void* pixels = NULL; | 6768 const void* pixels = NULL; |
| 6780 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { | 6769 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { |
| 6781 pixels = GetSharedMemoryAs<const void*>( | 6770 pixels = GetSharedMemoryAs<const void*>( |
| 6782 pixels_shm_id, pixels_shm_offset, pixels_size); | 6771 pixels_shm_id, pixels_shm_offset, pixels_size); |
| 6783 if (!pixels) { | 6772 if (!pixels) { |
| 6784 return error::kOutOfBounds; | 6773 return error::kOutOfBounds; |
| 6785 } | 6774 } |
| 6786 } | 6775 } |
| 6787 return DoTexImage2D( | 6776 return DoTexImage2D( |
| 6788 target, level, internal_format, width, height, border, format, type, | 6777 target, level, internal_format, width, height, border, format, type, |
| 6789 pixels, pixels_size); | 6778 pixels, pixels_size); |
| 6790 } | 6779 } |
| 6791 | 6780 |
| 6792 error::Error GLES2DecoderImpl::HandleTexImage2DImmediate( | 6781 error::Error GLES2DecoderImpl::HandleTexImage2DImmediate( |
| 6793 uint32 immediate_data_size, const gles2::TexImage2DImmediate& c) { | 6782 uint32 immediate_data_size, const gles2::TexImage2DImmediate& c) { |
| 6794 GLenum target = static_cast<GLenum>(c.target); | 6783 GLenum target = static_cast<GLenum>(c.target); |
| 6795 GLint level = static_cast<GLint>(c.level); | 6784 GLint level = static_cast<GLint>(c.level); |
| 6796 GLint internal_format = static_cast<GLint>(c.internalformat); | 6785 GLint internal_format = static_cast<GLint>(c.internalformat); |
| 6797 GLsizei width = static_cast<GLsizei>(c.width); | 6786 GLsizei width = static_cast<GLsizei>(c.width); |
| 6798 GLsizei height = static_cast<GLsizei>(c.height); | 6787 GLsizei height = static_cast<GLsizei>(c.height); |
| 6799 GLint border = static_cast<GLint>(c.border); | 6788 GLint border = static_cast<GLint>(c.border); |
| 6800 GLenum format = static_cast<GLenum>(c.format); | 6789 GLenum format = static_cast<GLenum>(c.format); |
| 6801 GLenum type = static_cast<GLenum>(c.type); | 6790 GLenum type = static_cast<GLenum>(c.type); |
| 6802 uint32 size; | 6791 uint32 size; |
| 6803 if (!GLES2Util::ComputeImageDataSize( | 6792 if (!GLES2Util::ComputeImageDataSizes( |
| 6804 width, height, format, type, unpack_alignment_, &size)) { | 6793 width, height, format, type, unpack_alignment_, &size, NULL, NULL)) { |
| 6805 return error::kOutOfBounds; | 6794 return error::kOutOfBounds; |
| 6806 } | 6795 } |
| 6807 const void* pixels = GetImmediateDataAs<const void*>( | 6796 const void* pixels = GetImmediateDataAs<const void*>( |
| 6808 c, size, immediate_data_size); | 6797 c, size, immediate_data_size); |
| 6809 if (!pixels) { | 6798 if (!pixels) { |
| 6810 return error::kOutOfBounds; | 6799 return error::kOutOfBounds; |
| 6811 } | 6800 } |
| 6812 DoTexImage2D( | 6801 DoTexImage2D( |
| 6813 target, level, internal_format, width, height, border, format, type, | 6802 target, level, internal_format, width, height, border, format, type, |
| 6814 pixels, size); | 6803 pixels, size); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7020 SetGLError(GL_OUT_OF_MEMORY, "glCopyTexSubImage2D: dimensions too big"); | 7009 SetGLError(GL_OUT_OF_MEMORY, "glCopyTexSubImage2D: dimensions too big"); |
| 7021 return; | 7010 return; |
| 7022 } | 7011 } |
| 7023 | 7012 |
| 7024 if (copyX != x || | 7013 if (copyX != x || |
| 7025 copyY != y || | 7014 copyY != y || |
| 7026 copyWidth != width || | 7015 copyWidth != width || |
| 7027 copyHeight != height) { | 7016 copyHeight != height) { |
| 7028 // some part was clipped so clear the sub rect. | 7017 // some part was clipped so clear the sub rect. |
| 7029 uint32 pixels_size = 0; | 7018 uint32 pixels_size = 0; |
| 7030 if (!GLES2Util::ComputeImageDataSize( | 7019 if (!GLES2Util::ComputeImageDataSizes( |
| 7031 width, height, format, type, unpack_alignment_, &pixels_size)) { | 7020 width, height, format, type, unpack_alignment_, &pixels_size, NULL, |
| 7021 NULL)) { |
| 7032 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D: dimensions too large"); | 7022 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D: dimensions too large"); |
| 7033 return; | 7023 return; |
| 7034 } | 7024 } |
| 7035 scoped_array<char> zero(new char[pixels_size]); | 7025 scoped_array<char> zero(new char[pixels_size]); |
| 7036 memset(zero.get(), 0, pixels_size); | 7026 memset(zero.get(), 0, pixels_size); |
| 7037 glTexSubImage2D( | 7027 glTexSubImage2D( |
| 7038 target, level, xoffset, yoffset, width, height, | 7028 target, level, xoffset, yoffset, width, height, |
| 7039 format, type, zero.get()); | 7029 format, type, zero.get()); |
| 7040 } | 7030 } |
| 7041 | 7031 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7128 | 7118 |
| 7129 GLenum target = static_cast<GLenum>(c.target); | 7119 GLenum target = static_cast<GLenum>(c.target); |
| 7130 GLint level = static_cast<GLint>(c.level); | 7120 GLint level = static_cast<GLint>(c.level); |
| 7131 GLint xoffset = static_cast<GLint>(c.xoffset); | 7121 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 7132 GLint yoffset = static_cast<GLint>(c.yoffset); | 7122 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 7133 GLsizei width = static_cast<GLsizei>(c.width); | 7123 GLsizei width = static_cast<GLsizei>(c.width); |
| 7134 GLsizei height = static_cast<GLsizei>(c.height); | 7124 GLsizei height = static_cast<GLsizei>(c.height); |
| 7135 GLenum format = static_cast<GLenum>(c.format); | 7125 GLenum format = static_cast<GLenum>(c.format); |
| 7136 GLenum type = static_cast<GLenum>(c.type); | 7126 GLenum type = static_cast<GLenum>(c.type); |
| 7137 uint32 data_size; | 7127 uint32 data_size; |
| 7138 if (!GLES2Util::ComputeImageDataSize( | 7128 if (!GLES2Util::ComputeImageDataSizes( |
| 7139 width, height, format, type, unpack_alignment_, &data_size)) { | 7129 width, height, format, type, unpack_alignment_, &data_size, NULL, NULL)) { |
| 7140 return error::kOutOfBounds; | 7130 return error::kOutOfBounds; |
| 7141 } | 7131 } |
| 7142 const void* pixels = GetSharedMemoryAs<const void*>( | 7132 const void* pixels = GetSharedMemoryAs<const void*>( |
| 7143 c.pixels_shm_id, c.pixels_shm_offset, data_size); | 7133 c.pixels_shm_id, c.pixels_shm_offset, data_size); |
| 7144 if (!validators_->texture_target.IsValid(target)) { | 7134 if (!validators_->texture_target.IsValid(target)) { |
| 7145 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: target GL_INVALID_ENUM"); | 7135 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: target GL_INVALID_ENUM"); |
| 7146 return error::kNoError; | 7136 return error::kNoError; |
| 7147 } | 7137 } |
| 7148 if (width < 0) { | 7138 if (width < 0) { |
| 7149 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: width < 0"); | 7139 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: width < 0"); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 7177 | 7167 |
| 7178 GLenum target = static_cast<GLenum>(c.target); | 7168 GLenum target = static_cast<GLenum>(c.target); |
| 7179 GLint level = static_cast<GLint>(c.level); | 7169 GLint level = static_cast<GLint>(c.level); |
| 7180 GLint xoffset = static_cast<GLint>(c.xoffset); | 7170 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 7181 GLint yoffset = static_cast<GLint>(c.yoffset); | 7171 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 7182 GLsizei width = static_cast<GLsizei>(c.width); | 7172 GLsizei width = static_cast<GLsizei>(c.width); |
| 7183 GLsizei height = static_cast<GLsizei>(c.height); | 7173 GLsizei height = static_cast<GLsizei>(c.height); |
| 7184 GLenum format = static_cast<GLenum>(c.format); | 7174 GLenum format = static_cast<GLenum>(c.format); |
| 7185 GLenum type = static_cast<GLenum>(c.type); | 7175 GLenum type = static_cast<GLenum>(c.type); |
| 7186 uint32 data_size; | 7176 uint32 data_size; |
| 7187 if (!GLES2Util::ComputeImageDataSize( | 7177 if (!GLES2Util::ComputeImageDataSizes( |
| 7188 width, height, format, type, unpack_alignment_, &data_size)) { | 7178 width, height, format, type, unpack_alignment_, &data_size, NULL, NULL)) { |
| 7189 return error::kOutOfBounds; | 7179 return error::kOutOfBounds; |
| 7190 } | 7180 } |
| 7191 const void* pixels = GetImmediateDataAs<const void*>( | 7181 const void* pixels = GetImmediateDataAs<const void*>( |
| 7192 c, data_size, immediate_data_size); | 7182 c, data_size, immediate_data_size); |
| 7193 if (!validators_->texture_target.IsValid(target)) { | 7183 if (!validators_->texture_target.IsValid(target)) { |
| 7194 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: target GL_INVALID_ENUM"); | 7184 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: target GL_INVALID_ENUM"); |
| 7195 return error::kNoError; | 7185 return error::kNoError; |
| 7196 } | 7186 } |
| 7197 if (width < 0) { | 7187 if (width < 0) { |
| 7198 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: width < 0"); | 7188 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: width < 0"); |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8316 } | 8306 } |
| 8317 } | 8307 } |
| 8318 | 8308 |
| 8319 // Include the auto-generated part of this file. We split this because it means | 8309 // Include the auto-generated part of this file. We split this because it means |
| 8320 // we can easily edit the non-auto generated parts right here in this file | 8310 // we can easily edit the non-auto generated parts right here in this file |
| 8321 // instead of having to edit some template or the code generator. | 8311 // instead of having to edit some template or the code generator. |
| 8322 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 8312 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 8323 | 8313 |
| 8324 } // namespace gles2 | 8314 } // namespace gles2 |
| 8325 } // namespace gpu | 8315 } // namespace gpu |
| OLD | NEW |