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