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/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 GLuint program, GLuint index, const char* name) { | 1389 GLuint program, GLuint index, const char* name) { |
1390 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 1390 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
1391 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindAttribLocation(" | 1391 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindAttribLocation(" |
1392 << program << ", " << index << ", " << name << ")"); | 1392 << program << ", " << index << ", " << name << ")"); |
1393 SetBucketAsString(kResultBucketId, name); | 1393 SetBucketAsString(kResultBucketId, name); |
1394 helper_->BindAttribLocationBucket(program, index, kResultBucketId); | 1394 helper_->BindAttribLocationBucket(program, index, kResultBucketId); |
1395 helper_->SetBucketSize(kResultBucketId, 0); | 1395 helper_->SetBucketSize(kResultBucketId, 0); |
1396 CheckGLError(); | 1396 CheckGLError(); |
1397 } | 1397 } |
1398 | 1398 |
| 1399 void GLES2Implementation::BindFragDataLocationEXT(GLuint program, |
| 1400 GLuint colorName, |
| 1401 const char* name) { |
| 1402 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 1403 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFragDataLocationEXT(" |
| 1404 << program << ", " << colorName << ", " << name << ")"); |
| 1405 SetBucketAsString(kResultBucketId, name); |
| 1406 helper_->BindFragDataLocationEXTBucket(program, colorName, kResultBucketId); |
| 1407 helper_->SetBucketSize(kResultBucketId, 0); |
| 1408 CheckGLError(); |
| 1409 } |
| 1410 |
| 1411 void GLES2Implementation::BindFragDataLocationIndexedEXT(GLuint program, |
| 1412 GLuint colorName, |
| 1413 GLuint index, |
| 1414 const char* name) { |
| 1415 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 1416 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFragDataLocationEXT(" |
| 1417 << program << ", " << colorName << ", " << index << ", " |
| 1418 << name << ")"); |
| 1419 SetBucketAsString(kResultBucketId, name); |
| 1420 helper_->BindFragDataLocationIndexedEXTBucket(program, colorName, index, |
| 1421 kResultBucketId); |
| 1422 helper_->SetBucketSize(kResultBucketId, 0); |
| 1423 CheckGLError(); |
| 1424 } |
| 1425 |
1399 void GLES2Implementation::BindUniformLocationCHROMIUM( | 1426 void GLES2Implementation::BindUniformLocationCHROMIUM( |
1400 GLuint program, GLint location, const char* name) { | 1427 GLuint program, GLint location, const char* name) { |
1401 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 1428 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
1402 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindUniformLocationCHROMIUM(" | 1429 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindUniformLocationCHROMIUM(" |
1403 << program << ", " << location << ", " << name << ")"); | 1430 << program << ", " << location << ", " << name << ")"); |
1404 SetBucketAsString(kResultBucketId, name); | 1431 SetBucketAsString(kResultBucketId, name); |
1405 helper_->BindUniformLocationCHROMIUMBucket( | 1432 helper_->BindUniformLocationCHROMIUMBucket( |
1406 program, location, kResultBucketId); | 1433 program, location, kResultBucketId); |
1407 helper_->SetBucketSize(kResultBucketId, 0); | 1434 helper_->SetBucketSize(kResultBucketId, 0); |
1408 CheckGLError(); | 1435 CheckGLError(); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 bool got_value = share_group_->program_info_manager()->GetProgramiv( | 1627 bool got_value = share_group_->program_info_manager()->GetProgramiv( |
1601 this, program, pname, params); | 1628 this, program, pname, params); |
1602 GPU_CLIENT_LOG_CODE_BLOCK({ | 1629 GPU_CLIENT_LOG_CODE_BLOCK({ |
1603 if (got_value) { | 1630 if (got_value) { |
1604 GPU_CLIENT_LOG(" 0: " << *params); | 1631 GPU_CLIENT_LOG(" 0: " << *params); |
1605 } | 1632 } |
1606 }); | 1633 }); |
1607 return got_value; | 1634 return got_value; |
1608 } | 1635 } |
1609 | 1636 |
| 1637 GLint GLES2Implementation::GetFragDataIndexEXTHelper(GLuint program, |
| 1638 const char* name) { |
| 1639 typedef cmds::GetFragDataIndexEXT::Result Result; |
| 1640 Result* result = GetResultAs<Result*>(); |
| 1641 if (!result) { |
| 1642 return -1; |
| 1643 } |
| 1644 *result = -1; |
| 1645 SetBucketAsCString(kResultBucketId, name); |
| 1646 helper_->GetFragDataIndexEXT(program, kResultBucketId, GetResultShmId(), |
| 1647 GetResultShmOffset()); |
| 1648 WaitForCmd(); |
| 1649 helper_->SetBucketSize(kResultBucketId, 0); |
| 1650 return *result; |
| 1651 } |
| 1652 |
| 1653 GLint GLES2Implementation::GetFragDataIndexEXT(GLuint program, |
| 1654 const char* name) { |
| 1655 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 1656 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFragDataIndexEXT(" << program |
| 1657 << ", " << name << ")"); |
| 1658 TRACE_EVENT0("gpu", "GLES2::GetFragDataIndexEXT"); |
| 1659 GLint loc = share_group_->program_info_manager()->GetFragDataIndex( |
| 1660 this, program, name); |
| 1661 GPU_CLIENT_LOG("returned " << loc); |
| 1662 CheckGLError(); |
| 1663 return loc; |
| 1664 } |
| 1665 |
1610 GLint GLES2Implementation::GetFragDataLocationHelper( | 1666 GLint GLES2Implementation::GetFragDataLocationHelper( |
1611 GLuint program, const char* name) { | 1667 GLuint program, const char* name) { |
1612 typedef cmds::GetFragDataLocation::Result Result; | 1668 typedef cmds::GetFragDataLocation::Result Result; |
1613 Result* result = GetResultAs<Result*>(); | 1669 Result* result = GetResultAs<Result*>(); |
1614 if (!result) { | 1670 if (!result) { |
1615 return -1; | 1671 return -1; |
1616 } | 1672 } |
1617 *result = -1; | 1673 *result = -1; |
1618 SetBucketAsCString(kResultBucketId, name); | 1674 SetBucketAsCString(kResultBucketId, name); |
1619 helper_->GetFragDataLocation( | 1675 helper_->GetFragDataLocation( |
(...skipping 4828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6448 CheckGLError(); | 6504 CheckGLError(); |
6449 } | 6505 } |
6450 | 6506 |
6451 // Include the auto-generated part of this file. We split this because it means | 6507 // Include the auto-generated part of this file. We split this because it means |
6452 // we can easily edit the non-auto generated parts right here in this file | 6508 // we can easily edit the non-auto generated parts right here in this file |
6453 // instead of having to edit some template or the code generator. | 6509 // instead of having to edit some template or the code generator. |
6454 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6510 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6455 | 6511 |
6456 } // namespace gles2 | 6512 } // namespace gles2 |
6457 } // namespace gpu | 6513 } // namespace gpu |
OLD | NEW |