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

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

Issue 224763002: Remove default textures in (!bind_generates_resource) context groups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use kBindGeneratesResource in context_group_unittest.cc. Created 6 years, 9 months 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/test_helper.h ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/test_helper.cc
diff --git a/gpu/command_buffer/service/test_helper.cc b/gpu/command_buffer/service/test_helper.cc
index 79c29c54fb7f7e118f038f8b21deb45704bfa861..a3a64ca40b9b7e8fd0c406fa276c780e8c485a3d 100644
--- a/gpu/command_buffer/service/test_helper.cc
+++ b/gpu/command_buffer/service/test_helper.cc
@@ -61,7 +61,9 @@ const GLint TestHelper::kMaxVertexUniformComponents;
#endif
void TestHelper::SetupTextureInitializationExpectations(
- ::gfx::MockGLInterface* gl, GLenum target) {
+ ::gfx::MockGLInterface* gl,
+ GLenum target,
+ bool use_default_textures) {
InSequence sequence;
bool needs_initialization = (target != GL_TEXTURE_EXTERNAL_OES);
@@ -98,7 +100,7 @@ void TestHelper::SetupTextureInitializationExpectations(
NOTREACHED();
}
- int array_size = 2;
+ int array_size = use_default_textures ? 2 : 1;
EXPECT_CALL(*gl, GenTextures(array_size, _))
.WillOnce(SetArrayArgument<1>(texture_ids,
@@ -139,11 +141,14 @@ void TestHelper::SetupTextureInitializationExpectations(
void TestHelper::SetupTextureManagerInitExpectations(
::gfx::MockGLInterface* gl,
- const char* extensions) {
+ const char* extensions,
+ bool use_default_textures) {
InSequence sequence;
- SetupTextureInitializationExpectations(gl, GL_TEXTURE_2D);
- SetupTextureInitializationExpectations(gl, GL_TEXTURE_CUBE_MAP);
+ SetupTextureInitializationExpectations(
+ gl, GL_TEXTURE_2D, use_default_textures);
+ SetupTextureInitializationExpectations(
+ gl, GL_TEXTURE_CUBE_MAP, use_default_textures);
bool ext_image_external = false;
bool arb_texture_rectangle = false;
@@ -160,15 +165,22 @@ void TestHelper::SetupTextureManagerInitExpectations(
}
if (ext_image_external) {
- SetupTextureInitializationExpectations(gl, GL_TEXTURE_EXTERNAL_OES);
+ SetupTextureInitializationExpectations(
+ gl, GL_TEXTURE_EXTERNAL_OES, use_default_textures);
}
if (arb_texture_rectangle) {
- SetupTextureInitializationExpectations(gl, GL_TEXTURE_RECTANGLE_ARB);
+ SetupTextureInitializationExpectations(
+ gl, GL_TEXTURE_RECTANGLE_ARB, use_default_textures);
}
}
void TestHelper::SetupTextureDestructionExpectations(
- ::gfx::MockGLInterface* gl, GLenum target) {
+ ::gfx::MockGLInterface* gl,
+ GLenum target,
+ bool use_default_textures) {
+ if (!use_default_textures)
+ return;
+
GLuint texture_id = 0;
switch (target) {
case GL_TEXTURE_2D:
@@ -194,9 +206,11 @@ void TestHelper::SetupTextureDestructionExpectations(
void TestHelper::SetupTextureManagerDestructionExpectations(
::gfx::MockGLInterface* gl,
- const char* extensions) {
- SetupTextureDestructionExpectations(gl, GL_TEXTURE_2D);
- SetupTextureDestructionExpectations(gl, GL_TEXTURE_CUBE_MAP);
+ const char* extensions,
+ bool use_default_textures) {
+ SetupTextureDestructionExpectations(gl, GL_TEXTURE_2D, use_default_textures);
+ SetupTextureDestructionExpectations(
+ gl, GL_TEXTURE_CUBE_MAP, use_default_textures);
bool ext_image_external = false;
bool arb_texture_rectangle = false;
@@ -213,10 +227,12 @@ void TestHelper::SetupTextureManagerDestructionExpectations(
}
if (ext_image_external) {
- SetupTextureDestructionExpectations(gl, GL_TEXTURE_EXTERNAL_OES);
+ SetupTextureDestructionExpectations(
+ gl, GL_TEXTURE_EXTERNAL_OES, use_default_textures);
}
if (arb_texture_rectangle) {
- SetupTextureDestructionExpectations(gl, GL_TEXTURE_RECTANGLE_ARB);
+ SetupTextureDestructionExpectations(
+ gl, GL_TEXTURE_RECTANGLE_ARB, use_default_textures);
}
EXPECT_CALL(*gl, DeleteTextures(4, _))
@@ -225,10 +241,11 @@ void TestHelper::SetupTextureManagerDestructionExpectations(
}
void TestHelper::SetupContextGroupInitExpectations(
- ::gfx::MockGLInterface* gl,
- const DisallowedFeatures& disallowed_features,
- const char* extensions,
- const char* gl_version) {
+ ::gfx::MockGLInterface* gl,
+ const DisallowedFeatures& disallowed_features,
+ const char* extensions,
+ const char* gl_version,
+ bool bind_generates_resource) {
InSequence sequence;
SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", gl_version);
@@ -277,7 +294,8 @@ void TestHelper::SetupContextGroupInitExpectations(
.WillOnce(SetArgumentPointee<1>(kMaxVertexUniformComponents))
.RetiresOnSaturation();
- SetupTextureManagerInitExpectations(gl, extensions);
+ bool use_default_textures = bind_generates_resource;
+ SetupTextureManagerInitExpectations(gl, extensions, use_default_textures);
}
void TestHelper::SetupFeatureInfoInitExpectations(
« no previous file with comments | « gpu/command_buffer/service/test_helper.h ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698