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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 bool got_value = share_group_->program_info_manager()->GetProgramiv( | 1054 bool got_value = share_group_->program_info_manager()->GetProgramiv( |
1055 this, program, pname, params); | 1055 this, program, pname, params); |
1056 GPU_CLIENT_LOG_CODE_BLOCK({ | 1056 GPU_CLIENT_LOG_CODE_BLOCK({ |
1057 if (got_value) { | 1057 if (got_value) { |
1058 GPU_CLIENT_LOG(" 0: " << *params); | 1058 GPU_CLIENT_LOG(" 0: " << *params); |
1059 } | 1059 } |
1060 }); | 1060 }); |
1061 return got_value; | 1061 return got_value; |
1062 } | 1062 } |
1063 | 1063 |
| 1064 GLint GLES2Implementation::GetFragDataLocationHelper( |
| 1065 GLuint program, const char* name) { |
| 1066 typedef cmds::GetFragDataLocation::Result Result; |
| 1067 Result* result = GetResultAs<Result*>(); |
| 1068 if (!result) { |
| 1069 return -1; |
| 1070 } |
| 1071 *result = -1; |
| 1072 SetBucketAsCString(kResultBucketId, name); |
| 1073 helper_->GetFragDataLocation( |
| 1074 program, kResultBucketId, GetResultShmId(), GetResultShmOffset()); |
| 1075 WaitForCmd(); |
| 1076 helper_->SetBucketSize(kResultBucketId, 0); |
| 1077 return *result; |
| 1078 } |
| 1079 |
| 1080 GLint GLES2Implementation::GetFragDataLocation( |
| 1081 GLuint program, const char* name) { |
| 1082 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 1083 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFragDataLocation(" |
| 1084 << program << ", " << name << ")"); |
| 1085 TRACE_EVENT0("gpu", "GLES2::GetFragDataLocation"); |
| 1086 GLint loc = share_group_->program_info_manager()->GetFragDataLocation( |
| 1087 this, program, name); |
| 1088 GPU_CLIENT_LOG("returned " << loc); |
| 1089 CheckGLError(); |
| 1090 return loc; |
| 1091 } |
| 1092 |
1064 void GLES2Implementation::LinkProgram(GLuint program) { | 1093 void GLES2Implementation::LinkProgram(GLuint program) { |
1065 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 1094 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
1066 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLinkProgram(" << program << ")"); | 1095 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLinkProgram(" << program << ")"); |
1067 helper_->LinkProgram(program); | 1096 helper_->LinkProgram(program); |
1068 share_group_->program_info_manager()->CreateInfo(program); | 1097 share_group_->program_info_manager()->CreateInfo(program); |
1069 CheckGLError(); | 1098 CheckGLError(); |
1070 } | 1099 } |
1071 | 1100 |
1072 void GLES2Implementation::ShaderBinary( | 1101 void GLES2Implementation::ShaderBinary( |
1073 GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, | 1102 GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, |
(...skipping 3270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4344 return false; | 4373 return false; |
4345 } | 4374 } |
4346 | 4375 |
4347 // Include the auto-generated part of this file. We split this because it means | 4376 // Include the auto-generated part of this file. We split this because it means |
4348 // we can easily edit the non-auto generated parts right here in this file | 4377 // we can easily edit the non-auto generated parts right here in this file |
4349 // instead of having to edit some template or the code generator. | 4378 // instead of having to edit some template or the code generator. |
4350 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 4379 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
4351 | 4380 |
4352 } // namespace gles2 | 4381 } // namespace gles2 |
4353 } // namespace gpu | 4382 } // namespace gpu |
OLD | NEW |