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/test_helper.h" | 5 #include "gpu/command_buffer/service/test_helper.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 strstr(extensions, "GL_EXT_multisampled_render_to_texture") || | 332 strstr(extensions, "GL_EXT_multisampled_render_to_texture") || |
333 gl_info.is_es3) { | 333 gl_info.is_es3) { |
334 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES, _)) | 334 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES, _)) |
335 .WillOnce(SetArgumentPointee<1>(kMaxSamples)) | 335 .WillOnce(SetArgumentPointee<1>(kMaxSamples)) |
336 .RetiresOnSaturation(); | 336 .RetiresOnSaturation(); |
337 } else if (strstr(extensions, "GL_IMG_multisampled_render_to_texture")) { | 337 } else if (strstr(extensions, "GL_IMG_multisampled_render_to_texture")) { |
338 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES_IMG, _)) | 338 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES_IMG, _)) |
339 .WillOnce(SetArgumentPointee<1>(kMaxSamples)) | 339 .WillOnce(SetArgumentPointee<1>(kMaxSamples)) |
340 .RetiresOnSaturation(); | 340 .RetiresOnSaturation(); |
341 } | 341 } |
| 342 |
| 343 if (gl_info.IsAtLeastGL(3, 3) || |
| 344 (gl_info.IsAtLeastGL(3, 2) && |
| 345 strstr(extensions, "GL_ARB_blend_func_extended")) || |
| 346 (gl_info.is_es && strstr(extensions, "GL_EXT_blend_func_extended"))) { |
| 347 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT, _)) |
| 348 .WillOnce(SetArgumentPointee<1>(8)) |
| 349 .RetiresOnSaturation(); |
| 350 } |
| 351 |
342 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VERTEX_ATTRIBS, _)) | 352 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VERTEX_ATTRIBS, _)) |
343 .WillOnce(SetArgumentPointee<1>(kNumVertexAttribs)) | 353 .WillOnce(SetArgumentPointee<1>(kNumVertexAttribs)) |
344 .RetiresOnSaturation(); | 354 .RetiresOnSaturation(); |
345 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, _)) | 355 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, _)) |
346 .WillOnce(SetArgumentPointee<1>(kNumTextureUnits)) | 356 .WillOnce(SetArgumentPointee<1>(kNumTextureUnits)) |
347 .RetiresOnSaturation(); | 357 .RetiresOnSaturation(); |
348 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_TEXTURE_SIZE, _)) | 358 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_TEXTURE_SIZE, _)) |
349 .WillOnce(SetArgumentPointee<1>(kMaxTextureSize)) | 359 .WillOnce(SetArgumentPointee<1>(kMaxTextureSize)) |
350 .RetiresOnSaturation(); | 360 .RetiresOnSaturation(); |
351 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, _)) | 361 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, _)) |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 | 692 |
683 void TestHelper::SetupProgramSuccessExpectations( | 693 void TestHelper::SetupProgramSuccessExpectations( |
684 ::gfx::MockGLInterface* gl, | 694 ::gfx::MockGLInterface* gl, |
685 const FeatureInfo* feature_info, | 695 const FeatureInfo* feature_info, |
686 AttribInfo* attribs, | 696 AttribInfo* attribs, |
687 size_t num_attribs, | 697 size_t num_attribs, |
688 UniformInfo* uniforms, | 698 UniformInfo* uniforms, |
689 size_t num_uniforms, | 699 size_t num_uniforms, |
690 VaryingInfo* varyings, | 700 VaryingInfo* varyings, |
691 size_t num_varyings, | 701 size_t num_varyings, |
| 702 ProgramOutputInfo* program_outputs, |
| 703 size_t num_program_outputs, |
692 GLuint service_id) { | 704 GLuint service_id) { |
693 EXPECT_CALL(*gl, | 705 EXPECT_CALL(*gl, |
694 GetProgramiv(service_id, GL_LINK_STATUS, _)) | 706 GetProgramiv(service_id, GL_LINK_STATUS, _)) |
695 .WillOnce(SetArgumentPointee<2>(1)) | 707 .WillOnce(SetArgumentPointee<2>(1)) |
696 .RetiresOnSaturation(); | 708 .RetiresOnSaturation(); |
697 EXPECT_CALL(*gl, | 709 EXPECT_CALL(*gl, |
698 GetProgramiv(service_id, GL_INFO_LOG_LENGTH, _)) | 710 GetProgramiv(service_id, GL_INFO_LOG_LENGTH, _)) |
699 .WillOnce(SetArgumentPointee<2>(0)) | 711 .WillOnce(SetArgumentPointee<2>(0)) |
700 .RetiresOnSaturation(); | 712 .RetiresOnSaturation(); |
701 EXPECT_CALL(*gl, | 713 EXPECT_CALL(*gl, |
(...skipping 15 matching lines...) Expand all Loading... |
717 EXPECT_CALL(*gl, | 729 EXPECT_CALL(*gl, |
718 GetActiveAttrib(service_id, ii, | 730 GetActiveAttrib(service_id, ii, |
719 max_attrib_len, _, _, _, _)) | 731 max_attrib_len, _, _, _, _)) |
720 .WillOnce(DoAll( | 732 .WillOnce(DoAll( |
721 SetArgumentPointee<3>(strlen(info.name)), | 733 SetArgumentPointee<3>(strlen(info.name)), |
722 SetArgumentPointee<4>(info.size), | 734 SetArgumentPointee<4>(info.size), |
723 SetArgumentPointee<5>(info.type), | 735 SetArgumentPointee<5>(info.type), |
724 SetArrayArgument<6>(info.name, | 736 SetArrayArgument<6>(info.name, |
725 info.name + strlen(info.name) + 1))) | 737 info.name + strlen(info.name) + 1))) |
726 .RetiresOnSaturation(); | 738 .RetiresOnSaturation(); |
727 if (!ProgramManager::IsInvalidPrefix(info.name, strlen(info.name))) { | 739 if (!ProgramManager::HasBuiltInPrefix(info.name)) { |
728 EXPECT_CALL(*gl, GetAttribLocation(service_id, StrEq(info.name))) | 740 EXPECT_CALL(*gl, GetAttribLocation(service_id, StrEq(info.name))) |
729 .WillOnce(Return(info.location)) | 741 .WillOnce(Return(info.location)) |
730 .RetiresOnSaturation(); | 742 .RetiresOnSaturation(); |
731 } | 743 } |
732 } | 744 } |
733 EXPECT_CALL(*gl, | 745 EXPECT_CALL(*gl, |
734 GetProgramiv(service_id, GL_ACTIVE_UNIFORMS, _)) | 746 GetProgramiv(service_id, GL_ACTIVE_UNIFORMS, _)) |
735 .WillOnce(SetArgumentPointee<2>(num_uniforms)) | 747 .WillOnce(SetArgumentPointee<2>(num_uniforms)) |
736 .RetiresOnSaturation(); | 748 .RetiresOnSaturation(); |
737 | 749 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 .WillOnce(SetArgumentPointee<3>(int(max_varying_len))) | 804 .WillOnce(SetArgumentPointee<3>(int(max_varying_len))) |
793 .RetiresOnSaturation(); | 805 .RetiresOnSaturation(); |
794 for (size_t ii = 0; ii < num_varyings; ++ii) { | 806 for (size_t ii = 0; ii < num_varyings; ++ii) { |
795 VaryingInfo& info = varyings[ii]; | 807 VaryingInfo& info = varyings[ii]; |
796 EXPECT_CALL(*gl, GetProgramResourceName(service_id, GL_FRAGMENT_INPUT_NV, | 808 EXPECT_CALL(*gl, GetProgramResourceName(service_id, GL_FRAGMENT_INPUT_NV, |
797 ii, max_varying_len, _, _)) | 809 ii, max_varying_len, _, _)) |
798 .WillOnce(DoAll(SetArgumentPointee<4>(strlen(info.name)), | 810 .WillOnce(DoAll(SetArgumentPointee<4>(strlen(info.name)), |
799 SetArrayArgument<5>( | 811 SetArrayArgument<5>( |
800 info.name, info.name + strlen(info.name) + 1))) | 812 info.name, info.name + strlen(info.name) + 1))) |
801 .RetiresOnSaturation(); | 813 .RetiresOnSaturation(); |
802 if (!ProgramManager::IsInvalidPrefix(info.name, strlen(info.name))) { | 814 if (ProgramManager::HasBuiltInPrefix(info.name)) |
| 815 continue; |
| 816 |
803 static const GLenum kPropsArray[] = {GL_LOCATION, GL_TYPE, | 817 static const GLenum kPropsArray[] = {GL_LOCATION, GL_TYPE, |
804 GL_ARRAY_SIZE}; | 818 GL_ARRAY_SIZE}; |
805 static const size_t kPropsSize = arraysize(kPropsArray); | 819 static const size_t kPropsSize = arraysize(kPropsArray); |
806 EXPECT_CALL( | 820 EXPECT_CALL( |
807 *gl, GetProgramResourceiv( | 821 *gl, GetProgramResourceiv( |
808 service_id, GL_FRAGMENT_INPUT_NV, ii, kPropsSize, | 822 service_id, GL_FRAGMENT_INPUT_NV, ii, kPropsSize, |
809 _ /*testing::ElementsAreArray(kPropsArray, kPropsSize)*/, | 823 _ /*testing::ElementsAreArray(kPropsArray, kPropsSize)*/, |
810 kPropsSize, _, _)) | 824 kPropsSize, _, _)) |
811 .WillOnce(testing::Invoke([info](GLuint, GLenum, GLuint, GLsizei, | 825 .WillOnce(testing::Invoke([info](GLuint, GLenum, GLuint, GLsizei, |
812 const GLenum*, GLsizei, | 826 const GLenum*, GLsizei, |
813 GLsizei* length, GLint* params) { | 827 GLsizei* length, GLint* params) { |
814 *length = kPropsSize; | 828 *length = kPropsSize; |
815 params[0] = info.real_location; | 829 params[0] = info.real_location; |
816 params[1] = info.type; | 830 params[1] = info.type; |
817 params[2] = info.size; | 831 params[2] = info.size; |
818 })) | 832 })) |
819 .RetiresOnSaturation(); | 833 .RetiresOnSaturation(); |
820 } | 834 } |
| 835 } |
| 836 if (feature_info->gl_version_info().IsES3Capable() && |
| 837 !feature_info->disable_shader_translator()) { |
| 838 for (size_t ii = 0; ii < num_program_outputs; ++ii) { |
| 839 ProgramOutputInfo& info = program_outputs[ii]; |
| 840 if (ProgramManager::HasBuiltInPrefix(info.name)) |
| 841 continue; |
| 842 |
| 843 EXPECT_CALL(*gl, GetFragDataLocation(service_id, StrEq(info.name))) |
| 844 .WillOnce(Return(info.color_name)) |
| 845 .RetiresOnSaturation(); |
| 846 if (feature_info->feature_flags().ext_blend_func_extended) { |
| 847 EXPECT_CALL(*gl, GetFragDataIndex(service_id, StrEq(info.name))) |
| 848 .WillOnce(Return(info.index)) |
| 849 .RetiresOnSaturation(); |
| 850 } else { |
| 851 // Test case must not use indices, or the context of the testcase has to |
| 852 // support the dual source blending. |
| 853 DCHECK(info.index == 0); |
| 854 } |
821 } | 855 } |
822 } | 856 } |
823 } | 857 } |
824 | 858 |
825 void TestHelper::SetupShaderExpectations(::gfx::MockGLInterface* gl, | 859 void TestHelper::SetupShaderExpectations(::gfx::MockGLInterface* gl, |
826 const FeatureInfo* feature_info, | 860 const FeatureInfo* feature_info, |
827 AttribInfo* attribs, | 861 AttribInfo* attribs, |
828 size_t num_attribs, | 862 size_t num_attribs, |
829 UniformInfo* uniforms, | 863 UniformInfo* uniforms, |
830 size_t num_uniforms, | 864 size_t num_uniforms, |
831 GLuint service_id) { | 865 GLuint service_id) { |
832 InSequence s; | 866 InSequence s; |
833 | 867 |
834 EXPECT_CALL(*gl, LinkProgram(service_id)).Times(1).RetiresOnSaturation(); | 868 EXPECT_CALL(*gl, LinkProgram(service_id)).Times(1).RetiresOnSaturation(); |
835 | 869 |
836 SetupProgramSuccessExpectations(gl, feature_info, attribs, num_attribs, | 870 SetupProgramSuccessExpectations(gl, feature_info, attribs, num_attribs, |
837 uniforms, num_uniforms, nullptr, 0, | 871 uniforms, num_uniforms, nullptr, 0, nullptr, |
838 service_id); | 872 0, service_id); |
839 } | 873 } |
840 | 874 |
841 void TestHelper::SetupShaderExpectationsWithVaryings( | 875 void TestHelper::SetupShaderExpectationsWithVaryings( |
842 ::gfx::MockGLInterface* gl, | 876 ::gfx::MockGLInterface* gl, |
843 const FeatureInfo* feature_info, | 877 const FeatureInfo* feature_info, |
844 AttribInfo* attribs, | 878 AttribInfo* attribs, |
845 size_t num_attribs, | 879 size_t num_attribs, |
846 UniformInfo* uniforms, | 880 UniformInfo* uniforms, |
847 size_t num_uniforms, | 881 size_t num_uniforms, |
848 VaryingInfo* varyings, | 882 VaryingInfo* varyings, |
849 size_t num_varyings, | 883 size_t num_varyings, |
| 884 ProgramOutputInfo* program_outputs, |
| 885 size_t num_program_outputs, |
850 GLuint service_id) { | 886 GLuint service_id) { |
851 InSequence s; | 887 InSequence s; |
852 | 888 |
853 EXPECT_CALL(*gl, | 889 EXPECT_CALL(*gl, |
854 LinkProgram(service_id)) | 890 LinkProgram(service_id)) |
855 .Times(1) | 891 .Times(1) |
856 .RetiresOnSaturation(); | 892 .RetiresOnSaturation(); |
857 | 893 |
858 SetupProgramSuccessExpectations(gl, feature_info, attribs, num_attribs, | 894 SetupProgramSuccessExpectations( |
859 uniforms, num_uniforms, varyings, | 895 gl, feature_info, attribs, num_attribs, uniforms, num_uniforms, varyings, |
860 num_varyings, service_id); | 896 num_varyings, program_outputs, num_program_outputs, service_id); |
861 } | 897 } |
862 | 898 |
863 void TestHelper::DoBufferData( | 899 void TestHelper::DoBufferData( |
864 ::gfx::MockGLInterface* gl, MockErrorState* error_state, | 900 ::gfx::MockGLInterface* gl, MockErrorState* error_state, |
865 BufferManager* manager, Buffer* buffer, GLenum target, GLsizeiptr size, | 901 BufferManager* manager, Buffer* buffer, GLenum target, GLsizeiptr size, |
866 GLenum usage, const GLvoid* data, GLenum error) { | 902 GLenum usage, const GLvoid* data, GLenum error) { |
867 EXPECT_CALL(*error_state, CopyRealGLErrorsToWrapper(_, _, _)) | 903 EXPECT_CALL(*error_state, CopyRealGLErrorsToWrapper(_, _, _)) |
868 .Times(1) | 904 .Times(1) |
869 .RetiresOnSaturation(); | 905 .RetiresOnSaturation(); |
870 if (manager->IsUsageClientSideArray(usage)) { | 906 if (manager->IsUsageClientSideArray(usage)) { |
(...skipping 27 matching lines...) Expand all Loading... |
898 } else { | 934 } else { |
899 EXPECT_CALL(*error_state, SetGLErrorInvalidParami(_, _, error, _, _, _)) | 935 EXPECT_CALL(*error_state, SetGLErrorInvalidParami(_, _, error, _, _, _)) |
900 .Times(1) | 936 .Times(1) |
901 .RetiresOnSaturation(); | 937 .RetiresOnSaturation(); |
902 } | 938 } |
903 manager->SetParameteri("", error_state, texture_ref, pname, value); | 939 manager->SetParameteri("", error_state, texture_ref, pname, value); |
904 } | 940 } |
905 | 941 |
906 // static | 942 // static |
907 void TestHelper::SetShaderStates( | 943 void TestHelper::SetShaderStates( |
908 ::gfx::MockGLInterface* gl, Shader* shader, | 944 ::gfx::MockGLInterface* gl, |
909 bool expected_valid, | 945 Shader* shader, |
910 const std::string* const expected_log_info, | 946 bool expected_valid, |
911 const std::string* const expected_translated_source, | 947 const std::string* const expected_log_info, |
912 const int* const expected_shader_version, | 948 const std::string* const expected_translated_source, |
913 const AttributeMap* const expected_attrib_map, | 949 const int* const expected_shader_version, |
914 const UniformMap* const expected_uniform_map, | 950 const AttributeMap* const expected_attrib_map, |
915 const VaryingMap* const expected_varying_map, | 951 const UniformMap* const expected_uniform_map, |
916 const InterfaceBlockMap* const expected_interface_block_map, | 952 const VaryingMap* const expected_varying_map, |
917 const NameMap* const expected_name_map) { | 953 const InterfaceBlockMap* const expected_interface_block_map, |
| 954 const OutputVariableList* const expected_output_variable_list, |
| 955 const NameMap* const expected_name_map) { |
918 const std::string empty_log_info; | 956 const std::string empty_log_info; |
919 const std::string* log_info = (expected_log_info && !expected_valid) ? | 957 const std::string* log_info = (expected_log_info && !expected_valid) ? |
920 expected_log_info : &empty_log_info; | 958 expected_log_info : &empty_log_info; |
921 const std::string empty_translated_source; | 959 const std::string empty_translated_source; |
922 const std::string* translated_source = | 960 const std::string* translated_source = |
923 (expected_translated_source && expected_valid) ? | 961 (expected_translated_source && expected_valid) ? |
924 expected_translated_source : &empty_translated_source; | 962 expected_translated_source : &empty_translated_source; |
925 int default_shader_version = 100; | 963 int default_shader_version = 100; |
926 const int* shader_version = (expected_shader_version && expected_valid) ? | 964 const int* shader_version = (expected_shader_version && expected_valid) ? |
927 expected_shader_version : &default_shader_version; | 965 expected_shader_version : &default_shader_version; |
928 const AttributeMap empty_attrib_map; | 966 const AttributeMap empty_attrib_map; |
929 const AttributeMap* attrib_map = (expected_attrib_map && expected_valid) ? | 967 const AttributeMap* attrib_map = (expected_attrib_map && expected_valid) ? |
930 expected_attrib_map : &empty_attrib_map; | 968 expected_attrib_map : &empty_attrib_map; |
931 const UniformMap empty_uniform_map; | 969 const UniformMap empty_uniform_map; |
932 const UniformMap* uniform_map = (expected_uniform_map && expected_valid) ? | 970 const UniformMap* uniform_map = (expected_uniform_map && expected_valid) ? |
933 expected_uniform_map : &empty_uniform_map; | 971 expected_uniform_map : &empty_uniform_map; |
934 const VaryingMap empty_varying_map; | 972 const VaryingMap empty_varying_map; |
935 const VaryingMap* varying_map = (expected_varying_map && expected_valid) ? | 973 const VaryingMap* varying_map = (expected_varying_map && expected_valid) ? |
936 expected_varying_map : &empty_varying_map; | 974 expected_varying_map : &empty_varying_map; |
937 const InterfaceBlockMap empty_interface_block_map; | 975 const InterfaceBlockMap empty_interface_block_map; |
938 const InterfaceBlockMap* interface_block_map = | 976 const InterfaceBlockMap* interface_block_map = |
939 (expected_interface_block_map && expected_valid) ? | 977 (expected_interface_block_map && expected_valid) ? |
940 expected_interface_block_map : &empty_interface_block_map; | 978 expected_interface_block_map : &empty_interface_block_map; |
| 979 const OutputVariableList empty_output_variable_list; |
| 980 const OutputVariableList* output_variable_list = |
| 981 (expected_output_variable_list && expected_valid) |
| 982 ? expected_output_variable_list |
| 983 : &empty_output_variable_list; |
941 const NameMap empty_name_map; | 984 const NameMap empty_name_map; |
942 const NameMap* name_map = (expected_name_map && expected_valid) ? | 985 const NameMap* name_map = (expected_name_map && expected_valid) ? |
943 expected_name_map : &empty_name_map; | 986 expected_name_map : &empty_name_map; |
944 | 987 |
945 MockShaderTranslator* mock_translator = new MockShaderTranslator; | 988 MockShaderTranslator* mock_translator = new MockShaderTranslator; |
946 scoped_refptr<ShaderTranslatorInterface> translator(mock_translator); | 989 scoped_refptr<ShaderTranslatorInterface> translator(mock_translator); |
947 EXPECT_CALL(*mock_translator, Translate(_, | 990 EXPECT_CALL(*mock_translator, Translate(_, |
948 NotNull(), // log_info | 991 NotNull(), // log_info |
949 NotNull(), // translated_source | 992 NotNull(), // translated_source |
950 NotNull(), // shader_version | 993 NotNull(), // shader_version |
951 NotNull(), // attrib_map | 994 NotNull(), // attrib_map |
952 NotNull(), // uniform_map | 995 NotNull(), // uniform_map |
953 NotNull(), // varying_map | 996 NotNull(), // varying_map |
954 NotNull(), // interface_block_map | 997 NotNull(), // interface_block_map |
| 998 NotNull(), // output_variable_list |
955 NotNull())) // name_map | 999 NotNull())) // name_map |
956 .WillOnce(DoAll(SetArgumentPointee<1>(*log_info), | 1000 .WillOnce(DoAll(SetArgumentPointee<1>(*log_info), |
957 SetArgumentPointee<2>(*translated_source), | 1001 SetArgumentPointee<2>(*translated_source), |
958 SetArgumentPointee<3>(*shader_version), | 1002 SetArgumentPointee<3>(*shader_version), |
959 SetArgumentPointee<4>(*attrib_map), | 1003 SetArgumentPointee<4>(*attrib_map), |
960 SetArgumentPointee<5>(*uniform_map), | 1004 SetArgumentPointee<5>(*uniform_map), |
961 SetArgumentPointee<6>(*varying_map), | 1005 SetArgumentPointee<6>(*varying_map), |
962 SetArgumentPointee<7>(*interface_block_map), | 1006 SetArgumentPointee<7>(*interface_block_map), |
963 SetArgumentPointee<8>(*name_map), | 1007 SetArgumentPointee<8>(*output_variable_list), |
964 Return(expected_valid))) | 1008 SetArgumentPointee<9>(*name_map), Return(expected_valid))) |
965 .RetiresOnSaturation(); | 1009 .RetiresOnSaturation(); |
966 if (expected_valid) { | 1010 if (expected_valid) { |
967 EXPECT_CALL(*gl, ShaderSource(shader->service_id(), 1, _, NULL)) | 1011 EXPECT_CALL(*gl, ShaderSource(shader->service_id(), 1, _, NULL)) |
968 .Times(1) | 1012 .Times(1) |
969 .RetiresOnSaturation(); | 1013 .RetiresOnSaturation(); |
970 EXPECT_CALL(*gl, CompileShader(shader->service_id())) | 1014 EXPECT_CALL(*gl, CompileShader(shader->service_id())) |
971 .Times(1) | 1015 .Times(1) |
972 .RetiresOnSaturation(); | 1016 .RetiresOnSaturation(); |
973 EXPECT_CALL(*gl, GetShaderiv(shader->service_id(), | 1017 EXPECT_CALL(*gl, GetShaderiv(shader->service_id(), |
974 GL_COMPILE_STATUS, | 1018 GL_COMPILE_STATUS, |
975 NotNull())) // status | 1019 NotNull())) // status |
976 .WillOnce(SetArgumentPointee<2>(GL_TRUE)) | 1020 .WillOnce(SetArgumentPointee<2>(GL_TRUE)) |
977 .RetiresOnSaturation(); | 1021 .RetiresOnSaturation(); |
978 } | 1022 } |
979 shader->RequestCompile(translator, Shader::kGL); | 1023 shader->RequestCompile(translator, Shader::kGL); |
980 shader->DoCompile(); | 1024 shader->DoCompile(); |
981 } | 1025 } |
982 | 1026 |
983 // static | 1027 // static |
984 void TestHelper::SetShaderStates( | 1028 void TestHelper::SetShaderStates( |
985 ::gfx::MockGLInterface* gl, Shader* shader, bool valid) { | 1029 ::gfx::MockGLInterface* gl, Shader* shader, bool valid) { |
986 SetShaderStates( | 1030 SetShaderStates(gl, shader, valid, nullptr, nullptr, nullptr, nullptr, |
987 gl, shader, valid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); | 1031 nullptr, nullptr, nullptr, nullptr, nullptr); |
988 } | 1032 } |
989 | 1033 |
990 // static | 1034 // static |
991 sh::Attribute TestHelper::ConstructAttribute( | 1035 sh::Attribute TestHelper::ConstructAttribute( |
992 GLenum type, GLint array_size, GLenum precision, | 1036 GLenum type, GLint array_size, GLenum precision, |
993 bool static_use, const std::string& name) { | 1037 bool static_use, const std::string& name) { |
994 return ConstructShaderVariable<sh::Attribute>( | 1038 return ConstructShaderVariable<sh::Attribute>( |
995 type, array_size, precision, static_use, name); | 1039 type, array_size, precision, static_use, name); |
996 } | 1040 } |
997 | 1041 |
998 // static | 1042 // static |
999 sh::Uniform TestHelper::ConstructUniform( | 1043 sh::Uniform TestHelper::ConstructUniform( |
1000 GLenum type, GLint array_size, GLenum precision, | 1044 GLenum type, GLint array_size, GLenum precision, |
1001 bool static_use, const std::string& name) { | 1045 bool static_use, const std::string& name) { |
1002 return ConstructShaderVariable<sh::Uniform>( | 1046 return ConstructShaderVariable<sh::Uniform>( |
1003 type, array_size, precision, static_use, name); | 1047 type, array_size, precision, static_use, name); |
1004 } | 1048 } |
1005 | 1049 |
1006 // static | 1050 // static |
1007 sh::Varying TestHelper::ConstructVarying( | 1051 sh::Varying TestHelper::ConstructVarying( |
1008 GLenum type, GLint array_size, GLenum precision, | 1052 GLenum type, GLint array_size, GLenum precision, |
1009 bool static_use, const std::string& name) { | 1053 bool static_use, const std::string& name) { |
1010 return ConstructShaderVariable<sh::Varying>( | 1054 return ConstructShaderVariable<sh::Varying>( |
1011 type, array_size, precision, static_use, name); | 1055 type, array_size, precision, static_use, name); |
1012 } | 1056 } |
1013 | 1057 |
| 1058 sh::OutputVariable TestHelper::ConstructOutputVariable( |
| 1059 GLenum type, |
| 1060 GLint array_size, |
| 1061 GLenum precision, |
| 1062 bool static_use, |
| 1063 const std::string& name) { |
| 1064 return ConstructShaderVariable<sh::OutputVariable>( |
| 1065 type, array_size, precision, static_use, name); |
| 1066 } |
| 1067 |
1014 ScopedGLImplementationSetter::ScopedGLImplementationSetter( | 1068 ScopedGLImplementationSetter::ScopedGLImplementationSetter( |
1015 gfx::GLImplementation implementation) | 1069 gfx::GLImplementation implementation) |
1016 : old_implementation_(gfx::GetGLImplementation()) { | 1070 : old_implementation_(gfx::GetGLImplementation()) { |
1017 gfx::SetGLImplementation(implementation); | 1071 gfx::SetGLImplementation(implementation); |
1018 } | 1072 } |
1019 | 1073 |
1020 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { | 1074 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { |
1021 gfx::SetGLImplementation(old_implementation_); | 1075 gfx::SetGLImplementation(old_implementation_); |
1022 } | 1076 } |
1023 | 1077 |
1024 } // namespace gles2 | 1078 } // namespace gles2 |
1025 } // namespace gpu | 1079 } // namespace gpu |
1026 | 1080 |
OLD | NEW |