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

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

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: [WIP] Introduced internal SetAsyncToken command buffer command Created 6 years, 11 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
OLDNEW
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 <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 } 1371 }
1372 1372
1373 GLuint buffer_id; 1373 GLuint buffer_id;
1374 if (GetBoundPixelTransferBuffer(target, "glBufferData", &buffer_id)) { 1374 if (GetBoundPixelTransferBuffer(target, "glBufferData", &buffer_id)) {
1375 if (!buffer_id) { 1375 if (!buffer_id) {
1376 return; 1376 return;
1377 } 1377 }
1378 1378
1379 BufferTracker::Buffer* buffer = buffer_tracker_->GetBuffer(buffer_id); 1379 BufferTracker::Buffer* buffer = buffer_tracker_->GetBuffer(buffer_id);
1380 if (buffer) { 1380 if (buffer) {
1381 // Free buffer memory, pending the passage of a token. 1381 FreeTransferBuffer(buffer);
1382 buffer_tracker_->FreePendingToken(buffer, helper_->InsertToken()); 1382 buffer_tracker_->RemoveBuffer(buffer->id());
1383
1384 // Remove old buffer.
1385 buffer_tracker_->RemoveBuffer(buffer_id);
1386 } 1383 }
1387 1384
1388 // Create new buffer. 1385 // Create new buffer.
1389 buffer = buffer_tracker_->CreateBuffer(buffer_id, size); 1386 buffer = buffer_tracker_->CreateBuffer(buffer_id, size);
1390 DCHECK(buffer); 1387 DCHECK(buffer);
1391 if (buffer->address() && data) 1388 if (buffer->address() && data)
1392 memcpy(buffer->address(), data, size); 1389 memcpy(buffer->address(), data, size);
1393 return; 1390 return;
1394 } 1391 }
1395 1392
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { 1501 GLenum target, GLintptr offset, GLsizeiptr size, const void* data) {
1505 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1502 GPU_CLIENT_SINGLE_THREAD_CHECK();
1506 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBufferSubData(" 1503 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBufferSubData("
1507 << GLES2Util::GetStringBufferTarget(target) << ", " 1504 << GLES2Util::GetStringBufferTarget(target) << ", "
1508 << offset << ", " << size << ", " 1505 << offset << ", " << size << ", "
1509 << static_cast<const void*>(data) << ")"); 1506 << static_cast<const void*>(data) << ")");
1510 BufferSubDataHelper(target, offset, size, data); 1507 BufferSubDataHelper(target, offset, size, data);
1511 CheckGLError(); 1508 CheckGLError();
1512 } 1509 }
1513 1510
1511 void GLES2Implementation::FreeTransferBuffer(BufferTracker::Buffer* buffer) {
1512 int32 token = buffer->last_usage_token();
1513 uint32 async_token = buffer->async_token();
1514
1515 if (async_token) {
1516 if (helper_->HasAsyncTokenPassed(async_token))
1517 buffer_tracker_->Free(buffer);
1518 else
1519 buffer_tracker_->FreePendingAsyncToken(buffer, async_token);
1520 } else if (token) {
1521 if (helper_->HasTokenPassed(token))
1522 buffer_tracker_->Free(buffer);
1523 else
1524 buffer_tracker_->FreePendingToken(buffer, token);
1525 }
1526 }
1527
1514 bool GLES2Implementation::GetBoundPixelTransferBuffer( 1528 bool GLES2Implementation::GetBoundPixelTransferBuffer(
1515 GLenum target, 1529 GLenum target,
1516 const char* function_name, 1530 const char* function_name,
1517 GLuint* buffer_id) { 1531 GLuint* buffer_id) {
1518 *buffer_id = 0; 1532 *buffer_id = 0;
1519 1533
1520 switch (target) { 1534 switch (target) {
1521 case GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM: 1535 case GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM:
1522 *buffer_id = bound_pixel_pack_transfer_buffer_id_; 1536 *buffer_id = bound_pixel_pack_transfer_buffer_id_;
1523 break; 1537 break;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 // CompressedTexImage2D. 1593 // CompressedTexImage2D.
1580 if (bound_pixel_unpack_transfer_buffer_id_) { 1594 if (bound_pixel_unpack_transfer_buffer_id_) {
1581 GLuint offset = ToGLuint(data); 1595 GLuint offset = ToGLuint(data);
1582 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( 1596 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid(
1583 bound_pixel_unpack_transfer_buffer_id_, 1597 bound_pixel_unpack_transfer_buffer_id_,
1584 "glCompressedTexImage2D", offset, image_size); 1598 "glCompressedTexImage2D", offset, image_size);
1585 if (buffer && buffer->shm_id() != -1) { 1599 if (buffer && buffer->shm_id() != -1) {
1586 helper_->CompressedTexImage2D( 1600 helper_->CompressedTexImage2D(
1587 target, level, internalformat, width, height, border, image_size, 1601 target, level, internalformat, width, height, border, image_size,
1588 buffer->shm_id(), buffer->shm_offset() + offset); 1602 buffer->shm_id(), buffer->shm_offset() + offset);
1589 buffer->set_transfer_ready_token(helper_->InsertToken()); 1603 MarkPixelTransferBufferLastUsage(buffer);
1590 } 1604 }
1591 return; 1605 return;
1592 } 1606 }
1593 SetBucketContents(kResultBucketId, data, image_size); 1607 SetBucketContents(kResultBucketId, data, image_size);
1594 helper_->CompressedTexImage2DBucket( 1608 helper_->CompressedTexImage2DBucket(
1595 target, level, internalformat, width, height, border, kResultBucketId); 1609 target, level, internalformat, width, height, border, kResultBucketId);
1596 // Free the bucket. This is not required but it does free up the memory. 1610 // Free the bucket. This is not required but it does free up the memory.
1597 // and we don't have to wait for the result so from the client's perspective 1611 // and we don't have to wait for the result so from the client's perspective
1598 // it's cheap. 1612 // it's cheap.
1599 helper_->SetBucketSize(kResultBucketId, 0); 1613 helper_->SetBucketSize(kResultBucketId, 0);
(...skipping 20 matching lines...) Expand all
1620 // CompressedTexSubImage2D. 1634 // CompressedTexSubImage2D.
1621 if (bound_pixel_unpack_transfer_buffer_id_) { 1635 if (bound_pixel_unpack_transfer_buffer_id_) {
1622 GLuint offset = ToGLuint(data); 1636 GLuint offset = ToGLuint(data);
1623 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( 1637 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid(
1624 bound_pixel_unpack_transfer_buffer_id_, 1638 bound_pixel_unpack_transfer_buffer_id_,
1625 "glCompressedTexSubImage2D", offset, image_size); 1639 "glCompressedTexSubImage2D", offset, image_size);
1626 if (buffer && buffer->shm_id() != -1) { 1640 if (buffer && buffer->shm_id() != -1) {
1627 helper_->CompressedTexSubImage2D( 1641 helper_->CompressedTexSubImage2D(
1628 target, level, xoffset, yoffset, width, height, format, image_size, 1642 target, level, xoffset, yoffset, width, height, format, image_size,
1629 buffer->shm_id(), buffer->shm_offset() + offset); 1643 buffer->shm_id(), buffer->shm_offset() + offset);
1630 buffer->set_transfer_ready_token(helper_->InsertToken()); 1644 MarkPixelTransferBufferLastUsage(buffer);
1631 CheckGLError(); 1645 CheckGLError();
1632 } 1646 }
1633 return; 1647 return;
1634 } 1648 }
1635 SetBucketContents(kResultBucketId, data, image_size); 1649 SetBucketContents(kResultBucketId, data, image_size);
1636 helper_->CompressedTexSubImage2DBucket( 1650 helper_->CompressedTexSubImage2DBucket(
1637 target, level, xoffset, yoffset, width, height, format, kResultBucketId); 1651 target, level, xoffset, yoffset, width, height, format, kResultBucketId);
1638 // Free the bucket. This is not required but it does free up the memory. 1652 // Free the bucket. This is not required but it does free up the memory.
1639 // and we don't have to wait for the result so from the client's perspective 1653 // and we don't have to wait for the result so from the client's perspective
1640 // it's cheap. 1654 // it's cheap.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 // If there's a pixel unpack buffer bound use it when issuing TexImage2D. 1721 // If there's a pixel unpack buffer bound use it when issuing TexImage2D.
1708 if (bound_pixel_unpack_transfer_buffer_id_) { 1722 if (bound_pixel_unpack_transfer_buffer_id_) {
1709 GLuint offset = ToGLuint(pixels); 1723 GLuint offset = ToGLuint(pixels);
1710 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( 1724 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid(
1711 bound_pixel_unpack_transfer_buffer_id_, 1725 bound_pixel_unpack_transfer_buffer_id_,
1712 "glTexImage2D", offset, size); 1726 "glTexImage2D", offset, size);
1713 if (buffer && buffer->shm_id() != -1) { 1727 if (buffer && buffer->shm_id() != -1) {
1714 helper_->TexImage2D( 1728 helper_->TexImage2D(
1715 target, level, internalformat, width, height, border, format, type, 1729 target, level, internalformat, width, height, border, format, type,
1716 buffer->shm_id(), buffer->shm_offset() + offset); 1730 buffer->shm_id(), buffer->shm_offset() + offset);
1717 buffer->set_transfer_ready_token(helper_->InsertToken()); 1731 MarkPixelTransferBufferLastUsage(buffer);
1718 CheckGLError(); 1732 CheckGLError();
1719 } 1733 }
1720 return; 1734 return;
1721 } 1735 }
1722 1736
1723 // If there's no data just issue TexImage2D 1737 // If there's no data just issue TexImage2D
1724 if (!pixels) { 1738 if (!pixels) {
1725 helper_->TexImage2D( 1739 helper_->TexImage2D(
1726 target, level, internalformat, width, height, border, format, type, 1740 target, level, internalformat, width, height, border, format, type,
1727 0, 0); 1741 0, 0);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 // If there's a pixel unpack buffer bound use it when issuing TexSubImage2D. 1827 // If there's a pixel unpack buffer bound use it when issuing TexSubImage2D.
1814 if (bound_pixel_unpack_transfer_buffer_id_) { 1828 if (bound_pixel_unpack_transfer_buffer_id_) {
1815 GLuint offset = ToGLuint(pixels); 1829 GLuint offset = ToGLuint(pixels);
1816 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( 1830 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid(
1817 bound_pixel_unpack_transfer_buffer_id_, 1831 bound_pixel_unpack_transfer_buffer_id_,
1818 "glTexSubImage2D", offset, temp_size); 1832 "glTexSubImage2D", offset, temp_size);
1819 if (buffer && buffer->shm_id() != -1) { 1833 if (buffer && buffer->shm_id() != -1) {
1820 helper_->TexSubImage2D( 1834 helper_->TexSubImage2D(
1821 target, level, xoffset, yoffset, width, height, format, type, 1835 target, level, xoffset, yoffset, width, height, format, type,
1822 buffer->shm_id(), buffer->shm_offset() + offset, false); 1836 buffer->shm_id(), buffer->shm_offset() + offset, false);
1823 buffer->set_transfer_ready_token(helper_->InsertToken()); 1837 MarkPixelTransferBufferLastUsage(buffer);
1824 CheckGLError(); 1838 CheckGLError();
1825 } 1839 }
1826 return; 1840 return;
1827 } 1841 }
1828 1842
1829 // compute the advance bytes per row for the src pixels 1843 // compute the advance bytes per row for the src pixels
1830 uint32 src_padded_row_size; 1844 uint32 src_padded_row_size;
1831 if (unpack_row_length_ > 0) { 1845 if (unpack_row_length_ > 0) {
1832 if (!GLES2Util::ComputeImagePaddedRowSize( 1846 if (!GLES2Util::ComputeImagePaddedRowSize(
1833 unpack_row_length_, format, type, unpack_alignment_, 1847 unpack_row_length_, format, type, unpack_alignment_,
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
2396 } 2410 }
2397 2411
2398 // NOTE #1: On old versions of OpenGL, calling glBindXXX with an unused id 2412 // NOTE #1: On old versions of OpenGL, calling glBindXXX with an unused id
2399 // generates a new resource. On newer versions of OpenGL they don't. The code 2413 // generates a new resource. On newer versions of OpenGL they don't. The code
2400 // related to binding below will need to change if we switch to the new OpenGL 2414 // related to binding below will need to change if we switch to the new OpenGL
2401 // model. Specifically it assumes a bind will succeed which is always true in 2415 // model. Specifically it assumes a bind will succeed which is always true in
2402 // the old model but possibly not true in the new model if another context has 2416 // the old model but possibly not true in the new model if another context has
2403 // deleted the resource. 2417 // deleted the resource.
2404 2418
2405 bool GLES2Implementation::BindBufferHelper( 2419 bool GLES2Implementation::BindBufferHelper(
2406 GLenum target, GLuint buffer) { 2420 GLenum target, GLuint buffer_id) {
2407 // TODO(gman): See note #1 above. 2421 // TODO(gman): See note #1 above.
2408 bool changed = false; 2422 bool changed = false;
2409 switch (target) { 2423 switch (target) {
2410 case GL_ARRAY_BUFFER: 2424 case GL_ARRAY_BUFFER:
2411 if (bound_array_buffer_id_ != buffer) { 2425 if (bound_array_buffer_id_ != buffer_id) {
2412 bound_array_buffer_id_ = buffer; 2426 bound_array_buffer_id_ = buffer_id;
2413 changed = true; 2427 changed = true;
2414 } 2428 }
2415 break; 2429 break;
2416 case GL_ELEMENT_ARRAY_BUFFER: 2430 case GL_ELEMENT_ARRAY_BUFFER:
2417 changed = vertex_array_object_manager_->BindElementArray(buffer); 2431 changed = vertex_array_object_manager_->BindElementArray(buffer_id);
2418 break; 2432 break;
2419 case GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM: 2433 case GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM:
2420 bound_pixel_pack_transfer_buffer_id_ = buffer; 2434 bound_pixel_pack_transfer_buffer_id_ = buffer_id;
2421 break; 2435 break;
2422 case GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM: 2436 case GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM:
2423 bound_pixel_unpack_transfer_buffer_id_ = buffer; 2437 bound_pixel_unpack_transfer_buffer_id_ = buffer_id;
2424 break; 2438 break;
2425 default: 2439 default:
2426 changed = true; 2440 changed = true;
2427 break; 2441 break;
2428 } 2442 }
2429 // TODO(gman): There's a bug here. If the target is invalid the ID will not be 2443 // TODO(gman): There's a bug here. If the target is invalid the ID will not be
2430 // used even though it's marked it as used here. 2444 // used even though it's marked it as used here.
2431 GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind(buffer); 2445 GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind(buffer_id);
2432 return changed; 2446 return changed;
2433 } 2447 }
2434 2448
2435 bool GLES2Implementation::BindFramebufferHelper( 2449 bool GLES2Implementation::BindFramebufferHelper(
2436 GLenum target, GLuint framebuffer) { 2450 GLenum target, GLuint framebuffer) {
2437 // TODO(gman): See note #1 above. 2451 // TODO(gman): See note #1 above.
2438 bool changed = false; 2452 bool changed = false;
2439 switch (target) { 2453 switch (target) {
2440 case GL_FRAMEBUFFER: 2454 case GL_FRAMEBUFFER:
2441 if (bound_framebuffer_ != framebuffer || 2455 if (bound_framebuffer_ != framebuffer ||
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2555 SetGLError( 2569 SetGLError(
2556 GL_INVALID_VALUE, 2570 GL_INVALID_VALUE,
2557 "glDeleteBuffers", "id not created by this context."); 2571 "glDeleteBuffers", "id not created by this context.");
2558 return; 2572 return;
2559 } 2573 }
2560 for (GLsizei ii = 0; ii < n; ++ii) { 2574 for (GLsizei ii = 0; ii < n; ++ii) {
2561 if (buffers[ii] == bound_array_buffer_id_) { 2575 if (buffers[ii] == bound_array_buffer_id_) {
2562 bound_array_buffer_id_ = 0; 2576 bound_array_buffer_id_ = 0;
2563 } 2577 }
2564 vertex_array_object_manager_->UnbindBuffer(buffers[ii]); 2578 vertex_array_object_manager_->UnbindBuffer(buffers[ii]);
2579
2565 BufferTracker::Buffer* buffer = buffer_tracker_->GetBuffer(buffers[ii]); 2580 BufferTracker::Buffer* buffer = buffer_tracker_->GetBuffer(buffers[ii]);
2566 if (buffer) { 2581 if (buffer) {
2567 // Free buffer memory, pending the passage of a token. 2582 FreeTransferBuffer(buffer);
2568 buffer_tracker_->FreePendingToken(buffer, helper_->InsertToken()); 2583 buffer_tracker_->RemoveBuffer(buffer->id());
2569 // Remove buffer.
2570 buffer_tracker_->RemoveBuffer(buffers[ii]);
2571 } 2584 }
2585
2572 if (buffers[ii] == bound_pixel_unpack_transfer_buffer_id_) { 2586 if (buffers[ii] == bound_pixel_unpack_transfer_buffer_id_) {
2573 bound_pixel_unpack_transfer_buffer_id_ = 0; 2587 bound_pixel_unpack_transfer_buffer_id_ = 0;
2574 } 2588 }
2575 } 2589 }
2576 } 2590 }
2577 2591
2578 void GLES2Implementation::DeleteBuffersStub( 2592 void GLES2Implementation::DeleteBuffersStub(
2579 GLsizei n, const GLuint* buffers) { 2593 GLsizei n, const GLuint* buffers) {
2580 helper_->DeleteBuffersImmediate(n, buffers); 2594 helper_->DeleteBuffersImmediate(n, buffers);
2581 } 2595 }
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
3604 } 3618 }
3605 if (buffer->mapped()) { 3619 if (buffer->mapped()) {
3606 SetGLError(GL_INVALID_OPERATION, "glMapBufferCHROMIUM", "already mapped"); 3620 SetGLError(GL_INVALID_OPERATION, "glMapBufferCHROMIUM", "already mapped");
3607 return NULL; 3621 return NULL;
3608 } 3622 }
3609 // Here we wait for previous transfer operations to be finished. 3623 // Here we wait for previous transfer operations to be finished.
3610 // TODO(hubbe): AsyncTex(Sub)Image2dCHROMIUM does not currently work 3624 // TODO(hubbe): AsyncTex(Sub)Image2dCHROMIUM does not currently work
3611 // with this method of synchronization. Until this is fixed, 3625 // with this method of synchronization. Until this is fixed,
3612 // MapBufferCHROMIUM will not block even if the transfer is not ready 3626 // MapBufferCHROMIUM will not block even if the transfer is not ready
3613 // for these calls. 3627 // for these calls.
3614 if (buffer->transfer_ready_token()) { 3628 if (buffer->last_usage_token()) {
3615 helper_->WaitForToken(buffer->transfer_ready_token()); 3629 helper_->WaitForToken(buffer->last_usage_token());
3616 buffer->set_transfer_ready_token(0); 3630 buffer->set_last_usage_token(0);
3617 } 3631 }
3618 buffer->set_mapped(true); 3632 buffer->set_mapped(true);
3619 3633
3620 GPU_CLIENT_LOG(" returned " << buffer->address()); 3634 GPU_CLIENT_LOG(" returned " << buffer->address());
3621 CheckGLError(); 3635 CheckGLError();
3622 return buffer->address(); 3636 return buffer->address();
3623 } 3637 }
3624 3638
3625 GLboolean GLES2Implementation::UnmapBufferCHROMIUM(GLuint target) { 3639 GLboolean GLES2Implementation::UnmapBufferCHROMIUM(GLuint target) {
3626 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3640 GPU_CLIENT_SINGLE_THREAD_CHECK();
(...skipping 13 matching lines...) Expand all
3640 } 3654 }
3641 if (!buffer->mapped()) { 3655 if (!buffer->mapped()) {
3642 SetGLError(GL_INVALID_OPERATION, "glUnmapBufferCHROMIUM", "not mapped"); 3656 SetGLError(GL_INVALID_OPERATION, "glUnmapBufferCHROMIUM", "not mapped");
3643 return false; 3657 return false;
3644 } 3658 }
3645 buffer->set_mapped(false); 3659 buffer->set_mapped(false);
3646 CheckGLError(); 3660 CheckGLError();
3647 return true; 3661 return true;
3648 } 3662 }
3649 3663
3664 void GLES2Implementation::InsertAsyncPixelUnpackToken(
3665 BufferTracker::Buffer *buffer) {
3666 buffer->set_async_token(helper_->InsertAsyncToken());
3667 }
3668
3669 void GLES2Implementation::MarkPixelTransferBufferLastUsage(
3670 BufferTracker::Buffer* buffer) {
3671 buffer->set_last_usage_token(helper_->InsertToken());
3672 }
reveman 2014/01/22 17:30:04 IMO, the code is easier to understand without thes
3673
3650 void GLES2Implementation::AsyncTexImage2DCHROMIUM( 3674 void GLES2Implementation::AsyncTexImage2DCHROMIUM(
3651 GLenum target, GLint level, GLint internalformat, GLsizei width, 3675 GLenum target, GLint level, GLint internalformat, GLsizei width,
3652 GLsizei height, GLint border, GLenum format, GLenum type, 3676 GLsizei height, GLint border, GLenum format, GLenum type,
3653 const void* pixels) { 3677 const void* pixels) {
3654 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3678 GPU_CLIENT_SINGLE_THREAD_CHECK();
3655 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImage2D(" 3679 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImage2D("
3656 << GLES2Util::GetStringTextureTarget(target) << ", " 3680 << GLES2Util::GetStringTextureTarget(target) << ", "
3657 << level << ", " 3681 << level << ", "
3658 << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", " 3682 << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", "
3659 << width << ", " << height << ", " << border << ", " 3683 << width << ", " << height << ", " << border << ", "
(...skipping 27 matching lines...) Expand all
3687 // the buffer before the transfer is finished. (Currently such 3711 // the buffer before the transfer is finished. (Currently such
3688 // synchronization has to be handled manually.) 3712 // synchronization has to be handled manually.)
3689 GLuint offset = ToGLuint(pixels); 3713 GLuint offset = ToGLuint(pixels);
3690 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( 3714 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid(
3691 bound_pixel_unpack_transfer_buffer_id_, 3715 bound_pixel_unpack_transfer_buffer_id_,
3692 "glAsyncTexImage2DCHROMIUM", offset, size); 3716 "glAsyncTexImage2DCHROMIUM", offset, size);
3693 if (buffer && buffer->shm_id() != -1) { 3717 if (buffer && buffer->shm_id() != -1) {
3694 helper_->AsyncTexImage2DCHROMIUM( 3718 helper_->AsyncTexImage2DCHROMIUM(
3695 target, level, internalformat, width, height, border, format, type, 3719 target, level, internalformat, width, height, border, format, type,
3696 buffer->shm_id(), buffer->shm_offset() + offset); 3720 buffer->shm_id(), buffer->shm_offset() + offset);
3721 InsertAsyncPixelUnpackToken(buffer);
3697 } 3722 }
3698 } 3723 }
3699 3724
3700 void GLES2Implementation::AsyncTexSubImage2DCHROMIUM( 3725 void GLES2Implementation::AsyncTexSubImage2DCHROMIUM(
3701 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, 3726 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
3702 GLsizei height, GLenum format, GLenum type, const void* pixels) { 3727 GLsizei height, GLenum format, GLenum type, const void* pixels) {
3703 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3728 GPU_CLIENT_SINGLE_THREAD_CHECK();
3704 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glAsyncTexSubImage2DCHROMIUM(" 3729 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glAsyncTexSubImage2DCHROMIUM("
3705 << GLES2Util::GetStringTextureTarget(target) << ", " 3730 << GLES2Util::GetStringTextureTarget(target) << ", "
3706 << level << ", " 3731 << level << ", "
(...skipping 24 matching lines...) Expand all
3731 // the buffer before the transfer is finished. (Currently such 3756 // the buffer before the transfer is finished. (Currently such
3732 // synchronization has to be handled manually.) 3757 // synchronization has to be handled manually.)
3733 GLuint offset = ToGLuint(pixels); 3758 GLuint offset = ToGLuint(pixels);
3734 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( 3759 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid(
3735 bound_pixel_unpack_transfer_buffer_id_, 3760 bound_pixel_unpack_transfer_buffer_id_,
3736 "glAsyncTexSubImage2DCHROMIUM", offset, size); 3761 "glAsyncTexSubImage2DCHROMIUM", offset, size);
3737 if (buffer && buffer->shm_id() != -1) { 3762 if (buffer && buffer->shm_id() != -1) {
3738 helper_->AsyncTexSubImage2DCHROMIUM( 3763 helper_->AsyncTexSubImage2DCHROMIUM(
3739 target, level, xoffset, yoffset, width, height, format, type, 3764 target, level, xoffset, yoffset, width, height, format, type,
3740 buffer->shm_id(), buffer->shm_offset() + offset); 3765 buffer->shm_id(), buffer->shm_offset() + offset);
3766 InsertAsyncPixelUnpackToken(buffer);
3741 } 3767 }
3742 } 3768 }
3743 3769
3744 void GLES2Implementation::WaitAsyncTexImage2DCHROMIUM(GLenum target) { 3770 void GLES2Implementation::WaitAsyncTexImage2DCHROMIUM(GLenum target) {
3745 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3771 GPU_CLIENT_SINGLE_THREAD_CHECK();
3746 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitAsyncTexImage2DCHROMIUM(" 3772 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitAsyncTexImage2DCHROMIUM("
3747 << GLES2Util::GetStringTextureTarget(target) << ")"); 3773 << GLES2Util::GetStringTextureTarget(target) << ")");
3748 helper_->WaitAsyncTexImage2DCHROMIUM(target); 3774 helper_->WaitAsyncTexImage2DCHROMIUM(target);
3749 CheckGLError(); 3775 CheckGLError();
3750 } 3776 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3917 CheckGLError(); 3943 CheckGLError();
3918 } 3944 }
3919 3945
3920 // Include the auto-generated part of this file. We split this because it means 3946 // Include the auto-generated part of this file. We split this because it means
3921 // we can easily edit the non-auto generated parts right here in this file 3947 // we can easily edit the non-auto generated parts right here in this file
3922 // instead of having to edit some template or the code generator. 3948 // instead of having to edit some template or the code generator.
3923 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 3949 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
3924 3950
3925 } // namespace gles2 3951 } // namespace gles2
3926 } // namespace gpu 3952 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698