OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 attach_cmd.Init(program_client_id, vertex_shader_client_id); | 1248 attach_cmd.Init(program_client_id, vertex_shader_client_id); |
1249 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 1249 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
1250 | 1250 |
1251 attach_cmd.Init(program_client_id, fragment_shader_client_id); | 1251 attach_cmd.Init(program_client_id, fragment_shader_client_id); |
1252 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); | 1252 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); |
1253 | 1253 |
1254 LinkProgram link_cmd; | 1254 LinkProgram link_cmd; |
1255 link_cmd.Init(program_client_id); | 1255 link_cmd.Init(program_client_id); |
1256 | 1256 |
1257 EXPECT_EQ(error::kNoError, ExecuteCmd(link_cmd)); | 1257 EXPECT_EQ(error::kNoError, ExecuteCmd(link_cmd)); |
| 1258 |
| 1259 // Assume the next command will be UseProgram. |
| 1260 SetupExpectationsForClearingUniforms(uniforms, num_uniforms); |
| 1261 } |
| 1262 |
| 1263 void GLES2DecoderTestBase::SetupExpectationsForClearingUniforms( |
| 1264 UniformInfo* uniforms, size_t num_uniforms) { |
| 1265 for (size_t ii = 0; ii < num_uniforms; ++ii) { |
| 1266 const UniformInfo& info = uniforms[ii]; |
| 1267 switch (info.type) { |
| 1268 case GL_FLOAT: |
| 1269 EXPECT_CALL(*gl_, Uniform1fv(info.real_location, info.size, _)) |
| 1270 .Times(1) |
| 1271 .RetiresOnSaturation(); |
| 1272 break; |
| 1273 case GL_FLOAT_VEC2: |
| 1274 EXPECT_CALL(*gl_, Uniform2fv(info.real_location, info.size, _)) |
| 1275 .Times(1) |
| 1276 .RetiresOnSaturation(); |
| 1277 break; |
| 1278 case GL_FLOAT_VEC3: |
| 1279 EXPECT_CALL(*gl_, Uniform3fv(info.real_location, info.size, _)) |
| 1280 .Times(1) |
| 1281 .RetiresOnSaturation(); |
| 1282 break; |
| 1283 case GL_FLOAT_VEC4: |
| 1284 EXPECT_CALL(*gl_, Uniform4fv(info.real_location, info.size, _)) |
| 1285 .Times(1) |
| 1286 .RetiresOnSaturation(); |
| 1287 break; |
| 1288 case GL_INT: |
| 1289 case GL_BOOL: |
| 1290 case GL_SAMPLER_2D: |
| 1291 case GL_SAMPLER_CUBE: |
| 1292 case GL_SAMPLER_EXTERNAL_OES: |
| 1293 EXPECT_CALL(*gl_, Uniform1iv(info.real_location, info.size, _)) |
| 1294 .Times(1) |
| 1295 .RetiresOnSaturation(); |
| 1296 break; |
| 1297 case GL_INT_VEC2: |
| 1298 case GL_BOOL_VEC2: |
| 1299 EXPECT_CALL(*gl_, Uniform2iv(info.real_location, info.size, _)) |
| 1300 .Times(1) |
| 1301 .RetiresOnSaturation(); |
| 1302 break; |
| 1303 case GL_INT_VEC3: |
| 1304 case GL_BOOL_VEC3: |
| 1305 EXPECT_CALL(*gl_, Uniform3iv(info.real_location, info.size, _)) |
| 1306 .Times(1) |
| 1307 .RetiresOnSaturation(); |
| 1308 break; |
| 1309 case GL_INT_VEC4: |
| 1310 case GL_BOOL_VEC4: |
| 1311 EXPECT_CALL(*gl_, Uniform4iv(info.real_location, info.size, _)) |
| 1312 .Times(1) |
| 1313 .RetiresOnSaturation(); |
| 1314 break; |
| 1315 case GL_FLOAT_MAT2: |
| 1316 EXPECT_CALL(*gl_, UniformMatrix2fv( |
| 1317 info.real_location, info.size, false, _)) |
| 1318 .Times(1) |
| 1319 .RetiresOnSaturation(); |
| 1320 break; |
| 1321 case GL_FLOAT_MAT3: |
| 1322 EXPECT_CALL(*gl_, UniformMatrix3fv( |
| 1323 info.real_location, info.size, false, _)) |
| 1324 .Times(1) |
| 1325 .RetiresOnSaturation(); |
| 1326 break; |
| 1327 case GL_FLOAT_MAT4: |
| 1328 EXPECT_CALL(*gl_, UniformMatrix4fv( |
| 1329 info.real_location, info.size, false, _)) |
| 1330 .Times(1) |
| 1331 .RetiresOnSaturation(); |
| 1332 break; |
| 1333 default: |
| 1334 NOTREACHED(); |
| 1335 break; |
| 1336 } |
| 1337 } |
1258 } | 1338 } |
1259 | 1339 |
1260 void GLES2DecoderTestBase::DoEnableVertexAttribArray(GLint index) { | 1340 void GLES2DecoderTestBase::DoEnableVertexAttribArray(GLint index) { |
1261 EXPECT_CALL(*gl_, EnableVertexAttribArray(index)) | 1341 EXPECT_CALL(*gl_, EnableVertexAttribArray(index)) |
1262 .Times(1) | 1342 .Times(1) |
1263 .RetiresOnSaturation(); | 1343 .RetiresOnSaturation(); |
1264 EnableVertexAttribArray cmd; | 1344 EnableVertexAttribArray cmd; |
1265 cmd.Init(index); | 1345 cmd.Init(index); |
1266 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1346 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1267 } | 1347 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 num_vertices, buffer_id, GL_NO_ERROR); | 1464 num_vertices, buffer_id, GL_NO_ERROR); |
1385 } | 1465 } |
1386 | 1466 |
1387 void GLES2DecoderWithShaderTestBase::SetUp() { | 1467 void GLES2DecoderWithShaderTestBase::SetUp() { |
1388 GLES2DecoderTestBase::SetUp(); | 1468 GLES2DecoderTestBase::SetUp(); |
1389 SetupDefaultProgram(); | 1469 SetupDefaultProgram(); |
1390 } | 1470 } |
1391 | 1471 |
1392 } // namespace gles2 | 1472 } // namespace gles2 |
1393 } // namespace gpu | 1473 } // namespace gpu |
OLD | NEW |