1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861
|
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is auto-generated from
// gpu/command_buffer/build_raster_cmd_buffer.py
// It's formatted by clang-format using chromium coding style:
// clang-format -i -style=chromium filename
// DO NOT EDIT!
// This file contains unit tests for raster commands
// It is included by raster_cmd_format_test.cc
#ifndef GPU_COMMAND_BUFFER_COMMON_RASTER_CMD_FORMAT_TEST_AUTOGEN_H_
#define GPU_COMMAND_BUFFER_COMMON_RASTER_CMD_FORMAT_TEST_AUTOGEN_H_
TEST_F(RasterFormatTest, Finish) {
cmds::Finish& cmd = *GetBufferAs<cmds::Finish>();
void* next_cmd = cmd.Set(&cmd);
EXPECT_EQ(static_cast<uint32_t>(cmds::Finish::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, Flush) {
cmds::Flush& cmd = *GetBufferAs<cmds::Flush>();
void* next_cmd = cmd.Set(&cmd);
EXPECT_EQ(static_cast<uint32_t>(cmds::Flush::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, GetError) {
cmds::GetError& cmd = *GetBufferAs<cmds::GetError>();
void* next_cmd =
cmd.Set(&cmd, static_cast<uint32_t>(11), static_cast<uint32_t>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetError::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<uint32_t>(11), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, GenQueriesEXTImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::GenQueriesEXTImmediate& cmd =
*GetBufferAs<cmds::GenQueriesEXTImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(std::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::GenQueriesEXTImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(std::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(std::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(RasterFormatTest, DeleteQueriesEXTImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::DeleteQueriesEXTImmediate& cmd =
*GetBufferAs<cmds::DeleteQueriesEXTImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(std::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteQueriesEXTImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(std::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(std::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(RasterFormatTest, QueryCounterEXT) {
cmds::QueryCounterEXT& cmd = *GetBufferAs<cmds::QueryCounterEXT>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
static_cast<GLenum>(12), static_cast<uint32_t>(13),
static_cast<uint32_t>(14), static_cast<GLuint>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::QueryCounterEXT::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.id);
EXPECT_EQ(static_cast<GLenum>(12), cmd.target);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.sync_data_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.sync_data_shm_offset);
EXPECT_EQ(static_cast<GLuint>(15), cmd.submit_count);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, BeginQueryEXT) {
cmds::BeginQueryEXT& cmd = *GetBufferAs<cmds::BeginQueryEXT>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::BeginQueryEXT::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.sync_data_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.sync_data_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, EndQueryEXT) {
cmds::EndQueryEXT& cmd = *GetBufferAs<cmds::EndQueryEXT>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::EndQueryEXT::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.submit_count);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, LoseContextCHROMIUM) {
cmds::LoseContextCHROMIUM& cmd = *GetBufferAs<cmds::LoseContextCHROMIUM>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::LoseContextCHROMIUM::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.current);
EXPECT_EQ(static_cast<GLenum>(12), cmd.other);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, BeginRasterCHROMIUMImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLbyte data[] = {
static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
};
cmds::BeginRasterCHROMIUMImmediate& cmd =
*GetBufferAs<cmds::BeginRasterCHROMIUMImmediate>();
void* next_cmd = cmd.Set(
&cmd, static_cast<GLfloat>(11), static_cast<GLfloat>(12),
static_cast<GLfloat>(13), static_cast<GLfloat>(14),
static_cast<GLboolean>(15), static_cast<GLuint>(16),
static_cast<gpu::raster::MsaaMode>(17), static_cast<GLboolean>(18),
static_cast<GLboolean>(19), static_cast<GLfloat>(20), data);
EXPECT_EQ(static_cast<uint32_t>(cmds::BeginRasterCHROMIUMImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLfloat>(11), cmd.r);
EXPECT_EQ(static_cast<GLfloat>(12), cmd.g);
EXPECT_EQ(static_cast<GLfloat>(13), cmd.b);
EXPECT_EQ(static_cast<GLfloat>(14), cmd.a);
EXPECT_EQ(static_cast<GLboolean>(15), cmd.needs_clear);
EXPECT_EQ(static_cast<GLuint>(16), cmd.msaa_sample_count);
EXPECT_EQ(static_cast<gpu::raster::MsaaMode>(17), cmd.msaa_mode);
EXPECT_EQ(static_cast<GLboolean>(18), cmd.can_use_lcd_text);
EXPECT_EQ(static_cast<GLboolean>(19), cmd.visible);
EXPECT_EQ(static_cast<GLfloat>(20), cmd.hdr_headroom);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(RasterFormatTest, RasterCHROMIUM) {
cmds::RasterCHROMIUM& cmd = *GetBufferAs<cmds::RasterCHROMIUM>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
static_cast<GLsizeiptr>(13), static_cast<GLuint>(14),
static_cast<GLuint>(15), static_cast<GLsizeiptr>(16));
EXPECT_EQ(static_cast<uint32_t>(cmds::RasterCHROMIUM::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.raster_shm_id);
EXPECT_EQ(static_cast<GLuint>(12), cmd.raster_shm_offset);
EXPECT_EQ(static_cast<GLsizeiptr>(13), cmd.raster_shm_size);
EXPECT_EQ(static_cast<GLuint>(14), cmd.font_shm_id);
EXPECT_EQ(static_cast<GLuint>(15), cmd.font_shm_offset);
EXPECT_EQ(static_cast<GLsizeiptr>(16), cmd.font_shm_size);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, EndRasterCHROMIUM) {
cmds::EndRasterCHROMIUM& cmd = *GetBufferAs<cmds::EndRasterCHROMIUM>();
void* next_cmd = cmd.Set(&cmd);
EXPECT_EQ(static_cast<uint32_t>(cmds::EndRasterCHROMIUM::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, CreateTransferCacheEntryINTERNAL) {
cmds::CreateTransferCacheEntryINTERNAL& cmd =
*GetBufferAs<cmds::CreateTransferCacheEntryINTERNAL>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
static_cast<GLuint>(12), static_cast<GLuint>(13),
static_cast<GLuint>(14), static_cast<GLuint>(15),
static_cast<GLuint>(16), static_cast<GLuint>(17));
EXPECT_EQ(
static_cast<uint32_t>(cmds::CreateTransferCacheEntryINTERNAL::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.entry_type);
EXPECT_EQ(static_cast<GLuint>(12), cmd.entry_id);
EXPECT_EQ(static_cast<GLuint>(13), cmd.handle_shm_id);
EXPECT_EQ(static_cast<GLuint>(14), cmd.handle_shm_offset);
EXPECT_EQ(static_cast<GLuint>(15), cmd.data_shm_id);
EXPECT_EQ(static_cast<GLuint>(16), cmd.data_shm_offset);
EXPECT_EQ(static_cast<GLuint>(17), cmd.data_size);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, DeleteTransferCacheEntryINTERNAL) {
cmds::DeleteTransferCacheEntryINTERNAL& cmd =
*GetBufferAs<cmds::DeleteTransferCacheEntryINTERNAL>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
EXPECT_EQ(
static_cast<uint32_t>(cmds::DeleteTransferCacheEntryINTERNAL::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.entry_type);
EXPECT_EQ(static_cast<GLuint>(12), cmd.entry_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, UnlockTransferCacheEntryINTERNAL) {
cmds::UnlockTransferCacheEntryINTERNAL& cmd =
*GetBufferAs<cmds::UnlockTransferCacheEntryINTERNAL>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
EXPECT_EQ(
static_cast<uint32_t>(cmds::UnlockTransferCacheEntryINTERNAL::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.entry_type);
EXPECT_EQ(static_cast<GLuint>(12), cmd.entry_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, DeletePaintCachePathsINTERNALImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::DeletePaintCachePathsINTERNALImmediate& cmd =
*GetBufferAs<cmds::DeletePaintCachePathsINTERNALImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(std::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(
cmds::DeletePaintCachePathsINTERNALImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(std::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(std::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(RasterFormatTest, DeletePaintCachePathsINTERNAL) {
cmds::DeletePaintCachePathsINTERNAL& cmd =
*GetBufferAs<cmds::DeletePaintCachePathsINTERNAL>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLsizei>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::DeletePaintCachePathsINTERNAL::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(11), cmd.n);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.ids_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.ids_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, ClearPaintCacheINTERNAL) {
cmds::ClearPaintCacheINTERNAL& cmd =
*GetBufferAs<cmds::ClearPaintCacheINTERNAL>();
void* next_cmd = cmd.Set(&cmd);
EXPECT_EQ(static_cast<uint32_t>(cmds::ClearPaintCacheINTERNAL::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, CopySharedImageINTERNALImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLbyte data[] = {
static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 16),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 17),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 18),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 19),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 20),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 21),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 22),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 23),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 24),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 25),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 26),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 27),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 28),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 29),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 30),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 31),
};
cmds::CopySharedImageINTERNALImmediate& cmd =
*GetBufferAs<cmds::CopySharedImageINTERNALImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
static_cast<GLint>(13), static_cast<GLint>(14),
static_cast<GLsizei>(15), static_cast<GLsizei>(16),
static_cast<GLboolean>(17), data);
EXPECT_EQ(
static_cast<uint32_t>(cmds::CopySharedImageINTERNALImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLint>(11), cmd.xoffset);
EXPECT_EQ(static_cast<GLint>(12), cmd.yoffset);
EXPECT_EQ(static_cast<GLint>(13), cmd.x);
EXPECT_EQ(static_cast<GLint>(14), cmd.y);
EXPECT_EQ(static_cast<GLsizei>(15), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(16), cmd.height);
EXPECT_EQ(static_cast<GLboolean>(17), cmd.unpack_flip_y);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(RasterFormatTest, WritePixelsINTERNALImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLbyte data[] = {
static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
};
cmds::WritePixelsINTERNALImmediate& cmd =
*GetBufferAs<cmds::WritePixelsINTERNALImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
static_cast<GLint>(13), static_cast<GLuint>(14),
static_cast<GLuint>(15), static_cast<GLuint>(16),
static_cast<GLuint>(17), static_cast<GLuint>(18),
static_cast<GLint>(19), static_cast<GLuint>(20),
static_cast<GLuint>(21), data);
EXPECT_EQ(static_cast<uint32_t>(cmds::WritePixelsINTERNALImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLint>(11), cmd.x_offset);
EXPECT_EQ(static_cast<GLint>(12), cmd.y_offset);
EXPECT_EQ(static_cast<GLint>(13), cmd.plane_index);
EXPECT_EQ(static_cast<GLuint>(14), cmd.src_width);
EXPECT_EQ(static_cast<GLuint>(15), cmd.src_height);
EXPECT_EQ(static_cast<GLuint>(16), cmd.src_row_bytes);
EXPECT_EQ(static_cast<GLuint>(17), cmd.src_sk_color_type);
EXPECT_EQ(static_cast<GLuint>(18), cmd.src_sk_alpha_type);
EXPECT_EQ(static_cast<GLint>(19), cmd.shm_id);
EXPECT_EQ(static_cast<GLuint>(20), cmd.shm_offset);
EXPECT_EQ(static_cast<GLuint>(21), cmd.pixels_offset);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(RasterFormatTest, WritePixelsYUVINTERNALImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLbyte data[] = {
static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
};
cmds::WritePixelsYUVINTERNALImmediate& cmd =
*GetBufferAs<cmds::WritePixelsYUVINTERNALImmediate>();
void* next_cmd = cmd.Set(
&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
static_cast<GLuint>(13), static_cast<GLuint>(14), static_cast<GLuint>(15),
static_cast<GLuint>(16), static_cast<GLuint>(17), static_cast<GLuint>(18),
static_cast<GLuint>(19), static_cast<GLint>(20), static_cast<GLuint>(21),
static_cast<GLuint>(22), static_cast<GLuint>(23), static_cast<GLuint>(24),
data);
EXPECT_EQ(
static_cast<uint32_t>(cmds::WritePixelsYUVINTERNALImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.src_width);
EXPECT_EQ(static_cast<GLuint>(12), cmd.src_height);
EXPECT_EQ(static_cast<GLuint>(13), cmd.src_row_bytes_plane1);
EXPECT_EQ(static_cast<GLuint>(14), cmd.src_row_bytes_plane2);
EXPECT_EQ(static_cast<GLuint>(15), cmd.src_row_bytes_plane3);
EXPECT_EQ(static_cast<GLuint>(16), cmd.src_row_bytes_plane4);
EXPECT_EQ(static_cast<GLuint>(17), cmd.src_yuv_plane_config);
EXPECT_EQ(static_cast<GLuint>(18), cmd.src_yuv_subsampling);
EXPECT_EQ(static_cast<GLuint>(19), cmd.src_yuv_datatype);
EXPECT_EQ(static_cast<GLint>(20), cmd.shm_id);
EXPECT_EQ(static_cast<GLuint>(21), cmd.shm_offset);
EXPECT_EQ(static_cast<GLuint>(22), cmd.plane2_offset);
EXPECT_EQ(static_cast<GLuint>(23), cmd.plane3_offset);
EXPECT_EQ(static_cast<GLuint>(24), cmd.plane4_offset);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(RasterFormatTest, ReadbackARGBImagePixelsINTERNALImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLbyte data[] = {
static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
};
cmds::ReadbackARGBImagePixelsINTERNALImmediate& cmd =
*GetBufferAs<cmds::ReadbackARGBImagePixelsINTERNALImmediate>();
void* next_cmd = cmd.Set(
&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
static_cast<GLint>(13), static_cast<GLuint>(14), static_cast<GLuint>(15),
static_cast<GLuint>(16), static_cast<GLuint>(17), static_cast<GLuint>(18),
static_cast<GLint>(19), static_cast<GLuint>(20), static_cast<GLuint>(21),
static_cast<GLuint>(22), data);
EXPECT_EQ(static_cast<uint32_t>(
cmds::ReadbackARGBImagePixelsINTERNALImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLint>(11), cmd.src_x);
EXPECT_EQ(static_cast<GLint>(12), cmd.src_y);
EXPECT_EQ(static_cast<GLint>(13), cmd.plane_index);
EXPECT_EQ(static_cast<GLuint>(14), cmd.dst_width);
EXPECT_EQ(static_cast<GLuint>(15), cmd.dst_height);
EXPECT_EQ(static_cast<GLuint>(16), cmd.row_bytes);
EXPECT_EQ(static_cast<GLuint>(17), cmd.dst_sk_color_type);
EXPECT_EQ(static_cast<GLuint>(18), cmd.dst_sk_alpha_type);
EXPECT_EQ(static_cast<GLint>(19), cmd.shm_id);
EXPECT_EQ(static_cast<GLuint>(20), cmd.shm_offset);
EXPECT_EQ(static_cast<GLuint>(21), cmd.color_space_offset);
EXPECT_EQ(static_cast<GLuint>(22), cmd.pixels_offset);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(RasterFormatTest, ReadbackYUVImagePixelsINTERNALImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLbyte data[] = {
static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
};
cmds::ReadbackYUVImagePixelsINTERNALImmediate& cmd =
*GetBufferAs<cmds::ReadbackYUVImagePixelsINTERNALImmediate>();
void* next_cmd = cmd.Set(
&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
static_cast<GLint>(13), static_cast<GLuint>(14), static_cast<GLuint>(15),
static_cast<GLuint>(16), static_cast<GLuint>(17), static_cast<GLuint>(18),
static_cast<GLuint>(19), static_cast<GLuint>(20), data);
EXPECT_EQ(static_cast<uint32_t>(
cmds::ReadbackYUVImagePixelsINTERNALImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.dst_width);
EXPECT_EQ(static_cast<GLuint>(12), cmd.dst_height);
EXPECT_EQ(static_cast<GLint>(13), cmd.shm_id);
EXPECT_EQ(static_cast<GLuint>(14), cmd.shm_offset);
EXPECT_EQ(static_cast<GLuint>(15), cmd.y_offset);
EXPECT_EQ(static_cast<GLuint>(16), cmd.y_stride);
EXPECT_EQ(static_cast<GLuint>(17), cmd.u_offset);
EXPECT_EQ(static_cast<GLuint>(18), cmd.u_stride);
EXPECT_EQ(static_cast<GLuint>(19), cmd.v_offset);
EXPECT_EQ(static_cast<GLuint>(20), cmd.v_stride);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(RasterFormatTest, ConvertYUVAMailboxesToRGBINTERNALImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLbyte data[] = {
static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 16),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 17),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 18),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 19),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 20),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 21),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 22),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 23),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 24),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 25),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 26),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 27),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 28),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 29),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 30),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 31),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 32),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 33),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 34),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 35),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 36),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 37),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 38),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 39),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 40),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 41),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 42),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 43),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 44),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 45),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 46),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 47),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 48),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 49),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 50),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 51),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 52),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 53),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 54),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 55),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 56),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 57),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 58),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 59),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 60),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 61),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 62),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 63),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 64),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 65),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 66),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 67),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 68),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 69),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 70),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 71),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 72),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 73),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 74),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 75),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 76),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 77),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 78),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 79),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 80),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 81),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 82),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 83),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 84),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 85),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 86),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 87),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 88),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 89),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 90),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 91),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 92),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 93),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 94),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 95),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 96),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 97),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 98),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 99),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 100),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 101),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 102),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 103),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 104),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 105),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 106),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 107),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 108),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 109),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 110),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 111),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 112),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 113),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 114),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 115),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 116),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 117),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 118),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 119),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 120),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 121),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 122),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 123),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 124),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 125),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 126),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 127),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 128),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 129),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 130),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 131),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 132),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 133),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 134),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 135),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 136),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 137),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 138),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 139),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 140),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 141),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 142),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 143),
};
cmds::ConvertYUVAMailboxesToRGBINTERNALImmediate& cmd =
*GetBufferAs<cmds::ConvertYUVAMailboxesToRGBINTERNALImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11), static_cast<GLint>(12),
static_cast<GLsizei>(13), static_cast<GLsizei>(14),
static_cast<GLenum>(15), static_cast<GLenum>(16),
static_cast<GLenum>(17), data);
EXPECT_EQ(static_cast<uint32_t>(
cmds::ConvertYUVAMailboxesToRGBINTERNALImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLint>(11), cmd.src_x);
EXPECT_EQ(static_cast<GLint>(12), cmd.src_y);
EXPECT_EQ(static_cast<GLsizei>(13), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(14), cmd.height);
EXPECT_EQ(static_cast<GLenum>(15), cmd.planes_yuv_color_space);
EXPECT_EQ(static_cast<GLenum>(16), cmd.plane_config);
EXPECT_EQ(static_cast<GLenum>(17), cmd.subsampling);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(RasterFormatTest, ConvertRGBAToYUVAMailboxesINTERNALImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLbyte data[] = {
static_cast<GLbyte>(kSomeBaseValueToTestWith + 0),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 1),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 2),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 3),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 4),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 5),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 6),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 7),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 8),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 9),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 10),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 11),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 12),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 13),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 14),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 15),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 16),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 17),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 18),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 19),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 20),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 21),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 22),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 23),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 24),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 25),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 26),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 27),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 28),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 29),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 30),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 31),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 32),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 33),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 34),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 35),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 36),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 37),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 38),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 39),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 40),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 41),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 42),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 43),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 44),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 45),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 46),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 47),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 48),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 49),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 50),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 51),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 52),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 53),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 54),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 55),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 56),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 57),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 58),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 59),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 60),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 61),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 62),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 63),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 64),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 65),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 66),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 67),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 68),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 69),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 70),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 71),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 72),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 73),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 74),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 75),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 76),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 77),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 78),
static_cast<GLbyte>(kSomeBaseValueToTestWith + 79),
};
cmds::ConvertRGBAToYUVAMailboxesINTERNALImmediate& cmd =
*GetBufferAs<cmds::ConvertRGBAToYUVAMailboxesINTERNALImmediate>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<GLenum>(13), data);
EXPECT_EQ(static_cast<uint32_t>(
cmds::ConvertRGBAToYUVAMailboxesINTERNALImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.planes_yuv_color_space);
EXPECT_EQ(static_cast<GLenum>(12), cmd.plane_config);
EXPECT_EQ(static_cast<GLenum>(13), cmd.subsampling);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(RasterFormatTest, TraceBeginCHROMIUM) {
cmds::TraceBeginCHROMIUM& cmd = *GetBufferAs<cmds::TraceBeginCHROMIUM>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::TraceBeginCHROMIUM::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.category_bucket_id);
EXPECT_EQ(static_cast<GLuint>(12), cmd.name_bucket_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, TraceEndCHROMIUM) {
cmds::TraceEndCHROMIUM& cmd = *GetBufferAs<cmds::TraceEndCHROMIUM>();
void* next_cmd = cmd.Set(&cmd);
EXPECT_EQ(static_cast<uint32_t>(cmds::TraceEndCHROMIUM::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(RasterFormatTest, SetActiveURLCHROMIUM) {
cmds::SetActiveURLCHROMIUM& cmd = *GetBufferAs<cmds::SetActiveURLCHROMIUM>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::SetActiveURLCHROMIUM::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.url_bucket_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
#endif // GPU_COMMAND_BUFFER_COMMON_RASTER_CMD_FORMAT_TEST_AUTOGEN_H_
|