OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 11 #include "gpu/command_buffer/common/id_allocator.h" |
| 12 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_mock.h" |
| 13 #include "gpu/command_buffer/service/async_pixel_transfer_manager.h" |
| 14 #include "gpu/command_buffer/service/async_pixel_transfer_manager_mock.h" |
| 15 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 16 #include "gpu/command_buffer/service/context_group.h" |
| 17 #include "gpu/command_buffer/service/context_state.h" |
| 18 #include "gpu/command_buffer/service/gl_surface_mock.h" |
| 19 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" |
| 20 |
| 21 #include "gpu/command_buffer/service/gpu_switches.h" |
| 22 #include "gpu/command_buffer/service/image_manager.h" |
| 23 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 24 #include "gpu/command_buffer/service/mocks.h" |
| 25 #include "gpu/command_buffer/service/program_manager.h" |
| 26 #include "gpu/command_buffer/service/test_helper.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" |
| 28 #include "ui/gl/gl_implementation.h" |
| 29 #include "ui/gl/gl_mock.h" |
| 30 #include "ui/gl/gl_surface_stub.h" |
| 31 |
| 32 #if !defined(GL_DEPTH24_STENCIL8) |
| 33 #define GL_DEPTH24_STENCIL8 0x88F0 |
| 34 #endif |
| 35 |
| 36 using ::gfx::MockGLInterface; |
| 37 using ::testing::_; |
| 38 using ::testing::DoAll; |
| 39 using ::testing::InSequence; |
| 40 using ::testing::Invoke; |
| 41 using ::testing::MatcherCast; |
| 42 using ::testing::Mock; |
| 43 using ::testing::Pointee; |
| 44 using ::testing::Return; |
| 45 using ::testing::SaveArg; |
| 46 using ::testing::SetArrayArgument; |
| 47 using ::testing::SetArgumentPointee; |
| 48 using ::testing::SetArgPointee; |
| 49 using ::testing::StrEq; |
| 50 using ::testing::StrictMock; |
| 51 |
| 52 namespace gpu { |
| 53 namespace gles2 { |
| 54 |
| 55 using namespace cmds; |
| 56 |
| 57 TEST_F(GLES2DecoderWithShaderTest, GetVertexAttribPointervSucceeds) { |
| 58 const float dummy = 0; |
| 59 const GLuint kOffsetToTestFor = sizeof(dummy) * 4; |
| 60 const GLuint kIndexToTest = 1; |
| 61 GetVertexAttribPointerv::Result* result = |
| 62 static_cast<GetVertexAttribPointerv::Result*>(shared_memory_address_); |
| 63 result->size = 0; |
| 64 const GLuint* result_value = result->GetData(); |
| 65 // Test that initial value is 0. |
| 66 GetVertexAttribPointerv cmd; |
| 67 cmd.Init(kIndexToTest, |
| 68 GL_VERTEX_ATTRIB_ARRAY_POINTER, |
| 69 shared_memory_id_, |
| 70 shared_memory_offset_); |
| 71 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 72 EXPECT_EQ(sizeof(*result_value), result->size); |
| 73 EXPECT_EQ(0u, *result_value); |
| 74 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 75 |
| 76 // Set the value and see that we get it. |
| 77 SetupVertexBuffer(); |
| 78 DoVertexAttribPointer(kIndexToTest, 2, GL_FLOAT, 0, kOffsetToTestFor); |
| 79 result->size = 0; |
| 80 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 81 EXPECT_EQ(sizeof(*result_value), result->size); |
| 82 EXPECT_EQ(kOffsetToTestFor, *result_value); |
| 83 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 84 } |
| 85 |
| 86 TEST_F(GLES2DecoderWithShaderTest, GetVertexAttribPointervBadArgsFails) { |
| 87 const GLuint kIndexToTest = 1; |
| 88 GetVertexAttribPointerv::Result* result = |
| 89 static_cast<GetVertexAttribPointerv::Result*>(shared_memory_address_); |
| 90 result->size = 0; |
| 91 const GLuint* result_value = result->GetData(); |
| 92 // Test pname invalid fails. |
| 93 GetVertexAttribPointerv cmd; |
| 94 cmd.Init(kIndexToTest, |
| 95 GL_VERTEX_ATTRIB_ARRAY_POINTER + 1, |
| 96 shared_memory_id_, |
| 97 shared_memory_offset_); |
| 98 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 99 EXPECT_EQ(0u, result->size); |
| 100 EXPECT_EQ(kInitialResult, *result_value); |
| 101 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 102 |
| 103 // Test index out of range fails. |
| 104 result->size = 0; |
| 105 cmd.Init(kNumVertexAttribs, |
| 106 GL_VERTEX_ATTRIB_ARRAY_POINTER, |
| 107 shared_memory_id_, |
| 108 shared_memory_offset_); |
| 109 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 110 EXPECT_EQ(0u, result->size); |
| 111 EXPECT_EQ(kInitialResult, *result_value); |
| 112 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 113 |
| 114 // Test memory id bad fails. |
| 115 cmd.Init(kIndexToTest, |
| 116 GL_VERTEX_ATTRIB_ARRAY_POINTER, |
| 117 kInvalidSharedMemoryId, |
| 118 shared_memory_offset_); |
| 119 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 120 |
| 121 // Test memory offset bad fails. |
| 122 cmd.Init(kIndexToTest, |
| 123 GL_VERTEX_ATTRIB_ARRAY_POINTER, |
| 124 shared_memory_id_, |
| 125 kInvalidSharedMemoryOffset); |
| 126 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 127 } |
| 128 |
| 129 TEST_F(GLES2DecoderWithShaderTest, BindBufferToDifferentTargetFails) { |
| 130 // Bind the buffer to GL_ARRAY_BUFFER |
| 131 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId); |
| 132 // Attempt to rebind to GL_ELEMENT_ARRAY_BUFFER |
| 133 // NOTE: Real GLES2 does not have this restriction but WebGL and we do. |
| 134 // This can be restriction can be removed at runtime. |
| 135 EXPECT_CALL(*gl_, BindBuffer(_, _)).Times(0); |
| 136 BindBuffer cmd; |
| 137 cmd.Init(GL_ELEMENT_ARRAY_BUFFER, client_buffer_id_); |
| 138 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 139 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 140 } |
| 141 |
| 142 TEST_F(GLES2DecoderWithShaderTest, VertexAttribPointer) { |
| 143 SetupVertexBuffer(); |
| 144 static const GLenum types[] = { |
| 145 GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, |
| 146 GL_FLOAT, GL_FIXED, GL_INT, GL_UNSIGNED_INT, |
| 147 }; |
| 148 static const GLsizei sizes[] = { |
| 149 1, 1, 2, 2, 4, 4, 4, 4, |
| 150 }; |
| 151 static const GLuint indices[] = { |
| 152 0, 1, kNumVertexAttribs - 1, kNumVertexAttribs, |
| 153 }; |
| 154 static const GLsizei offset_mult[] = { |
| 155 0, 0, 1, 1, 2, 1000, |
| 156 }; |
| 157 static const GLsizei offset_offset[] = { |
| 158 0, 1, 0, 1, 0, 0, |
| 159 }; |
| 160 static const GLsizei stride_mult[] = { |
| 161 -1, 0, 0, 1, 1, 2, 1000, |
| 162 }; |
| 163 static const GLsizei stride_offset[] = { |
| 164 0, 0, 1, 0, 1, 0, 0, |
| 165 }; |
| 166 for (size_t tt = 0; tt < arraysize(types); ++tt) { |
| 167 GLenum type = types[tt]; |
| 168 GLsizei num_bytes = sizes[tt]; |
| 169 for (size_t ii = 0; ii < arraysize(indices); ++ii) { |
| 170 GLuint index = indices[ii]; |
| 171 for (GLint size = 0; size < 5; ++size) { |
| 172 for (size_t oo = 0; oo < arraysize(offset_mult); ++oo) { |
| 173 GLuint offset = num_bytes * offset_mult[oo] + offset_offset[oo]; |
| 174 for (size_t ss = 0; ss < arraysize(stride_mult); ++ss) { |
| 175 GLsizei stride = num_bytes * stride_mult[ss] + stride_offset[ss]; |
| 176 for (int normalize = 0; normalize < 2; ++normalize) { |
| 177 bool index_good = index < static_cast<GLuint>(kNumVertexAttribs); |
| 178 bool size_good = (size > 0 && size < 5); |
| 179 bool offset_good = (offset % num_bytes == 0); |
| 180 bool stride_good = |
| 181 (stride % num_bytes == 0) && stride >= 0 && stride <= 255; |
| 182 bool type_good = (type != GL_INT && type != GL_UNSIGNED_INT && |
| 183 type != GL_FIXED); |
| 184 bool good = size_good && offset_good && stride_good && |
| 185 type_good && index_good; |
| 186 bool call = good && (type != GL_FIXED); |
| 187 if (call) { |
| 188 EXPECT_CALL(*gl_, |
| 189 VertexAttribPointer(index, |
| 190 size, |
| 191 type, |
| 192 normalize, |
| 193 stride, |
| 194 BufferOffset(offset))); |
| 195 } |
| 196 VertexAttribPointer cmd; |
| 197 cmd.Init(index, size, type, normalize, stride, offset); |
| 198 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 199 if (good) { |
| 200 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 201 } else if (size_good && offset_good && stride_good && type_good && |
| 202 !index_good) { |
| 203 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 204 } else if (size_good && offset_good && stride_good && |
| 205 !type_good && index_good) { |
| 206 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 207 } else if (size_good && offset_good && !stride_good && |
| 208 type_good && index_good) { |
| 209 if (stride < 0 || stride > 255) { |
| 210 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 211 } else { |
| 212 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 213 } |
| 214 } else if (size_good && !offset_good && stride_good && |
| 215 type_good && index_good) { |
| 216 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 217 } else if (!size_good && offset_good && stride_good && |
| 218 type_good && index_good) { |
| 219 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 220 } else { |
| 221 EXPECT_NE(GL_NO_ERROR, GetGLError()); |
| 222 } |
| 223 } |
| 224 } |
| 225 } |
| 226 } |
| 227 } |
| 228 } |
| 229 } |
| 230 |
| 231 class GLES2DecoderVertexArraysOESTest : public GLES2DecoderWithShaderTest { |
| 232 public: |
| 233 GLES2DecoderVertexArraysOESTest() {} |
| 234 |
| 235 bool vertex_array_deleted_manually_; |
| 236 |
| 237 virtual void SetUp() { |
| 238 InitState init; |
| 239 init.extensions = "GL_OES_vertex_array_object"; |
| 240 init.gl_version = "opengl es 2.0"; |
| 241 init.bind_generates_resource = true; |
| 242 InitDecoder(init); |
| 243 SetupDefaultProgram(); |
| 244 |
| 245 AddExpectationsForGenVertexArraysOES(); |
| 246 GenHelper<GenVertexArraysOESImmediate>(client_vertexarray_id_); |
| 247 |
| 248 vertex_array_deleted_manually_ = false; |
| 249 } |
| 250 |
| 251 virtual void TearDown() { |
| 252 // This should only be set if the test handled deletion of the vertex array |
| 253 // itself. Necessary because vertex_array_objects are not sharable, and thus |
| 254 // not managed in the ContextGroup, meaning they will be destroyed during |
| 255 // test tear down |
| 256 if (!vertex_array_deleted_manually_) { |
| 257 AddExpectationsForDeleteVertexArraysOES(); |
| 258 } |
| 259 |
| 260 GLES2DecoderWithShaderTest::TearDown(); |
| 261 } |
| 262 |
| 263 void GenVertexArraysOESValidArgs() { |
| 264 AddExpectationsForGenVertexArraysOES(); |
| 265 GetSharedMemoryAs<GLuint*>()[0] = kNewClientId; |
| 266 GenVertexArraysOES cmd; |
| 267 cmd.Init(1, shared_memory_id_, shared_memory_offset_); |
| 268 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 269 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 270 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId) != NULL); |
| 271 AddExpectationsForDeleteVertexArraysOES(); |
| 272 } |
| 273 |
| 274 void GenVertexArraysOESInvalidArgs() { |
| 275 EXPECT_CALL(*gl_, GenVertexArraysOES(_, _)).Times(0); |
| 276 GetSharedMemoryAs<GLuint*>()[0] = client_vertexarray_id_; |
| 277 GenVertexArraysOES cmd; |
| 278 cmd.Init(1, shared_memory_id_, shared_memory_offset_); |
| 279 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd)); |
| 280 } |
| 281 |
| 282 void GenVertexArraysOESImmediateValidArgs() { |
| 283 AddExpectationsForGenVertexArraysOES(); |
| 284 GenVertexArraysOESImmediate* cmd = |
| 285 GetImmediateAs<GenVertexArraysOESImmediate>(); |
| 286 GLuint temp = kNewClientId; |
| 287 cmd->Init(1, &temp); |
| 288 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp))); |
| 289 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 290 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId) != NULL); |
| 291 AddExpectationsForDeleteVertexArraysOES(); |
| 292 } |
| 293 |
| 294 void GenVertexArraysOESImmediateInvalidArgs() { |
| 295 EXPECT_CALL(*gl_, GenVertexArraysOES(_, _)).Times(0); |
| 296 GenVertexArraysOESImmediate* cmd = |
| 297 GetImmediateAs<GenVertexArraysOESImmediate>(); |
| 298 cmd->Init(1, &client_vertexarray_id_); |
| 299 EXPECT_EQ(error::kInvalidArguments, |
| 300 ExecuteImmediateCmd(*cmd, sizeof(&client_vertexarray_id_))); |
| 301 } |
| 302 |
| 303 void DeleteVertexArraysOESValidArgs() { |
| 304 AddExpectationsForDeleteVertexArraysOES(); |
| 305 GetSharedMemoryAs<GLuint*>()[0] = client_vertexarray_id_; |
| 306 DeleteVertexArraysOES cmd; |
| 307 cmd.Init(1, shared_memory_id_, shared_memory_offset_); |
| 308 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 309 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 310 EXPECT_TRUE(GetVertexArrayInfo(client_vertexarray_id_) == NULL); |
| 311 vertex_array_deleted_manually_ = true; |
| 312 } |
| 313 |
| 314 void DeleteVertexArraysOESInvalidArgs() { |
| 315 GetSharedMemoryAs<GLuint*>()[0] = kInvalidClientId; |
| 316 DeleteVertexArraysOES cmd; |
| 317 cmd.Init(1, shared_memory_id_, shared_memory_offset_); |
| 318 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 319 } |
| 320 |
| 321 void DeleteVertexArraysOESImmediateValidArgs() { |
| 322 AddExpectationsForDeleteVertexArraysOES(); |
| 323 DeleteVertexArraysOESImmediate& cmd = |
| 324 *GetImmediateAs<DeleteVertexArraysOESImmediate>(); |
| 325 cmd.Init(1, &client_vertexarray_id_); |
| 326 EXPECT_EQ(error::kNoError, |
| 327 ExecuteImmediateCmd(cmd, sizeof(client_vertexarray_id_))); |
| 328 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 329 EXPECT_TRUE(GetVertexArrayInfo(client_vertexarray_id_) == NULL); |
| 330 vertex_array_deleted_manually_ = true; |
| 331 } |
| 332 |
| 333 void DeleteVertexArraysOESImmediateInvalidArgs() { |
| 334 DeleteVertexArraysOESImmediate& cmd = |
| 335 *GetImmediateAs<DeleteVertexArraysOESImmediate>(); |
| 336 GLuint temp = kInvalidClientId; |
| 337 cmd.Init(1, &temp); |
| 338 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); |
| 339 } |
| 340 |
| 341 void DeleteBoundVertexArraysOESImmediateValidArgs() { |
| 342 BindVertexArrayOESValidArgs(); |
| 343 |
| 344 AddExpectationsForDeleteBoundVertexArraysOES(); |
| 345 DeleteVertexArraysOESImmediate& cmd = |
| 346 *GetImmediateAs<DeleteVertexArraysOESImmediate>(); |
| 347 cmd.Init(1, &client_vertexarray_id_); |
| 348 EXPECT_EQ(error::kNoError, |
| 349 ExecuteImmediateCmd(cmd, sizeof(client_vertexarray_id_))); |
| 350 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 351 EXPECT_TRUE(GetVertexArrayInfo(client_vertexarray_id_) == NULL); |
| 352 vertex_array_deleted_manually_ = true; |
| 353 } |
| 354 |
| 355 void IsVertexArrayOESValidArgs() { |
| 356 IsVertexArrayOES cmd; |
| 357 cmd.Init(client_vertexarray_id_, shared_memory_id_, shared_memory_offset_); |
| 358 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 359 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 360 } |
| 361 |
| 362 void IsVertexArrayOESInvalidArgsBadSharedMemoryId() { |
| 363 IsVertexArrayOES cmd; |
| 364 cmd.Init( |
| 365 client_vertexarray_id_, kInvalidSharedMemoryId, shared_memory_offset_); |
| 366 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); |
| 367 cmd.Init( |
| 368 client_vertexarray_id_, shared_memory_id_, kInvalidSharedMemoryOffset); |
| 369 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); |
| 370 } |
| 371 |
| 372 void BindVertexArrayOESValidArgs() { |
| 373 AddExpectationsForBindVertexArrayOES(); |
| 374 BindVertexArrayOES cmd; |
| 375 cmd.Init(client_vertexarray_id_); |
| 376 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 377 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 378 } |
| 379 |
| 380 void BindVertexArrayOESValidArgsNewId() { |
| 381 BindVertexArrayOES cmd; |
| 382 cmd.Init(kNewClientId); |
| 383 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 384 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 385 } |
| 386 }; |
| 387 |
| 388 class GLES2DecoderEmulatedVertexArraysOESTest |
| 389 : public GLES2DecoderVertexArraysOESTest { |
| 390 public: |
| 391 GLES2DecoderEmulatedVertexArraysOESTest() {} |
| 392 |
| 393 virtual void SetUp() { |
| 394 InitState init; |
| 395 init.gl_version = "3.0"; |
| 396 init.bind_generates_resource = true; |
| 397 InitDecoder(init); |
| 398 SetupDefaultProgram(); |
| 399 |
| 400 AddExpectationsForGenVertexArraysOES(); |
| 401 GenHelper<GenVertexArraysOESImmediate>(client_vertexarray_id_); |
| 402 |
| 403 vertex_array_deleted_manually_ = false; |
| 404 } |
| 405 }; |
| 406 |
| 407 // Test vertex array objects with native support |
| 408 TEST_F(GLES2DecoderVertexArraysOESTest, GenVertexArraysOESValidArgs) { |
| 409 GenVertexArraysOESValidArgs(); |
| 410 } |
| 411 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, GenVertexArraysOESValidArgs) { |
| 412 GenVertexArraysOESValidArgs(); |
| 413 } |
| 414 |
| 415 TEST_F(GLES2DecoderVertexArraysOESTest, GenVertexArraysOESInvalidArgs) { |
| 416 GenVertexArraysOESInvalidArgs(); |
| 417 } |
| 418 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, ) { |
| 419 GenVertexArraysOESInvalidArgs(); |
| 420 } |
| 421 |
| 422 TEST_F(GLES2DecoderVertexArraysOESTest, GenVertexArraysOESImmediateValidArgs) { |
| 423 GenVertexArraysOESImmediateValidArgs(); |
| 424 } |
| 425 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, |
| 426 GenVertexArraysOESImmediateValidArgs) { |
| 427 GenVertexArraysOESImmediateValidArgs(); |
| 428 } |
| 429 |
| 430 TEST_F(GLES2DecoderVertexArraysOESTest, |
| 431 GenVertexArraysOESImmediateInvalidArgs) { |
| 432 GenVertexArraysOESImmediateInvalidArgs(); |
| 433 } |
| 434 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, |
| 435 GenVertexArraysOESImmediateInvalidArgs) { |
| 436 GenVertexArraysOESImmediateInvalidArgs(); |
| 437 } |
| 438 |
| 439 TEST_F(GLES2DecoderVertexArraysOESTest, DeleteVertexArraysOESValidArgs) { |
| 440 DeleteVertexArraysOESValidArgs(); |
| 441 } |
| 442 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, |
| 443 DeleteVertexArraysOESValidArgs) { |
| 444 DeleteVertexArraysOESValidArgs(); |
| 445 } |
| 446 |
| 447 TEST_F(GLES2DecoderVertexArraysOESTest, DeleteVertexArraysOESInvalidArgs) { |
| 448 DeleteVertexArraysOESInvalidArgs(); |
| 449 } |
| 450 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, |
| 451 DeleteVertexArraysOESInvalidArgs) { |
| 452 DeleteVertexArraysOESInvalidArgs(); |
| 453 } |
| 454 |
| 455 TEST_F(GLES2DecoderVertexArraysOESTest, |
| 456 DeleteVertexArraysOESImmediateValidArgs) { |
| 457 DeleteVertexArraysOESImmediateValidArgs(); |
| 458 } |
| 459 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, |
| 460 DeleteVertexArraysOESImmediateValidArgs) { |
| 461 DeleteVertexArraysOESImmediateValidArgs(); |
| 462 } |
| 463 |
| 464 TEST_F(GLES2DecoderVertexArraysOESTest, |
| 465 DeleteVertexArraysOESImmediateInvalidArgs) { |
| 466 DeleteVertexArraysOESImmediateInvalidArgs(); |
| 467 } |
| 468 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, |
| 469 DeleteVertexArraysOESImmediateInvalidArgs) { |
| 470 DeleteVertexArraysOESImmediateInvalidArgs(); |
| 471 } |
| 472 |
| 473 TEST_F(GLES2DecoderVertexArraysOESTest, |
| 474 DeleteBoundVertexArraysOESImmediateValidArgs) { |
| 475 DeleteBoundVertexArraysOESImmediateValidArgs(); |
| 476 } |
| 477 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, |
| 478 DeleteBoundVertexArraysOESImmediateValidArgs) { |
| 479 DeleteBoundVertexArraysOESImmediateValidArgs(); |
| 480 } |
| 481 |
| 482 TEST_F(GLES2DecoderVertexArraysOESTest, IsVertexArrayOESValidArgs) { |
| 483 IsVertexArrayOESValidArgs(); |
| 484 } |
| 485 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, IsVertexArrayOESValidArgs) { |
| 486 IsVertexArrayOESValidArgs(); |
| 487 } |
| 488 |
| 489 TEST_F(GLES2DecoderVertexArraysOESTest, |
| 490 IsVertexArrayOESInvalidArgsBadSharedMemoryId) { |
| 491 IsVertexArrayOESInvalidArgsBadSharedMemoryId(); |
| 492 } |
| 493 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, |
| 494 IsVertexArrayOESInvalidArgsBadSharedMemoryId) { |
| 495 IsVertexArrayOESInvalidArgsBadSharedMemoryId(); |
| 496 } |
| 497 |
| 498 TEST_F(GLES2DecoderVertexArraysOESTest, BindVertexArrayOESValidArgs) { |
| 499 BindVertexArrayOESValidArgs(); |
| 500 } |
| 501 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, BindVertexArrayOESValidArgs) { |
| 502 BindVertexArrayOESValidArgs(); |
| 503 } |
| 504 |
| 505 TEST_F(GLES2DecoderVertexArraysOESTest, BindVertexArrayOESValidArgsNewId) { |
| 506 BindVertexArrayOESValidArgsNewId(); |
| 507 } |
| 508 TEST_F(GLES2DecoderEmulatedVertexArraysOESTest, |
| 509 BindVertexArrayOESValidArgsNewId) { |
| 510 BindVertexArrayOESValidArgsNewId(); |
| 511 } |
| 512 |
| 513 TEST_F(GLES2DecoderTest, BufferDataGLError) { |
| 514 GLenum target = GL_ARRAY_BUFFER; |
| 515 GLsizeiptr size = 4; |
| 516 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId); |
| 517 BufferManager* manager = group().buffer_manager(); |
| 518 Buffer* buffer = manager->GetBuffer(client_buffer_id_); |
| 519 ASSERT_TRUE(buffer != NULL); |
| 520 EXPECT_EQ(0, buffer->size()); |
| 521 EXPECT_CALL(*gl_, GetError()) |
| 522 .WillOnce(Return(GL_NO_ERROR)) |
| 523 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
| 524 .RetiresOnSaturation(); |
| 525 EXPECT_CALL(*gl_, BufferData(target, size, _, GL_STREAM_DRAW)) |
| 526 .Times(1) |
| 527 .RetiresOnSaturation(); |
| 528 BufferData cmd; |
| 529 cmd.Init(target, size, 0, 0, GL_STREAM_DRAW); |
| 530 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 531 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 532 EXPECT_EQ(0, buffer->size()); |
| 533 } |
| 534 |
| 535 // TODO(gman): BufferData |
| 536 |
| 537 // TODO(gman): BufferDataImmediate |
| 538 |
| 539 // TODO(gman): BufferSubData |
| 540 |
| 541 // TODO(gman): BufferSubDataImmediate |
| 542 |
| 543 } // namespace gles2 |
| 544 } // namespace gpu |
OLD | NEW |