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 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 GLuint program, GLuint index, const char* name) { | 1353 GLuint program, GLuint index, const char* name) { |
1354 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 1354 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
1355 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindAttribLocation(" | 1355 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindAttribLocation(" |
1356 << program << ", " << index << ", " << name << ")"); | 1356 << program << ", " << index << ", " << name << ")"); |
1357 SetBucketAsString(kResultBucketId, name); | 1357 SetBucketAsString(kResultBucketId, name); |
1358 helper_->BindAttribLocationBucket(program, index, kResultBucketId); | 1358 helper_->BindAttribLocationBucket(program, index, kResultBucketId); |
1359 helper_->SetBucketSize(kResultBucketId, 0); | 1359 helper_->SetBucketSize(kResultBucketId, 0); |
1360 CheckGLError(); | 1360 CheckGLError(); |
1361 } | 1361 } |
1362 | 1362 |
| 1363 void GLES2Implementation::BindFragDataLocationEXT(GLuint program, |
| 1364 GLuint colorName, |
| 1365 const char* name) { |
| 1366 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 1367 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFragDataLocationEXT(" |
| 1368 << program << ", " << colorName << ", " << name << ")"); |
| 1369 SetBucketAsString(kResultBucketId, name); |
| 1370 helper_->BindFragDataLocationEXTBucket(program, colorName, kResultBucketId); |
| 1371 helper_->SetBucketSize(kResultBucketId, 0); |
| 1372 CheckGLError(); |
| 1373 } |
| 1374 |
| 1375 void GLES2Implementation::BindFragDataLocationIndexedEXT(GLuint program, |
| 1376 GLuint colorName, |
| 1377 GLuint index, |
| 1378 const char* name) { |
| 1379 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 1380 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFragDataLocationEXT(" |
| 1381 << program << ", " << colorName << ", " << index << ", " |
| 1382 << name << ")"); |
| 1383 SetBucketAsString(kResultBucketId, name); |
| 1384 helper_->BindFragDataLocationIndexedEXTBucket(program, colorName, index, |
| 1385 kResultBucketId); |
| 1386 helper_->SetBucketSize(kResultBucketId, 0); |
| 1387 CheckGLError(); |
| 1388 } |
| 1389 |
1363 void GLES2Implementation::BindUniformLocationCHROMIUM( | 1390 void GLES2Implementation::BindUniformLocationCHROMIUM( |
1364 GLuint program, GLint location, const char* name) { | 1391 GLuint program, GLint location, const char* name) { |
1365 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 1392 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
1366 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindUniformLocationCHROMIUM(" | 1393 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindUniformLocationCHROMIUM(" |
1367 << program << ", " << location << ", " << name << ")"); | 1394 << program << ", " << location << ", " << name << ")"); |
1368 SetBucketAsString(kResultBucketId, name); | 1395 SetBucketAsString(kResultBucketId, name); |
1369 helper_->BindUniformLocationCHROMIUMBucket( | 1396 helper_->BindUniformLocationCHROMIUMBucket( |
1370 program, location, kResultBucketId); | 1397 program, location, kResultBucketId); |
1371 helper_->SetBucketSize(kResultBucketId, 0); | 1398 helper_->SetBucketSize(kResultBucketId, 0); |
1372 CheckGLError(); | 1399 CheckGLError(); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 bool got_value = share_group_->program_info_manager()->GetProgramiv( | 1591 bool got_value = share_group_->program_info_manager()->GetProgramiv( |
1565 this, program, pname, params); | 1592 this, program, pname, params); |
1566 GPU_CLIENT_LOG_CODE_BLOCK({ | 1593 GPU_CLIENT_LOG_CODE_BLOCK({ |
1567 if (got_value) { | 1594 if (got_value) { |
1568 GPU_CLIENT_LOG(" 0: " << *params); | 1595 GPU_CLIENT_LOG(" 0: " << *params); |
1569 } | 1596 } |
1570 }); | 1597 }); |
1571 return got_value; | 1598 return got_value; |
1572 } | 1599 } |
1573 | 1600 |
| 1601 GLint GLES2Implementation::GetFragDataIndexEXTHelper(GLuint program, |
| 1602 const char* name) { |
| 1603 typedef cmds::GetFragDataIndexEXT::Result Result; |
| 1604 Result* result = GetResultAs<Result*>(); |
| 1605 if (!result) { |
| 1606 return -1; |
| 1607 } |
| 1608 *result = -1; |
| 1609 SetBucketAsCString(kResultBucketId, name); |
| 1610 helper_->GetFragDataIndexEXT(program, kResultBucketId, GetResultShmId(), |
| 1611 GetResultShmOffset()); |
| 1612 WaitForCmd(); |
| 1613 helper_->SetBucketSize(kResultBucketId, 0); |
| 1614 return *result; |
| 1615 } |
| 1616 |
| 1617 GLint GLES2Implementation::GetFragDataIndexEXT(GLuint program, |
| 1618 const char* name) { |
| 1619 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 1620 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFragDataIndexEXT(" << program |
| 1621 << ", " << name << ")"); |
| 1622 TRACE_EVENT0("gpu", "GLES2::GetFragDataIndexEXT"); |
| 1623 GLint loc = share_group_->program_info_manager()->GetFragDataIndex( |
| 1624 this, program, name); |
| 1625 GPU_CLIENT_LOG("returned " << loc); |
| 1626 CheckGLError(); |
| 1627 return loc; |
| 1628 } |
| 1629 |
1574 GLint GLES2Implementation::GetFragDataLocationHelper( | 1630 GLint GLES2Implementation::GetFragDataLocationHelper( |
1575 GLuint program, const char* name) { | 1631 GLuint program, const char* name) { |
1576 typedef cmds::GetFragDataLocation::Result Result; | 1632 typedef cmds::GetFragDataLocation::Result Result; |
1577 Result* result = GetResultAs<Result*>(); | 1633 Result* result = GetResultAs<Result*>(); |
1578 if (!result) { | 1634 if (!result) { |
1579 return -1; | 1635 return -1; |
1580 } | 1636 } |
1581 *result = -1; | 1637 *result = -1; |
1582 SetBucketAsCString(kResultBucketId, name); | 1638 SetBucketAsCString(kResultBucketId, name); |
1583 helper_->GetFragDataLocation( | 1639 helper_->GetFragDataLocation( |
(...skipping 4670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6254 CheckGLError(); | 6310 CheckGLError(); |
6255 } | 6311 } |
6256 | 6312 |
6257 // Include the auto-generated part of this file. We split this because it means | 6313 // Include the auto-generated part of this file. We split this because it means |
6258 // we can easily edit the non-auto generated parts right here in this file | 6314 // we can easily edit the non-auto generated parts right here in this file |
6259 // instead of having to edit some template or the code generator. | 6315 // instead of having to edit some template or the code generator. |
6260 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6316 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6261 | 6317 |
6262 } // namespace gles2 | 6318 } // namespace gles2 |
6263 } // namespace gpu | 6319 } // namespace gpu |
OLD | NEW |