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 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 return *result != 0; | 2356 return *result != 0; |
2357 } | 2357 } |
2358 | 2358 |
2359 void GLES2Implementation::GetActiveUniformBlockName( | 2359 void GLES2Implementation::GetActiveUniformBlockName( |
2360 GLuint program, GLuint index, GLsizei bufsize, | 2360 GLuint program, GLuint index, GLsizei bufsize, |
2361 GLsizei* length, char* name) { | 2361 GLsizei* length, char* name) { |
2362 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 2362 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
2363 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetActiveUniformBlockName(" | 2363 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetActiveUniformBlockName(" |
2364 << program << ", " << index << ", " << bufsize << ", " | 2364 << program << ", " << index << ", " << bufsize << ", " |
2365 << static_cast<const void*>(length) << ", " | 2365 << static_cast<const void*>(length) << ", " |
2366 << static_cast<const void*>(name) << ", "); | 2366 << static_cast<const void*>(name) << ")"); |
2367 if (bufsize < 0) { | 2367 if (bufsize < 0) { |
2368 SetGLError(GL_INVALID_VALUE, "glGetActiveUniformBlockName", "bufsize < 0"); | 2368 SetGLError(GL_INVALID_VALUE, "glGetActiveUniformBlockName", "bufsize < 0"); |
2369 return; | 2369 return; |
2370 } | 2370 } |
2371 TRACE_EVENT0("gpu", "GLES2::GetActiveUniformBlockName"); | 2371 TRACE_EVENT0("gpu", "GLES2::GetActiveUniformBlockName"); |
2372 bool success = | 2372 bool success = |
2373 share_group_->program_info_manager()->GetActiveUniformBlockName( | 2373 share_group_->program_info_manager()->GetActiveUniformBlockName( |
2374 this, program, index, bufsize, length, name); | 2374 this, program, index, bufsize, length, name); |
2375 if (success) { | 2375 if (success) { |
2376 if (name) { | 2376 if (name) { |
2377 GPU_CLIENT_LOG(" name: " << name); | 2377 GPU_CLIENT_LOG(" name: " << name); |
2378 } | 2378 } |
2379 } | 2379 } |
2380 CheckGLError(); | 2380 CheckGLError(); |
2381 } | 2381 } |
2382 | 2382 |
| 2383 bool GLES2Implementation::GetActiveUniformBlockivHelper( |
| 2384 GLuint program, GLuint index, GLenum pname, GLint* params) { |
| 2385 typedef cmds::GetActiveUniformBlockiv::Result Result; |
| 2386 Result* result = GetResultAs<Result*>(); |
| 2387 if (!result) { |
| 2388 return false; |
| 2389 } |
| 2390 result->SetNumResults(0); |
| 2391 helper_->GetActiveUniformBlockiv( |
| 2392 program, index, pname, GetResultShmId(), GetResultShmOffset()); |
| 2393 WaitForCmd(); |
| 2394 if (result->GetNumResults() > 0) { |
| 2395 if (params) { |
| 2396 result->CopyResult(params); |
| 2397 } |
| 2398 GPU_CLIENT_LOG_CODE_BLOCK({ |
| 2399 for (int32_t i = 0; i < result->GetNumResults(); ++i) { |
| 2400 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); |
| 2401 } |
| 2402 }); |
| 2403 return true; |
| 2404 } |
| 2405 return false; |
| 2406 } |
| 2407 |
| 2408 void GLES2Implementation::GetActiveUniformBlockiv( |
| 2409 GLuint program, GLuint index, GLenum pname, GLint* params) { |
| 2410 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 2411 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetActiveUniformBlockiv(" |
| 2412 << program << ", " << index << ", " |
| 2413 << GLES2Util::GetStringProgramParameter(pname) << ", " |
| 2414 << static_cast<const void*>(params) << ")"); |
| 2415 TRACE_EVENT0("gpu", "GLES2::GetActiveUniformBlockiv"); |
| 2416 bool success = |
| 2417 share_group_->program_info_manager()->GetActiveUniformBlockiv( |
| 2418 this, program, index, pname, params); |
| 2419 if (success) { |
| 2420 if (params) { |
| 2421 // TODO(zmo): For GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, there will |
| 2422 // be more than one value returned in params. |
| 2423 GPU_CLIENT_LOG(" params: " << params[0]); |
| 2424 } |
| 2425 } |
| 2426 CheckGLError(); |
| 2427 } |
| 2428 |
2383 void GLES2Implementation::GetAttachedShaders( | 2429 void GLES2Implementation::GetAttachedShaders( |
2384 GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { | 2430 GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { |
2385 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 2431 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
2386 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetAttachedShaders(" | 2432 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetAttachedShaders(" |
2387 << program << ", " << maxcount << ", " | 2433 << program << ", " << maxcount << ", " |
2388 << static_cast<const void*>(count) << ", " | 2434 << static_cast<const void*>(count) << ", " |
2389 << static_cast<const void*>(shaders) << ", "); | 2435 << static_cast<const void*>(shaders) << ", "); |
2390 if (maxcount < 0) { | 2436 if (maxcount < 0) { |
2391 SetGLError(GL_INVALID_VALUE, "glGetAttachedShaders", "maxcount < 0"); | 2437 SetGLError(GL_INVALID_VALUE, "glGetAttachedShaders", "maxcount < 0"); |
2392 return; | 2438 return; |
(...skipping 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4603 return true; | 4649 return true; |
4604 } | 4650 } |
4605 | 4651 |
4606 // Include the auto-generated part of this file. We split this because it means | 4652 // Include the auto-generated part of this file. We split this because it means |
4607 // we can easily edit the non-auto generated parts right here in this file | 4653 // we can easily edit the non-auto generated parts right here in this file |
4608 // instead of having to edit some template or the code generator. | 4654 // instead of having to edit some template or the code generator. |
4609 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 4655 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
4610 | 4656 |
4611 } // namespace gles2 | 4657 } // namespace gles2 |
4612 } // namespace gpu | 4658 } // namespace gpu |
OLD | NEW |