| 64 | } |
| 65 | |
| 66 | bool GL46Buffer::Update() |
| 67 | { |
| 68 | Buffer* buffer = GetBuffer(); |
| 69 | LogAssert(buffer->GetUsage() == Resource::Usage::DYNAMIC_UPDATE, |
| 70 | "Buffer usage is not DYNAMIC_UPDATE."); |
| 71 | |
| 72 | GLuint numActiveBytes = buffer->GetNumActiveBytes(); |
| 73 | if (numActiveBytes > 0) |
| 74 | { |
| 75 | // Copy from CPU memory to GPU memory. |
| 76 | GLintptr offsetInBytes = |
| 77 | static_cast<GLintptr>(buffer->GetOffset()) * |
| 78 | static_cast<GLintptr>(buffer->GetElementSize()); |
| 79 | char const* source = buffer->GetData() + offsetInBytes; |
| 80 | glBindBuffer(mType, mGLHandle); |
| 81 | glBufferSubData(mType, offsetInBytes, numActiveBytes, source); |
| 82 | glBindBuffer(mType, 0); |
| 83 | } |
| 84 | return true; |
| 85 | } |
| 86 | |
| 87 | bool GL46Buffer::CopyCpuToGpu() |
| 88 | { |
nothing calls this directly
no test coverage detected