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

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

Issue 2543033002: Add texture swizzle back to command buffer. (Closed)
Patch Set: add swizzle value negative test Created 4 years 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
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4702 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, TexSwizzleAllowed) {
4724 const GLenum kTarget = GL_TEXTURE_2D;
4725 const GLenum kSwizzleParam = GL_TEXTURE_SWIZZLE_R;
4726 const GLenum kSwizzleValue = GL_BLUE;
4727 const GLenum kInvalidSwizzleValue = GL_RG;
4728
4729 {
4730 EXPECT_CALL(*gl_, TexParameteri(kTarget, kSwizzleParam, kSwizzleValue));
4731 TexParameteri cmd;
4732 cmd.Init(kTarget, kSwizzleParam, kSwizzleValue);
4733 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4734 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4735 }
4736
4737 {
4738 TexParameteri cmd;
4739 cmd.Init(kTarget, kSwizzleParam, kInvalidSwizzleValue);
4740 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4741 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
4742 }
4743
4744 {
4745 EXPECT_CALL(*gl_, GetError())
4746 .WillOnce(Return(GL_NO_ERROR))
4747 .WillOnce(Return(GL_NO_ERROR))
4748 .RetiresOnSaturation();
4749 typedef GetTexParameteriv::Result Result;
4750 Result* result = static_cast<Result*>(shared_memory_address_);
4751 result->size = 0;
4752 GetTexParameteriv cmd;
4753 cmd.Init(kTarget, kSwizzleParam, shared_memory_id_, shared_memory_offset_);
4754 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4755 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(kSwizzleParam),
4756 result->GetNumResults());
4757 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4758 EXPECT_EQ(kSwizzleValue, static_cast<GLenum>(result->GetData()[0]));
4759 }
4760 }
4761
4762 TEST_P(WebGL2DecoderTest, TexSwizzleDisabled) {
4763 const GLenum kTarget = GL_TEXTURE_2D;
4764 const GLenum kSwizzleParam = GL_TEXTURE_SWIZZLE_R;
4765 const GLenum kSwizzleValue = GL_BLUE;
4766
4767 {
4768 TexParameteri cmd;
4769 cmd.Init(kTarget, kSwizzleParam, kSwizzleValue);
4770 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4771 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
4772 }
4773
4774 {
4775 typedef GetTexParameteriv::Result Result;
4776 Result* result = static_cast<Result*>(shared_memory_address_);
4777 result->size = 0;
4778 GetTexParameteriv cmd;
4779 cmd.Init(kTarget, kSwizzleParam, shared_memory_id_, shared_memory_offset_);
4780 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4781 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
4782 }
4783 }
4784
4723 // TODO(gman): Complete this test. 4785 // TODO(gman): Complete this test.
4724 // TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) { 4786 // TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) {
4725 // } 4787 // }
4726 4788
4727 // TODO(gman): CompressedTexImage2D 4789 // TODO(gman): CompressedTexImage2D
4728 4790
4729 // TODO(gman): CompressedTexImage2DImmediate 4791 // TODO(gman): CompressedTexImage2DImmediate
4730 4792
4731 // TODO(gman): CompressedTexSubImage2DImmediate 4793 // TODO(gman): CompressedTexSubImage2DImmediate
4732 4794
4733 // TODO(gman): TexImage2D 4795 // TODO(gman): TexImage2D
4734 4796
4735 // TODO(gman): TexImage2DImmediate 4797 // TODO(gman): TexImage2DImmediate
4736 4798
4737 // TODO(gman): TexSubImage2DImmediate 4799 // TODO(gman): TexSubImage2DImmediate
4738 4800
4739 } // namespace gles2 4801 } // namespace gles2
4740 } // namespace gpu 4802 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698