Chromium Code Reviews| 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 839 uint32_t immediate_data_size, | 839 uint32_t immediate_data_size, |
| 840 const volatile void* cmd_data) { | 840 const volatile void* cmd_data) { |
| 841 const volatile gles2::cmds::ReadPixels& c = | 841 const volatile gles2::cmds::ReadPixels& c = |
| 842 *static_cast<const volatile gles2::cmds::ReadPixels*>(cmd_data); | 842 *static_cast<const volatile gles2::cmds::ReadPixels*>(cmd_data); |
| 843 GLint x = static_cast<GLint>(c.x); | 843 GLint x = static_cast<GLint>(c.x); |
| 844 GLint y = static_cast<GLint>(c.y); | 844 GLint y = static_cast<GLint>(c.y); |
| 845 GLsizei width = static_cast<GLsizei>(c.width); | 845 GLsizei width = static_cast<GLsizei>(c.width); |
| 846 GLsizei height = static_cast<GLsizei>(c.height); | 846 GLsizei height = static_cast<GLsizei>(c.height); |
| 847 GLenum format = static_cast<GLenum>(c.format); | 847 GLenum format = static_cast<GLenum>(c.format); |
| 848 GLenum type = static_cast<GLenum>(c.type); | 848 GLenum type = static_cast<GLenum>(c.type); |
| 849 uint32_t pixels_shm_id = c.pixels_shm_id; | |
| 850 uint32_t pixels_shm_offset = c.pixels_shm_offset; | |
| 849 | 851 |
| 850 uint8_t* pixels = nullptr; | 852 uint8_t* pixels = nullptr; |
| 851 unsigned int buffer_size = 0; | 853 unsigned int buffer_size = 0; |
| 852 if (c.pixels_shm_id != 0) { | 854 if (c.pixels_shm_id != 0) { |
| 853 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( | 855 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( |
| 854 c.pixels_shm_id, c.pixels_shm_offset, 0, &buffer_size); | 856 pixels_shm_id, pixels_shm_offset, 0, &buffer_size); |
| 855 if (!pixels) { | 857 if (!pixels) { |
| 856 return error::kOutOfBounds; | 858 return error::kOutOfBounds; |
| 857 } | 859 } |
| 860 } else { | |
| 861 pixels = | |
| 862 reinterpret_cast<uint8_t*>(static_cast<intptr_t>(pixels_shm_offset)); | |
| 858 } | 863 } |
| 859 | 864 |
| 860 GLsizei bufsize = buffer_size; | 865 GLsizei bufsize = buffer_size; |
| 861 GLsizei length = 0; | 866 GLsizei length = 0; |
| 862 GLsizei columns = 0; | 867 GLsizei columns = 0; |
| 863 GLsizei rows = 0; | 868 GLsizei rows = 0; |
| 864 int32_t success = 0; | 869 int32_t success = 0; |
| 865 error::Error error = DoReadPixels(x, y, width, height, format, type, bufsize, | 870 error::Error error = DoReadPixels(x, y, width, height, format, type, bufsize, |
| 866 &length, &columns, &rows, pixels, &success); | 871 &length, &columns, &rows, pixels, &success); |
| 867 if (error != error::kNoError) { | 872 if (error != error::kNoError) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 933 GLsizei height = static_cast<GLsizei>(c.height); | 938 GLsizei height = static_cast<GLsizei>(c.height); |
| 934 GLint border = static_cast<GLint>(c.border); | 939 GLint border = static_cast<GLint>(c.border); |
| 935 GLenum format = static_cast<GLenum>(c.format); | 940 GLenum format = static_cast<GLenum>(c.format); |
| 936 GLenum type = static_cast<GLenum>(c.type); | 941 GLenum type = static_cast<GLenum>(c.type); |
| 937 uint32_t pixels_shm_id = c.pixels_shm_id; | 942 uint32_t pixels_shm_id = c.pixels_shm_id; |
| 938 uint32_t pixels_shm_offset = c.pixels_shm_offset; | 943 uint32_t pixels_shm_offset = c.pixels_shm_offset; |
| 939 | 944 |
| 940 unsigned int buffer_size = 0; | 945 unsigned int buffer_size = 0; |
| 941 const void* pixels = nullptr; | 946 const void* pixels = nullptr; |
| 942 | 947 |
| 943 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { | 948 if (pixels_shm_id != 0) { |
| 944 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( | 949 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( |
| 945 pixels_shm_id, pixels_shm_offset, 0, &buffer_size); | 950 pixels_shm_id, pixels_shm_offset, 0, &buffer_size); |
| 946 if (!pixels) { | 951 if (!pixels) { |
| 947 return error::kOutOfBounds; | 952 return error::kOutOfBounds; |
| 948 } | 953 } |
| 954 } else { | |
| 955 pixels = | |
| 956 reinterpret_cast<const void*>(static_cast<intptr_t>(pixels_shm_offset)); | |
| 949 } | 957 } |
| 950 | 958 |
| 951 error::Error error = | 959 return DoTexImage2D(target, level, internal_format, width, height, border, |
| 952 DoTexImage2D(target, level, internal_format, width, height, border, | 960 format, type, buffer_size, pixels); |
| 953 format, type, buffer_size, pixels); | |
| 954 if (error != error::kNoError) { | |
| 955 return error; | |
| 956 } | |
| 957 | |
| 958 return error::kNoError; | |
| 959 } | 961 } |
| 960 | 962 |
| 961 error::Error GLES2DecoderPassthroughImpl::HandleTexImage3D( | 963 error::Error GLES2DecoderPassthroughImpl::HandleTexImage3D( |
| 962 uint32_t immediate_data_size, | 964 uint32_t immediate_data_size, |
| 963 const volatile void* cmd_data) { | 965 const volatile void* cmd_data) { |
| 964 const volatile gles2::cmds::TexImage3D& c = | 966 const volatile gles2::cmds::TexImage3D& c = |
| 965 *static_cast<const volatile gles2::cmds::TexImage3D*>(cmd_data); | 967 *static_cast<const volatile gles2::cmds::TexImage3D*>(cmd_data); |
| 966 GLenum target = static_cast<GLenum>(c.target); | 968 GLenum target = static_cast<GLenum>(c.target); |
| 967 GLint level = static_cast<GLint>(c.level); | 969 GLint level = static_cast<GLint>(c.level); |
| 968 GLint internal_format = static_cast<GLint>(c.internalformat); | 970 GLint internal_format = static_cast<GLint>(c.internalformat); |
| 969 GLsizei width = static_cast<GLsizei>(c.width); | 971 GLsizei width = static_cast<GLsizei>(c.width); |
| 970 GLsizei height = static_cast<GLsizei>(c.height); | 972 GLsizei height = static_cast<GLsizei>(c.height); |
| 971 GLsizei depth = static_cast<GLsizei>(c.depth); | 973 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 972 GLint border = static_cast<GLint>(c.border); | 974 GLint border = static_cast<GLint>(c.border); |
| 973 GLenum format = static_cast<GLenum>(c.format); | 975 GLenum format = static_cast<GLenum>(c.format); |
| 974 GLenum type = static_cast<GLenum>(c.type); | 976 GLenum type = static_cast<GLenum>(c.type); |
| 975 uint32_t pixels_shm_id = c.pixels_shm_id; | 977 uint32_t pixels_shm_id = c.pixels_shm_id; |
| 976 uint32_t pixels_shm_offset = c.pixels_shm_offset; | 978 uint32_t pixels_shm_offset = c.pixels_shm_offset; |
| 977 | 979 |
| 978 unsigned int buffer_size = 0; | 980 unsigned int buffer_size = 0; |
| 979 const void* pixels = nullptr; | 981 const void* pixels = nullptr; |
| 980 | 982 |
| 981 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { | 983 if (pixels_shm_id != 0) { |
| 982 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( | 984 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( |
| 983 pixels_shm_id, pixels_shm_offset, 0, &buffer_size); | 985 pixels_shm_id, pixels_shm_offset, 0, &buffer_size); |
| 984 if (!pixels) { | 986 if (!pixels) { |
| 985 return error::kOutOfBounds; | 987 return error::kOutOfBounds; |
| 986 } | 988 } |
| 989 } else { | |
| 990 pixels = | |
| 991 reinterpret_cast<const void*>(static_cast<intptr_t>(pixels_shm_offset)); | |
| 987 } | 992 } |
| 988 | 993 |
| 989 error::Error error = | 994 return DoTexImage3D(target, level, internal_format, width, height, depth, |
| 990 DoTexImage3D(target, level, internal_format, width, height, depth, border, | 995 border, format, type, buffer_size, pixels); |
| 991 format, type, buffer_size, pixels); | |
| 992 if (error != error::kNoError) { | |
| 993 return error; | |
| 994 } | |
| 995 | |
| 996 return error::kNoError; | |
| 997 } | 996 } |
| 998 | 997 |
| 999 error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage2D( | 998 error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage2D( |
| 1000 uint32_t immediate_data_size, | 999 uint32_t immediate_data_size, |
| 1001 const volatile void* cmd_data) { | 1000 const volatile void* cmd_data) { |
| 1002 const volatile gles2::cmds::TexSubImage2D& c = | 1001 const volatile gles2::cmds::TexSubImage2D& c = |
| 1003 *static_cast<const volatile gles2::cmds::TexSubImage2D*>(cmd_data); | 1002 *static_cast<const volatile gles2::cmds::TexSubImage2D*>(cmd_data); |
| 1004 GLenum target = static_cast<GLenum>(c.target); | 1003 GLenum target = static_cast<GLenum>(c.target); |
| 1005 GLint level = static_cast<GLint>(c.level); | 1004 GLint level = static_cast<GLint>(c.level); |
| 1006 GLint xoffset = static_cast<GLint>(c.xoffset); | 1005 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 1007 GLint yoffset = static_cast<GLint>(c.yoffset); | 1006 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 1008 GLsizei width = static_cast<GLsizei>(c.width); | 1007 GLsizei width = static_cast<GLsizei>(c.width); |
| 1009 GLsizei height = static_cast<GLsizei>(c.height); | 1008 GLsizei height = static_cast<GLsizei>(c.height); |
| 1010 GLenum format = static_cast<GLenum>(c.format); | 1009 GLenum format = static_cast<GLenum>(c.format); |
| 1011 GLenum type = static_cast<GLenum>(c.type); | 1010 GLenum type = static_cast<GLenum>(c.type); |
| 1012 uint32_t pixels_shm_id = c.pixels_shm_id; | 1011 uint32_t pixels_shm_id = c.pixels_shm_id; |
| 1013 uint32_t pixels_shm_offset = c.pixels_shm_offset; | 1012 uint32_t pixels_shm_offset = c.pixels_shm_offset; |
| 1014 | 1013 |
| 1015 unsigned int buffer_size = 0; | 1014 unsigned int buffer_size = 0; |
| 1016 const void* pixels = nullptr; | 1015 const void* pixels = nullptr; |
| 1017 | 1016 |
| 1018 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { | 1017 if (pixels_shm_id != 0) { |
| 1019 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( | 1018 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( |
| 1020 pixels_shm_id, pixels_shm_offset, 0, &buffer_size); | 1019 pixels_shm_id, pixels_shm_offset, 0, &buffer_size); |
| 1021 if (!pixels) { | 1020 if (!pixels) { |
| 1022 return error::kOutOfBounds; | 1021 return error::kOutOfBounds; |
| 1023 } | 1022 } |
| 1023 } else { | |
| 1024 pixels = | |
| 1025 reinterpret_cast<const void*>(static_cast<intptr_t>(pixels_shm_offset)); | |
| 1024 } | 1026 } |
| 1025 | 1027 |
| 1026 error::Error error = | 1028 return DoTexSubImage2D(target, level, xoffset, yoffset, width, height, format, |
| 1027 DoTexSubImage2D(target, level, xoffset, yoffset, width, height, format, | 1029 type, buffer_size, pixels); |
| 1028 type, buffer_size, pixels); | |
| 1029 if (error != error::kNoError) { | |
| 1030 return error; | |
| 1031 } | |
| 1032 | |
| 1033 return error::kNoError; | |
| 1034 } | 1030 } |
| 1035 | 1031 |
| 1036 error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage3D( | 1032 error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage3D( |
| 1037 uint32_t immediate_data_size, | 1033 uint32_t immediate_data_size, |
| 1038 const volatile void* cmd_data) { | 1034 const volatile void* cmd_data) { |
| 1039 const volatile gles2::cmds::TexSubImage3D& c = | 1035 const volatile gles2::cmds::TexSubImage3D& c = |
| 1040 *static_cast<const volatile gles2::cmds::TexSubImage3D*>(cmd_data); | 1036 *static_cast<const volatile gles2::cmds::TexSubImage3D*>(cmd_data); |
| 1041 GLenum target = static_cast<GLenum>(c.target); | 1037 GLenum target = static_cast<GLenum>(c.target); |
| 1042 GLint level = static_cast<GLint>(c.level); | 1038 GLint level = static_cast<GLint>(c.level); |
| 1043 GLint xoffset = static_cast<GLint>(c.xoffset); | 1039 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 1044 GLint yoffset = static_cast<GLint>(c.yoffset); | 1040 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 1045 GLint zoffset = static_cast<GLint>(c.zoffset); | 1041 GLint zoffset = static_cast<GLint>(c.zoffset); |
| 1046 GLsizei width = static_cast<GLsizei>(c.width); | 1042 GLsizei width = static_cast<GLsizei>(c.width); |
| 1047 GLsizei height = static_cast<GLsizei>(c.height); | 1043 GLsizei height = static_cast<GLsizei>(c.height); |
| 1048 GLsizei depth = static_cast<GLsizei>(c.depth); | 1044 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 1049 GLenum format = static_cast<GLenum>(c.format); | 1045 GLenum format = static_cast<GLenum>(c.format); |
| 1050 GLenum type = static_cast<GLenum>(c.type); | 1046 GLenum type = static_cast<GLenum>(c.type); |
| 1051 uint32_t pixels_shm_id = c.pixels_shm_id; | 1047 uint32_t pixels_shm_id = c.pixels_shm_id; |
| 1052 uint32_t pixels_shm_offset = c.pixels_shm_offset; | 1048 uint32_t pixels_shm_offset = c.pixels_shm_offset; |
| 1053 | 1049 |
| 1054 unsigned int buffer_size = 0; | 1050 unsigned int buffer_size = 0; |
| 1055 const void* pixels = nullptr; | 1051 const void* pixels = nullptr; |
| 1056 | 1052 |
| 1057 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { | 1053 if (pixels_shm_id != 0) { |
| 1058 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( | 1054 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( |
| 1059 pixels_shm_id, pixels_shm_offset, 0, &buffer_size); | 1055 pixels_shm_id, pixels_shm_offset, 0, &buffer_size); |
| 1060 if (!pixels) { | 1056 if (!pixels) { |
| 1061 return error::kOutOfBounds; | 1057 return error::kOutOfBounds; |
| 1062 } | 1058 } |
| 1059 } else { | |
| 1060 pixels = | |
| 1061 reinterpret_cast<const void*>(static_cast<intptr_t>(pixels_shm_offset)); | |
| 1063 } | 1062 } |
| 1064 | 1063 |
| 1065 error::Error error = | 1064 return DoTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, |
| 1066 DoTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, | 1065 height, depth, format, type, buffer_size, pixels); |
| 1067 depth, format, type, buffer_size, pixels); | |
| 1068 if (error != error::kNoError) { | |
| 1069 return error; | |
| 1070 } | |
| 1071 | |
| 1072 return error::kNoError; | |
| 1073 } | 1066 } |
| 1074 | 1067 |
| 1075 error::Error GLES2DecoderPassthroughImpl::HandleUniformBlockBinding( | 1068 error::Error GLES2DecoderPassthroughImpl::HandleUniformBlockBinding( |
| 1076 uint32_t immediate_data_size, | 1069 uint32_t immediate_data_size, |
| 1077 const volatile void* cmd_data) { | 1070 const volatile void* cmd_data) { |
| 1078 const volatile gles2::cmds::UniformBlockBinding& c = | 1071 const volatile gles2::cmds::UniformBlockBinding& c = |
| 1079 *static_cast<const volatile gles2::cmds::UniformBlockBinding*>(cmd_data); | 1072 *static_cast<const volatile gles2::cmds::UniformBlockBinding*>(cmd_data); |
| 1080 GLuint program = static_cast<GLuint>(c.program); | 1073 GLuint program = static_cast<GLuint>(c.program); |
| 1081 GLuint index = static_cast<GLuint>(c.index); | 1074 GLuint index = static_cast<GLuint>(c.index); |
| 1082 GLuint binding = static_cast<GLuint>(c.binding); | 1075 GLuint binding = static_cast<GLuint>(c.binding); |
| (...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2511 GLsizei width = static_cast<GLsizei>(c.width); | 2504 GLsizei width = static_cast<GLsizei>(c.width); |
| 2512 GLsizei height = static_cast<GLsizei>(c.height); | 2505 GLsizei height = static_cast<GLsizei>(c.height); |
| 2513 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); | 2506 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); |
| 2514 GLint border = static_cast<GLint>(c.border); | 2507 GLint border = static_cast<GLint>(c.border); |
| 2515 Bucket* bucket = GetBucket(bucket_id); | 2508 Bucket* bucket = GetBucket(bucket_id); |
| 2516 if (!bucket) | 2509 if (!bucket) |
| 2517 return error::kInvalidArguments; | 2510 return error::kInvalidArguments; |
| 2518 uint32_t image_size = bucket->size(); | 2511 uint32_t image_size = bucket->size(); |
| 2519 const void* data = bucket->GetData(0, image_size); | 2512 const void* data = bucket->GetData(0, image_size); |
| 2520 DCHECK(data || !image_size); | 2513 DCHECK(data || !image_size); |
| 2521 return DoCompressedTexImage2D( | 2514 return DoCompressedTexImage2D(target, level, internal_format, width, height, |
| 2522 target, level, internal_format, width, height, border, image_size, data); | 2515 border, image_size, image_size, data); |
| 2523 } | 2516 } |
| 2524 | 2517 |
| 2525 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage2D( | 2518 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage2D( |
| 2526 uint32_t immediate_data_size, const volatile void* cmd_data) { | 2519 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2527 const volatile gles2::cmds::CompressedTexImage2D& c = | 2520 const volatile gles2::cmds::CompressedTexImage2D& c = |
| 2528 *static_cast<const volatile gles2::cmds::CompressedTexImage2D*>(cmd_data); | 2521 *static_cast<const volatile gles2::cmds::CompressedTexImage2D*>(cmd_data); |
| 2529 GLenum target = static_cast<GLenum>(c.target); | 2522 GLenum target = static_cast<GLenum>(c.target); |
| 2530 GLint level = static_cast<GLint>(c.level); | 2523 GLint level = static_cast<GLint>(c.level); |
| 2531 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 2524 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 2532 GLsizei width = static_cast<GLsizei>(c.width); | 2525 GLsizei width = static_cast<GLsizei>(c.width); |
| 2533 GLsizei height = static_cast<GLsizei>(c.height); | 2526 GLsizei height = static_cast<GLsizei>(c.height); |
| 2534 GLint border = static_cast<GLint>(c.border); | 2527 GLint border = static_cast<GLint>(c.border); |
| 2535 GLsizei image_size = static_cast<GLsizei>(c.imageSize); | 2528 GLsizei image_size = static_cast<GLsizei>(c.imageSize); |
| 2536 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. | 2529 uint32_t data_shm_id = c.data_shm_id; |
| 2537 const void* data = GetSharedMemoryAs<const void*>( | 2530 uint32_t data_shm_offset = c.data_shm_offset; |
| 2538 c.data_shm_id, c.data_shm_offset, image_size); | 2531 |
| 2539 return DoCompressedTexImage2D( | 2532 unsigned int data_size = 0; |
|
Zhenyao Mo
2017/04/11 19:56:54
nit: use GLsizei to be consistent.
Corentin Wallez
2017/04/11 22:06:34
data_size has to be unsigned because GetSharedMemo
| |
| 2540 target, level, internal_format, width, height, border, image_size, data); | 2533 const void* data = nullptr; |
| 2534 if (data_shm_id != 0) { | |
| 2535 data = GetSharedMemoryAndSizeAs<const void*>(data_shm_id, data_shm_offset, | |
| 2536 image_size, &data_size); | |
| 2537 if (data == nullptr) { | |
| 2538 return error::kOutOfBounds; | |
| 2539 } | |
| 2540 } else { | |
| 2541 data = | |
| 2542 reinterpret_cast<const void*>(static_cast<intptr_t>(data_shm_offset)); | |
| 2543 } | |
| 2544 | |
| 2545 return DoCompressedTexImage2D(target, level, internal_format, width, height, | |
| 2546 border, image_size, data_size, data); | |
| 2541 } | 2547 } |
| 2542 | 2548 |
| 2543 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage2DBucket( | 2549 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage2DBucket( |
| 2544 uint32_t immediate_data_size, const volatile void* cmd_data) { | 2550 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2545 const volatile gles2::cmds::CompressedTexSubImage2DBucket& c = | 2551 const volatile gles2::cmds::CompressedTexSubImage2DBucket& c = |
| 2546 *static_cast<const volatile gles2::cmds::CompressedTexSubImage2DBucket*>( | 2552 *static_cast<const volatile gles2::cmds::CompressedTexSubImage2DBucket*>( |
| 2547 cmd_data); | 2553 cmd_data); |
| 2548 GLenum target = static_cast<GLenum>(c.target); | 2554 GLenum target = static_cast<GLenum>(c.target); |
| 2549 GLint level = static_cast<GLint>(c.level); | 2555 GLint level = static_cast<GLint>(c.level); |
| 2550 GLint xoffset = static_cast<GLint>(c.xoffset); | 2556 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 2551 GLint yoffset = static_cast<GLint>(c.yoffset); | 2557 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 2552 GLsizei width = static_cast<GLsizei>(c.width); | 2558 GLsizei width = static_cast<GLsizei>(c.width); |
| 2553 GLsizei height = static_cast<GLsizei>(c.height); | 2559 GLsizei height = static_cast<GLsizei>(c.height); |
| 2554 GLenum format = static_cast<GLenum>(c.format); | 2560 GLenum format = static_cast<GLenum>(c.format); |
| 2555 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); | 2561 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); |
| 2556 Bucket* bucket = GetBucket(bucket_id); | 2562 Bucket* bucket = GetBucket(bucket_id); |
| 2557 if (!bucket) | 2563 if (!bucket) |
| 2558 return error::kInvalidArguments; | 2564 return error::kInvalidArguments; |
| 2559 uint32_t image_size = bucket->size(); | 2565 uint32_t image_size = bucket->size(); |
| 2560 const void* data = bucket->GetData(0, image_size); | 2566 const void* data = bucket->GetData(0, image_size); |
| 2561 DCHECK(data || !image_size); | 2567 DCHECK(data || !image_size); |
| 2562 return DoCompressedTexSubImage2D( | 2568 return DoCompressedTexSubImage2D(target, level, xoffset, yoffset, width, |
| 2563 target, level, xoffset, yoffset, width, height, format, image_size, data); | 2569 height, format, image_size, image_size, |
| 2570 data); | |
| 2564 } | 2571 } |
| 2565 | 2572 |
| 2566 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage2D( | 2573 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage2D( |
| 2567 uint32_t immediate_data_size, const volatile void* cmd_data) { | 2574 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2568 const volatile gles2::cmds::CompressedTexSubImage2D& c = | 2575 const volatile gles2::cmds::CompressedTexSubImage2D& c = |
| 2569 *static_cast<const volatile gles2::cmds::CompressedTexSubImage2D*>( | 2576 *static_cast<const volatile gles2::cmds::CompressedTexSubImage2D*>( |
| 2570 cmd_data); | 2577 cmd_data); |
| 2571 GLenum target = static_cast<GLenum>(c.target); | 2578 GLenum target = static_cast<GLenum>(c.target); |
| 2572 GLint level = static_cast<GLint>(c.level); | 2579 GLint level = static_cast<GLint>(c.level); |
| 2573 GLint xoffset = static_cast<GLint>(c.xoffset); | 2580 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 2574 GLint yoffset = static_cast<GLint>(c.yoffset); | 2581 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 2575 GLsizei width = static_cast<GLsizei>(c.width); | 2582 GLsizei width = static_cast<GLsizei>(c.width); |
| 2576 GLsizei height = static_cast<GLsizei>(c.height); | 2583 GLsizei height = static_cast<GLsizei>(c.height); |
| 2577 GLenum format = static_cast<GLenum>(c.format); | 2584 GLenum format = static_cast<GLenum>(c.format); |
| 2578 GLsizei image_size = static_cast<GLsizei>(c.imageSize); | 2585 GLsizei image_size = static_cast<GLsizei>(c.imageSize); |
| 2579 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. | 2586 uint32_t data_shm_id = c.data_shm_id; |
| 2580 const void* data = GetSharedMemoryAs<const void*>( | 2587 uint32_t data_shm_offset = c.data_shm_offset; |
| 2581 c.data_shm_id, c.data_shm_offset, image_size); | 2588 |
| 2582 return DoCompressedTexSubImage2D( | 2589 unsigned int data_size = 0; |
|
Zhenyao Mo
2017/04/11 19:56:54
nit: use GLsizei.
Corentin Wallez
2017/04/11 22:06:34
See comment above
| |
| 2583 target, level, xoffset, yoffset, width, height, format, image_size, data); | 2590 const void* data = nullptr; |
| 2591 if (data_shm_id != 0) { | |
| 2592 data = GetSharedMemoryAndSizeAs<const void*>(data_shm_id, data_shm_offset, | |
| 2593 image_size, &data_size); | |
| 2594 if (data == nullptr) { | |
| 2595 return error::kOutOfBounds; | |
| 2596 } | |
| 2597 } else { | |
| 2598 data = | |
| 2599 reinterpret_cast<const void*>(static_cast<intptr_t>(data_shm_offset)); | |
| 2600 } | |
| 2601 | |
| 2602 return DoCompressedTexSubImage2D(target, level, xoffset, yoffset, width, | |
| 2603 height, format, image_size, data_size, data); | |
| 2584 } | 2604 } |
| 2585 | 2605 |
| 2586 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage3DBucket( | 2606 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage3DBucket( |
| 2587 uint32_t immediate_data_size, const volatile void* cmd_data) { | 2607 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2588 const volatile gles2::cmds::CompressedTexImage3DBucket& c = | 2608 const volatile gles2::cmds::CompressedTexImage3DBucket& c = |
| 2589 *static_cast<const volatile gles2::cmds::CompressedTexImage3DBucket*>( | 2609 *static_cast<const volatile gles2::cmds::CompressedTexImage3DBucket*>( |
| 2590 cmd_data); | 2610 cmd_data); |
| 2591 GLenum target = static_cast<GLenum>(c.target); | 2611 GLenum target = static_cast<GLenum>(c.target); |
| 2592 GLint level = static_cast<GLint>(c.level); | 2612 GLint level = static_cast<GLint>(c.level); |
| 2593 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 2613 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 2594 GLsizei width = static_cast<GLsizei>(c.width); | 2614 GLsizei width = static_cast<GLsizei>(c.width); |
| 2595 GLsizei height = static_cast<GLsizei>(c.height); | 2615 GLsizei height = static_cast<GLsizei>(c.height); |
| 2596 GLsizei depth = static_cast<GLsizei>(c.depth); | 2616 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 2597 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); | 2617 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); |
| 2598 GLint border = static_cast<GLint>(c.border); | 2618 GLint border = static_cast<GLint>(c.border); |
| 2599 Bucket* bucket = GetBucket(bucket_id); | 2619 Bucket* bucket = GetBucket(bucket_id); |
| 2600 if (!bucket) | 2620 if (!bucket) |
| 2601 return error::kInvalidArguments; | 2621 return error::kInvalidArguments; |
| 2602 GLsizei image_size = bucket->size(); | 2622 GLsizei image_size = bucket->size(); |
| 2603 const void* data = bucket->GetData(0, image_size); | 2623 const void* data = bucket->GetData(0, image_size); |
| 2604 DCHECK(data || !image_size); | 2624 DCHECK(data || !image_size); |
| 2605 return DoCompressedTexImage3D(target, level, internal_format, width, height, | 2625 return DoCompressedTexImage3D(target, level, internal_format, width, height, |
| 2606 depth, border, image_size, data); | 2626 depth, border, image_size, image_size, data); |
| 2607 } | 2627 } |
| 2608 | 2628 |
| 2609 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage3D( | 2629 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage3D( |
| 2610 uint32_t immediate_data_size, const volatile void* cmd_data) { | 2630 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2611 const volatile gles2::cmds::CompressedTexImage3D& c = | 2631 const volatile gles2::cmds::CompressedTexImage3D& c = |
| 2612 *static_cast<const volatile gles2::cmds::CompressedTexImage3D*>(cmd_data); | 2632 *static_cast<const volatile gles2::cmds::CompressedTexImage3D*>(cmd_data); |
| 2613 GLenum target = static_cast<GLenum>(c.target); | 2633 GLenum target = static_cast<GLenum>(c.target); |
| 2614 GLint level = static_cast<GLint>(c.level); | 2634 GLint level = static_cast<GLint>(c.level); |
| 2615 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 2635 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 2616 GLsizei width = static_cast<GLsizei>(c.width); | 2636 GLsizei width = static_cast<GLsizei>(c.width); |
| 2617 GLsizei height = static_cast<GLsizei>(c.height); | 2637 GLsizei height = static_cast<GLsizei>(c.height); |
| 2618 GLsizei depth = static_cast<GLsizei>(c.depth); | 2638 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 2619 GLint border = static_cast<GLint>(c.border); | 2639 GLint border = static_cast<GLint>(c.border); |
| 2620 GLsizei image_size = static_cast<GLsizei>(c.imageSize); | 2640 GLsizei image_size = static_cast<GLsizei>(c.imageSize); |
| 2621 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. | 2641 uint32_t data_shm_id = c.data_shm_id; |
| 2622 const void* data = GetSharedMemoryAs<const void*>( | 2642 uint32_t data_shm_offset = c.data_shm_offset; |
| 2623 c.data_shm_id, c.data_shm_offset, image_size); | 2643 |
| 2644 unsigned int data_size = 0; | |
|
Zhenyao Mo
2017/04/11 19:56:54
nit: use GLsizei.
Corentin Wallez
2017/04/11 22:06:34
See comment above
| |
| 2645 const void* data = nullptr; | |
| 2646 if (data_shm_id != 0) { | |
| 2647 data = GetSharedMemoryAndSizeAs<const void*>(data_shm_id, data_shm_offset, | |
| 2648 image_size, &data_size); | |
| 2649 if (data == nullptr) { | |
| 2650 return error::kOutOfBounds; | |
| 2651 } | |
| 2652 } else { | |
| 2653 data = | |
| 2654 reinterpret_cast<const void*>(static_cast<intptr_t>(data_shm_offset)); | |
| 2655 } | |
| 2656 | |
| 2624 return DoCompressedTexImage3D(target, level, internal_format, width, height, | 2657 return DoCompressedTexImage3D(target, level, internal_format, width, height, |
| 2625 depth, border, image_size, data); | 2658 depth, border, image_size, data_size, data); |
| 2626 } | 2659 } |
| 2627 | 2660 |
| 2628 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage3DBucket( | 2661 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage3DBucket( |
| 2629 uint32_t immediate_data_size, const volatile void* cmd_data) { | 2662 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2630 const volatile gles2::cmds::CompressedTexSubImage3DBucket& c = | 2663 const volatile gles2::cmds::CompressedTexSubImage3DBucket& c = |
| 2631 *static_cast<const volatile gles2::cmds::CompressedTexSubImage3DBucket*>( | 2664 *static_cast<const volatile gles2::cmds::CompressedTexSubImage3DBucket*>( |
| 2632 cmd_data); | 2665 cmd_data); |
| 2633 GLenum target = static_cast<GLenum>(c.target); | 2666 GLenum target = static_cast<GLenum>(c.target); |
| 2634 GLint level = static_cast<GLint>(c.level); | 2667 GLint level = static_cast<GLint>(c.level); |
| 2635 GLint xoffset = static_cast<GLint>(c.xoffset); | 2668 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 2636 GLint yoffset = static_cast<GLint>(c.yoffset); | 2669 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 2637 GLint zoffset = static_cast<GLint>(c.zoffset); | 2670 GLint zoffset = static_cast<GLint>(c.zoffset); |
| 2638 GLsizei width = static_cast<GLsizei>(c.width); | 2671 GLsizei width = static_cast<GLsizei>(c.width); |
| 2639 GLsizei height = static_cast<GLsizei>(c.height); | 2672 GLsizei height = static_cast<GLsizei>(c.height); |
| 2640 GLsizei depth = static_cast<GLsizei>(c.depth); | 2673 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 2641 GLenum format = static_cast<GLenum>(c.format); | 2674 GLenum format = static_cast<GLenum>(c.format); |
| 2642 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); | 2675 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); |
| 2643 Bucket* bucket = GetBucket(bucket_id); | 2676 Bucket* bucket = GetBucket(bucket_id); |
| 2644 if (!bucket) | 2677 if (!bucket) |
| 2645 return error::kInvalidArguments; | 2678 return error::kInvalidArguments; |
| 2646 uint32_t image_size = bucket->size(); | 2679 uint32_t image_size = bucket->size(); |
| 2647 const void* data = bucket->GetData(0, image_size); | 2680 const void* data = bucket->GetData(0, image_size); |
| 2648 DCHECK(data || !image_size); | 2681 DCHECK(data || !image_size); |
| 2649 return DoCompressedTexSubImage3D( | 2682 return DoCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, |
| 2650 target, level, xoffset, yoffset, zoffset, width, height, depth, | 2683 width, height, depth, format, image_size, |
| 2651 format, image_size, data); | 2684 image_size, data); |
| 2652 } | 2685 } |
| 2653 | 2686 |
| 2654 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage3D( | 2687 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage3D( |
| 2655 uint32_t immediate_data_size, const volatile void* cmd_data) { | 2688 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2656 const volatile gles2::cmds::CompressedTexSubImage3D& c = | 2689 const volatile gles2::cmds::CompressedTexSubImage3D& c = |
| 2657 *static_cast<const volatile gles2::cmds::CompressedTexSubImage3D*>( | 2690 *static_cast<const volatile gles2::cmds::CompressedTexSubImage3D*>( |
| 2658 cmd_data); | 2691 cmd_data); |
| 2659 GLenum target = static_cast<GLenum>(c.target); | 2692 GLenum target = static_cast<GLenum>(c.target); |
| 2660 GLint level = static_cast<GLint>(c.level); | 2693 GLint level = static_cast<GLint>(c.level); |
| 2661 GLint xoffset = static_cast<GLint>(c.xoffset); | 2694 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 2662 GLint yoffset = static_cast<GLint>(c.yoffset); | 2695 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 2663 GLint zoffset = static_cast<GLint>(c.zoffset); | 2696 GLint zoffset = static_cast<GLint>(c.zoffset); |
| 2664 GLsizei width = static_cast<GLsizei>(c.width); | 2697 GLsizei width = static_cast<GLsizei>(c.width); |
| 2665 GLsizei height = static_cast<GLsizei>(c.height); | 2698 GLsizei height = static_cast<GLsizei>(c.height); |
| 2666 GLsizei depth = static_cast<GLsizei>(c.depth); | 2699 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 2667 GLenum format = static_cast<GLenum>(c.format); | 2700 GLenum format = static_cast<GLenum>(c.format); |
| 2668 GLsizei image_size = static_cast<GLsizei>(c.imageSize); | 2701 GLsizei image_size = static_cast<GLsizei>(c.imageSize); |
| 2669 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. | 2702 uint32_t data_shm_id = c.data_shm_id; |
| 2670 const void* data = GetSharedMemoryAs<const void*>( | 2703 uint32_t data_shm_offset = c.data_shm_offset; |
| 2671 c.data_shm_id, c.data_shm_offset, image_size); | 2704 |
| 2672 return DoCompressedTexSubImage3D( | 2705 unsigned int data_size = 0; |
|
Zhenyao Mo
2017/04/11 19:56:54
nit: use GLsizei.
Corentin Wallez
2017/04/11 22:06:34
See comment above
| |
| 2673 target, level, xoffset, yoffset, zoffset, width, height, depth, | 2706 const void* data = nullptr; |
| 2674 format, image_size, data); | 2707 if (data_shm_id != 0) { |
| 2708 data = GetSharedMemoryAndSizeAs<const void*>(data_shm_id, data_shm_offset, | |
| 2709 image_size, &data_size); | |
| 2710 if (data == nullptr) { | |
| 2711 return error::kOutOfBounds; | |
| 2712 } | |
| 2713 } else { | |
| 2714 data = | |
| 2715 reinterpret_cast<const void*>(static_cast<intptr_t>(data_shm_offset)); | |
| 2716 } | |
| 2717 | |
| 2718 return DoCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, | |
| 2719 width, height, depth, format, image_size, | |
| 2720 data_size, data); | |
| 2675 } | 2721 } |
| 2676 | 2722 |
| 2677 } // namespace gles2 | 2723 } // namespace gles2 |
| 2678 } // namespace gpu | 2724 } // namespace gpu |
| OLD | NEW |