MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / Update

Method Update

GTE/Graphics/GL46/GL46Buffer.cpp:66–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66bool 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
87bool GL46Buffer::CopyCpuToGpu()
88{

Callers

nothing calls this directly

Calls 7

glBindBufferFunction · 0.85
glBufferSubDataFunction · 0.85
GetNumActiveBytesMethod · 0.80
GetElementSizeMethod · 0.80
GetUsageMethod · 0.45
GetOffsetMethod · 0.45
GetDataMethod · 0.45

Tested by

no test coverage detected