Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 7358006: Cache OpenGL program info on the client side of the command buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "../client/gles2_implementation.h" 7 #include "../client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2ext.h> 9 #include <GLES2/gl2ext.h>
10 #include <GLES2/gles2_command_buffer.h> 10 #include <GLES2/gles2_command_buffer.h>
11 #include "../client/mapped_memory.h" 11 #include "../client/mapped_memory.h"
12 #include "../client/program_info_manager.h"
12 #include "../common/gles2_cmd_utils.h" 13 #include "../common/gles2_cmd_utils.h"
13 #include "../common/id_allocator.h" 14 #include "../common/id_allocator.h"
14 #include "../common/trace_event.h" 15 #include "../common/trace_event.h"
15 16
16 #if defined(__native_client__) && !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 17 #if defined(__native_client__) && !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
17 #define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS 18 #define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS
18 #endif 19 #endif
19 20
20 #if defined(GPU_CLIENT_DEBUG) 21 #if defined(GPU_CLIENT_DEBUG)
21 #include "ui/gfx/gl/gl_switches.h" 22 #include "ui/gfx/gl/gl_switches.h"
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 util_.set_num_shader_binary_formats( 508 util_.set_num_shader_binary_formats(
508 gl_state_.num_shader_binary_formats); 509 gl_state_.num_shader_binary_formats);
509 510
510 GetMultipleIntegervCHROMIUM( 511 GetMultipleIntegervCHROMIUM(
511 pnames, arraysize(pnames), &gl_state_.max_combined_texture_image_units, 512 pnames, arraysize(pnames), &gl_state_.max_combined_texture_image_units,
512 sizeof(gl_state_)); 513 sizeof(gl_state_));
513 514
514 texture_units_.reset( 515 texture_units_.reset(
515 new TextureUnit[gl_state_.max_combined_texture_image_units]); 516 new TextureUnit[gl_state_.max_combined_texture_image_units]);
516 517
518
519 program_info_manager_.reset(ProgramInfoManager::Create(sharing_resources_));
520
517 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 521 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
518 buffer_id_handler_->MakeIds( 522 buffer_id_handler_->MakeIds(
519 kClientSideArrayId, arraysize(reserved_ids_), &reserved_ids_[0]); 523 kClientSideArrayId, arraysize(reserved_ids_), &reserved_ids_[0]);
520 524
521 client_side_buffer_helper_.reset(new ClientSideBufferHelper( 525 client_side_buffer_helper_.reset(new ClientSideBufferHelper(
522 gl_state_.max_vertex_attribs, 526 gl_state_.max_vertex_attribs,
523 reserved_ids_[0], 527 reserved_ids_[0],
524 reserved_ids_[1])); 528 reserved_ids_[1]));
525 #endif 529 #endif
526 } 530 }
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 index, pname, result_shm_id(), result_shm_offset()); 946 index, pname, result_shm_id(), result_shm_offset());
943 WaitForCmd(); 947 WaitForCmd();
944 result->CopyResult(ptr); 948 result->CopyResult(ptr);
945 GPU_CLIENT_LOG_CODE_BLOCK({ 949 GPU_CLIENT_LOG_CODE_BLOCK({
946 for (int32 i = 0; i < result->GetNumResults(); ++i) { 950 for (int32 i = 0; i < result->GetNumResults(); ++i) {
947 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); 951 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
948 } 952 }
949 }); 953 });
950 } 954 }
951 955
956 void GLES2Implementation::DeleteProgramOrShaderHelper(
957 GLuint program_or_shader) {
958 program_and_shader_id_handler_->FreeIds(1, &program_or_shader);
959 program_info_manager_->DeleteInfo(program_or_shader);
960 }
961
962 GLint GLES2Implementation::GetAttribLocationHelper(
963 GLuint program, const char* name) {
964 typedef GetAttribLocationBucket::Result Result;
965 Result* result = GetResultAs<Result*>();
966 *result = -1;
967 SetBucketAsCString(kResultBucketId, name);
968 helper_->GetAttribLocationBucket(
969 program, kResultBucketId, result_shm_id(), result_shm_offset());
970 WaitForCmd();
971 helper_->SetBucketSize(kResultBucketId, 0);
972 return *result;
973 }
974
952 GLint GLES2Implementation::GetAttribLocation( 975 GLint GLES2Implementation::GetAttribLocation(
953 GLuint program, const char* name) { 976 GLuint program, const char* name) {
954 GPU_CLIENT_LOG("[" << this << "] glGetAttribLocation(" << program 977 GPU_CLIENT_LOG("[" << this << "] glGetAttribLocation(" << program
955 << ", " << name << ")"); 978 << ", " << name << ")");
956 TRACE_EVENT0("gpu", "GLES2::GetAttribLocation"); 979 TRACE_EVENT0("gpu", "GLES2::GetAttribLocation");
957 typedef GetAttribLocationBucket::Result Result; 980 GLint loc = program_info_manager_->GetAttribLocation(this, program, name);
958 Result* result = GetResultAs<Result*>(); 981 GPU_CLIENT_LOG("returned " << loc);
959 *result = -1; 982 return loc;
960 SetBucketAsCString(kResultBucketId, name);
961 helper_->GetAttribLocationBucket(program, kResultBucketId,
962 result_shm_id(), result_shm_offset());
963 WaitForCmd();
964 helper_->SetBucketSize(kResultBucketId, 0);
965 GPU_CLIENT_LOG("returned " << *result);
966 return *result;
967 } 983 }
968 984
969 GLint GLES2Implementation::GetUniformLocation( 985 GLint GLES2Implementation::GetUniformLocationHelper(
970 GLuint program, const char* name) { 986 GLuint program, const char* name) {
971 GPU_CLIENT_LOG("[" << this << "] glGetUniformLocation(" << program
972 << ", " << name << ")");
973 TRACE_EVENT0("gpu", "GLES2::GetUniformLocation");
974 typedef GetUniformLocationBucket::Result Result; 987 typedef GetUniformLocationBucket::Result Result;
975 Result* result = GetResultAs<Result*>(); 988 Result* result = GetResultAs<Result*>();
976 *result = -1; 989 *result = -1;
977 SetBucketAsCString(kResultBucketId, name); 990 SetBucketAsCString(kResultBucketId, name);
978 helper_->GetUniformLocationBucket(program, kResultBucketId, 991 helper_->GetUniformLocationBucket(program, kResultBucketId,
979 result_shm_id(), result_shm_offset()); 992 result_shm_id(), result_shm_offset());
980 WaitForCmd(); 993 WaitForCmd();
981 helper_->SetBucketSize(kResultBucketId, 0); 994 helper_->SetBucketSize(kResultBucketId, 0);
982 GPU_CLIENT_LOG("returned " << *result);
983 return *result; 995 return *result;
984 } 996 }
985 997
998 GLint GLES2Implementation::GetUniformLocation(
999 GLuint program, const char* name) {
1000 GPU_CLIENT_LOG("[" << this << "] glGetUniformLocation(" << program
1001 << ", " << name << ")");
1002 TRACE_EVENT0("gpu", "GLES2::GetUniformLocation");
1003 GLint loc = program_info_manager_->GetUniformLocation(this, program, name);
1004 GPU_CLIENT_LOG("returned " << loc);
1005 return loc;
1006 }
1007
1008 bool GLES2Implementation::GetProgramivHelper(
1009 GLuint program, GLenum pname, GLint* params) {
1010 return program_info_manager_->GetProgramiv(this, program, pname, params);
1011 }
1012
1013 void GLES2Implementation::LinkProgram(GLuint program) {
1014 GPU_CLIENT_LOG("[" << this << "] glLinkProgram(" << program << ")");
1015 helper_->LinkProgram(program);
1016 program_info_manager_->CreateInfo(program);
1017 }
986 1018
987 void GLES2Implementation::ShaderBinary( 1019 void GLES2Implementation::ShaderBinary(
988 GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, 1020 GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary,
989 GLsizei length) { 1021 GLsizei length) {
990 GPU_CLIENT_LOG("[" << this << "] glShaderBinary(" << n << ", " 1022 GPU_CLIENT_LOG("[" << this << "] glShaderBinary(" << n << ", "
991 << static_cast<const void*>(shaders) << ", " 1023 << static_cast<const void*>(shaders) << ", "
992 << GLES2Util::GetStringEnum(binaryformat) << ", " 1024 << GLES2Util::GetStringEnum(binaryformat) << ", "
993 << static_cast<const void*>(binary) << ", " 1025 << static_cast<const void*>(binary) << ", "
994 << length << ")"); 1026 << length << ")");
995 if (n < 0) { 1027 if (n < 0) {
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 row_source += part_size; 1461 row_source += part_size;
1430 temp_xoffset += num_pixels; 1462 temp_xoffset += num_pixels;
1431 temp_width -= num_pixels; 1463 temp_width -= num_pixels;
1432 } 1464 }
1433 ++yoffset; 1465 ++yoffset;
1434 source += padded_row_size; 1466 source += padded_row_size;
1435 } 1467 }
1436 } 1468 }
1437 } 1469 }
1438 1470
1439 void GLES2Implementation::GetActiveAttrib( 1471 bool GLES2Implementation::GetActiveAttribHelper(
1440 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, 1472 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
1441 GLenum* type, char* name) { 1473 GLenum* type, char* name) {
1442 GPU_CLIENT_LOG("[" << this << "] glGetActiveAttrib(" 1474 // Clear the bucket so if the command fails nothing will be in it.
1443 << program << ", " << index << ", " << bufsize << ", "
1444 << static_cast<const void*>(length) << ", "
1445 << static_cast<const void*>(size) << ", "
1446 << static_cast<const void*>(type) << ", "
1447 << static_cast<const void*>(name) << ", ");
1448 if (bufsize < 0) {
1449 SetGLError(GL_INVALID_VALUE, "glGetActiveAttrib: bufsize < 0");
1450 return;
1451 }
1452 TRACE_EVENT0("gpu", "GLES2::GetActiveAttrib");
1453 // Clear the bucket so if we the command fails nothing will be in it.
1454 helper_->SetBucketSize(kResultBucketId, 0); 1475 helper_->SetBucketSize(kResultBucketId, 0);
1455 typedef gles2::GetActiveAttrib::Result Result; 1476 typedef gles2::GetActiveAttrib::Result Result;
1456 Result* result = static_cast<Result*>(result_buffer_); 1477 Result* result = static_cast<Result*>(result_buffer_);
1457 // Set as failed so if the command fails we'll recover. 1478 // Set as failed so if the command fails we'll recover.
1458 result->success = false; 1479 result->success = false;
1459 helper_->GetActiveAttrib(program, index, kResultBucketId, 1480 helper_->GetActiveAttrib(program, index, kResultBucketId,
1460 result_shm_id(), result_shm_offset()); 1481 result_shm_id(), result_shm_offset());
1461 WaitForCmd(); 1482 WaitForCmd();
1462 if (result->success) { 1483 if (result->success) {
1463 if (size) { 1484 if (size) {
1464 *size = result->size; 1485 *size = result->size;
1465 GPU_CLIENT_LOG(" size: " << *size);
1466 } 1486 }
1467 if (type) { 1487 if (type) {
1468 *type = result->type; 1488 *type = result->type;
1469 GPU_CLIENT_LOG(" type: " << GLES2Util::GetStringEnum(*type));
1470 } 1489 }
1471 if (length || name) { 1490 if (length || name) {
1472 std::vector<int8> str; 1491 std::vector<int8> str;
1473 GetBucketContents(kResultBucketId, &str); 1492 GetBucketContents(kResultBucketId, &str);
1474 GLsizei max_size = std::min(static_cast<size_t>(bufsize) - 1, 1493 GLsizei max_size = std::min(static_cast<size_t>(bufsize) - 1,
1475 std::max(static_cast<size_t>(0), 1494 std::max(static_cast<size_t>(0),
1476 str.size() - 1)); 1495 str.size() - 1));
1477 if (length) { 1496 if (length) {
1478 *length = max_size; 1497 *length = max_size;
1479 } 1498 }
1480 if (name && bufsize > 0) { 1499 if (name && bufsize > 0) {
1481 memcpy(name, &str[0], max_size); 1500 memcpy(name, &str[0], max_size);
1482 name[max_size] = '\0'; 1501 name[max_size] = '\0';
1483 GPU_CLIENT_LOG(" name: " << name);
1484 } 1502 }
1485 } 1503 }
1486 } 1504 }
1505 return result->success != 0;
1487 } 1506 }
1488 1507
1489 void GLES2Implementation::GetActiveUniform( 1508 void GLES2Implementation::GetActiveAttrib(
1490 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, 1509 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
1491 GLenum* type, char* name) { 1510 GLenum* type, char* name) {
1492 GPU_CLIENT_LOG("[" << this << "] glGetActiveUniform(" 1511 GPU_CLIENT_LOG("[" << this << "] glGetActiveAttrib("
1493 << program << ", " << index << ", " << bufsize << ", " 1512 << program << ", " << index << ", " << bufsize << ", "
1494 << static_cast<const void*>(length) << ", " 1513 << static_cast<const void*>(length) << ", "
1495 << static_cast<const void*>(size) << ", " 1514 << static_cast<const void*>(size) << ", "
1496 << static_cast<const void*>(type) << ", " 1515 << static_cast<const void*>(type) << ", "
1497 << static_cast<const void*>(name) << ", "); 1516 << static_cast<const void*>(name) << ", ");
1498 if (bufsize < 0) { 1517 if (bufsize < 0) {
1499 SetGLError(GL_INVALID_VALUE, "glGetActiveUniform: bufsize < 0"); 1518 SetGLError(GL_INVALID_VALUE, "glGetActiveAttrib: bufsize < 0");
1500 return; 1519 return;
1501 } 1520 }
1502 TRACE_EVENT0("gpu", "GLES2::GetActiveUniform"); 1521 TRACE_EVENT0("gpu", "GLES2::GetActiveAttrib");
1503 // Clear the bucket so if we the command fails nothing will be in it. 1522 bool success = program_info_manager_->GetActiveAttrib(
1523 this, program, index, bufsize, length, size, type, name);
1524 if (success) {
1525 if (size) {
1526 GPU_CLIENT_LOG(" size: " << *size);
1527 }
1528 if (type) {
1529 GPU_CLIENT_LOG(" type: " << GLES2Util::GetStringEnum(*type));
1530 }
1531 if (name) {
1532 GPU_CLIENT_LOG(" name: " << name);
1533 }
1534 }
1535 }
1536
1537 bool GLES2Implementation::GetActiveUniformHelper(
1538 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
1539 GLenum* type, char* name) {
1540 // Clear the bucket so if the command fails nothing will be in it.
1504 helper_->SetBucketSize(kResultBucketId, 0); 1541 helper_->SetBucketSize(kResultBucketId, 0);
1505 typedef gles2::GetActiveUniform::Result Result; 1542 typedef gles2::GetActiveUniform::Result Result;
1506 Result* result = static_cast<Result*>(result_buffer_); 1543 Result* result = static_cast<Result*>(result_buffer_);
1507 // Set as failed so if the command fails we'll recover. 1544 // Set as failed so if the command fails we'll recover.
1508 result->success = false; 1545 result->success = false;
1509 helper_->GetActiveUniform(program, index, kResultBucketId, 1546 helper_->GetActiveUniform(program, index, kResultBucketId,
1510 result_shm_id(), result_shm_offset()); 1547 result_shm_id(), result_shm_offset());
1511 WaitForCmd(); 1548 WaitForCmd();
1512 if (result->success) { 1549 if (result->success) {
1513 if (size) { 1550 if (size) {
1514 *size = result->size; 1551 *size = result->size;
1515 GPU_CLIENT_LOG(" size: " << *size);
1516 } 1552 }
1517 if (type) { 1553 if (type) {
1518 *type = result->type; 1554 *type = result->type;
1519 GPU_CLIENT_LOG(" type: " << GLES2Util::GetStringEnum(*type));
1520 } 1555 }
1521 if (length || name) { 1556 if (length || name) {
1522 std::vector<int8> str; 1557 std::vector<int8> str;
1523 GetBucketContents(kResultBucketId, &str); 1558 GetBucketContents(kResultBucketId, &str);
1524 GLsizei max_size = std::min(static_cast<size_t>(bufsize) - 1, 1559 GLsizei max_size = std::min(static_cast<size_t>(bufsize) - 1,
1525 std::max(static_cast<size_t>(0), 1560 std::max(static_cast<size_t>(0),
1526 str.size() - 1)); 1561 str.size() - 1));
1527 if (length) { 1562 if (length) {
1528 *length = max_size; 1563 *length = max_size;
1529 } 1564 }
1530 if (name && bufsize > 0) { 1565 if (name && bufsize > 0) {
1531 memcpy(name, &str[0], max_size); 1566 memcpy(name, &str[0], max_size);
1532 name[max_size] = '\0'; 1567 name[max_size] = '\0';
1533 GPU_CLIENT_LOG(" name: " << name);
1534 } 1568 }
1535 } 1569 }
1536 } 1570 }
1571 return result->success != 0;
1572 }
1573
1574 void GLES2Implementation::GetActiveUniform(
1575 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
1576 GLenum* type, char* name) {
1577 GPU_CLIENT_LOG("[" << this << "] glGetActiveUniform("
1578 << program << ", " << index << ", " << bufsize << ", "
1579 << static_cast<const void*>(length) << ", "
1580 << static_cast<const void*>(size) << ", "
1581 << static_cast<const void*>(type) << ", "
1582 << static_cast<const void*>(name) << ", ");
1583 if (bufsize < 0) {
1584 SetGLError(GL_INVALID_VALUE, "glGetActiveUniform: bufsize < 0");
1585 return;
1586 }
1587 TRACE_EVENT0("gpu", "GLES2::GetActiveUniform");
1588 bool success = program_info_manager_->GetActiveUniform(
1589 this, program, index, bufsize, length, size, type, name);
1590 if (success) {
1591 if (size) {
1592 GPU_CLIENT_LOG(" size: " << *size);
1593 }
1594 if (type) {
1595 GPU_CLIENT_LOG(" type: " << GLES2Util::GetStringEnum(*type));
1596 }
1597 if (name) {
1598 GPU_CLIENT_LOG(" name: " << name);
1599 }
1600 }
1537 } 1601 }
1538 1602
1539 void GLES2Implementation::GetAttachedShaders( 1603 void GLES2Implementation::GetAttachedShaders(
1540 GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { 1604 GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
1541 GPU_CLIENT_LOG("[" << this << "] glGetAttachedShaders(" 1605 GPU_CLIENT_LOG("[" << this << "] glGetAttachedShaders("
1542 << program << ", " << maxcount << ", " 1606 << program << ", " << maxcount << ", "
1543 << static_cast<const void*>(count) << ", " 1607 << static_cast<const void*>(count) << ", "
1544 << static_cast<const void*>(shaders) << ", "); 1608 << static_cast<const void*>(shaders) << ", ");
1545 if (maxcount < 0) { 1609 if (maxcount < 0) {
1546 SetGLError(GL_INVALID_VALUE, "glGetAttachedShaders: maxcount < 0"); 1610 SetGLError(GL_INVALID_VALUE, "glGetAttachedShaders: maxcount < 0");
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 // TODO(gman): We should be able to free without a token. 2389 // TODO(gman): We should be able to free without a token.
2326 transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken()); 2390 transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken());
2327 GPU_CLIENT_LOG(" returned"); 2391 GPU_CLIENT_LOG(" returned");
2328 GPU_CLIENT_LOG_CODE_BLOCK({ 2392 GPU_CLIENT_LOG_CODE_BLOCK({
2329 for (int i = 0; i < num_results; ++i) { 2393 for (int i = 0; i < num_results; ++i) {
2330 GPU_CLIENT_LOG(" " << i << ": " << (results[i])); 2394 GPU_CLIENT_LOG(" " << i << ": " << (results[i]));
2331 } 2395 }
2332 }); 2396 });
2333 } 2397 }
2334 2398
2399 void GLES2Implementation::GetProgramInfoCHROMIUMHelper(
2400 GLuint program, std::vector<int8>* result) {
2401 GPU_DCHECK(result);
2402 // Clear the bucket so if the command fails nothing will be in it.
2403 helper_->SetBucketSize(kResultBucketId, 0);
2404 helper_->GetProgramInfoCHROMIUM(program, kResultBucketId);
2405 GetBucketContents(kResultBucketId, result);
2406 }
2407
2335 void GLES2Implementation::GetProgramInfoCHROMIUM( 2408 void GLES2Implementation::GetProgramInfoCHROMIUM(
2336 GLuint program, GLsizei bufsize, GLsizei* size, void* info) { 2409 GLuint program, GLsizei bufsize, GLsizei* size, void* info) {
2337 if (bufsize < 0) { 2410 if (bufsize < 0) {
2338 SetGLError(GL_INVALID_VALUE, "glProgramInfoCHROMIUM: bufsize less than 0."); 2411 SetGLError(GL_INVALID_VALUE, "glProgramInfoCHROMIUM: bufsize less than 0.");
2339 return; 2412 return;
2340 } 2413 }
2341 if (size == NULL) { 2414 if (size == NULL) {
2342 SetGLError(GL_INVALID_VALUE, "glProgramInfoCHROMIUM: size is null."); 2415 SetGLError(GL_INVALID_VALUE, "glProgramInfoCHROMIUM: size is null.");
2343 return; 2416 return;
2344 } 2417 }
2345 // Make sure they've set size to 0 else the value will be undefined on 2418 // Make sure they've set size to 0 else the value will be undefined on
2346 // lost context. 2419 // lost context.
2347 GPU_DCHECK(*size == 0); 2420 GPU_DCHECK(*size == 0);
2348 // Clear the bucket so if the command fails nothing will be in it.
2349 helper_->SetBucketSize(kResultBucketId, 0);
2350 helper_->GetProgramInfoCHROMIUM(program, kResultBucketId);
2351 std::vector<int8> result; 2421 std::vector<int8> result;
2352 GetBucketContents(kResultBucketId, &result); 2422 GetProgramInfoCHROMIUMHelper(program, &result);
2353 if (result.size() == 0) { 2423 if (result.empty()) {
2354 return; 2424 return;
2355 } 2425 }
2356 *size = result.size(); 2426 *size = result.size();
2357 if (!info) { 2427 if (!info) {
2358 return; 2428 return;
2359 } 2429 }
2360 if (static_cast<size_t>(bufsize) < result.size()) { 2430 if (static_cast<size_t>(bufsize) < result.size()) {
2361 SetGLError(GL_INVALID_OPERATION, 2431 SetGLError(GL_INVALID_OPERATION,
2362 "glProgramInfoCHROMIUM: bufsize is too small for result."); 2432 "glProgramInfoCHROMIUM: bufsize is too small for result.");
2363 return; 2433 return;
2364 } 2434 }
2365 memcpy(info, &result[0], result.size()); 2435 memcpy(info, &result[0], result.size());
2366 } 2436 }
2367 2437
2368 } // namespace gles2 2438 } // namespace gles2
2369 } // namespace gpu 2439 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.h ('k') | gpu/command_buffer/client/gles2_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698