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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 return false; | 718 return false; |
719 } | 719 } |
720 *params = static_cast<GLfloat>(value); | 720 *params = static_cast<GLfloat>(value); |
721 return true; | 721 return true; |
722 } | 722 } |
723 | 723 |
724 bool GLES2Implementation::GetIntegervHelper(GLenum pname, GLint* params) { | 724 bool GLES2Implementation::GetIntegervHelper(GLenum pname, GLint* params) { |
725 return GetHelper(pname, params); | 725 return GetHelper(pname, params); |
726 } | 726 } |
727 | 727 |
| 728 bool GLES2Implementation::GetInternalformativHelper( |
| 729 GLenum target, GLenum format, GLenum pname, GLsizei bufSize, |
| 730 GLint* params) { |
| 731 // TODO(zmo): Implement the client side caching. |
| 732 return false; |
| 733 } |
| 734 |
728 GLuint GLES2Implementation::GetMaxValueInBufferCHROMIUMHelper( | 735 GLuint GLES2Implementation::GetMaxValueInBufferCHROMIUMHelper( |
729 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { | 736 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { |
730 typedef cmds::GetMaxValueInBufferCHROMIUM::Result Result; | 737 typedef cmds::GetMaxValueInBufferCHROMIUM::Result Result; |
731 Result* result = GetResultAs<Result*>(); | 738 Result* result = GetResultAs<Result*>(); |
732 if (!result) { | 739 if (!result) { |
733 return 0; | 740 return 0; |
734 } | 741 } |
735 *result = 0; | 742 *result = 0; |
736 helper_->GetMaxValueInBufferCHROMIUM( | 743 helper_->GetMaxValueInBufferCHROMIUM( |
737 buffer_id, count, type, offset, GetResultShmId(), GetResultShmOffset()); | 744 buffer_id, count, type, offset, GetResultShmId(), GetResultShmOffset()); |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 pack_reverse_row_order_ = | 1111 pack_reverse_row_order_ = |
1105 IsAnglePackReverseRowOrderAvailable() ? (param != 0) : false; | 1112 IsAnglePackReverseRowOrderAvailable() ? (param != 0) : false; |
1106 break; | 1113 break; |
1107 default: | 1114 default: |
1108 break; | 1115 break; |
1109 } | 1116 } |
1110 helper_->PixelStorei(pname, param); | 1117 helper_->PixelStorei(pname, param); |
1111 CheckGLError(); | 1118 CheckGLError(); |
1112 } | 1119 } |
1113 | 1120 |
| 1121 void GLES2Implementation::VertexAttribIPointer( |
| 1122 GLuint index, GLint size, GLenum type, GLsizei stride, const void* ptr) { |
| 1123 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 1124 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribPointer(" |
| 1125 << index << ", " |
| 1126 << size << ", " |
| 1127 << GLES2Util::GetStringVertexAttribType(type) << ", " |
| 1128 << stride << ", " |
| 1129 << ptr << ")"); |
| 1130 helper_->VertexAttribIPointer(index, size, type, stride, ToGLuint(ptr)); |
| 1131 CheckGLError(); |
| 1132 } |
| 1133 |
1114 void GLES2Implementation::VertexAttribPointer( | 1134 void GLES2Implementation::VertexAttribPointer( |
1115 GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, | 1135 GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, |
1116 const void* ptr) { | 1136 const void* ptr) { |
1117 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 1137 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
1118 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribPointer(" | 1138 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribPointer(" |
1119 << index << ", " | 1139 << index << ", " |
1120 << size << ", " | 1140 << size << ", " |
1121 << GLES2Util::GetStringVertexAttribType(type) << ", " | 1141 << GLES2Util::GetStringVertexAttribType(type) << ", " |
1122 << GLES2Util::GetStringBool(normalized) << ", " | 1142 << GLES2Util::GetStringBool(normalized) << ", " |
1123 << stride << ", " | 1143 << stride << ", " |
1124 << static_cast<const void*>(ptr) << ")"); | 1144 << ptr << ")"); |
1125 // Record the info on the client side. | 1145 // Record the info on the client side. |
1126 if (!vertex_array_object_manager_->SetAttribPointer( | 1146 if (!vertex_array_object_manager_->SetAttribPointer( |
1127 bound_array_buffer_id_, index, size, type, normalized, stride, ptr)) { | 1147 bound_array_buffer_id_, index, size, type, normalized, stride, ptr)) { |
1128 SetGLError(GL_INVALID_OPERATION, "glVertexAttribPointer", | 1148 SetGLError(GL_INVALID_OPERATION, "glVertexAttribPointer", |
1129 "client side arrays are not allowed in vertex array objects."); | 1149 "client side arrays are not allowed in vertex array objects."); |
1130 return; | 1150 return; |
1131 } | 1151 } |
1132 if (!support_client_side_arrays_ || bound_array_buffer_id_ != 0) { | 1152 if (!support_client_side_arrays_ || bound_array_buffer_id_ != 0) { |
1133 // Only report NON client side buffers to the service. | 1153 // Only report NON client side buffers to the service. |
1134 if (!ValidateOffset("glVertexAttribPointer", | 1154 if (!ValidateOffset("glVertexAttribPointer", |
(...skipping 2770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3905 return true; | 3925 return true; |
3906 } | 3926 } |
3907 | 3927 |
3908 // Include the auto-generated part of this file. We split this because it means | 3928 // Include the auto-generated part of this file. We split this because it means |
3909 // we can easily edit the non-auto generated parts right here in this file | 3929 // we can easily edit the non-auto generated parts right here in this file |
3910 // instead of having to edit some template or the code generator. | 3930 // instead of having to edit some template or the code generator. |
3911 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 3931 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
3912 | 3932 |
3913 } // namespace gles2 | 3933 } // namespace gles2 |
3914 } // namespace gpu | 3934 } // namespace gpu |
OLD | NEW |