OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 */ | 30 */ |
31 | 31 |
32 | 32 |
33 // This file implements the texture-related GAPI functions on GL. | 33 // This file implements the texture-related GAPI functions on GL. |
34 | 34 |
35 #include "command_buffer/service/cross/gl/gapi_gl.h" | 35 #include "command_buffer/service/cross/gl/gapi_gl.h" |
36 #include "command_buffer/service/cross/gl/texture_gl.h" | 36 #include "command_buffer/service/cross/gl/texture_gl.h" |
37 | 37 |
38 namespace o3d { | 38 namespace o3d { |
39 namespace command_buffer { | 39 namespace command_buffer { |
| 40 namespace o3d { |
40 | 41 |
41 namespace { | 42 namespace { |
42 | 43 |
43 // Gets the GL internal format, format and type corresponding to a command | 44 // Gets the GL internal format, format and type corresponding to a command |
44 // buffer texture format. | 45 // buffer texture format. |
45 bool GetGLFormatType(texture::Format format, | 46 bool GetGLFormatType(texture::Format format, |
46 GLenum *internal_format, | 47 GLenum *internal_format, |
47 GLenum *gl_format, | 48 GLenum *gl_format, |
48 GLenum *gl_type) { | 49 GLenum *gl_type) { |
49 switch (format) { | 50 switch (format) { |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 | 637 |
637 GLenum framebuffer_status = ::glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); | 638 GLenum framebuffer_status = ::glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); |
638 if (GL_FRAMEBUFFER_COMPLETE_EXT != framebuffer_status) { | 639 if (GL_FRAMEBUFFER_COMPLETE_EXT != framebuffer_status) { |
639 return false; | 640 return false; |
640 } | 641 } |
641 | 642 |
642 return true; | 643 return true; |
643 } | 644 } |
644 | 645 |
645 | 646 |
646 // GAPIGL functions. | |
647 | |
648 // Destroys a texture resource. | 647 // Destroys a texture resource. |
649 parse_error::ParseError GAPIGL::DestroyTexture(ResourceId id) { | 648 parse_error::ParseError GAPIGL::DestroyTexture(ResourceId id) { |
650 // Dirty effect, because this texture id may be used. | 649 // Dirty effect, because this texture id may be used. |
651 DirtyEffect(); | 650 DirtyEffect(); |
652 return textures_.Destroy(id) ? | 651 return textures_.Destroy(id) ? |
653 parse_error::kParseNoError : | 652 parse_error::kParseNoError : |
654 parse_error::kParseInvalidArguments; | 653 parse_error::kParseInvalidArguments; |
655 } | 654 } |
656 | 655 |
657 // Creates a 2D texture resource. | 656 // Creates a 2D texture resource. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 Volume volume = {x, y, z, width, height, depth}; | 756 Volume volume = {x, y, z, width, height, depth}; |
758 // Dirty effect: GetData may need to call glBindTexture which will mess up the | 757 // Dirty effect: GetData may need to call glBindTexture which will mess up the |
759 // sampler parameters. | 758 // sampler parameters. |
760 DirtyEffect(); | 759 DirtyEffect(); |
761 return texture->GetData(volume, level, face, row_pitch, slice_pitch, | 760 return texture->GetData(volume, level, face, row_pitch, slice_pitch, |
762 size, data) ? | 761 size, data) ? |
763 parse_error::kParseNoError : | 762 parse_error::kParseNoError : |
764 parse_error::kParseInvalidArguments; | 763 parse_error::kParseInvalidArguments; |
765 } | 764 } |
766 | 765 |
| 766 } // namespace o3d |
767 } // namespace command_buffer | 767 } // namespace command_buffer |
768 } // namespace o3d | 768 } // namespace o3d |
OLD | NEW |