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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc

Issue 1095893002: gpu: Fix some context lost marking glitches+leaks and add UMA stats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: kbr's comment Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" 9 #include "gpu/command_buffer/common/gles2_cmd_format.h"
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 AddExpectationsForSimulatedAttrib0WithError( 732 AddExpectationsForSimulatedAttrib0WithError(
733 kFakeLargeCount, 0, GL_OUT_OF_MEMORY); 733 kFakeLargeCount, 0, GL_OUT_OF_MEMORY);
734 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); 734 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation();
735 DrawArrays cmd; 735 DrawArrays cmd;
736 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount); 736 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount);
737 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 737 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
738 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); 738 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError());
739 EXPECT_FALSE(GetDecoder()->WasContextLost()); 739 EXPECT_FALSE(GetDecoder()->WasContextLost());
740 } 740 }
741 741
742 // Test that we lose context.
743 TEST_P(GLES2DecoderManualInitTest, LoseContextWhenOOM) {
744 InitState init;
745 init.has_alpha = true;
746 init.has_depth = true;
747 init.request_alpha = true;
748 init.request_depth = true;
749 init.bind_generates_resource = true;
750 init.lose_context_when_out_of_memory = true;
751 InitDecoder(init);
752 SetupDefaultProgram();
753
754 const GLsizei kFakeLargeCount = 0x1234;
755 SetupTexture();
756 AddExpectationsForSimulatedAttrib0WithError(
757 kFakeLargeCount, 0, GL_OUT_OF_MEMORY);
758 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation();
759 // Other contexts in the group should be lost also.
760 EXPECT_CALL(*mock_decoder_, LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB))
761 .Times(1)
762 .RetiresOnSaturation();
763 DrawArrays cmd;
764 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount);
765 // This context should be lost.
766 EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd));
767 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError());
768 EXPECT_TRUE(decoder_->WasContextLost());
769 }
770
771 TEST_P(GLES2DecoderWithShaderTest, DrawArraysBadTextureUsesBlack) { 742 TEST_P(GLES2DecoderWithShaderTest, DrawArraysBadTextureUsesBlack) {
772 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 743 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
773 // This is an NPOT texture. As the default filtering requires mips 744 // This is an NPOT texture. As the default filtering requires mips
774 // this should trigger replacing with black textures before rendering. 745 // this should trigger replacing with black textures before rendering.
775 DoTexImage2D(GL_TEXTURE_2D, 746 DoTexImage2D(GL_TEXTURE_2D,
776 0, 747 0,
777 GL_RGBA, 748 GL_RGBA,
778 3, 749 3,
779 1, 750 1,
780 0, 751 0,
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 .Times(1) 2352 .Times(1)
2382 .RetiresOnSaturation(); 2353 .RetiresOnSaturation();
2383 DrawArrays cmd; 2354 DrawArrays cmd;
2384 cmd.Init(GL_TRIANGLES, 0, kNumVertices); 2355 cmd.Init(GL_TRIANGLES, 0, kNumVertices);
2385 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2356 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2386 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2357 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2387 } 2358 }
2388 2359
2389 } // namespace gles2 2360 } // namespace gles2
2390 } // namespace gpu 2361 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_context_lost.cc ('k') | gpu/command_buffer/tests/gl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698