Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 4702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4713 BindTexture cmd; | 4713 BindTexture cmd; |
| 4714 cmd.Init(GL_TEXTURE_1D, client_texture_id_); | 4714 cmd.Init(GL_TEXTURE_1D, client_texture_id_); |
| 4715 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4715 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4716 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 4716 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 4717 | 4717 |
| 4718 cmd.Init(GL_TEXTURE_3D, client_texture_id_); | 4718 cmd.Init(GL_TEXTURE_3D, client_texture_id_); |
| 4719 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4719 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4720 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 4720 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 4721 } | 4721 } |
| 4722 | 4722 |
| 4723 TEST_P(GLES3DecoderTest, TexSwizzleValid) { | |
|
Ken Russell (switch to Gerrit)
2016/12/01 22:46:27
A test is needed of passing an invalid swizzle val
| |
| 4724 const GLenum kTarget = GL_TEXTURE_2D; | |
| 4725 const GLenum kSwizzleParam = GL_TEXTURE_SWIZZLE_R; | |
| 4726 const GLenum kSwizzleValue = GL_BLUE; | |
| 4727 | |
| 4728 { | |
| 4729 EXPECT_CALL(*gl_, TexParameteri(kTarget, kSwizzleParam, kSwizzleValue)); | |
| 4730 TexParameteri cmd; | |
| 4731 cmd.Init(kTarget, kSwizzleParam, kSwizzleValue); | |
| 4732 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
| 4733 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
| 4734 } | |
| 4735 | |
| 4736 { | |
| 4737 EXPECT_CALL(*gl_, GetError()) | |
| 4738 .WillOnce(Return(GL_NO_ERROR)) | |
| 4739 .WillOnce(Return(GL_NO_ERROR)) | |
| 4740 .RetiresOnSaturation(); | |
| 4741 typedef GetTexParameteriv::Result Result; | |
| 4742 Result* result = static_cast<Result*>(shared_memory_address_); | |
| 4743 result->size = 0; | |
| 4744 GetTexParameteriv cmd; | |
| 4745 cmd.Init(kTarget, kSwizzleParam, shared_memory_id_, shared_memory_offset_); | |
| 4746 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
| 4747 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(kSwizzleParam), | |
| 4748 result->GetNumResults()); | |
| 4749 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
| 4750 EXPECT_EQ(kSwizzleValue, static_cast<GLenum>(result->GetData()[0])); | |
| 4751 } | |
| 4752 } | |
| 4753 | |
| 4754 TEST_P(WebGL2DecoderTest, TexSwizzleDisabled) { | |
| 4755 const GLenum kTarget = GL_TEXTURE_2D; | |
| 4756 const GLenum kSwizzleParam = GL_TEXTURE_SWIZZLE_R; | |
| 4757 const GLenum kSwizzleValue = GL_BLUE; | |
| 4758 | |
| 4759 { | |
| 4760 TexParameteri cmd; | |
| 4761 cmd.Init(kTarget, kSwizzleParam, kSwizzleValue); | |
| 4762 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
| 4763 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | |
| 4764 } | |
| 4765 | |
| 4766 { | |
| 4767 typedef GetTexParameteriv::Result Result; | |
| 4768 Result* result = static_cast<Result*>(shared_memory_address_); | |
| 4769 result->size = 0; | |
| 4770 GetTexParameteriv cmd; | |
| 4771 cmd.Init(kTarget, kSwizzleParam, shared_memory_id_, shared_memory_offset_); | |
| 4772 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
| 4773 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | |
| 4774 } | |
| 4775 } | |
| 4776 | |
| 4723 // TODO(gman): Complete this test. | 4777 // TODO(gman): Complete this test. |
| 4724 // TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) { | 4778 // TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) { |
| 4725 // } | 4779 // } |
| 4726 | 4780 |
| 4727 // TODO(gman): CompressedTexImage2D | 4781 // TODO(gman): CompressedTexImage2D |
| 4728 | 4782 |
| 4729 // TODO(gman): CompressedTexImage2DImmediate | 4783 // TODO(gman): CompressedTexImage2DImmediate |
| 4730 | 4784 |
| 4731 // TODO(gman): CompressedTexSubImage2DImmediate | 4785 // TODO(gman): CompressedTexSubImage2DImmediate |
| 4732 | 4786 |
| 4733 // TODO(gman): TexImage2D | 4787 // TODO(gman): TexImage2D |
| 4734 | 4788 |
| 4735 // TODO(gman): TexImage2DImmediate | 4789 // TODO(gman): TexImage2DImmediate |
| 4736 | 4790 |
| 4737 // TODO(gman): TexSubImage2DImmediate | 4791 // TODO(gman): TexSubImage2DImmediate |
| 4738 | 4792 |
| 4739 } // namespace gles2 | 4793 } // namespace gles2 |
| 4740 } // namespace gpu | 4794 } // namespace gpu |
| OLD | NEW |