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 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 | 8 |
9 namespace gpu { | 9 namespace gpu { |
10 namespace gles2 { | 10 namespace gles2 { |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 const char* name, | 871 const char* name, |
872 GLint* result) { | 872 GLint* result) { |
873 *result = glGetAttribLocation(GetProgramServiceID(program, resources_), name); | 873 *result = glGetAttribLocation(GetProgramServiceID(program, resources_), name); |
874 return error::kNoError; | 874 return error::kNoError; |
875 } | 875 } |
876 | 876 |
877 error::Error GLES2DecoderPassthroughImpl::DoGetBooleanv(GLenum pname, | 877 error::Error GLES2DecoderPassthroughImpl::DoGetBooleanv(GLenum pname, |
878 GLsizei bufsize, | 878 GLsizei bufsize, |
879 GLsizei* length, | 879 GLsizei* length, |
880 GLboolean* params) { | 880 GLboolean* params) { |
881 glGetBooleanvRobustANGLE(pname, bufsize, length, params); | 881 return GetNumericHelper( |
882 return error::kNoError; | 882 pname, bufsize, length, params, |
| 883 [](GLenum pname, GLsizei bufsize, GLsizei* length, GLboolean* params) { |
| 884 glGetBooleanvRobustANGLE(pname, bufsize, length, params); |
| 885 }); |
883 } | 886 } |
884 | 887 |
885 error::Error GLES2DecoderPassthroughImpl::DoGetBufferParameteri64v( | 888 error::Error GLES2DecoderPassthroughImpl::DoGetBufferParameteri64v( |
886 GLenum target, | 889 GLenum target, |
887 GLenum pname, | 890 GLenum pname, |
888 GLsizei bufsize, | 891 GLsizei bufsize, |
889 GLsizei* length, | 892 GLsizei* length, |
890 GLint64* params) { | 893 GLint64* params) { |
891 glGetBufferParameteri64vRobustANGLE(target, pname, bufsize, length, params); | 894 glGetBufferParameteri64vRobustANGLE(target, pname, bufsize, length, params); |
892 return error::kNoError; | 895 return error::kNoError; |
(...skipping 11 matching lines...) Expand all Loading... |
904 | 907 |
905 error::Error GLES2DecoderPassthroughImpl::DoGetError(uint32_t* result) { | 908 error::Error GLES2DecoderPassthroughImpl::DoGetError(uint32_t* result) { |
906 *result = glGetError(); | 909 *result = glGetError(); |
907 return error::kNoError; | 910 return error::kNoError; |
908 } | 911 } |
909 | 912 |
910 error::Error GLES2DecoderPassthroughImpl::DoGetFloatv(GLenum pname, | 913 error::Error GLES2DecoderPassthroughImpl::DoGetFloatv(GLenum pname, |
911 GLsizei bufsize, | 914 GLsizei bufsize, |
912 GLsizei* length, | 915 GLsizei* length, |
913 GLfloat* params) { | 916 GLfloat* params) { |
914 glGetFloatvRobustANGLE(pname, bufsize, length, params); | 917 return GetNumericHelper( |
915 return error::kNoError; | 918 pname, bufsize, length, params, |
| 919 [](GLenum pname, GLsizei bufsize, GLsizei* length, GLfloat* params) { |
| 920 glGetFloatvRobustANGLE(pname, bufsize, length, params); |
| 921 }); |
916 } | 922 } |
917 | 923 |
918 error::Error GLES2DecoderPassthroughImpl::DoGetFragDataLocation( | 924 error::Error GLES2DecoderPassthroughImpl::DoGetFragDataLocation( |
919 GLuint program, | 925 GLuint program, |
920 const char* name, | 926 const char* name, |
921 GLint* result) { | 927 GLint* result) { |
922 *result = | 928 *result = |
923 glGetFragDataLocation(GetProgramServiceID(program, resources_), name); | 929 glGetFragDataLocation(GetProgramServiceID(program, resources_), name); |
924 return error::kNoError; | 930 return error::kNoError; |
925 } | 931 } |
926 | 932 |
927 error::Error GLES2DecoderPassthroughImpl::DoGetFramebufferAttachmentParameteriv( | 933 error::Error GLES2DecoderPassthroughImpl::DoGetFramebufferAttachmentParameteriv( |
928 GLenum target, | 934 GLenum target, |
929 GLenum attachment, | 935 GLenum attachment, |
930 GLenum pname, | 936 GLenum pname, |
931 GLsizei bufsize, | 937 GLsizei bufsize, |
932 GLsizei* length, | 938 GLsizei* length, |
933 GLint* params) { | 939 GLint* params) { |
934 glGetFramebufferAttachmentParameterivRobustANGLE(target, attachment, pname, | 940 // Get a scratch buffer to hold the result of the query |
935 bufsize, length, params); | 941 GLint* scratch_params = GetTypedScratchMemory<GLint>(bufsize); |
| 942 glGetFramebufferAttachmentParameterivRobustANGLE( |
| 943 target, attachment, pname, bufsize, length, scratch_params); |
| 944 |
| 945 // Update the results of the query, if needed |
| 946 error::Error error = PatchGetFramebufferAttachmentParameter( |
| 947 target, attachment, pname, *length, scratch_params); |
| 948 if (error != error::kNoError) { |
| 949 *length = 0; |
| 950 return error; |
| 951 } |
| 952 |
| 953 // Copy into the destination |
| 954 DCHECK(*length < bufsize); |
| 955 std::copy(scratch_params, scratch_params + *length, params); |
| 956 |
936 return error::kNoError; | 957 return error::kNoError; |
937 } | 958 } |
938 | 959 |
939 error::Error GLES2DecoderPassthroughImpl::DoGetInteger64v(GLenum pname, | 960 error::Error GLES2DecoderPassthroughImpl::DoGetInteger64v(GLenum pname, |
940 GLsizei bufsize, | 961 GLsizei bufsize, |
941 GLsizei* length, | 962 GLsizei* length, |
942 GLint64* params) { | 963 GLint64* params) { |
943 glGetInteger64vRobustANGLE(pname, bufsize, length, params); | 964 return GetNumericHelper( |
944 return error::kNoError; | 965 pname, bufsize, length, params, |
| 966 [](GLenum pname, GLsizei bufsize, GLsizei* length, GLint64* params) { |
| 967 glGetInteger64vRobustANGLE(pname, bufsize, length, params); |
| 968 }); |
945 } | 969 } |
946 | 970 |
947 error::Error GLES2DecoderPassthroughImpl::DoGetIntegeri_v(GLenum pname, | 971 error::Error GLES2DecoderPassthroughImpl::DoGetIntegeri_v(GLenum pname, |
948 GLuint index, | 972 GLuint index, |
949 GLsizei bufsize, | 973 GLsizei bufsize, |
950 GLsizei* length, | 974 GLsizei* length, |
951 GLint* data) { | 975 GLint* data) { |
952 glGetIntegeri_vRobustANGLE(pname, index, bufsize, length, data); | 976 glGetIntegeri_vRobustANGLE(pname, index, bufsize, length, data); |
953 return error::kNoError; | 977 return error::kNoError; |
954 } | 978 } |
955 | 979 |
956 error::Error GLES2DecoderPassthroughImpl::DoGetInteger64i_v(GLenum pname, | 980 error::Error GLES2DecoderPassthroughImpl::DoGetInteger64i_v(GLenum pname, |
957 GLuint index, | 981 GLuint index, |
958 GLsizei bufsize, | 982 GLsizei bufsize, |
959 GLsizei* length, | 983 GLsizei* length, |
960 GLint64* data) { | 984 GLint64* data) { |
961 glGetInteger64i_vRobustANGLE(pname, index, bufsize, length, data); | 985 glGetInteger64i_vRobustANGLE(pname, index, bufsize, length, data); |
962 return error::kNoError; | 986 return error::kNoError; |
963 } | 987 } |
964 | 988 |
965 error::Error GLES2DecoderPassthroughImpl::DoGetIntegerv(GLenum pname, | 989 error::Error GLES2DecoderPassthroughImpl::DoGetIntegerv(GLenum pname, |
966 GLsizei bufsize, | 990 GLsizei bufsize, |
967 GLsizei* length, | 991 GLsizei* length, |
968 GLint* params) { | 992 GLint* params) { |
969 glGetIntegervRobustANGLE(pname, bufsize, length, params); | 993 return GetNumericHelper( |
970 return error::kNoError; | 994 pname, bufsize, length, params, |
| 995 [](GLenum pname, GLsizei bufsize, GLsizei* length, GLint* params) { |
| 996 glGetIntegervRobustANGLE(pname, bufsize, length, params); |
| 997 }); |
971 } | 998 } |
972 | 999 |
973 error::Error GLES2DecoderPassthroughImpl::DoGetInternalformativ(GLenum target, | 1000 error::Error GLES2DecoderPassthroughImpl::DoGetInternalformativ(GLenum target, |
974 GLenum format, | 1001 GLenum format, |
975 GLenum pname, | 1002 GLenum pname, |
976 GLsizei bufSize, | 1003 GLsizei bufSize, |
977 GLsizei* length, | 1004 GLsizei* length, |
978 GLint* params) { | 1005 GLint* params) { |
979 glGetInternalformativRobustANGLE(target, format, pname, bufSize, length, | 1006 glGetInternalformativRobustANGLE(target, format, pname, bufSize, length, |
980 params); | 1007 params); |
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3030 GLES2DecoderPassthroughImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( | 3057 GLES2DecoderPassthroughImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( |
3031 GLint location, | 3058 GLint location, |
3032 GLboolean transpose, | 3059 GLboolean transpose, |
3033 const volatile GLfloat* defaultValue) { | 3060 const volatile GLfloat* defaultValue) { |
3034 NOTIMPLEMENTED(); | 3061 NOTIMPLEMENTED(); |
3035 return error::kNoError; | 3062 return error::kNoError; |
3036 } | 3063 } |
3037 | 3064 |
3038 } // namespace gles2 | 3065 } // namespace gles2 |
3039 } // namespace gpu | 3066 } // namespace gpu |
OLD | NEW |