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 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 void GLES2Implementation::DeleteShaderStub( | 1116 void GLES2Implementation::DeleteShaderStub( |
1117 GLsizei n, const GLuint* shaders) { | 1117 GLsizei n, const GLuint* shaders) { |
1118 DCHECK_EQ(1, n); | 1118 DCHECK_EQ(1, n); |
1119 share_group_->program_info_manager()->DeleteInfo(shaders[0]); | 1119 share_group_->program_info_manager()->DeleteInfo(shaders[0]); |
1120 helper_->DeleteShader(shaders[0]); | 1120 helper_->DeleteShader(shaders[0]); |
1121 } | 1121 } |
1122 | 1122 |
1123 | 1123 |
1124 GLint GLES2Implementation::GetAttribLocationHelper( | 1124 GLint GLES2Implementation::GetAttribLocationHelper( |
1125 GLuint program, const char* name) { | 1125 GLuint program, const char* name) { |
1126 typedef cmds::GetAttribLocationBucket::Result Result; | 1126 typedef cmds::GetAttribLocation::Result Result; |
1127 Result* result = GetResultAs<Result*>(); | 1127 Result* result = GetResultAs<Result*>(); |
1128 if (!result) { | 1128 if (!result) { |
1129 return -1; | 1129 return -1; |
1130 } | 1130 } |
1131 *result = -1; | 1131 *result = -1; |
1132 SetBucketAsCString(kResultBucketId, name); | 1132 SetBucketAsCString(kResultBucketId, name); |
1133 helper_->GetAttribLocationBucket( | 1133 helper_->GetAttribLocation( |
1134 program, kResultBucketId, GetResultShmId(), GetResultShmOffset()); | 1134 program, kResultBucketId, GetResultShmId(), GetResultShmOffset()); |
1135 WaitForCmd(); | 1135 WaitForCmd(); |
1136 helper_->SetBucketSize(kResultBucketId, 0); | 1136 helper_->SetBucketSize(kResultBucketId, 0); |
1137 return *result; | 1137 return *result; |
1138 } | 1138 } |
1139 | 1139 |
1140 GLint GLES2Implementation::GetAttribLocation( | 1140 GLint GLES2Implementation::GetAttribLocation( |
1141 GLuint program, const char* name) { | 1141 GLuint program, const char* name) { |
1142 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 1142 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
1143 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetAttribLocation(" << program | 1143 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetAttribLocation(" << program |
1144 << ", " << name << ")"); | 1144 << ", " << name << ")"); |
1145 TRACE_EVENT0("gpu", "GLES2::GetAttribLocation"); | 1145 TRACE_EVENT0("gpu", "GLES2::GetAttribLocation"); |
1146 GLint loc = share_group_->program_info_manager()->GetAttribLocation( | 1146 GLint loc = share_group_->program_info_manager()->GetAttribLocation( |
1147 this, program, name); | 1147 this, program, name); |
1148 GPU_CLIENT_LOG("returned " << loc); | 1148 GPU_CLIENT_LOG("returned " << loc); |
1149 CheckGLError(); | 1149 CheckGLError(); |
1150 return loc; | 1150 return loc; |
1151 } | 1151 } |
1152 | 1152 |
1153 GLint GLES2Implementation::GetUniformLocationHelper( | 1153 GLint GLES2Implementation::GetUniformLocationHelper( |
1154 GLuint program, const char* name) { | 1154 GLuint program, const char* name) { |
1155 typedef cmds::GetUniformLocationBucket::Result Result; | 1155 typedef cmds::GetUniformLocation::Result Result; |
1156 Result* result = GetResultAs<Result*>(); | 1156 Result* result = GetResultAs<Result*>(); |
1157 if (!result) { | 1157 if (!result) { |
1158 return -1; | 1158 return -1; |
1159 } | 1159 } |
1160 *result = -1; | 1160 *result = -1; |
1161 SetBucketAsCString(kResultBucketId, name); | 1161 SetBucketAsCString(kResultBucketId, name); |
1162 helper_->GetUniformLocationBucket(program, kResultBucketId, | 1162 helper_->GetUniformLocation(program, kResultBucketId, |
1163 GetResultShmId(), GetResultShmOffset()); | 1163 GetResultShmId(), GetResultShmOffset()); |
1164 WaitForCmd(); | 1164 WaitForCmd(); |
1165 helper_->SetBucketSize(kResultBucketId, 0); | 1165 helper_->SetBucketSize(kResultBucketId, 0); |
1166 return *result; | 1166 return *result; |
1167 } | 1167 } |
1168 | 1168 |
1169 GLint GLES2Implementation::GetUniformLocation( | 1169 GLint GLES2Implementation::GetUniformLocation( |
1170 GLuint program, const char* name) { | 1170 GLuint program, const char* name) { |
1171 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 1171 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
1172 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetUniformLocation(" << program | 1172 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetUniformLocation(" << program |
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4172 return true; | 4172 return true; |
4173 } | 4173 } |
4174 | 4174 |
4175 // Include the auto-generated part of this file. We split this because it means | 4175 // Include the auto-generated part of this file. We split this because it means |
4176 // we can easily edit the non-auto generated parts right here in this file | 4176 // we can easily edit the non-auto generated parts right here in this file |
4177 // instead of having to edit some template or the code generator. | 4177 // instead of having to edit some template or the code generator. |
4178 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 4178 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
4179 | 4179 |
4180 } // namespace gles2 | 4180 } // namespace gles2 |
4181 } // namespace gpu | 4181 } // namespace gpu |
OLD | NEW |