Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: command_buffer/service/win/d3d9/texture_d3d9.cc

Issue 212018: Change command buffer client code to use structures.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « command_buffer/service/win/d3d9/sampler_d3d9.cc ('k') | core/cross/command_buffer/buffer_cb.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 return true; 605 return true;
606 } 606 }
607 607
608 // GAPID3D9 functions. 608 // GAPID3D9 functions.
609 609
610 // Destroys a texture resource. 610 // Destroys a texture resource.
611 BufferSyncInterface::ParseError GAPID3D9::DestroyTexture(ResourceID id) { 611 BufferSyncInterface::ParseError GAPID3D9::DestroyTexture(ResourceID id) {
612 // Dirty effect, because this texture id may be used 612 // Dirty effect, because this texture id may be used
613 DirtyEffect(); 613 DirtyEffect();
614 return textures_.Destroy(id) ? 614 return textures_.Destroy(id) ?
615 BufferSyncInterface::PARSE_NO_ERROR : 615 BufferSyncInterface::kParseNoError :
616 BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 616 BufferSyncInterface::kParseInvalidArguments;
617 } 617 }
618 618
619 // Creates a 2D texture resource. 619 // Creates a 2D texture resource.
620 BufferSyncInterface::ParseError GAPID3D9::CreateTexture2D( 620 BufferSyncInterface::ParseError GAPID3D9::CreateTexture2D(
621 ResourceID id, 621 ResourceID id,
622 unsigned int width, 622 unsigned int width,
623 unsigned int height, 623 unsigned int height,
624 unsigned int levels, 624 unsigned int levels,
625 texture::Format format, 625 texture::Format format,
626 unsigned int flags, 626 unsigned int flags,
627 bool enable_render_surfaces) { 627 bool enable_render_surfaces) {
628 Texture2DD3D9 *texture = Texture2DD3D9::Create(this, width, height, levels, 628 Texture2DD3D9 *texture = Texture2DD3D9::Create(this, width, height, levels,
629 format, flags, 629 format, flags,
630 enable_render_surfaces); 630 enable_render_surfaces);
631 if (!texture) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 631 if (!texture) return BufferSyncInterface::kParseInvalidArguments;
632 // Dirty effect, because this texture id may be used 632 // Dirty effect, because this texture id may be used
633 DirtyEffect(); 633 DirtyEffect();
634 textures_.Assign(id, texture); 634 textures_.Assign(id, texture);
635 return BufferSyncInterface::PARSE_NO_ERROR; 635 return BufferSyncInterface::kParseNoError;
636 } 636 }
637 637
638 // Creates a 3D texture resource. 638 // Creates a 3D texture resource.
639 BufferSyncInterface::ParseError GAPID3D9::CreateTexture3D( 639 BufferSyncInterface::ParseError GAPID3D9::CreateTexture3D(
640 ResourceID id, 640 ResourceID id,
641 unsigned int width, 641 unsigned int width,
642 unsigned int height, 642 unsigned int height,
643 unsigned int depth, 643 unsigned int depth,
644 unsigned int levels, 644 unsigned int levels,
645 texture::Format format, 645 texture::Format format,
646 unsigned int flags, 646 unsigned int flags,
647 bool enable_render_surfaces) { 647 bool enable_render_surfaces) {
648 Texture3DD3D9 *texture = Texture3DD3D9::Create(this, width, height, depth, 648 Texture3DD3D9 *texture = Texture3DD3D9::Create(this, width, height, depth,
649 levels, format, flags, 649 levels, format, flags,
650 enable_render_surfaces); 650 enable_render_surfaces);
651 if (!texture) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 651 if (!texture) return BufferSyncInterface::kParseInvalidArguments;
652 // Dirty effect, because this texture id may be used 652 // Dirty effect, because this texture id may be used
653 DirtyEffect(); 653 DirtyEffect();
654 textures_.Assign(id, texture); 654 textures_.Assign(id, texture);
655 return BufferSyncInterface::PARSE_NO_ERROR; 655 return BufferSyncInterface::kParseNoError;
656 } 656 }
657 657
658 // Creates a cube map texture resource. 658 // Creates a cube map texture resource.
659 BufferSyncInterface::ParseError GAPID3D9::CreateTextureCube( 659 BufferSyncInterface::ParseError GAPID3D9::CreateTextureCube(
660 ResourceID id, 660 ResourceID id,
661 unsigned int side, 661 unsigned int side,
662 unsigned int levels, 662 unsigned int levels,
663 texture::Format format, 663 texture::Format format,
664 unsigned int flags, 664 unsigned int flags,
665 bool enable_render_surfaces) { 665 bool enable_render_surfaces) {
666 TextureCubeD3D9 *texture = TextureCubeD3D9::Create(this, side, levels, 666 TextureCubeD3D9 *texture = TextureCubeD3D9::Create(this, side, levels,
667 format, flags, 667 format, flags,
668 enable_render_surfaces); 668 enable_render_surfaces);
669 if (!texture) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 669 if (!texture) return BufferSyncInterface::kParseInvalidArguments;
670 // Dirty effect, because this texture id may be used 670 // Dirty effect, because this texture id may be used
671 DirtyEffect(); 671 DirtyEffect();
672 textures_.Assign(id, texture); 672 textures_.Assign(id, texture);
673 return BufferSyncInterface::PARSE_NO_ERROR; 673 return BufferSyncInterface::kParseNoError;
674 } 674 }
675 675
676 // Copies the data into a texture resource. 676 // Copies the data into a texture resource.
677 BufferSyncInterface::ParseError GAPID3D9::SetTextureData( 677 BufferSyncInterface::ParseError GAPID3D9::SetTextureData(
678 ResourceID id, 678 ResourceID id,
679 unsigned int x, 679 unsigned int x,
680 unsigned int y, 680 unsigned int y,
681 unsigned int z, 681 unsigned int z,
682 unsigned int width, 682 unsigned int width,
683 unsigned int height, 683 unsigned int height,
684 unsigned int depth, 684 unsigned int depth,
685 unsigned int level, 685 unsigned int level,
686 texture::Face face, 686 texture::Face face,
687 unsigned int row_pitch, 687 unsigned int row_pitch,
688 unsigned int slice_pitch, 688 unsigned int slice_pitch,
689 unsigned int size, 689 unsigned int size,
690 const void *data) { 690 const void *data) {
691 TextureD3D9 *texture = textures_.Get(id); 691 TextureD3D9 *texture = textures_.Get(id);
692 if (!texture) 692 if (!texture)
693 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 693 return BufferSyncInterface::kParseInvalidArguments;
694 Volume volume = {x, y, z, width, height, depth}; 694 Volume volume = {x, y, z, width, height, depth};
695 return texture->SetData(this, volume, level, face, row_pitch, slice_pitch, 695 return texture->SetData(this, volume, level, face, row_pitch, slice_pitch,
696 size, data) ? 696 size, data) ?
697 BufferSyncInterface::PARSE_NO_ERROR : 697 BufferSyncInterface::kParseNoError :
698 BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 698 BufferSyncInterface::kParseInvalidArguments;
699 } 699 }
700 700
701 // Copies the data from a texture resource. 701 // Copies the data from a texture resource.
702 BufferSyncInterface::ParseError GAPID3D9::GetTextureData( 702 BufferSyncInterface::ParseError GAPID3D9::GetTextureData(
703 ResourceID id, 703 ResourceID id,
704 unsigned int x, 704 unsigned int x,
705 unsigned int y, 705 unsigned int y,
706 unsigned int z, 706 unsigned int z,
707 unsigned int width, 707 unsigned int width,
708 unsigned int height, 708 unsigned int height,
709 unsigned int depth, 709 unsigned int depth,
710 unsigned int level, 710 unsigned int level,
711 texture::Face face, 711 texture::Face face,
712 unsigned int row_pitch, 712 unsigned int row_pitch,
713 unsigned int slice_pitch, 713 unsigned int slice_pitch,
714 unsigned int size, 714 unsigned int size,
715 void *data) { 715 void *data) {
716 TextureD3D9 *texture = textures_.Get(id); 716 TextureD3D9 *texture = textures_.Get(id);
717 if (!texture) 717 if (!texture)
718 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 718 return BufferSyncInterface::kParseInvalidArguments;
719 Volume volume = {x, y, z, width, height, depth}; 719 Volume volume = {x, y, z, width, height, depth};
720 return texture->GetData(this, volume, level, face, row_pitch, slice_pitch, 720 return texture->GetData(this, volume, level, face, row_pitch, slice_pitch,
721 size, data) ? 721 size, data) ?
722 BufferSyncInterface::PARSE_NO_ERROR : 722 BufferSyncInterface::kParseNoError :
723 BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 723 BufferSyncInterface::kParseInvalidArguments;
724 } 724 }
725 725
726 } // namespace command_buffer 726 } // namespace command_buffer
727 } // namespace o3d 727 } // namespace o3d
OLDNEW
« no previous file with comments | « command_buffer/service/win/d3d9/sampler_d3d9.cc ('k') | core/cross/command_buffer/buffer_cb.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698