| 85 | } |
| 86 | |
| 87 | bool GL46Buffer::CopyCpuToGpu() |
| 88 | { |
| 89 | if (!PreparedForCopy(GL_WRITE_ONLY)) |
| 90 | { |
| 91 | return false; |
| 92 | } |
| 93 | |
| 94 | Buffer* buffer = GetBuffer(); |
| 95 | GLuint numActiveBytes = buffer->GetNumActiveBytes(); |
| 96 | if (numActiveBytes > 0) |
| 97 | { |
| 98 | // Copy from CPU memory to GPU memory. |
| 99 | GLintptr offsetInBytes = |
| 100 | static_cast<GLintptr>(buffer->GetOffset()) * |
| 101 | static_cast<GLintptr>(buffer->GetElementSize()); |
| 102 | char const* source = buffer->GetData() + offsetInBytes; |
| 103 | glBindBuffer(mType, mGLHandle); |
| 104 | glBufferSubData(mType, offsetInBytes, numActiveBytes, source); |
| 105 | glBindBuffer(mType, 0); |
| 106 | } |
| 107 | return true; |
| 108 | } |
| 109 | |
| 110 | bool GL46Buffer::CopyGpuToCpu() |
| 111 | { |
nothing calls this directly
no test coverage detected