Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(939)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers.cc

Issue 2587583002: gles2_cmd_decoder_passthrough: Handle Tex[Sub]Image[2/3]D with empty shm (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 const volatile gles2::cmds::TexImage2D& c = 919 const volatile gles2::cmds::TexImage2D& c =
920 *static_cast<const volatile gles2::cmds::TexImage2D*>(cmd_data); 920 *static_cast<const volatile gles2::cmds::TexImage2D*>(cmd_data);
921 GLenum target = static_cast<GLenum>(c.target); 921 GLenum target = static_cast<GLenum>(c.target);
922 GLint level = static_cast<GLint>(c.level); 922 GLint level = static_cast<GLint>(c.level);
923 GLint internal_format = static_cast<GLint>(c.internalformat); 923 GLint internal_format = static_cast<GLint>(c.internalformat);
924 GLsizei width = static_cast<GLsizei>(c.width); 924 GLsizei width = static_cast<GLsizei>(c.width);
925 GLsizei height = static_cast<GLsizei>(c.height); 925 GLsizei height = static_cast<GLsizei>(c.height);
926 GLint border = static_cast<GLint>(c.border); 926 GLint border = static_cast<GLint>(c.border);
927 GLenum format = static_cast<GLenum>(c.format); 927 GLenum format = static_cast<GLenum>(c.format);
928 GLenum type = static_cast<GLenum>(c.type); 928 GLenum type = static_cast<GLenum>(c.type);
929 uint32_t pixels_shm_id = c.pixels_shm_id;
930 uint32_t pixels_shm_offset = c.pixels_shm_offset;
929 931
930 GLsizei imagesize = 0; 932 unsigned int buffer_size = 0;
931 const void* pixels = NULL; 933 const void* pixels = nullptr;
932 if (c.pixels_shm_id != 0 || c.pixels_shm_offset != 0) { 934
933 unsigned int buffer_size = 0; 935 if (pixels_shm_id != 0 || pixels_shm_offset != 0) {
934 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( 936 pixels = GetSharedMemoryAndSizeAs<uint8_t*>(
935 c.pixels_shm_id, c.pixels_shm_offset, &buffer_size); 937 pixels_shm_id, pixels_shm_offset, &buffer_size);
936 if (!pixels) { 938 if (!pixels) {
937 return error::kOutOfBounds; 939 return error::kOutOfBounds;
938 } 940 }
939 imagesize = buffer_size;
940 } 941 }
941 942
942 error::Error error = 943 error::Error error =
943 DoTexImage2D(target, level, internal_format, width, height, border, 944 DoTexImage2D(target, level, internal_format, width, height, border,
944 format, type, imagesize, pixels); 945 format, type, buffer_size, pixels);
945 if (error != error::kNoError) { 946 if (error != error::kNoError) {
946 return error; 947 return error;
947 } 948 }
948 949
949 return error::kNoError; 950 return error::kNoError;
950 } 951 }
951 952
952 error::Error GLES2DecoderPassthroughImpl::HandleTexImage3D( 953 error::Error GLES2DecoderPassthroughImpl::HandleTexImage3D(
953 uint32_t immediate_data_size, 954 uint32_t immediate_data_size,
954 const volatile void* cmd_data) { 955 const volatile void* cmd_data) {
955 const volatile gles2::cmds::TexImage3D& c = 956 const volatile gles2::cmds::TexImage3D& c =
956 *static_cast<const volatile gles2::cmds::TexImage3D*>(cmd_data); 957 *static_cast<const volatile gles2::cmds::TexImage3D*>(cmd_data);
957 GLenum target = static_cast<GLenum>(c.target); 958 GLenum target = static_cast<GLenum>(c.target);
958 GLint level = static_cast<GLint>(c.level); 959 GLint level = static_cast<GLint>(c.level);
959 GLint internal_format = static_cast<GLint>(c.internalformat); 960 GLint internal_format = static_cast<GLint>(c.internalformat);
960 GLsizei width = static_cast<GLsizei>(c.width); 961 GLsizei width = static_cast<GLsizei>(c.width);
961 GLsizei height = static_cast<GLsizei>(c.height); 962 GLsizei height = static_cast<GLsizei>(c.height);
962 GLsizei depth = static_cast<GLsizei>(c.depth); 963 GLsizei depth = static_cast<GLsizei>(c.depth);
963 GLint border = static_cast<GLint>(c.border); 964 GLint border = static_cast<GLint>(c.border);
964 GLenum format = static_cast<GLenum>(c.format); 965 GLenum format = static_cast<GLenum>(c.format);
965 GLenum type = static_cast<GLenum>(c.type); 966 GLenum type = static_cast<GLenum>(c.type);
967 uint32_t pixels_shm_id = c.pixels_shm_id;
968 uint32_t pixels_shm_offset = c.pixels_shm_offset;
966 969
967 GLsizei imagesize = 0; 970 unsigned int buffer_size = 0;
968 const void* pixels = NULL; 971 const void* pixels = nullptr;
969 if (c.pixels_shm_id != 0 || c.pixels_shm_offset != 0) { 972
970 unsigned int buffer_size = 0; 973 if (pixels_shm_id != 0 || pixels_shm_offset != 0) {
971 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( 974 pixels = GetSharedMemoryAndSizeAs<uint8_t*>(
972 c.pixels_shm_id, c.pixels_shm_offset, &buffer_size); 975 pixels_shm_id, pixels_shm_offset, &buffer_size);
973 if (!pixels) { 976 if (!pixels) {
974 return error::kOutOfBounds; 977 return error::kOutOfBounds;
975 } 978 }
976 imagesize = buffer_size;
977 } 979 }
978 980
979 error::Error error = 981 error::Error error =
980 DoTexImage3D(target, level, internal_format, width, height, depth, border, 982 DoTexImage3D(target, level, internal_format, width, height, depth, border,
981 format, type, imagesize, pixels); 983 format, type, buffer_size, pixels);
982 if (error != error::kNoError) { 984 if (error != error::kNoError) {
983 return error; 985 return error;
984 } 986 }
985 987
986 return error::kNoError; 988 return error::kNoError;
987 } 989 }
988 990
989 error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage2D( 991 error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage2D(
990 uint32_t immediate_data_size, 992 uint32_t immediate_data_size,
991 const volatile void* cmd_data) { 993 const volatile void* cmd_data) {
992 const volatile gles2::cmds::TexSubImage2D& c = 994 const volatile gles2::cmds::TexSubImage2D& c =
993 *static_cast<const volatile gles2::cmds::TexSubImage2D*>(cmd_data); 995 *static_cast<const volatile gles2::cmds::TexSubImage2D*>(cmd_data);
994 GLenum target = static_cast<GLenum>(c.target); 996 GLenum target = static_cast<GLenum>(c.target);
995 GLint level = static_cast<GLint>(c.level); 997 GLint level = static_cast<GLint>(c.level);
996 GLint xoffset = static_cast<GLint>(c.xoffset); 998 GLint xoffset = static_cast<GLint>(c.xoffset);
997 GLint yoffset = static_cast<GLint>(c.yoffset); 999 GLint yoffset = static_cast<GLint>(c.yoffset);
998 GLsizei width = static_cast<GLsizei>(c.width); 1000 GLsizei width = static_cast<GLsizei>(c.width);
999 GLsizei height = static_cast<GLsizei>(c.height); 1001 GLsizei height = static_cast<GLsizei>(c.height);
1000 GLenum format = static_cast<GLenum>(c.format); 1002 GLenum format = static_cast<GLenum>(c.format);
1001 GLenum type = static_cast<GLenum>(c.type); 1003 GLenum type = static_cast<GLenum>(c.type);
1004 uint32_t pixels_shm_id = c.pixels_shm_id;
1005 uint32_t pixels_shm_offset = c.pixels_shm_offset;
1002 1006
1003 unsigned int buffer_size = 0; 1007 unsigned int buffer_size = 0;
1004 const void* pixels = GetSharedMemoryAndSizeAs<uint8_t*>( 1008 const void* pixels = nullptr;
1005 c.pixels_shm_id, c.pixels_shm_offset, &buffer_size); 1009
1006 if (!pixels) { 1010 if (pixels_shm_id != 0 || pixels_shm_offset != 0) {
1007 return error::kOutOfBounds; 1011 pixels = GetSharedMemoryAndSizeAs<uint8_t*>(
1012 pixels_shm_id, pixels_shm_offset, &buffer_size);
1013 if (!pixels) {
1014 return error::kOutOfBounds;
1015 }
1008 } 1016 }
1009 GLsizei imagesize = buffer_size;
1010 1017
1011 error::Error error = DoTexSubImage2D(target, level, xoffset, yoffset, width, 1018 error::Error error =
1012 height, format, type, imagesize, pixels); 1019 DoTexSubImage2D(target, level, xoffset, yoffset, width, height, format,
1020 type, buffer_size, pixels);
1013 if (error != error::kNoError) { 1021 if (error != error::kNoError) {
1014 return error; 1022 return error;
1015 } 1023 }
1016 1024
1017 return error::kNoError; 1025 return error::kNoError;
1018 } 1026 }
1019 1027
1020 error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage3D( 1028 error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage3D(
1021 uint32_t immediate_data_size, 1029 uint32_t immediate_data_size,
1022 const volatile void* cmd_data) { 1030 const volatile void* cmd_data) {
1023 const volatile gles2::cmds::TexSubImage3D& c = 1031 const volatile gles2::cmds::TexSubImage3D& c =
1024 *static_cast<const volatile gles2::cmds::TexSubImage3D*>(cmd_data); 1032 *static_cast<const volatile gles2::cmds::TexSubImage3D*>(cmd_data);
1025 GLenum target = static_cast<GLenum>(c.target); 1033 GLenum target = static_cast<GLenum>(c.target);
1026 GLint level = static_cast<GLint>(c.level); 1034 GLint level = static_cast<GLint>(c.level);
1027 GLint xoffset = static_cast<GLint>(c.xoffset); 1035 GLint xoffset = static_cast<GLint>(c.xoffset);
1028 GLint yoffset = static_cast<GLint>(c.yoffset); 1036 GLint yoffset = static_cast<GLint>(c.yoffset);
1029 GLint zoffset = static_cast<GLint>(c.zoffset); 1037 GLint zoffset = static_cast<GLint>(c.zoffset);
1030 GLsizei width = static_cast<GLsizei>(c.width); 1038 GLsizei width = static_cast<GLsizei>(c.width);
1031 GLsizei height = static_cast<GLsizei>(c.height); 1039 GLsizei height = static_cast<GLsizei>(c.height);
1032 GLsizei depth = static_cast<GLsizei>(c.depth); 1040 GLsizei depth = static_cast<GLsizei>(c.depth);
1033 GLenum format = static_cast<GLenum>(c.format); 1041 GLenum format = static_cast<GLenum>(c.format);
1034 GLenum type = static_cast<GLenum>(c.type); 1042 GLenum type = static_cast<GLenum>(c.type);
1043 uint32_t pixels_shm_id = c.pixels_shm_id;
1044 uint32_t pixels_shm_offset = c.pixels_shm_offset;
1035 1045
1036 unsigned int buffer_size = 0; 1046 unsigned int buffer_size = 0;
1037 const void* pixels = GetSharedMemoryAndSizeAs<uint8_t*>( 1047 const void* pixels = nullptr;
1038 c.pixels_shm_id, c.pixels_shm_offset, &buffer_size); 1048
1039 if (!pixels) { 1049 if (pixels_shm_id != 0 || pixels_shm_offset != 0) {
1040 return error::kOutOfBounds; 1050 pixels = GetSharedMemoryAndSizeAs<uint8_t*>(
1051 pixels_shm_id, pixels_shm_offset, &buffer_size);
1052 if (!pixels) {
1053 return error::kOutOfBounds;
1054 }
1041 } 1055 }
1042 GLsizei imagesize = buffer_size;
1043 1056
1044 error::Error error = 1057 error::Error error =
1045 DoTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, 1058 DoTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height,
1046 depth, format, type, imagesize, pixels); 1059 depth, format, type, buffer_size, pixels);
1047 if (error != error::kNoError) { 1060 if (error != error::kNoError) {
1048 return error; 1061 return error;
1049 } 1062 }
1050 1063
1051 return error::kNoError; 1064 return error::kNoError;
1052 } 1065 }
1053 1066
1054 error::Error GLES2DecoderPassthroughImpl::HandleUniformBlockBinding( 1067 error::Error GLES2DecoderPassthroughImpl::HandleUniformBlockBinding(
1055 uint32_t immediate_data_size, 1068 uint32_t immediate_data_size,
1056 const volatile void* cmd_data) { 1069 const volatile void* cmd_data) {
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. 2621 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case.
2609 const void* data = GetSharedMemoryAs<const void*>( 2622 const void* data = GetSharedMemoryAs<const void*>(
2610 c.data_shm_id, c.data_shm_offset, image_size); 2623 c.data_shm_id, c.data_shm_offset, image_size);
2611 return DoCompressedTexSubImage3D( 2624 return DoCompressedTexSubImage3D(
2612 target, level, xoffset, yoffset, zoffset, width, height, depth, 2625 target, level, xoffset, yoffset, zoffset, width, height, depth,
2613 format, image_size, data); 2626 format, image_size, data);
2614 } 2627 }
2615 2628
2616 } // namespace gles2 2629 } // namespace gles2
2617 } // namespace gpu 2630 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698