| 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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <GLES2/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
| 10 #include <GLES2/gl2extchromium.h> | 10 #include <GLES2/gl2extchromium.h> |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 case GL_MAX_3D_TEXTURE_SIZE: | 779 case GL_MAX_3D_TEXTURE_SIZE: |
| 780 *params = capabilities_.max_3d_texture_size; | 780 *params = capabilities_.max_3d_texture_size; |
| 781 return true; | 781 return true; |
| 782 case GL_MAX_ARRAY_TEXTURE_LAYERS: | 782 case GL_MAX_ARRAY_TEXTURE_LAYERS: |
| 783 *params = capabilities_.max_array_texture_layers; | 783 *params = capabilities_.max_array_texture_layers; |
| 784 return true; | 784 return true; |
| 785 case GL_MAX_COLOR_ATTACHMENTS: | 785 case GL_MAX_COLOR_ATTACHMENTS: |
| 786 *params = capabilities_.max_color_attachments; | 786 *params = capabilities_.max_color_attachments; |
| 787 return true; | 787 return true; |
| 788 case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: | 788 case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: |
| 789 *params = capabilities_.max_combined_fragment_uniform_components; | 789 *params = static_cast<GLint>( |
| 790 capabilities_.max_combined_fragment_uniform_components); |
| 790 return true; | 791 return true; |
| 791 case GL_MAX_COMBINED_UNIFORM_BLOCKS: | 792 case GL_MAX_COMBINED_UNIFORM_BLOCKS: |
| 792 *params = capabilities_.max_combined_uniform_blocks; | 793 *params = capabilities_.max_combined_uniform_blocks; |
| 793 return true; | 794 return true; |
| 794 case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: | 795 case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: |
| 795 *params = capabilities_.max_combined_vertex_uniform_components; | 796 *params = static_cast<GLint>( |
| 797 capabilities_.max_combined_vertex_uniform_components); |
| 796 return true; | 798 return true; |
| 797 case GL_MAX_DRAW_BUFFERS: | 799 case GL_MAX_DRAW_BUFFERS: |
| 798 *params = capabilities_.max_draw_buffers; | 800 *params = capabilities_.max_draw_buffers; |
| 799 return true; | 801 return true; |
| 800 case GL_MAX_ELEMENT_INDEX: | 802 case GL_MAX_ELEMENT_INDEX: |
| 801 *params = capabilities_.max_element_index; | 803 *params = static_cast<GLint>(capabilities_.max_element_index); |
| 802 return true; | 804 return true; |
| 803 case GL_MAX_ELEMENTS_INDICES: | 805 case GL_MAX_ELEMENTS_INDICES: |
| 804 *params = capabilities_.max_elements_indices; | 806 *params = capabilities_.max_elements_indices; |
| 805 return true; | 807 return true; |
| 806 case GL_MAX_ELEMENTS_VERTICES: | 808 case GL_MAX_ELEMENTS_VERTICES: |
| 807 *params = capabilities_.max_elements_vertices; | 809 *params = capabilities_.max_elements_vertices; |
| 808 return true; | 810 return true; |
| 809 case GL_MAX_FRAGMENT_INPUT_COMPONENTS: | 811 case GL_MAX_FRAGMENT_INPUT_COMPONENTS: |
| 810 *params = capabilities_.max_fragment_input_components; | 812 *params = capabilities_.max_fragment_input_components; |
| 811 return true; | 813 return true; |
| 812 case GL_MAX_FRAGMENT_UNIFORM_BLOCKS: | 814 case GL_MAX_FRAGMENT_UNIFORM_BLOCKS: |
| 813 *params = capabilities_.max_fragment_uniform_blocks; | 815 *params = capabilities_.max_fragment_uniform_blocks; |
| 814 return true; | 816 return true; |
| 815 case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: | 817 case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: |
| 816 *params = capabilities_.max_fragment_uniform_components; | 818 *params = capabilities_.max_fragment_uniform_components; |
| 817 return true; | 819 return true; |
| 818 case GL_MAX_PROGRAM_TEXEL_OFFSET: | 820 case GL_MAX_PROGRAM_TEXEL_OFFSET: |
| 819 *params = capabilities_.max_program_texel_offset; | 821 *params = capabilities_.max_program_texel_offset; |
| 820 return true; | 822 return true; |
| 821 case GL_MAX_SAMPLES: | 823 case GL_MAX_SAMPLES: |
| 822 *params = capabilities_.max_samples; | 824 *params = capabilities_.max_samples; |
| 823 return true; | 825 return true; |
| 824 case GL_MAX_SERVER_WAIT_TIMEOUT: | 826 case GL_MAX_SERVER_WAIT_TIMEOUT: |
| 825 *params = capabilities_.max_server_wait_timeout; | 827 *params = static_cast<GLint>(capabilities_.max_server_wait_timeout); |
| 828 return true; |
| 829 case GL_MAX_TEXTURE_LOD_BIAS: |
| 830 *params = static_cast<GLint>(capabilities_.max_texture_lod_bias); |
| 826 return true; | 831 return true; |
| 827 case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: | 832 case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: |
| 828 *params = capabilities_.max_transform_feedback_interleaved_components; | 833 *params = capabilities_.max_transform_feedback_interleaved_components; |
| 829 return true; | 834 return true; |
| 830 case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: | 835 case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: |
| 831 *params = capabilities_.max_transform_feedback_separate_attribs; | 836 *params = capabilities_.max_transform_feedback_separate_attribs; |
| 832 return true; | 837 return true; |
| 833 case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: | 838 case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: |
| 834 *params = capabilities_.max_transform_feedback_separate_components; | 839 *params = capabilities_.max_transform_feedback_separate_components; |
| 835 return true; | 840 return true; |
| 836 case GL_MAX_UNIFORM_BLOCK_SIZE: | 841 case GL_MAX_UNIFORM_BLOCK_SIZE: |
| 837 *params = capabilities_.max_uniform_block_size; | 842 *params = static_cast<GLint>(capabilities_.max_uniform_block_size); |
| 838 return true; | 843 return true; |
| 839 case GL_MAX_UNIFORM_BUFFER_BINDINGS: | 844 case GL_MAX_UNIFORM_BUFFER_BINDINGS: |
| 840 *params = capabilities_.max_uniform_buffer_bindings; | 845 *params = capabilities_.max_uniform_buffer_bindings; |
| 841 return true; | 846 return true; |
| 842 case GL_MAX_VARYING_COMPONENTS: | 847 case GL_MAX_VARYING_COMPONENTS: |
| 843 *params = capabilities_.max_varying_components; | 848 *params = capabilities_.max_varying_components; |
| 844 return true; | 849 return true; |
| 845 case GL_MAX_VERTEX_OUTPUT_COMPONENTS: | 850 case GL_MAX_VERTEX_OUTPUT_COMPONENTS: |
| 846 *params = capabilities_.max_vertex_output_components; | 851 *params = capabilities_.max_vertex_output_components; |
| 847 return true; | 852 return true; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 case GL_DRAW_BUFFER8: | 886 case GL_DRAW_BUFFER8: |
| 882 case GL_DRAW_BUFFER9: | 887 case GL_DRAW_BUFFER9: |
| 883 case GL_DRAW_BUFFER10: | 888 case GL_DRAW_BUFFER10: |
| 884 case GL_DRAW_BUFFER11: | 889 case GL_DRAW_BUFFER11: |
| 885 case GL_DRAW_BUFFER12: | 890 case GL_DRAW_BUFFER12: |
| 886 case GL_DRAW_BUFFER13: | 891 case GL_DRAW_BUFFER13: |
| 887 case GL_DRAW_BUFFER14: | 892 case GL_DRAW_BUFFER14: |
| 888 case GL_DRAW_BUFFER15: | 893 case GL_DRAW_BUFFER15: |
| 889 case GL_DRAW_FRAMEBUFFER_BINDING: | 894 case GL_DRAW_FRAMEBUFFER_BINDING: |
| 890 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT: | 895 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT: |
| 891 case GL_MAX_TEXTURE_LOD_BIAS: | |
| 892 case GL_PACK_ROW_LENGTH: | 896 case GL_PACK_ROW_LENGTH: |
| 893 case GL_PACK_SKIP_PIXELS: | 897 case GL_PACK_SKIP_PIXELS: |
| 894 case GL_PACK_SKIP_ROWS: | 898 case GL_PACK_SKIP_ROWS: |
| 895 case GL_PIXEL_PACK_BUFFER_BINDING: | 899 case GL_PIXEL_PACK_BUFFER_BINDING: |
| 896 case GL_PIXEL_UNPACK_BUFFER_BINDING: | 900 case GL_PIXEL_UNPACK_BUFFER_BINDING: |
| 897 case GL_PRIMITIVE_RESTART_FIXED_INDEX: | 901 case GL_PRIMITIVE_RESTART_FIXED_INDEX: |
| 898 case GL_PROGRAM_BINARY_FORMATS: | 902 case GL_PROGRAM_BINARY_FORMATS: |
| 899 case GL_RASTERIZER_DISCARD: | 903 case GL_RASTERIZER_DISCARD: |
| 900 case GL_READ_BUFFER: | 904 case GL_READ_BUFFER: |
| 901 case GL_READ_FRAMEBUFFER_BINDING: | 905 case GL_READ_FRAMEBUFFER_BINDING: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 928 GLint value; | 932 GLint value; |
| 929 if (!GetHelper(pname, &value)) { | 933 if (!GetHelper(pname, &value)) { |
| 930 return false; | 934 return false; |
| 931 } | 935 } |
| 932 *params = static_cast<GLboolean>(value); | 936 *params = static_cast<GLboolean>(value); |
| 933 return true; | 937 return true; |
| 934 } | 938 } |
| 935 | 939 |
| 936 bool GLES2Implementation::GetFloatvHelper(GLenum pname, GLfloat* params) { | 940 bool GLES2Implementation::GetFloatvHelper(GLenum pname, GLfloat* params) { |
| 937 // TODO(gman): Make this handle pnames that return more than 1 value. | 941 // TODO(gman): Make this handle pnames that return more than 1 value. |
| 942 switch (pname) { |
| 943 case GL_MAX_TEXTURE_LOD_BIAS: |
| 944 *params = capabilities_.max_texture_lod_bias; |
| 945 return true; |
| 946 default: |
| 947 break; |
| 948 } |
| 938 GLint value; | 949 GLint value; |
| 939 if (!GetHelper(pname, &value)) { | 950 if (!GetHelper(pname, &value)) { |
| 940 return false; | 951 return false; |
| 941 } | 952 } |
| 942 *params = static_cast<GLfloat>(value); | 953 *params = static_cast<GLfloat>(value); |
| 943 return true; | 954 return true; |
| 944 } | 955 } |
| 945 | 956 |
| 946 bool GLES2Implementation::GetInteger64vHelper(GLenum pname, GLint64* params) { | 957 bool GLES2Implementation::GetInteger64vHelper(GLenum pname, GLint64* params) { |
| 947 // TODO(zmo): we limit values to 32-bit, which is OK for now. | 958 switch (pname) { |
| 959 case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: |
| 960 *params = capabilities_.max_combined_fragment_uniform_components; |
| 961 return true; |
| 962 case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: |
| 963 *params = capabilities_.max_combined_vertex_uniform_components; |
| 964 return true; |
| 965 case GL_MAX_ELEMENT_INDEX: |
| 966 *params = capabilities_.max_element_index; |
| 967 return true; |
| 968 case GL_MAX_SERVER_WAIT_TIMEOUT: |
| 969 *params = capabilities_.max_server_wait_timeout; |
| 970 return true; |
| 971 case GL_MAX_UNIFORM_BLOCK_SIZE: |
| 972 *params = capabilities_.max_uniform_block_size; |
| 973 return true; |
| 974 default: |
| 975 break; |
| 976 } |
| 948 GLint value; | 977 GLint value; |
| 949 if (!GetHelper(pname, &value)) { | 978 if (!GetHelper(pname, &value)) { |
| 950 return false; | 979 return false; |
| 951 } | 980 } |
| 952 *params = value; | 981 *params = static_cast<GLint64>(value); |
| 953 return true; | 982 return true; |
| 954 } | 983 } |
| 955 | 984 |
| 956 bool GLES2Implementation::GetIntegervHelper(GLenum pname, GLint* params) { | 985 bool GLES2Implementation::GetIntegervHelper(GLenum pname, GLint* params) { |
| 957 return GetHelper(pname, params); | 986 return GetHelper(pname, params); |
| 958 } | 987 } |
| 959 | 988 |
| 960 bool GLES2Implementation::GetIntegeri_vHelper( | 989 bool GLES2Implementation::GetIntegeri_vHelper( |
| 961 GLenum pname, GLuint index, GLint* data) { | 990 GLenum pname, GLuint index, GLint* data) { |
| 962 // TODO(zmo): Implement client side caching. | 991 // TODO(zmo): Implement client side caching. |
| (...skipping 4611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5574 CheckGLError(); | 5603 CheckGLError(); |
| 5575 } | 5604 } |
| 5576 | 5605 |
| 5577 // Include the auto-generated part of this file. We split this because it means | 5606 // Include the auto-generated part of this file. We split this because it means |
| 5578 // we can easily edit the non-auto generated parts right here in this file | 5607 // we can easily edit the non-auto generated parts right here in this file |
| 5579 // instead of having to edit some template or the code generator. | 5608 // instead of having to edit some template or the code generator. |
| 5580 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 5609 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 5581 | 5610 |
| 5582 } // namespace gles2 | 5611 } // namespace gles2 |
| 5583 } // namespace gpu | 5612 } // namespace gpu |
| OLD | NEW |