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

Unified Diff: gpu/command_buffer/service/feature_info_unittest.cc

Issue 72173002: gpu: Support ES3 msaa and depth/stencil formats (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment, rebase Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/feature_info_unittest.cc
diff --git a/gpu/command_buffer/service/feature_info_unittest.cc b/gpu/command_buffer/service/feature_info_unittest.cc
index 041ab36c916e0d4864e90a41360b5192d1422615..8164b3580ac254999a4b03f56641bd64a2f60718 100644
--- a/gpu/command_buffer/service/feature_info_unittest.cc
+++ b/gpu/command_buffer/service/feature_info_unittest.cc
@@ -32,19 +32,23 @@ using ::testing::StrictMock;
namespace gpu {
namespace gles2 {
+namespace {
+const char kGLRendererStringANGLE[] = "ANGLE (some renderer)";
+} // anonymous namespace
+
class FeatureInfoTest : public testing::Test {
public:
FeatureInfoTest() {
}
void SetupInitExpectations(const char* extensions) {
- SetupInitExpectationsWithGLVersion(extensions, "");
+ SetupInitExpectationsWithGLVersion(extensions, "", "");
}
void SetupInitExpectationsWithGLVersion(
- const char* extensions, const char* version) {
+ const char* extensions, const char* renderer, const char* version) {
TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
- gl_.get(), extensions, version);
+ gl_.get(), extensions, renderer, version);
info_ = new FeatureInfo();
info_->Initialize();
}
@@ -56,7 +60,7 @@ class FeatureInfoTest : public testing::Test {
void SetupInitExpectationsWithCommandLine(
const char* extensions, const CommandLine& command_line) {
TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
- gl_.get(), extensions, "");
+ gl_.get(), extensions, "", "");
info_ = new FeatureInfo(command_line);
info_->Initialize();
}
@@ -95,6 +99,7 @@ TEST_F(FeatureInfoTest, Basic) {
SetupWithoutInit();
// Test it starts off uninitialized.
EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample);
+ EXPECT_FALSE(info_->feature_flags().use_core_framebuffer_multisample);
EXPECT_FALSE(info_->feature_flags().multisampled_render_to_texture);
EXPECT_FALSE(info_->feature_flags(
).use_img_for_multisampled_render_to_texture);
@@ -103,6 +108,8 @@ TEST_F(FeatureInfoTest, Basic) {
EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear);
EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear);
EXPECT_FALSE(info_->feature_flags().oes_egl_image_external);
+ EXPECT_FALSE(info_->feature_flags().oes_depth24);
+ EXPECT_FALSE(info_->feature_flags().packed_depth24_stencil8);
EXPECT_FALSE(info_->feature_flags().chromium_stream_texture);
EXPECT_FALSE(info_->feature_flags().angle_translated_shader_source);
EXPECT_FALSE(info_->feature_flags().angle_pack_reverse_row_order);
@@ -118,6 +125,7 @@ TEST_F(FeatureInfoTest, Basic) {
EXPECT_FALSE(info_->feature_flags().use_async_readpixels);
EXPECT_FALSE(info_->feature_flags().ext_discard_framebuffer);
EXPECT_FALSE(info_->feature_flags().angle_depth_texture);
+ EXPECT_FALSE(info_->feature_flags().is_angle);
#define GPU_OP(type, name) EXPECT_FALSE(info_->workarounds().name);
GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
@@ -289,6 +297,11 @@ TEST_F(FeatureInfoTest, InitializeNoExtensions) {
GL_DEPTH24_STENCIL8_OES));
}
+TEST_F(FeatureInfoTest, InitializeWithANGLE) {
+ SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE, "");
+ EXPECT_TRUE(info_->feature_flags().is_angle);
+}
+
TEST_F(FeatureInfoTest, InitializeNPOTExtensionGLES) {
SetupInitExpectations("GL_OES_texture_npot");
EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_npot"));
@@ -548,6 +561,44 @@ TEST_F(FeatureInfoTest, InitializeEXT_framebuffer_multisample) {
GL_RENDERBUFFER_SAMPLES_EXT));
}
+TEST_F(FeatureInfoTest, InitializeANGLE_framebuffer_multisample) {
+ SetupInitExpectationsWithGLVersion(
+ "GL_ANGLE_framebuffer_multisample", kGLRendererStringANGLE, "");
+ EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample);
+ EXPECT_THAT(info_->extensions(),
+ HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
+ EXPECT_TRUE(info_->validators()->frame_buffer_target.IsValid(
+ GL_READ_FRAMEBUFFER_EXT));
+ EXPECT_TRUE(info_->validators()->frame_buffer_target.IsValid(
+ GL_DRAW_FRAMEBUFFER_EXT));
+ EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
+ GL_READ_FRAMEBUFFER_BINDING_EXT));
+ EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
+ GL_MAX_SAMPLES_EXT));
+ EXPECT_TRUE(info_->validators()->render_buffer_parameter.IsValid(
+ GL_RENDERBUFFER_SAMPLES_EXT));
+}
+
+// We don't allow ANGLE_framebuffer_multisample on non-ANGLE implementations,
+// because we wouldn't be choosing the right driver entry point and because the
+// extension was falsely advertised on some Android devices (crbug.com/165736).
+TEST_F(FeatureInfoTest, InitializeANGLE_framebuffer_multisampleWithoutANGLE) {
+ SetupInitExpectations("GL_ANGLE_framebuffer_multisample");
+ EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample);
+ EXPECT_THAT(info_->extensions(),
+ Not(HasSubstr("GL_CHROMIUM_framebuffer_multisample")));
+ EXPECT_FALSE(info_->validators()->frame_buffer_target.IsValid(
+ GL_READ_FRAMEBUFFER_EXT));
+ EXPECT_FALSE(info_->validators()->frame_buffer_target.IsValid(
+ GL_DRAW_FRAMEBUFFER_EXT));
+ EXPECT_FALSE(info_->validators()->g_l_state.IsValid(
+ GL_READ_FRAMEBUFFER_BINDING_EXT));
+ EXPECT_FALSE(info_->validators()->g_l_state.IsValid(
+ GL_MAX_SAMPLES_EXT));
+ EXPECT_FALSE(info_->validators()->render_buffer_parameter.IsValid(
+ GL_RENDERBUFFER_SAMPLES_EXT));
+}
+
TEST_F(FeatureInfoTest, InitializeEXT_multisampled_render_to_texture) {
SetupInitExpectations("GL_EXT_multisampled_render_to_texture");
EXPECT_TRUE(info_->feature_flags(
@@ -708,6 +759,7 @@ TEST_F(FeatureInfoTest,
TEST_F(FeatureInfoTest, InitializeOES_depth24) {
SetupInitExpectations("GL_OES_depth24");
+ EXPECT_TRUE(info_->feature_flags().oes_depth24);
EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24"));
EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
GL_DEPTH_COMPONENT24));
@@ -860,26 +912,50 @@ TEST_F(FeatureInfoTest, InitializeEXT_discard_framebuffer) {
}
TEST_F(FeatureInfoTest, InitializeSamplersWithARBSamplerObjects) {
- SetupInitExpectationsWithGLVersion("GL_ARB_sampler_objects", "OpenGL 3.0");
+ SetupInitExpectationsWithGLVersion(
+ "GL_ARB_sampler_objects", "", "OpenGL 3.0");
EXPECT_TRUE(info_->feature_flags().enable_samplers);
}
TEST_F(FeatureInfoTest, InitializeWithES3) {
- SetupInitExpectationsWithGLVersion("", "OpenGL ES 3.0");
+ SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
EXPECT_TRUE(info_->feature_flags().enable_samplers);
EXPECT_TRUE(info_->feature_flags().map_buffer_range);
EXPECT_TRUE(info_->feature_flags().ext_discard_framebuffer);
EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
+ EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample);
+ EXPECT_TRUE(info_->feature_flags().use_core_framebuffer_multisample);
+ EXPECT_THAT(info_->extensions(),
+ HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
EXPECT_FALSE(info_->feature_flags().use_async_readpixels);
+ EXPECT_TRUE(info_->feature_flags().oes_depth24);
+ EXPECT_THAT(info_->extensions(), HasSubstr("GL_GOOGLE_depth_texture"));
+ EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_depth_texture"));
+ EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT_24_8));
+ EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT)
+ .IsValid(GL_UNSIGNED_SHORT));
+ EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT)
+ .IsValid(GL_UNSIGNED_INT));
+ EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_STENCIL)
+ .IsValid(GL_UNSIGNED_INT_24_8));
+ EXPECT_TRUE(info_->feature_flags().packed_depth24_stencil8);
+ EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24"));
+ EXPECT_TRUE(
+ info_->validators()->render_buffer_format.IsValid(GL_DEPTH_COMPONENT24));
+ EXPECT_TRUE(
+ info_->validators()->render_buffer_format.IsValid(GL_DEPTH24_STENCIL8));
+ EXPECT_TRUE(
+ info_->validators()->texture_internal_format.IsValid(GL_DEPTH_STENCIL));
+ EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
}
TEST_F(FeatureInfoTest, InitializeWithoutSamplers) {
- SetupInitExpectationsWithGLVersion("", "OpenGL GL 3.0");
+ SetupInitExpectationsWithGLVersion("", "", "OpenGL GL 3.0");
EXPECT_FALSE(info_->feature_flags().enable_samplers);
}
TEST_F(FeatureInfoTest, InitializeWithES3AndFences) {
- SetupInitExpectationsWithGLVersion("EGL_KHR_fence_sync", "OpenGL ES 3.0");
+ SetupInitExpectationsWithGLVersion("EGL_KHR_fence_sync", "", "OpenGL ES 3.0");
EXPECT_TRUE(info_->feature_flags().use_async_readpixels);
}
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698