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/feature_info.h" | 5 #include "gpu/command_buffer/service/feature_info.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "gpu/command_buffer/service/gpu_switches.h" | 10 #include "gpu/command_buffer/service/gpu_switches.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 const GLenum* types; | 88 const GLenum* types; |
89 size_t count; | 89 size_t count; |
90 }; | 90 }; |
91 | 91 |
92 } // anonymous namespace. | 92 } // anonymous namespace. |
93 | 93 |
94 TEST_F(FeatureInfoTest, Basic) { | 94 TEST_F(FeatureInfoTest, Basic) { |
95 SetupWithoutInit(); | 95 SetupWithoutInit(); |
96 // Test it starts off uninitialized. | 96 // Test it starts off uninitialized. |
97 EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample); | 97 EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample); |
| 98 EXPECT_FALSE(info_->feature_flags().core_framebuffer_multisample); |
98 EXPECT_FALSE(info_->feature_flags().multisampled_render_to_texture); | 99 EXPECT_FALSE(info_->feature_flags().multisampled_render_to_texture); |
99 EXPECT_FALSE(info_->feature_flags( | 100 EXPECT_FALSE(info_->feature_flags( |
100 ).use_img_for_multisampled_render_to_texture); | 101 ).use_img_for_multisampled_render_to_texture); |
101 EXPECT_FALSE(info_->feature_flags().oes_standard_derivatives); | 102 EXPECT_FALSE(info_->feature_flags().oes_standard_derivatives); |
102 EXPECT_FALSE(info_->feature_flags().npot_ok); | 103 EXPECT_FALSE(info_->feature_flags().npot_ok); |
103 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear); | 104 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear); |
104 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear); | 105 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear); |
105 EXPECT_FALSE(info_->feature_flags().oes_egl_image_external); | 106 EXPECT_FALSE(info_->feature_flags().oes_egl_image_external); |
| 107 EXPECT_FALSE(info_->feature_flags().oes_depth24); |
| 108 EXPECT_FALSE(info_->feature_flags().packed_depth24_stencil8); |
106 EXPECT_FALSE(info_->feature_flags().chromium_stream_texture); | 109 EXPECT_FALSE(info_->feature_flags().chromium_stream_texture); |
107 EXPECT_FALSE(info_->feature_flags().angle_translated_shader_source); | 110 EXPECT_FALSE(info_->feature_flags().angle_translated_shader_source); |
108 EXPECT_FALSE(info_->feature_flags().angle_pack_reverse_row_order); | 111 EXPECT_FALSE(info_->feature_flags().angle_pack_reverse_row_order); |
109 EXPECT_FALSE(info_->feature_flags().arb_texture_rectangle); | 112 EXPECT_FALSE(info_->feature_flags().arb_texture_rectangle); |
110 EXPECT_FALSE(info_->feature_flags().angle_instanced_arrays); | 113 EXPECT_FALSE(info_->feature_flags().angle_instanced_arrays); |
111 EXPECT_FALSE(info_->feature_flags().occlusion_query_boolean); | 114 EXPECT_FALSE(info_->feature_flags().occlusion_query_boolean); |
112 EXPECT_FALSE(info_->feature_flags( | 115 EXPECT_FALSE(info_->feature_flags( |
113 ).use_arb_occlusion_query2_for_occlusion_query_boolean); | 116 ).use_arb_occlusion_query2_for_occlusion_query_boolean); |
114 EXPECT_FALSE(info_->feature_flags( | 117 EXPECT_FALSE(info_->feature_flags( |
115 ).use_arb_occlusion_query_for_occlusion_query_boolean); | 118 ).use_arb_occlusion_query_for_occlusion_query_boolean); |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid( | 702 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid( |
700 GL_UNSIGNED_SHORT)); | 703 GL_UNSIGNED_SHORT)); |
701 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid( | 704 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid( |
702 GL_UNSIGNED_INT)); | 705 GL_UNSIGNED_INT)); |
703 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_STENCIL).IsValid( | 706 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_STENCIL).IsValid( |
704 GL_UNSIGNED_INT_24_8)); | 707 GL_UNSIGNED_INT_24_8)); |
705 } | 708 } |
706 | 709 |
707 TEST_F(FeatureInfoTest, InitializeOES_depth24) { | 710 TEST_F(FeatureInfoTest, InitializeOES_depth24) { |
708 SetupInitExpectations("GL_OES_depth24"); | 711 SetupInitExpectations("GL_OES_depth24"); |
| 712 EXPECT_TRUE(info_->feature_flags().oes_depth24); |
709 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24")); | 713 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24")); |
710 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid( | 714 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid( |
711 GL_DEPTH_COMPONENT24)); | 715 GL_DEPTH_COMPONENT24)); |
712 } | 716 } |
713 | 717 |
714 TEST_F(FeatureInfoTest, InitializeOES_standard_derivatives) { | 718 TEST_F(FeatureInfoTest, InitializeOES_standard_derivatives) { |
715 SetupInitExpectations("GL_OES_standard_derivatives"); | 719 SetupInitExpectations("GL_OES_standard_derivatives"); |
716 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_standard_derivatives")); | 720 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_standard_derivatives")); |
717 EXPECT_TRUE(info_->feature_flags().oes_standard_derivatives); | 721 EXPECT_TRUE(info_->feature_flags().oes_standard_derivatives); |
718 EXPECT_TRUE(info_->validators()->hint_target.IsValid( | 722 EXPECT_TRUE(info_->validators()->hint_target.IsValid( |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 SetupInitExpectationsWithGLVersion("GL_ARB_sampler_objects", "OpenGL 3.0"); | 865 SetupInitExpectationsWithGLVersion("GL_ARB_sampler_objects", "OpenGL 3.0"); |
862 EXPECT_TRUE(info_->feature_flags().enable_samplers); | 866 EXPECT_TRUE(info_->feature_flags().enable_samplers); |
863 } | 867 } |
864 | 868 |
865 TEST_F(FeatureInfoTest, InitializeWithES3) { | 869 TEST_F(FeatureInfoTest, InitializeWithES3) { |
866 SetupInitExpectationsWithGLVersion("", "OpenGL ES 3.0"); | 870 SetupInitExpectationsWithGLVersion("", "OpenGL ES 3.0"); |
867 EXPECT_TRUE(info_->feature_flags().enable_samplers); | 871 EXPECT_TRUE(info_->feature_flags().enable_samplers); |
868 EXPECT_TRUE(info_->feature_flags().map_buffer_range); | 872 EXPECT_TRUE(info_->feature_flags().map_buffer_range); |
869 EXPECT_TRUE(info_->feature_flags().ext_discard_framebuffer); | 873 EXPECT_TRUE(info_->feature_flags().ext_discard_framebuffer); |
870 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_discard_framebuffer")); | 874 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_discard_framebuffer")); |
| 875 EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample); |
| 876 EXPECT_TRUE(info_->feature_flags().core_framebuffer_multisample); |
| 877 EXPECT_THAT(info_->extensions(), |
| 878 HasSubstr("GL_CHROMIUM_framebuffer_multisample")); |
871 EXPECT_FALSE(info_->feature_flags().use_async_readpixels); | 879 EXPECT_FALSE(info_->feature_flags().use_async_readpixels); |
| 880 EXPECT_TRUE(info_->feature_flags().oes_depth24); |
| 881 EXPECT_THAT(info_->extensions(), HasSubstr("GL_GOOGLE_depth_texture")); |
| 882 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_depth_texture")); |
| 883 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT_24_8)); |
| 884 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT) |
| 885 .IsValid(GL_UNSIGNED_SHORT)); |
| 886 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT) |
| 887 .IsValid(GL_UNSIGNED_INT)); |
| 888 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_STENCIL) |
| 889 .IsValid(GL_UNSIGNED_INT_24_8)); |
| 890 EXPECT_TRUE(info_->feature_flags().packed_depth24_stencil8); |
| 891 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24")); |
| 892 EXPECT_TRUE( |
| 893 info_->validators()->render_buffer_format.IsValid(GL_DEPTH_COMPONENT24)); |
| 894 EXPECT_TRUE( |
| 895 info_->validators()->render_buffer_format.IsValid(GL_DEPTH24_STENCIL8)); |
| 896 EXPECT_TRUE( |
| 897 info_->validators()->texture_internal_format.IsValid(GL_DEPTH_STENCIL)); |
| 898 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL)); |
872 } | 899 } |
873 | 900 |
874 TEST_F(FeatureInfoTest, InitializeWithoutSamplers) { | 901 TEST_F(FeatureInfoTest, InitializeWithoutSamplers) { |
875 SetupInitExpectationsWithGLVersion("", "OpenGL GL 3.0"); | 902 SetupInitExpectationsWithGLVersion("", "OpenGL GL 3.0"); |
876 EXPECT_FALSE(info_->feature_flags().enable_samplers); | 903 EXPECT_FALSE(info_->feature_flags().enable_samplers); |
877 } | 904 } |
878 | 905 |
879 TEST_F(FeatureInfoTest, InitializeWithES3AndFences) { | 906 TEST_F(FeatureInfoTest, InitializeWithES3AndFences) { |
880 SetupInitExpectationsWithGLVersion("EGL_KHR_fence_sync", "OpenGL ES 3.0"); | 907 SetupInitExpectationsWithGLVersion("EGL_KHR_fence_sync", "OpenGL ES 3.0"); |
881 EXPECT_TRUE(info_->feature_flags().use_async_readpixels); | 908 EXPECT_TRUE(info_->feature_flags().use_async_readpixels); |
(...skipping 18 matching lines...) Expand all Loading... |
900 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096)); | 927 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096)); |
901 // Workarounds should get parsed without the need for a context. | 928 // Workarounds should get parsed without the need for a context. |
902 SetupWithCommandLine(command_line); | 929 SetupWithCommandLine(command_line); |
903 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); | 930 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); |
904 EXPECT_EQ(1024, info_->workarounds().max_cube_map_texture_size); | 931 EXPECT_EQ(1024, info_->workarounds().max_cube_map_texture_size); |
905 EXPECT_EQ(4096, info_->workarounds().max_texture_size); | 932 EXPECT_EQ(4096, info_->workarounds().max_texture_size); |
906 } | 933 } |
907 | 934 |
908 } // namespace gles2 | 935 } // namespace gles2 |
909 } // namespace gpu | 936 } // namespace gpu |
OLD | NEW |