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

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

Issue 2827573007: Reset TexImage2D base level to workaround Intel mac driver bug (Closed)
Patch Set: Add gpu unittests Created 3 years, 6 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 4700 matching lines...) Expand 10 before | Expand all | Expand 10 after
4711 4711
4712 // Re-locking should delete the previous resource (preserving the generated 4712 // Re-locking should delete the previous resource (preserving the generated
4713 // one). 4713 // one).
4714 EXPECT_CALL(*gl_, DeleteTextures(1, Pointee(kServiceTextureId))) 4714 EXPECT_CALL(*gl_, DeleteTextures(1, Pointee(kServiceTextureId)))
4715 .RetiresOnSaturation(); 4715 .RetiresOnSaturation();
4716 DoLockDiscardableTextureCHROMIUM(client_texture_id_); 4716 DoLockDiscardableTextureCHROMIUM(client_texture_id_);
4717 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kNewServiceId); 4717 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kNewServiceId);
4718 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 4718 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4719 } 4719 }
4720 4720
4721 // Test texture base level is set before texImage2D when workaround
4722 // RESET_TEXIMAGE2D_BASE_LEVEL is enabled
4723 TEST_P(GLES3DecoderManualInitTest, SetTextureBaseLevelBeforeTexImage2D) {
4724 base::CommandLine command_line(0, nullptr);
4725 command_line.AppendSwitchASCII(
4726 switches::kGpuDriverBugWorkarounds,
4727 base::IntToString(gpu::SET_ZERO_LEVEL_BEFORE_GENERATING_MIPMAP) + "," +
4728 base::IntToString(gpu::RESET_TEXIMAGE2D_BASE_LEVEL));
4729 InitState init;
4730 init.gl_version = "OpenGL ES 3.0";
4731 init.bind_generates_resource = true;
4732 init.context_type = CONTEXT_TYPE_OPENGLES3;
4733 InitDecoderWithCommandLine(init, &command_line);
4734
4735 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)).Times(0);
4736 GLint base_level = 2;
4737 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
4738 DoTexImage2D(GL_TEXTURE_2D, base_level, GL_RGBA, 2, 2, 0, GL_RGBA,
4739 GL_UNSIGNED_BYTE, 0, 0);
4740 SetupClearTextureExpectations(kServiceTextureId, kServiceTextureId,
4741 GL_TEXTURE_2D, GL_TEXTURE_2D, base_level,
4742 GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0, 2, 2);
4743 DoTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
4744 DoTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
4745 DoTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, base_level);
4746 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0))
4747 .Times(1)
4748 .RetiresOnSaturation();
4749 EXPECT_CALL(*gl_, TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA,
4750 GL_UNSIGNED_BYTE, nullptr))
4751 .Times(1)
4752 .RetiresOnSaturation();
4753 EXPECT_CALL(*gl_,
4754 TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, base_level))
4755 .Times(1)
4756 .RetiresOnSaturation();
4757 EXPECT_CALL(*gl_, GenerateMipmapEXT(GL_TEXTURE_2D))
4758 .Times(1)
4759 .RetiresOnSaturation();
4760 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0))
4761 .Times(1)
4762 .RetiresOnSaturation();
4763 EXPECT_CALL(*gl_, TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 0, GL_RGBA,
4764 GL_UNSIGNED_BYTE, nullptr))
4765 .Times(1)
4766 .RetiresOnSaturation();
4767 EXPECT_CALL(*gl_,
4768 TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, base_level))
4769 .Times(1)
4770 .RetiresOnSaturation();
4771 EXPECT_CALL(*gl_, GetError())
4772 .WillOnce(Return(GL_NO_ERROR))
4773 .WillOnce(Return(GL_NO_ERROR))
4774 .RetiresOnSaturation();
4775 GenerateMipmap cmd;
4776 cmd.Init(GL_TEXTURE_2D);
4777 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4778 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4779 }
4780
4721 // TODO(gman): Complete this test. 4781 // TODO(gman): Complete this test.
4722 // TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) { 4782 // TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) {
4723 // } 4783 // }
4724 4784
4725 // TODO(gman): CompressedTexImage2D 4785 // TODO(gman): CompressedTexImage2D
4726 4786
4727 // TODO(gman): CompressedTexImage2DImmediate 4787 // TODO(gman): CompressedTexImage2DImmediate
4728 4788
4729 // TODO(gman): CompressedTexSubImage2DImmediate 4789 // TODO(gman): CompressedTexSubImage2DImmediate
4730 4790
4731 // TODO(gman): TexImage2D 4791 // TODO(gman): TexImage2D
4732 4792
4733 // TODO(gman): TexImage2DImmediate 4793 // TODO(gman): TexImage2DImmediate
4734 4794
4735 // TODO(gman): TexSubImage2DImmediate 4795 // TODO(gman): TexSubImage2DImmediate
4736 4796
4737 } // namespace gles2 4797 } // namespace gles2
4738 } // namespace gpu 4798 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698