| 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 12646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12657 } | 12657 } |
| 12658 | 12658 |
| 12659 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); | 12659 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); |
| 12660 GLenum read_type = GetBoundReadFrameBufferTextureType(); | 12660 GLenum read_type = GetBoundReadFrameBufferTextureType(); |
| 12661 if (!ValidateCopyTexFormat(func_name, internal_format, | 12661 if (!ValidateCopyTexFormat(func_name, internal_format, |
| 12662 read_format, read_type)) { | 12662 read_format, read_type)) { |
| 12663 return; | 12663 return; |
| 12664 } | 12664 } |
| 12665 | 12665 |
| 12666 uint32_t pixels_size = 0; | 12666 uint32_t pixels_size = 0; |
| 12667 GLenum format = TextureManager::ExtractFormatFromStorageFormat( | 12667 // TODO(piman): OpenGL ES 3.0.4 Section 3.8.5 specifies how to pick an |
| 12668 internal_format); | 12668 // effective internal format if internal_format is unsized, which is a fairly |
| 12669 // involved logic. For now, just make sure we pick something valid. |
| 12670 GLenum format = |
| 12671 TextureManager::ExtractFormatFromStorageFormat(internal_format); |
| 12669 GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format); | 12672 GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format); |
| 12673 if (!format || !type) { |
| 12674 LOCAL_SET_GL_ERROR( |
| 12675 GL_INVALID_OPERATION, |
| 12676 func_name, "Invalid unsized internal format."); |
| 12677 return; |
| 12678 } |
| 12679 |
| 12680 DCHECK(texture_manager()->ValidateTextureParameters( |
| 12681 GetErrorState(), func_name, true, format, type, internal_format, level)); |
| 12682 |
| 12670 // Only target image size is validated here. | 12683 // Only target image size is validated here. |
| 12671 if (!GLES2Util::ComputeImageDataSizes( | 12684 if (!GLES2Util::ComputeImageDataSizes( |
| 12672 width, height, 1, format, type, | 12685 width, height, 1, format, type, |
| 12673 state_.unpack_alignment, &pixels_size, NULL, NULL)) { | 12686 state_.unpack_alignment, &pixels_size, NULL, NULL)) { |
| 12674 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "dimensions too large"); | 12687 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "dimensions too large"); |
| 12675 return; | 12688 return; |
| 12676 } | 12689 } |
| 12677 | 12690 |
| 12678 if (!EnsureGPUMemoryAvailable(pixels_size)) { | 12691 if (!EnsureGPUMemoryAvailable(pixels_size)) { |
| 12679 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "out of memory"); | 12692 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "out of memory"); |
| (...skipping 4668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17348 } | 17361 } |
| 17349 | 17362 |
| 17350 // Include the auto-generated part of this file. We split this because it means | 17363 // Include the auto-generated part of this file. We split this because it means |
| 17351 // we can easily edit the non-auto generated parts right here in this file | 17364 // we can easily edit the non-auto generated parts right here in this file |
| 17352 // instead of having to edit some template or the code generator. | 17365 // instead of having to edit some template or the code generator. |
| 17353 #include "base/macros.h" | 17366 #include "base/macros.h" |
| 17354 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17367 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17355 | 17368 |
| 17356 } // namespace gles2 | 17369 } // namespace gles2 |
| 17357 } // namespace gpu | 17370 } // namespace gpu |
| OLD | NEW |