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 "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 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 kInvalidSharedMemoryId, | 1838 kInvalidSharedMemoryId, |
1839 kSharedMemoryOffset); | 1839 kSharedMemoryOffset); |
1840 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 1840 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
1841 cmd.Init(client_program_id_, | 1841 cmd.Init(client_program_id_, |
1842 kBucketId, | 1842 kBucketId, |
1843 kSharedMemoryId, | 1843 kSharedMemoryId, |
1844 kInvalidSharedMemoryOffset); | 1844 kInvalidSharedMemoryOffset); |
1845 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 1845 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
1846 } | 1846 } |
1847 | 1847 |
1848 TEST_P(GLES2DecoderWithShaderTest, GetFragDataLocation) { | 1848 TEST_P(GLES3DecoderWithESSL3ShaderTest, GetFragDataLocation) { |
1849 const uint32 kBucketId = 123; | 1849 const uint32 kBucketId = 123; |
1850 const GLint kLocation = 10; | 1850 const GLint kLocation = 10; |
1851 const char* kName = "color"; | |
1852 typedef GetFragDataLocation::Result Result; | 1851 typedef GetFragDataLocation::Result Result; |
1853 Result* result = GetSharedMemoryAs<Result*>(); | 1852 Result* result = GetSharedMemoryAs<Result*>(); |
1854 SetBucketAsCString(kBucketId, kName); | 1853 SetBucketAsCString(kBucketId, kOutputVariable1NameESSL3); |
1855 *result = -1; | 1854 *result = -1; |
1856 GetFragDataLocation cmd; | 1855 GetFragDataLocation cmd; |
1857 cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); | 1856 cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); |
1858 EXPECT_CALL(*gl_, GetFragDataLocation(kServiceProgramId, StrEq(kName))) | 1857 EXPECT_CALL(*gl_, GetFragDataLocation(kServiceProgramId, |
| 1858 StrEq(kOutputVariable1NameESSL3))) |
1859 .WillOnce(Return(kLocation)) | 1859 .WillOnce(Return(kLocation)) |
1860 .RetiresOnSaturation(); | 1860 .RetiresOnSaturation(); |
1861 decoder_->set_unsafe_es3_apis_enabled(true); | 1861 decoder_->set_unsafe_es3_apis_enabled(true); |
1862 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1862 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1863 EXPECT_EQ(kLocation, *result); | 1863 EXPECT_EQ(kLocation, *result); |
1864 decoder_->set_unsafe_es3_apis_enabled(false); | 1864 decoder_->set_unsafe_es3_apis_enabled(false); |
1865 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); | 1865 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); |
1866 } | 1866 } |
1867 | 1867 |
1868 TEST_P(GLES2DecoderWithShaderTest, GetFragDataLocationInvalidArgs) { | 1868 TEST_P(GLES3DecoderWithESSL3ShaderTest, GetFragDataLocationInvalidArgs) { |
1869 const uint32 kBucketId = 123; | 1869 const uint32 kBucketId = 123; |
1870 typedef GetFragDataLocation::Result Result; | 1870 typedef GetFragDataLocation::Result Result; |
1871 Result* result = GetSharedMemoryAs<Result*>(); | 1871 Result* result = GetSharedMemoryAs<Result*>(); |
1872 *result = -1; | 1872 *result = -1; |
1873 GetFragDataLocation cmd; | 1873 GetFragDataLocation cmd; |
1874 decoder_->set_unsafe_es3_apis_enabled(true); | 1874 decoder_->set_unsafe_es3_apis_enabled(true); |
1875 // Check no bucket | 1875 // Check no bucket |
1876 cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); | 1876 cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); |
1877 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 1877 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
1878 EXPECT_EQ(-1, *result); | 1878 EXPECT_EQ(-1, *result); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2115 } | 2115 } |
2116 | 2116 |
2117 // TODO(gman): DeleteProgram | 2117 // TODO(gman): DeleteProgram |
2118 | 2118 |
2119 // TODO(gman): UseProgram | 2119 // TODO(gman): UseProgram |
2120 | 2120 |
2121 // TODO(gman): DeleteShader | 2121 // TODO(gman): DeleteShader |
2122 | 2122 |
2123 } // namespace gles2 | 2123 } // namespace gles2 |
2124 } // namespace gpu | 2124 } // namespace gpu |
OLD | NEW |