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 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 kInvalidSharedMemoryId, | 2009 kInvalidSharedMemoryId, |
2010 kSharedMemoryOffset); | 2010 kSharedMemoryOffset); |
2011 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 2011 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
2012 cmd.Init(client_program_id_, | 2012 cmd.Init(client_program_id_, |
2013 kBucketId, | 2013 kBucketId, |
2014 kSharedMemoryId, | 2014 kSharedMemoryId, |
2015 kInvalidSharedMemoryOffset); | 2015 kInvalidSharedMemoryOffset); |
2016 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 2016 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
2017 } | 2017 } |
2018 | 2018 |
2019 TEST_P(GLES2DecoderWithShaderTest, GetFragDataLocation) { | 2019 TEST_P(GLES3DecoderWithESSL3ShaderTest, GetFragDataLocation) { |
2020 const uint32 kBucketId = 123; | 2020 const uint32 kBucketId = 123; |
2021 const GLint kLocation = 10; | |
2022 const char* kName = "color"; | |
2023 typedef GetFragDataLocation::Result Result; | 2021 typedef GetFragDataLocation::Result Result; |
2024 Result* result = GetSharedMemoryAs<Result*>(); | 2022 Result* result = GetSharedMemoryAs<Result*>(); |
2025 SetBucketAsCString(kBucketId, kName); | 2023 SetBucketAsCString(kBucketId, kOutputVariable1NameESSL3); |
2026 *result = -1; | 2024 *result = -1; |
2027 GetFragDataLocation cmd; | 2025 GetFragDataLocation cmd; |
2028 cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); | 2026 cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); |
2029 EXPECT_CALL(*gl_, GetFragDataLocation(kServiceProgramId, StrEq(kName))) | |
2030 .WillOnce(Return(kLocation)) | |
2031 .RetiresOnSaturation(); | |
2032 decoder_->set_unsafe_es3_apis_enabled(true); | 2027 decoder_->set_unsafe_es3_apis_enabled(true); |
2033 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2028 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2034 EXPECT_EQ(kLocation, *result); | 2029 EXPECT_EQ(static_cast<GLint>(kOutputVariable1ColorName), *result); |
2035 decoder_->set_unsafe_es3_apis_enabled(false); | 2030 decoder_->set_unsafe_es3_apis_enabled(false); |
2036 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); | 2031 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); |
2037 } | 2032 } |
2038 | 2033 |
2039 TEST_P(GLES2DecoderWithShaderTest, GetFragDataLocationInvalidArgs) { | 2034 TEST_P(GLES3DecoderWithESSL3ShaderTest, GetFragDataLocationInvalidArgs) { |
2040 const uint32 kBucketId = 123; | 2035 const uint32 kBucketId = 123; |
2041 typedef GetFragDataLocation::Result Result; | 2036 typedef GetFragDataLocation::Result Result; |
2042 Result* result = GetSharedMemoryAs<Result*>(); | 2037 Result* result = GetSharedMemoryAs<Result*>(); |
2043 *result = -1; | 2038 *result = -1; |
2044 GetFragDataLocation cmd; | 2039 GetFragDataLocation cmd; |
2045 decoder_->set_unsafe_es3_apis_enabled(true); | 2040 decoder_->set_unsafe_es3_apis_enabled(true); |
2046 // Check no bucket | 2041 // Check no bucket |
2047 cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); | 2042 cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset); |
2048 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 2043 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
2049 EXPECT_EQ(-1, *result); | 2044 EXPECT_EQ(-1, *result); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2286 } | 2281 } |
2287 | 2282 |
2288 // TODO(gman): DeleteProgram | 2283 // TODO(gman): DeleteProgram |
2289 | 2284 |
2290 // TODO(gman): UseProgram | 2285 // TODO(gman): UseProgram |
2291 | 2286 |
2292 // TODO(gman): DeleteShader | 2287 // TODO(gman): DeleteShader |
2293 | 2288 |
2294 } // namespace gles2 | 2289 } // namespace gles2 |
2295 } // namespace gpu | 2290 } // namespace gpu |
OLD | NEW |