| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_passthrough.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
| 6 | 6 |
| 7 namespace gpu { | 7 namespace gpu { |
| 8 namespace gles2 { | 8 namespace gles2 { |
| 9 | 9 |
| 10 // Custom Handlers | 10 // Custom Handlers |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 if (c.pixels_shm_id != 0) { | 852 if (c.pixels_shm_id != 0) { |
| 853 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( | 853 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( |
| 854 c.pixels_shm_id, c.pixels_shm_offset, 0, &buffer_size); | 854 c.pixels_shm_id, c.pixels_shm_offset, 0, &buffer_size); |
| 855 if (!pixels) { | 855 if (!pixels) { |
| 856 return error::kOutOfBounds; | 856 return error::kOutOfBounds; |
| 857 } | 857 } |
| 858 } | 858 } |
| 859 | 859 |
| 860 GLsizei bufsize = buffer_size; | 860 GLsizei bufsize = buffer_size; |
| 861 GLsizei length = 0; | 861 GLsizei length = 0; |
| 862 GLsizei columns = 0; | |
| 863 GLsizei rows = 0; | |
| 864 int32_t success = 0; | 862 int32_t success = 0; |
| 865 error::Error error = DoReadPixels(x, y, width, height, format, type, bufsize, | 863 error::Error error = DoReadPixels(x, y, width, height, format, type, bufsize, |
| 866 &length, &columns, &rows, pixels, &success); | 864 &length, pixels, &success); |
| 867 if (error != error::kNoError) { | 865 if (error != error::kNoError) { |
| 868 return error; | 866 return error; |
| 869 } | 867 } |
| 870 if (length > bufsize) { | 868 if (length > bufsize) { |
| 871 return error::kOutOfBounds; | 869 return error::kOutOfBounds; |
| 872 } | 870 } |
| 873 | 871 |
| 874 typedef cmds::ReadPixels::Result Result; | 872 typedef cmds::ReadPixels::Result Result; |
| 875 Result* result = nullptr; | 873 Result* result = nullptr; |
| 876 if (c.result_shm_id != 0) { | 874 if (c.result_shm_id != 0) { |
| 877 result = GetSharedMemoryAs<Result*>(c.result_shm_id, c.result_shm_offset, | 875 result = GetSharedMemoryAs<Result*>(c.result_shm_id, c.result_shm_offset, |
| 878 sizeof(*result)); | 876 sizeof(*result)); |
| 879 if (!result) { | 877 if (!result) { |
| 880 return error::kOutOfBounds; | 878 return error::kOutOfBounds; |
| 881 } | 879 } |
| 882 if (result->success != 0) { | 880 if (result->success != 0) { |
| 883 return error::kInvalidArguments; | 881 return error::kInvalidArguments; |
| 884 } | 882 } |
| 885 } | 883 } |
| 886 | 884 |
| 887 if (result) { | 885 if (result) { |
| 888 result->success = success; | 886 result->success = success; |
| 889 result->row_length = static_cast<uint32_t>(columns); | 887 result->row_length = static_cast<uint32_t>(width); |
| 890 result->num_rows = static_cast<uint32_t>(rows); | 888 result->num_rows = static_cast<uint32_t>(height); |
| 891 } | 889 } |
| 892 | 890 |
| 893 return error::kNoError; | 891 return error::kNoError; |
| 894 } | 892 } |
| 895 | 893 |
| 896 error::Error GLES2DecoderPassthroughImpl::HandleShaderBinary( | 894 error::Error GLES2DecoderPassthroughImpl::HandleShaderBinary( |
| 897 uint32_t immediate_data_size, | 895 uint32_t immediate_data_size, |
| 898 const volatile void* cmd_data) { | 896 const volatile void* cmd_data) { |
| 899 const volatile gles2::cmds::ShaderBinary& c = | 897 const volatile gles2::cmds::ShaderBinary& c = |
| 900 *static_cast<const volatile gles2::cmds::ShaderBinary*>(cmd_data); | 898 *static_cast<const volatile gles2::cmds::ShaderBinary*>(cmd_data); |
| (...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2669 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. | 2667 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. |
| 2670 const void* data = GetSharedMemoryAs<const void*>( | 2668 const void* data = GetSharedMemoryAs<const void*>( |
| 2671 c.data_shm_id, c.data_shm_offset, image_size); | 2669 c.data_shm_id, c.data_shm_offset, image_size); |
| 2672 return DoCompressedTexSubImage3D( | 2670 return DoCompressedTexSubImage3D( |
| 2673 target, level, xoffset, yoffset, zoffset, width, height, depth, | 2671 target, level, xoffset, yoffset, zoffset, width, height, depth, |
| 2674 format, image_size, data); | 2672 format, image_size, data); |
| 2675 } | 2673 } |
| 2676 | 2674 |
| 2677 } // namespace gles2 | 2675 } // namespace gles2 |
| 2678 } // namespace gpu | 2676 } // namespace gpu |
| OLD | NEW |