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