| 108 | } |
| 109 | |
| 110 | bool GL46Buffer::CopyGpuToCpu() |
| 111 | { |
| 112 | if (!PreparedForCopy(GL_READ_ONLY)) |
| 113 | { |
| 114 | return false; |
| 115 | } |
| 116 | |
| 117 | Buffer* buffer = GetBuffer(); |
| 118 | GLuint numActiveBytes = buffer->GetNumActiveBytes(); |
| 119 | if (numActiveBytes > 0) |
| 120 | { |
| 121 | // Copy from GPU memory to CPU memory. |
| 122 | GLintptr offsetInBytes = |
| 123 | static_cast<GLintptr>(buffer->GetOffset()) * |
| 124 | static_cast<GLintptr>(buffer->GetElementSize()); |
| 125 | char* target = buffer->GetData() + offsetInBytes; |
| 126 | glBindBuffer(mType, mGLHandle); |
| 127 | glGetBufferSubData(mType, offsetInBytes, numActiveBytes, target); |
| 128 | glBindBuffer(mType, 0); |
| 129 | } |
| 130 | return true; |
| 131 | } |
| 132 | |
| 133 |
nothing calls this directly
no test coverage detected